/**
 * File: layout.css
 * Purpose: Structural layout components (header, navigation, footer, responsive grids & flex helpers) defining
 *          persistent chrome and adaptive behaviors for different breakpoints.
 * Guidelines:
 *   - Keep purely structural styles here; visual component skinning belongs to dedicated component/section files.
 *   - Maintain mobile-first approach; override progressively with min/max width media queries.
 *   - Avoid hard-coded pixel values when variables exist; use design tokens from variables.css.
 */

header {
    background: var(--color-bg-header);
    padding: var(--header-padding) 0;
    border-bottom: 1px solid var(--color-border-primary);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: var(--z-index-fixed);
    box-shadow: var(--shadow-header);
    box-sizing: border-box;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

header .logo a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

header .logo img {
    max-height: var(--logo-max-height);
    filter: brightness(0.8);
    transition: max-height 0.3s ease, width 0.3s ease;
    width: auto;
}

header nav ul,
header .main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
}

header nav ul li,
header .main-nav ul li {
    margin-left: var(--spacing-lg);
}

header nav ul li a,
header .main-nav ul li a {
    color: var(--color-text-primary);
    font-weight: var(--font-weight-normal);
    padding: var(--spacing-xs) 0;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: var(--font-size-nav);
    transition: var(--transition-normal);
}

header nav ul li a::after,
header .main-nav ul li a::after {
    content: '';
    position: absolute;
    width: 0;
    height: var(--nav-underline-height);
    bottom: calc(-1 * var(--nav-underline-height));
    left: 0;
    background: var(--gradient-primary);
    transition: var(--transition-normal);
}

header nav ul li a:hover::after,
header .main-nav ul li a:hover::after {
    width: 100%;
}

header nav ul li a:hover,
header nav ul li a.active,
header .main-nav ul li a:hover,
header .main-nav ul li a.active {
    color: var(--color-primary);
}

header nav ul li a:focus,
header .main-nav ul li a:focus {
    outline: none;
    color: var(--color-primary);
}

header nav ul li a:focus::after,
header .main-nav ul li a:focus::after {
    width: 100%;
}

header nav ul li a:focus-visible,
header .main-nav ul li a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 4px;
    border-radius: var(--border-radius-small);
}

.mobile-menu-toggle {
    display: none !important;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: center;
    width: var(--hamburger-size);
    height: var(--hamburger-size);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: calc(var(--z-index-mobile-menu) + 1);
    transition: var(--transition-normal);
    outline: none;
    position: relative;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.mobile-menu-toggle:focus {
    outline: none;
}

.mobile-menu-toggle:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--border-radius-small);
}

.mobile-menu-toggle span {
    display: block;
    height: var(--hamburger-line-height);
    width: 100%;
    background: var(--color-text-primary);
    border-radius: var(--hamburger-border-radius);
    transition: var(--transition-normal);
    transform-origin: center center;
    position: relative;
    margin: 0;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform, opacity;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: var(--hamburger-transform-1);
    background: var(--color-text-bright-white);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
    background: var(--color-text-bright-white);
    transform: scaleX(0);
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: var(--hamburger-transform-2);
    background: var(--color-text-bright-white);
}

body.nav-open {
    overflow: hidden;
}

body.nav-open .mobile-menu-toggle span {
    background: var(--color-text-bright-white);
}

body.nav-open header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: calc(var(--z-index-mobile-menu) + 1);
}

body.nav-open .mobile-menu-toggle {
    z-index: calc(var(--z-index-mobile-menu) + 3);
    position: fixed;
    top: var(--mobile-menu-position);
    right: var(--mobile-menu-position);
}

footer {
    background: var(--gradient-dark);
    color: var(--color-text-white);
    padding: var(--spacing-xl) 0 var(--spacing-md) 0;
    text-align: center;
}

footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

footer ul {
    list-style: none;
    padding: 0;
    margin: 0 0 var(--spacing-md) 0;
    display: flex;
    gap: var(--spacing-md);
}

footer ul li a {
    color: var(--color-text-white);
    font-weight: var(--font-weight-light);
    transition: var(--transition-normal);
}

footer ul li a:hover {
    color: var(--color-primary);
}

footer p {
    margin: var(--spacing-xs) 0;
    font-size: var(--font-size-footer-text);
}

.site-footer {
    background: var(--gradient-dark-footer);
    color: var(--color-text-white);
    padding: 60px 0 40px 0;
    font-size: var(--font-size-input);
    font-weight: var(--font-weight-light);
    position: relative;
    overflow: hidden;
}

.site-footer::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 1400px;
    height: var(--footer-plant-height);
    background: url('../images/footer-pflanze.png') no-repeat center bottom;
    background-size: contain;
    opacity: 0.4;
    z-index: 1;
    pointer-events: none;
    transition: height 0.3s ease;
}

.footer-content-grid {
    display: grid;
    grid-template-columns: auto auto auto auto;
    gap: var(--spacing-xl); 
    text-align: left;
    max-width: 1200px;
    width: fit-content;
    margin: 0 auto var(--spacing-xl) auto;
    padding: 0 var(--spacing-md);
    box-sizing: border-box;
    position: relative;
    z-index: 2;
    justify-content: center;
}

.footer-column {
    position: relative;
    z-index: 3;
    padding: 0 var(--spacing-sm);
    box-sizing: border-box;
}

.footer-column:nth-child(1) {
    max-width: 340px;
}

.footer-column:nth-child(2) {
    max-width: 225px;
}

.footer-column:nth-child(3) {
    max-width: 270px;
}

.footer-column:nth-child(4) {
    max-width: 180px;
}

.footer-column:first-child {
    flex: 1 1 300px;
    max-width: 350px;
}

.footer-column h4 {
    color: var(--color-primary);
    margin-top: 0;
    margin-bottom: var(--spacing-lg);
    font-size: var(--font-size-h5);
    font-weight: var(--font-weight-normal);
    letter-spacing: 0.5px;
}

.footer-column p, .footer-column ul {
    margin-bottom: var(--spacing-md);
}

.footer-column ul {
    list-style: none;
    padding: 0;
    display: block;
}

.footer-column ul li {
    margin-bottom: var(--spacing-sm);
}

.footer-column ul li a {
    color: var(--color-text-footer-light);
    transition: var(--transition-fast);
}

.footer-column ul li a:hover {
    color: var(--color-primary);
}

.footer-column ul li a:focus {
    outline: none;
    color: var(--color-primary);
}

.footer-column ul li a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--border-radius-small);
}

.footer-column .footer-logo {
    margin-bottom: var(--spacing-lg);
    text-align: left;
}

.footer-column .footer-logo a {
    display: inline-block;
    width: 100%;
}

.footer-column .footer-logo img {
    max-height: var(--logo-footer-height);
    margin: 0;
    display: block;
    transition: max-height 0.3s ease, width 0.3s ease;
    width: auto;
}

.partner-badge {
    margin: 1.2rem 0 0;
    padding: 0.45rem 0.7rem 0.3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 14px;
    box-shadow: 0 4px 14px -4px rgba(0,0,0,0.55);
    backdrop-filter: blur(6px);
}
.partner-badge img {
    max-width: 120px; /* global kleiner */
    height: auto;
    display: block;
}

@media screen and (max-width: 768px) {
    .partner-badge {
        margin-top: 1rem;
        margin-left: auto;
        margin-right: auto; /* zentriert */
        display: inline-flex !important; /* nicht volle Breite */
        width: auto !important;
    }
    .partner-badge img { max-width: 100px; }
}

@media screen and (max-width: 480px) {
    .partner-badge img { max-width: 90px; }
}

.footer-contact-details i {
    color: var(--color-primary);
    margin-right: 10px;
    width: 20px;
    font-size: var(--icon-size-sm);
}

.footer-social-links {
    margin-top: 10px;
}

.footer-social-links a {
    color: var(--color-text-footer-light);
    margin-right: 18px;
    font-size: var(--icon-size-footer-social);
    transition: var(--transition-fast);
}

.footer-social-links a:last-child {
    margin-right: 0;
}

.footer-social-links a:hover {
    color: var(--color-primary);
    transform: scale(1.1);
}

.footer-social-links a:focus {
    outline: none;
    color: var(--color-primary);
    transform: scale(1.1);
}

.footer-social-links a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 3px;
    border-radius: var(--border-radius-small);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    font-size: var(--font-size-small);
    color: var(--color-text-footer-muted);
    position: relative;
    z-index: 3;
}

.footer-bottom a {
    color: var(--color-primary);
}

.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: stretch;
    margin-bottom: 0;
}

.flex-item {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
}

.flex-item ul {
    margin-bottom: 0;
}

.flex-item ul li:last-of-type {
    margin-bottom: 0;
}

.flex-item-narrow {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
}

@media screen and (max-width: 1100px) {
    .mobile-menu-toggle {
        display: flex !important;
        position: absolute !important;
        top: 50% !important;
        right: var(--mobile-menu-position) !important;
        transform: translateY(-50%) !important;
        z-index: calc(var(--z-index-mobile-menu) + 2) !important;
    }

    .mobile-menu-toggle span {
        background: var(--color-text-primary);
    }

    header .container {
        position: relative;
    }

    .main-nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: var(--gradient-dark);
        transition: var(--transition-normal);
        z-index: var(--z-index-mobile-menu);
        padding-top: 80px;
        box-shadow: var(--shadow-mobile-menu);
        overflow-y: auto;
    }

    .main-nav.active {
        right: 0;
    }

    .main-nav ul {
        flex-direction: column;
        padding: 0 30px;
        margin: 0;
    }

    .main-nav ul li {
        margin: 0;
        margin-bottom: 20px;
        border-bottom: 1px solid var(--color-border-white-transparent);
        padding-bottom: 20px;
    }

    .main-nav ul li:last-child {
        border-bottom: none;
    }

    header .main-nav ul li a {
        color: var(--color-text-bright-white);
        font-size: var(--font-size-nav);
        padding: 15px 0;
        display: block;
        text-align: left;
        font-weight: var(--font-weight-light);
        letter-spacing: 0.5px;
    }

    header .main-nav ul li a:hover,
    header .main-nav ul li a.active {
        color: var(--color-primary);
    }

    header .main-nav ul li a::after {
        display: none;
    }

    header {
        padding: var(--header-padding) 0;
    }

    header .logo img {
        max-height: var(--logo-max-height);
    }
}

@media screen and (max-width: 999px) and (min-width: 769px) {
    .footer-content-grid {
        grid-template-columns: auto auto;
        gap: var(--spacing-xl);
        width: fit-content;
        justify-content: center;
        padding: 0 var(--spacing-lg);
    }

    .footer-column:nth-child(1),
    .footer-column:nth-child(3) {
        width: 100%;
        max-width: 340px;
        min-width: 300px;
    }

    .footer-column:nth-child(2),
    .footer-column:nth-child(4) {
        width: 100%;
        max-width: 225px;
        min-width: 205px;
    }
}

@media screen and (max-width: 768px) {
    .main-nav {
        width: 280px;
    }

    .footer-content-grid {
        grid-template-columns: auto;
        text-align: center;
        gap: var(--spacing-xl);
        width: fit-content;
        justify-items: center;
        padding: 0 var(--spacing-md);
    }

    .footer-column {
        width: 100%;
        max-width: 400px;
    }

    .footer-column .footer-logo {
        text-align: center !important;
        margin: 0 auto !important;
    }

    .footer-column .footer-logo a {
        display: block !important;
        text-align: center !important;
    }

    .footer-column .footer-logo img {
        margin: 0 auto !important;
        display: block !important;
    }

    .flex-container {
        flex-direction: column;
    }
}

@media screen and (max-width: 480px) {
    .main-nav {
        width: 100%;
    }

    .footer-column {
        max-width: 100%;
    }
}

@media screen and (max-width: 360px) {
    .flex-item {
        min-width: 0;
    }
}

@media screen and (max-width: 900px) and (orientation: landscape) {
}
