/*
  responsive.css
  [KPZ] PURPOSE: Responsive behavior — desktop-first, mobile-safe.
  [KPZ] SCOPE: Site-wide.
  [KPZ] DEPENDENCY: variables.css, layout.css, components.css
  [KPZ] SCOPE NOTE: nav.main-nav breakpoint below (1560px) is based on this component's real
  content width (6 nav items + Request Consultation quicklink + lang switch + CTA). Raised
  from 1400px to 1560px on 2026-08-12 after nav font-size/letter-spacing/gap were increased
  (user request) — the larger text needs more room before it must collapse to the burger.
*/

/* ---------- Desktop nav -> hamburger ---------- */
@media (max-width:1560px){
  nav.main-nav{display:none;}
  .burger{display:flex;}
  /* [KPZ] Mobile/tablet header shows "KPZ SRV Login" (solid cta-btn) instead of
     "Request Consultation" (ghost nav-consult) — user request 2026-08-12. Request
     Consultation is NOT removed site-wide, it remains as the last item inside the
     burger's mobile-nav overlay (see includes/header.php .mobile-cta). */
  .header-actions .nav-consult{display:none;}
  /* [KPZ] BUGFIX 2026-08-14, user report: "WhatsApp button not visible on mobile" / "light
     mode toggle doesn't work on mobile" / "logo not visible on mobile" — all three traced to
     ONE root cause. .header-actions carries margin-left:36px (components.css), meant to
     space it away from the desktop nav.main-nav — but nav.main-nav is already display:none
     at this breakpoint, so that 36px was pure dead space on every phone/tablet. Combined with
     the lang switch + KPZ SRV Login button + theme toggle + burger all needing to fit in one
     row, real narrow phones (≤375px, e.g. iPhone SE/mini) measured with the theme-toggle and
     burger pushed PAST the right edge of the viewport (confirmed via automated layout
     measurement: at 320px width the burger's bounding box started at x=351, past the visible
     320px viewport entirely) — not just "small tap target" as the 2026-08-13 note assumed.
     That horizontal overflow is also the likely cause of the logo/WhatsApp reports: a page
     wider than its viewport is a known trigger for iOS Safari mis-rendering `position:fixed`
     elements (like .wa-float) relative to the overflowed layout width instead of the visible
     screen, and can leave the header visually shifted on load. */
  .header-actions{margin-left:0;}
  /* [KPZ] BUGFIX 2026-08-13: .nav-row's desktop grid is `1fr auto 1fr` — with nav.main-nav
     display:none above, that middle "auto" track should size to 0, but on narrow phone
     widths (~375px and below, verified via automated screenshot testing) some browsers
     instead let the now-empty auto track claim the bulk of the row while collapsing BOTH
     outer 1fr tracks to 0 — the logo (.brand) and (depending on content) parts of
     .header-actions would silently vanish, not just overflow. Dropping the row to a plain
     2-column grid here (no middle track to mis-size at all, since main-nav is display:none
     and grid auto-excludes it from placement) removes the ambiguity entirely. */
  .nav-row{grid-template-columns:auto 1fr;}
}

/* [KPZ] Mobile/tablet header logo — user reported it looked too small next to the
   burger + KPZ SRV Login button on narrow screens; bump it up from the 46px desktop
   size so it reads at a comparable visual weight. */
@media (max-width:1560px){
  .brand img{height:57px;}
}
@media (max-width:640px){
  .brand img{height:48px;}
}

/* Mobile-nav docked panel on tablet/mid-width (981-1560px) */
@media (min-width:981px) and (max-width:1560px){
  .mobile-nav{
    left:auto;width:380px;max-width:60vw;
    border-left:1px solid var(--line-strong);
    box-shadow:-24px 0 48px -18px rgba(0,0,0,.6);
  }
}

/* ---------- Tablet ---------- */
@media (max-width:980px){
  .foot-grid{grid-template-columns:1fr 1fr;}
  .service-list{grid-template-columns:1fr;}
  .acc-content{padding:0 20px 22px 20px;}
  .dash-mock-body{grid-template-columns:1fr;}
  .dash-ticket{border-right:none;border-bottom:1px solid var(--line);}
  .contact-grid{grid-template-columns:1fr;gap:40px;}
  /* [KPZ] 2026-08-13: the two "book page" cards stack to one column here — at that point
     .contact-page's own 40px padding is already the same left/right rhythm as everything
     else on the page, so let the form use the card's full width instead of staying
     narrowed for a 2-column layout that no longer exists at this size. */
  .contact-book{grid-template-columns:1fr;row-gap:32px;}
  .contact-page{padding:32px 24px;}
  .quad-form-cell{max-width:none;}
  .tree-node::after{display:none;}
  .locations-grid{grid-template-columns:1fr 1fr;row-gap:32px;width:85%;}
  .locations-map-card{width:85%;}
}

/* ---------- Mobile ---------- */
@media (max-width:640px){
  .header-actions{gap:8px;}
  .lang-switch{font-size:9.5px;margin-right:0;}
  .lang-switch a{padding:5px 6px;}
  .foot-grid{grid-template-columns:1fr;}
  .locations-grid{grid-template-columns:1fr;width:100%;}
  .locations-map-card{width:100%;}
  .careers-countries-grid{grid-template-columns:1fr;}
  form .form-row{grid-template-columns:1fr;}
  .page-hero{padding:56px 0 40px;}
  .section{padding:56px 0;}
  .contact-page{padding:24px 18px;}

  /* [KPZ] 2026-08-15: the Item 41 fix (contact2-row-label widened to 230px, table-layout:fixed,
     see components.css) is correct on desktop but at mobile widths a fixed 230px label column
     left almost no room for the input column (~65-100px). Stack the request-consultation table
     into label-above-input blocks below 640px instead, matching the mobile-standard pattern for
     data tables — label and input both get full width, and the per-row divider moves from the
     td (which would otherwise double up between label/value) to the tr. */
  .contact2-req-table,.contact2-req-table tbody,.contact2-req-table tr,.contact2-req-table td{display:block;width:100% !important;}
  .contact2-req-table td{border-top:none !important;padding:4px 0 !important;}
  .contact2-req-table tr{border-top:1px solid var(--line);padding-top:12px;margin-top:12px;}
  .contact2-req-table tr:first-child{border-top:none;padding-top:0;margin-top:0;}
  .contact2-req-table .contact2-row-label{padding-top:0 !important;}
}

@media (max-width:360px){
  section a.cta-btn,section button.cta-btn{white-space:normal;}
}

/* [KPZ] BUGFIX 2026-08-13: on small phones (~480px and below) the header's logo + language
   switch + KPZ SRV Login + burger genuinely don't all fit at their normal sizes — tightening
   paddings/gaps here (not touching .cta-btn globally, which is used elsewhere at full size)
   closes most of the gap; the very smallest phones (~360px and under) may still scroll a few
   px, but the logo/buttons no longer disappear (see layout.css .nav-row .brand min-width).
   [KPZ] UPDATE 2026-08-13 (logo swap): the new logo artwork is a noticeably wider aspect
   ratio (~3.09:1 vs the old ~2.55:1), so holding this breakpoint's logo height at the old
   37px value re-introduced overflow (~90-116px at 360-375px widths) purely from the extra
   logo width. Brought logo height down slightly here (37 -> 32px) and tightened the other
   header controls a bit further to absorb the rest, so the net result is still a visibly
   bigger logo than the original pre-request 34px baseline, without bringing back overflow. */
@media (max-width:480px){
  /* [KPZ] BUGFIX 2026-08-14: the "may still scroll a few px" caveat above undersold the real
     problem — automated measurement at 320px (iPhone SE 1st gen) showed the burger pushed
     ~25-61px past the viewport edge, i.e. genuinely unreachable, not just a few stray px.
     Closing container-padding down here (32px -> 16px each side = 32px back) is what finally
     closes the gap at true 320px width, on top of the .header-actions margin-left fix above. */
  :root{--container-padding:16px;}
  .nav-row .brand{min-width:70px;}
  .brand img{height:32px;}
  .header-actions{gap:3px;}
  .header-actions .cta-btn{padding:8px 8px;font-size:10.5px;}
  .lang-switch{font-size:8px;margin-right:0;}
  .lang-switch a{padding:3px 3px;}
  .burger{padding:12px 2px;}
  /* [KPZ] 2026-08-13: bumped back up from 26px — likely too small a tap target combined
     with the tight 4px gap next to .burger, see the touch-action fix note in components.css. */
  .theme-toggle{width:30px;height:30px;font-size:13px;}
}

@media (prefers-reduced-motion:reduce){
  .cta-btn,.burger span,.dropdown,.mobile-nav,.acc-panel,.acc-icon::after{transition:none !important;}
  .tree-root::after,.tree-node::before,.tree-node:not(:last-child)::after{animation:none !important;background:var(--line-strong) !important;}
}
