/* ==========================================================================
   Mobile Optimization
   Targeted overrides for smaller viewports.
   ========================================================================== */

/* Mobile burger menu (desktop default: hidden) */
.nav-burger { display: none; }
.nav-drawer { display: none; }

@media (max-width: 900px) {
  :root { --gutter: 18px; }

  /* Section spacing tighter */
  section { padding: 64px 0; }
  .sec-head { padding-bottom: 32px; }
  .sec-head h2 {
    font-size: clamp(34px, 9vw, 48px);
    letter-spacing: -0.03em;
    line-height: 1.02;
  }
  .sec-sub { font-size: 15px; margin-top: 16px; }

  /* NAV - clean mobile */
  .nav {
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
  }
  .nav.is-open {
    background: var(--bg);
    border-bottom-color: var(--line);
  }
  /* Auf dem Handy ist die Leiste 64px hoch statt 72px. */
  section[id] { scroll-margin-top: 42px; }

  /* Drei gleich gewichtete Spalten: Burger links, Logo exakt mittig,
     Hell/Dunkel-Schalter rechts. Die 1fr-Spalten außen sind gleich breit,
     dadurch sitzt das Logo unabhängig von der Breite der beiden Knöpfe in
     der Mitte. */
  .nav-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 14px var(--gutter);
    height: 64px;
  }
  .nav-brand { justify-self: center; }
  .nav-brand img { height: 32px; }
  .nav-links { display: none; }
  .nav-phone { display: none; }
  .nav-btn-desktop { display: none; }
  .nav-cta { justify-self: end; gap: 2px; }

  .nav-burger {
    justify-self: start;
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px; height: 44px;
    background: transparent;
    border: 0;
    border-radius: var(--radius);
    padding: 0;
    cursor: pointer;
    margin-left: -10px;
  }
  .nav-burger span {
    display: block;
    width: 22px;
    height: 1.8px;
    background: var(--fg);
    border-radius: 2px;
    transition: transform .3s cubic-bezier(.2,.7,.2,1), opacity .2s ease;
    transform-origin: center;
  }
  .nav-burger.is-open span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
  .nav-burger.is-open span:nth-child(2) { opacity: 0; }
  .nav-burger.is-open span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }

  .nav-drawer {
    display: block;
    position: fixed;
    top: 64px; left: 0; right: 0;
    background: var(--bg);
    height: calc(100dvh - 64px);
    padding: 20px var(--gutter) 28px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform .35s cubic-bezier(.2,.7,.2,1), opacity .25s ease;
    overflow-y: auto;
    z-index: 49;
    display: flex;
    flex-direction: column;
  }
  .nav-drawer.is-open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  .nav-drawer-links {
    list-style: none;
    padding: 8px 0 0;
    margin: 0;
  }
  .nav-drawer-links li {
    opacity: 0;
    transform: translateY(8px);
  }
  .nav-drawer.is-open .nav-drawer-links li {
    opacity: 1;
    transform: none;
    transition: opacity .35s ease, transform .35s cubic-bezier(.2,.7,.2,1);
  }
  .nav-drawer.is-open .nav-drawer-links li:nth-child(1) { transition-delay: 60ms; }
  .nav-drawer.is-open .nav-drawer-links li:nth-child(2) { transition-delay: 110ms; }
  .nav-drawer.is-open .nav-drawer-links li:nth-child(3) { transition-delay: 160ms; }
  .nav-drawer.is-open .nav-drawer-links li:nth-child(4) { transition-delay: 210ms; }
  .nav-drawer.is-open .nav-drawer-links li:nth-child(5) { transition-delay: 260ms; }

  .nav-drawer-links li button {
    width: 100%;
    background: transparent;
    border: 0;
    padding: 12px 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--sans);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: -0.005em;
    color: var(--fg);
    text-align: left;
    cursor: pointer;
    line-height: 1.3;
  }
  .nav-drawer-arrow {
    font-size: 15px;
    color: var(--muted-2);
    font-weight: 400;
  }
  .nav-drawer-foot {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }
  .nav-drawer-foot .link {
    font-size: 15px;
    font-weight: 500;
    color: var(--fg);
    padding: 6px 4px;
  }
  .nav-drawer-foot .btn {
    justify-content: center;
    padding: 14px 22px;
    font-size: 15px;
    margin-top: 4px;
  }

  /* HERO */
  .hero {
    padding: 120px 0 56px;
    margin-top: -64px;
  }
  .hero-eyebrow { margin-bottom: 18px; }
  .hero-title {
    font-size: clamp(36px, 9.5vw, 52px);
    letter-spacing: -0.04em;
    line-height: 1;
    max-width: none;
    margin: 0 0 20px;
    font-weight: 600;
  }
  .hero-title-sub {
    font-size: 14.5px;
    margin-top: 14px;
    max-width: none;
    font-weight: 500;
    color: var(--fg-soft);
    line-height: 1.4;
  }
  .hero-actions { gap: 8px; }
  .hero-actions .btn { padding: 12px 18px; font-size: 14px; }

  .hero-meta-bar {
    margin-top: 36px;
    padding: 18px 0 0;
    grid-template-columns: 1fr 1fr;
    gap: 20px 18px;
  }
  .hero-meta-item .v { font-size: 22px; }
  .hero-meta-item .k { font-size: 11.5px; line-height: 1.35; }

  /* ABOUT */
  .about-grid { grid-template-columns: 1fr; gap: 20px; }
  /* KEIN min-height zusammen mit aspect-ratio: beides zusammen erzwingt
     eine Mindestbreite (220 × 3/2 = 330px), und weil Rasterelemente
     wegen min-width:auto nicht darunter schrumpfen, wurde die Seite
     breiter als der Bildschirm. Die Höhe ergibt sich aus dem
     Seitenverhältnis von allein. */
  .about-brand { min-height: 0; aspect-ratio: 3 / 2; }
  .about-brand-logo { width: 80%; }
  .about-copy { padding: 0; gap: 14px; }
  .about-copy .prose { font-size: 16px; line-height: 1.55; }
  .values {
    grid-template-columns: 1fr 1fr;
    gap: 20px 16px;
    margin-top: 48px;
    padding-top: 32px;
  }
  .value-title { font-size: 15px; }
  .value-body { font-size: 13.5px; }

  /* SERVICES */
  .services-list { grid-template-columns: 1fr; gap: 12px; }
  .service-row {
    min-height: auto;
    padding: 22px 20px;
    gap: 10px;
  }
  .service-title { font-size: 22px; }
  .service-tagline { font-size: 14px; }
  .service-keys li { font-size: 11.5px; padding: 3px 9px; }

  /* PROCESS — vertical timeline */
  .process-list {
    grid-template-columns: 1fr;
    border-top: 0;
  }
  .process-step {
    padding: 20px 0 24px;
    border-right: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
    gap: 10px;
  }
  .process-step:last-child { border-bottom: 0 !important; }
  .process-title { font-size: 19px; }
  .process-lead { font-size: 14.5px; }
  .process-text { font-size: 13.5px; }

  /* TEAM */
  .team-grid {
    --team-cols: 2;
    --team-gap: 14px;
  }
  .team-card { gap: 10px; }
  .team-photo { aspect-ratio: 4/5; border-radius: 8px; }
  .team-name { font-size: 14px; line-height: 1.2; }
  .team-role { font-size: 11.5px; }

  /* CONTACT */
  .contact-grid { grid-template-columns: 1fr; gap: 16px; }
  .contact-form-wrap { order: 2; }
  .contact-side { order: 1; gap: 12px; }
  .contact-card { padding: 18px 18px; }
  .contact-card-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .contact-card-row .contact-card { padding: 14px 14px; }
  .contact-map { aspect-ratio: 4/3; }
  .maps-consent { padding: 22px 18px; gap: 10px; }
  .maps-consent h4 { font-size: 15.5px; }
  .maps-consent p { font-size: 12.5px; }

  /* CONTACT FORM */
  .cf { padding: 22px 18px; border-radius: 10px; }
  .cf-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }
  .cf-head h3 { font-size: 17px; }
  .cf-grid { grid-template-columns: 1fr; gap: 14px; }
  .cf-field input, .cf-field textarea { font-size: 16px; /* avoid iOS zoom */ }
  .chip { font-size: 12.5px; padding: 8px 12px; }
  .cf-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .cf-actions .btn { justify-content: center; width: 100%; padding: 14px 18px; }
  .cf-foot { display: none; }

  /* DETAIL pages */
  .detail { padding: 24px 0 72px; }
  .back-link { margin-bottom: 24px; font-size: 13px; }
  .prose { font-size: 15.5px; line-height: 1.6; }

  /* TEAM DETAIL */
  .team-detail .td-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .td-photo { max-width: 280px; }
  .td-name {
    font-size: clamp(30px, 8vw, 44px);
    letter-spacing: -0.025em;
  }
  .td-role { font-size: 14px; }
  .td-contact {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 16px 0;
  }
  .td-actions .btn { width: 100%; justify-content: center; padding: 14px 20px; }

  /* LEGAL */

  /* Tippflächen: unter ~44px trifft man auf dem Handy zuverlässig daneben.
     Betrifft die Auswahl-Chips im Formular, die Kontaktlinks und den
     Hell/Dunkel-Schalter. */
  .chip { min-height: 44px; padding: 10px 16px; }
  .cf-captcha-reload { width: 44px; height: 44px; }
  .dm-toggle { width: 44px; height: 44px; }
  .contact-card .link,
  .td-contact .link { display: inline-block; padding: 6px 0; }
  /* Footer-Links stehen dicht untereinander - ohne Polsterung trifft man
     auf dem Handy leicht den Nachbarn. */
  .footer-col ul li a,
  .footer-link-btn { display: inline-block; padding: 7px 0; }
  .nav-brand { padding: 8px 0; }

  /* Formularfelder: iOS Safari zoomt beim Antippen in die Seite hinein,
     sobald die Schrift kleiner als 16px ist. Danach ist die Seite verschoben
     und der Besucher muss von Hand herauszoomen. */
  .cf-field input,
  .cf-field textarea,
  .cf-captcha-input { font-size: 16px; }

  /* FOOTER */
  .footer { padding: 48px 0 24px; }
  /* Eine Spalte: Logo und Firmenname mittig oben, darunter die Linklisten
     untereinander. Nebeneinander wurden die Spalten auf dem Handy so schmal,
     dass die Einträge umbrachen. */
  .footer-top {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-bottom: 32px;
  }
  .footer-brand-col {
    justify-self: center;
    align-items: center;
    text-align: center;
    margin-bottom: 8px;
  }
  .footer-brand-col img { height: 30px; margin-bottom: 12px; }
  .footer-brand-col p { font-size: 13px; }
  .footer-col-title { font-size: 11.5px; margin-bottom: 10px; }
  .footer-col li button, .footer-col li a, .footer-col li { font-size: 13.5px; }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    font-size: 12px;
  }
  .footer-links { flex-wrap: wrap; gap: 12px; }
}

/* Extra-tight phones */
@media (max-width: 420px) {
  .hero-title { font-size: clamp(30px, 8.5vw, 42px); }
  .nav-brand img { height: 28px; }
  .team-grid {
    --team-cols: 2;
    --team-gap: 10px;
  }
  .values { grid-template-columns: 1fr; }
  .contact-card-row { grid-template-columns: 1fr; }
  .td-contact { grid-template-columns: 1fr; }
}

/* Touch device polish */
@media (hover: none) {
  .team-card:hover .team-photo img { transform: none; }
}
