/* Größere Bildschirme - bessere Skalierung */
@media (min-width: 87.5em) {
    .navbar { padding: 0.4rem 0; --nav-h: clamp(72px, 6vw, 110px); height: var(--nav-h); }
    
    .nav-menu {
        gap: 4rem;
    }
    
    .nav-link {
        font-size: 1.15rem;
    }

    .hero h1 {
        font-size: 4.5rem;
    }
    
    .hero h2 {
        font-size: 1.4rem;
    }
    
    .hero-content {
        max-width: 800px;
    }
    
    /* Hero Logo größer auf sehr großen Bildschirmen */
    .hero-logo-img {
        width: clamp(250px, 24vw, 350px);
    }

    /* Leistungen breiter auf sehr großen Screens */
    .services .container {
        max-width: 1500px;
        padding-inline: 50px; /* horizontal padding only; top from base clamp */
    }
    .services {
        padding: 0 0 90px; /* no top padding to keep wave connection */
    }
    .service-main {
        padding: 60px 55px;
    }
}

@media (min-width: 75em) and (max-width: 87.4375em) {
    .services .container {
        max-width: 1350px;
    padding-inline: 40px; /* horizontal padding only; top from base clamp */
    }
    .services {
        padding: 0 0 85px; /* no top padding to keep wave connection */
    }
    .service-main {
        padding: 55px 50px;
    }
}

/* Desktop: scale navbar/logo a bit larger (covers 1400–1599px) */
@media (min-width: 87.5em) and (max-width: 99.9375em) {
    .navbar { --nav-h: clamp(96px, 7vw, 112px); height: var(--nav-h); }
    /* Logo is now in hero */
}

@media (min-width: 100em) {
    .navbar { padding: 0.4rem 0; --nav-h: clamp(104px, 6vw, 128px); height: var(--nav-h); }
    /* Logo is now in hero */
    .services .container { max-width: 1650px; padding-inline: 60px; }
    .services { padding: 0 0 90px; }
    .service-main { padding: 65px 60px; }
}

@media (max-width: 48em) {
    .navbar {
    padding: clamp(0.3rem, 0.8vw, 0.5rem) 0;
    /* unify mobile height via CSS var */
    --nav-h: clamp(76px, 16vw, 110px);
    }
    
    /* Mobile Navigation bleibt immer sichtbar */
    .navbar.sticky {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-container {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        padding: 0 clamp(15px, 3vw, 20px);
        position: relative;
    }
    
    .nav-left,
    .nav-right {
        position: fixed;
        left: -100%;
        top: var(--nav-h);
        display: flex;
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: left 0.3s ease;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 30px 0;
        gap: 1.5rem;
        transform: none;
        z-index: 98;
    }
    
    .nav-left.active,
    .nav-right.active {
        left: 0;
    }
    
    .nav-left {
        height: auto;
        padding-bottom: 0;
    }
    
    .nav-right {
        top: calc(var(--nav-h) + 150px);
        height: auto;
        box-shadow: none;
    }
    
    .nav-logo {
        grid-column: unset;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .nav-toggle { 
        display: flex; 
        z-index: 1002;
        margin-left: auto;
    }

    /* When mobile menu is open, extend nav-decoration across full width */
    .navbar.menu-open .nav-decoration svg {
        left: 0;
        right: auto;
        width: 200%;
        transform: none;
        transition: width 0.3s ease;
    }

    /* allow larger logo with increased nav height */
    /* Logo is now in hero, not nav */
    
    /* Hero Logo Mobile */
    .hero-logo {
        top: clamp(6px, 2vw, 12px);
        left: clamp(10px, 3vw, 18px);
        z-index: 1001;
    }
    
    .hero-logo-img {
        width: clamp(140px, 35vw, 220px);
    }

    .nav-menu {
        position: fixed;
        left: -100%;
        top: var(--nav-h);
        flex-direction: column;
        background-color: white;
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: 0 10px 27px rgba(0, 0, 0, 0.05);
        padding: 30px 0;
        gap: 1.5rem;
        transform: none;
        height: calc(100vh - var(--nav-h));
        overflow-y: auto;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-left a,
    .nav-right a,
    .nav-menu a {
        color: var(--clr-primary-600);
        font-size: clamp(1rem, 2.5vw, 1.2rem);
        padding: 0.8rem 0;
        transition: color 0.3s ease;
        text-transform: uppercase;
    }

    .nav-left a:hover,
    .nav-right a:hover,
    .nav-menu a:hover {
        color: var(--clr-accent);
    }

    /* duplicate .nav-toggle removed */

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    /* hero heading sizes adjusted for <=768px */
    .hero h1 { font-size: clamp(2.2rem, 6vw, 3.2rem); }
    .hero h2 { font-size: clamp(0.9rem, 3vw, 1.1rem); }

    .hero-buttons {
        flex-direction: row;
        align-items: flex-start;
        width: 100%;
        gap: clamp(0.8rem, 2vw, 1.2rem);
        flex-wrap: wrap;
        margin-top: clamp(1.5rem, 3vw, 2rem);
    }

    .hero-buttons .btn {
        flex: 0 0 auto;
        min-width: clamp(130px, 25vw, 160px);
        padding: clamp(10px, 2vw, 14px) clamp(20px, 4vw, 28px);
        font-size: clamp(0.85rem, 2vw, 0.95rem);
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    .service-main {
        padding: 40px 30px;
    }

    .references-grid {
        grid-template-columns: 1fr;
    }

    .contact-content {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .contact-form {
        padding: 30px 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    /* .hero-content: no override needed here; mobile-specific tweaks handled in smaller breakpoint */
    /* Mobile-only: make main Munich Lines white; keep reflection dark */
    .hero-munich-lines .munich-lines-svg:not(.munich-lines-reflection) {
        filter: brightness(0) invert(1) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    }
}

/* Breite Bildschirme (16:9 Vollbild) */
@media (min-width: 87.5em) {
    .nav-decoration svg {
        width: clamp(1050px, 100vw, 1300px);
        transform: translateX(3%);
    }
    
    .nav-right {
        margin-right: clamp(5rem, 10vw, 8rem);
    }
}

/* Tablet-optimierte Größen */
@media (max-width: 64em) and (min-width: 48.0625em) {
    .navbar { --nav-h: clamp(62px, 8.5vw, 90px); height: var(--nav-h); }
    
    .nav-container {
        padding: 0 clamp(12px, 2vw, 18px);
        gap: clamp(1.5rem, 3vw, 3rem);
    }
    
    .nav-right {
        margin-right: clamp(3rem, 6vw, 5rem);
        gap: clamp(1.5rem, 2.5vw, 2.5rem);
    }
    
    .nav-decoration svg {
        width: 110%;
        min-width: 110%;
        max-width: none;
        left: -10%;
        right: 0;
        transform: translateX(0);
    }
    
    .nav-menu {
        gap: clamp(1.5rem, 4vw, 2.5rem);
    }
    
    .nav-link {
        font-size: clamp(0.95rem, 1.3vw, 1.05rem);
    }
    
    /* Hero Logo Tablet */
    .hero-logo {
        top: clamp(6px, 1.5vw, 12px);
        left: clamp(10px, 2vw, 20px);
        z-index: 1001;
    }
    
    .hero-logo-img {
        width: clamp(160px, 20vw, 260px);
    }

    .hero {
        background-attachment: scroll;
        background-position: 10% 5%;
        padding: clamp(80px, 12vw, 120px) 0 0;
        height: 100dvh;
        min-height: unset;
    }
    
    .hero-wave-bottom {
        height: clamp(80px, 10vw, 120px);
    }
    
    .hero h1 {
        font-size: clamp(3rem, 4.5vw, 3.8rem);
    }
    
    .hero h2 {
        font-size: clamp(1.1rem, 2.2vw, 1.25rem);
    }
    
    .hero-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: clamp(1.2rem, 2vw, 1.8rem);
    width: 100%;
    }
    
    .hero-buttons .btn {
    width: 100%;
    min-width: 0;
    max-width: none;
    padding: clamp(12px, 2vw, 15px) clamp(24px, 4vw, 30px);
    font-size: clamp(0.9rem, 1.6vw, 1rem);
    }
    
    .hero-wave-bottom {
        height: clamp(100px, 14vw, 180px);
    }
    
    .hero-munich-lines {
        bottom: 0;
        left: 0;
    }
    
    .munich-lines-svg {
        height: clamp(70px, 12vw, 120px);
    }
    
    .hero-mitglied-badge {
        bottom: 0;
        right: clamp(10px, 2vw, 20px);
    }
    
    .mitglied-badge-svg { height: clamp(40px, 6vw, 65px); }
}

@media (max-width: 30em) {
    .navbar { --nav-h: clamp(56px, 14vw, 68px); height: var(--nav-h); }
    
    .nav-container { padding: clamp(6px, 2.5vw, 10px); gap: clamp(0.8rem, 2vw, 1.4rem); }
    
    .nav-right { margin-right: clamp(0.5rem, 2vw, 1rem); gap: clamp(0.8rem, 2vw, 1.2rem); }
    
    .nav-decoration {
        overflow: hidden;
    }
    
    .nav-decoration svg { 
        width: 100%; 
        min-width: 100%;
        max-width: 100%;
        transform: translateX(0); 
        right: 0;
        left: 0;
    }

    .bar { width: 22px; height: 2.5px; }
    
    .nav-menu {
        gap: clamp(1rem, 3vw, 1.8rem);
    }
    
    /* Hero Logo sehr klein auf kleinen Phones */
    .hero-logo {
        top: clamp(5px, 1.5vw, 10px);
        left: clamp(8px, 2.5vw, 15px);
        z-index: 1001;
    }
    
    .hero-logo-img {
        width: clamp(120px, 32vw, 180px);
    }

    .hero {
        background-attachment: scroll;
        background-size: cover;
        background-position: 15% 8%;
        padding: 80px 0 0;
        height: 100dvh;
        min-height: unset;
        align-items: flex-start;
    }

    .hero-wave-bottom {
        height: clamp(80px, 10vw, 120px);
    }

    /* smaller phones tweak */
    .hero h1 { font-size: clamp(1.8rem, 7vw, 2.8rem); }
    .hero h2 { font-size: clamp(0.8rem, 3.5vw, 1rem); }

    .hero-buttons {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
        margin-top: clamp(1.2rem, 4vw, 1.8rem);
        width: 100%;
        align-items: stretch;
    }

    .hero-buttons .btn {
        width: 100%;
        min-width: 0;
        max-width: none;
        padding: clamp(8px, 2.5vw, 12px) clamp(16px, 5vw, 24px);
        font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    }

    .contact-form { padding:34px 26px 38px; }
    /* .form-row mobile layout already defined at <=768px */
    .contact-form input, .contact-form textarea { padding:15px 16px 14px; margin-bottom:16px; }

    .service-main {
        padding: 30px 20px;
    }

    .service-main h2 {
        font-size: 1.6rem;
    }

    .references {
        padding: 60px 0;
    }

    .contact { padding:65px 0 90px; }
    
    /* Team Mobile Styles */
    .team {
        padding: 65px 0 90px;
    }
    
    .value-item {
        padding: 25px 20px;
    }
    
    .value-title {
        font-size: 1.25rem;
    }
    
    .value-description {
        font-size: 1rem;
    }
    
    .cta-text {
        font-size: 1.1rem;
    }

    /* services header/title inherit global defaults on mobile */

    .services-intro p {
        font-size: 1.05rem;
        line-height: 1.65;
        color: #4a4f55;
        margin-bottom: 18px;
    }

    .intro-highlights {
        list-style: none;
        margin: 0 0 10px 0;
        padding: 0;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 10px 35px;
    }

    .intro-highlights li {
        position: relative;
        padding-left: 20px;
        font-size: 0.95rem;
        color: #2f3438;
        line-height: 1.4;
    }

    .intro-highlights li::before {
        content: '';
        position: absolute;
        left: 0;
        top: 6px;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--clr-primary), var(--clr-primary-light));
    box-shadow: 0 0 0 2px rgba(var(--clr-primary-rgb),0.12);
    }

    /* Pre-Animation states */
    .pre-animate, .service-main, .contact-content, .intro-highlights li {
        opacity: 0;
        transform: translateY(25px);
        transition: opacity 0.6s ease, transform 0.6s ease;
    }

    /* Mobile visibility handled by global .in-view */
    .references h2 {
        font-size: 2rem;
    }

    .contact-info h2 {
        font-size: 2rem;
    }
    
    .hero-wave-bottom {
        height: clamp(80px, 12vw, 150px);
    }
    
    .hero-munich-lines {
        bottom: 0;
        left: 0;
    }
    
    .munich-lines-svg {
        height: clamp(60px, 10vw, 90px);
    }
    
    .hero-mitglied-badge { bottom: 0; right: clamp(8px, 2vw, 15px); }
    .mitglied-badge-svg { height: clamp(35px, 5vw, 50px); }

    /* legal bottom deco adjustments at small phones */
    .legal-bottom-deco { min-height: 130px; }
    .legal-bottom-deco .munich-lines-svg { height: clamp(40px, 10vw, 70px); }
    .legal-bottom-deco .mitglied-badge-svg { height: clamp(36px, 8vw, 60px); }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Loading animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    40% {
        transform: translateX(-50%) translateY(-10px);
    }
    60% {
        transform: translateX(-50%) translateY(-5px);
    }
}

.animate-in-up {
    animation: fadeInUp 0.6s ease-out;
}

/* ===== Modal (Formulare) ===== */
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2000; padding: 20px; overflow-y: auto; }
.modal.is-open { display: flex; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); }
.modal-dialog { position: relative; z-index: 1; width: min(680px, 92vw); max-height: calc(100vh - 40px); background: #fff; border-radius: 16px; padding: 24px; box-shadow: 0 18px 60px -12px rgba(0,0,0,0.35); border: 2px solid rgba(var(--clr-primary-rgb),0.12); overflow-y: auto; margin: auto; }
.modal-close { position: absolute; top: 10px; right: 12px; background: transparent; border: none; font-size: 1.8rem; line-height: 1; cursor: pointer; color: #6b7280; z-index: 10; }
.modal-title { margin: 0 0 14px; font-size: 1.4rem; font-weight: 700; color: #37383C; padding-right: 30px; }
.modal-form input, .modal-form textarea { width: 100%; padding: 14px 16px; border: 2px solid rgba(var(--clr-primary-rgb),0.2); border-radius: 12px; font-size: 1rem; margin-bottom: 14px; font-family: 'Barlow', sans-serif; transition: border-color .3s ease, box-shadow .3s ease; }
.modal-form input:focus, .modal-form textarea:focus { outline: none; border-color: var(--clr-primary); box-shadow: 0 0 0 4px rgba(var(--clr-primary-rgb),0.12); }

/* Checkbox und Radio Button Styling */
.modal-form input[type="checkbox"],
.modal-form input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--clr-primary);
}

.modal-form .form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    padding: 8px 0;
    line-height: 1.4;
}

.modal-form .form-group > div[style*="flex"] label,
.modal-form .form-group > div[style*="grid"] label {
    margin-bottom: 0;
}

.modal-hint { margin-top: 10px; font-size: .85rem; color: #6b7280; }

/* Mobile Modal Optimierung */
@media (max-width: 768px) {
    .modal { padding: 10px; align-items: flex-start; }
    .modal-dialog { width: 100%; max-height: calc(100vh - 20px); margin-top: 10px; padding: 20px; }
    .modal-title { font-size: 1.2rem; }
    
    /* Checkbox-Grids auf 1 Spalte für bessere Lesbarkeit */
    .modal-form .form-group > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

/* ========= Leistungen Header Spring Fly-In (Gummiband) ========= */
/* Initial state for title & subtitle (overrides container fade for own timing) */
.services-header .section-title,
.services-header .section-subtitle {
    opacity: 0;
    transform: none;
    will-change: opacity;
}

@keyframes headerFadeUp {
    0% { opacity:0; }
    100% { opacity:1; }
}

/* Reuse class names for simplicity so JS stays untouched */
.spring-in { animation: headerFadeUp 1.1s ease-out forwards; }
.spring-in-delay { animation: headerFadeUp 1.1s ease-out .18s forwards; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .services-header .section-title,
    .services-header .section-subtitle { animation: none !important; opacity:1 !important; transform:none !important; }
}

/* ========= Service Unterpunkte sanftes Fade-In ========= */
@keyframes listFadeUp { 0% {opacity:0;} 100% {opacity:1;} }
.service-li-hidden { opacity:0; visibility:hidden; transform:none; }
.service-li-in { visibility:visible; animation: listFadeUp .9s ease-out forwards; }

@media (prefers-reduced-motion: reduce) {
    .service-li-hidden { opacity:1; transform:none; }
    .service-li-in { animation:none !important; }
}

/* ========= Hohe DPI Skalierung (125% - 150%) ========= */
@media screen and (-webkit-min-device-pixel-ratio: 1.25), 
       screen and (min-resolution: 120dpi), 
       screen and (min-resolution: 1.25dppx) {
    
    .hero-logo-img {
        width: clamp(160px, 20vw, 280px) !important;
    }
    
    .munich-lines-svg {
        height: clamp(40px, 5vw, 80px) !important;
    }
    
    .hero-wave-bottom {
        height: clamp(80px, 10vw, 150px) !important;
    }
    
    .mitglied-badge-svg {
        height: clamp(35px, 4vw, 60px) !important;
    }
    
    .hero {
        padding: clamp(100px, 12vw, 160px) 0 clamp(50px, 10vw, 100px) !important;
    }
    
    /* forms-hero uses base/mobile padding; no extra high-DPI override */
}

/* ========= FORMULARE SEITE ========= */
