/**
 * responsive.css — breakpoints and print. Loaded last so it can override.
 */

/* ===================== tablet / small desktop ===================== */

@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* matches carousel.js's own `narrow` breakpoint (window.innerWidth < 560) —
   keep the card at its original width here so the spacing computed there
   (also unchanged below this breakpoint) still matches the card size */
@media (max-width: 559px) {
  .carousel-card { width: 250px; }
}

/* the walkthrough stacks before the columns get too narrow to read:
   below this the aside would be a 250px ribbon next to a letterboxed video */
@media (max-width: 940px) {
  .plant-showcase { grid-template-columns: 1fr; gap: 16px; }
  .plant-aside-keys { display: none; }          /* no keyboard on touch */
  .vp-chapters { max-height: 168px; overflow-y: auto; overscroll-behavior: contain; }
}

@media (max-width: 860px) {
  .detail-body { grid-template-columns: 1fr; }
  .booking-grid { grid-template-columns: 1fr; }
  .roi-grid { grid-template-columns: 1fr; }
  .roi-output { position: static; }
}

@media (max-width: 820px) {
  .story-grid { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .client-grid { grid-template-columns: repeat(2, 1fr); }

  /* orbit.js swaps to the portrait-aspect slot set at this breakpoint;
     the scene stays a floating composition (not a shrunk desktop one,
     and not a flat scroll row). Stage height is set in the override
     block further down, after the laptop/tablet rules.

     left/top/width/height are docked by orbit.js (full-viewport on this
     breakpoint) — only the internal layout needs adjusting here */
  .orbit-story { grid-template-columns: 1fr; grid-template-rows: 170px 1fr; }
  .orbit-story-portrait { min-height: 0; }
  .orbit-story-body { padding: 20px; }
}

/* Sphere size and field height are computed in orbit.js from the measured
   stage and the number of case studies in the selected year, so there are
   deliberately no per-breakpoint size/height rules here — a second scale
   factor in CSS would fight that. Only the year chrome adapts below. */
@media (max-width: 760px) {
  .orbit-yearnav { gap: 14px; }
  .orbit-year-value { font-size: 26px; }
  .orbit-year-display { min-width: 112px; }
  .orbit-year-arrow { width: 44px; height: 44px; }   /* touch target */
  .orbit-hint { font-size: 10.5px; }
}

/* ===================== mobile ===================== */

@media (max-width: 720px) {
  :root { --wrap-pad: 22px; }

  /* the capsule takes its padding out of the gutter: the row inside keeps
     the full content width (the switch and the rail need every pixel) */
  .topbar { padding: 8px calc(var(--wrap-pad) - 10px) 0; margin-bottom: 24px; }
  .topbar > .topbar-main { margin-inline: 0; padding: 8px 10px; border-radius: 20px; }
  .brand-sub { display: none; }

  h1 { font-size: 26px; }
  .story-h1 { font-size: 23px; }
  .lead, .story-lead { font-size: 14.5px; }

  /* touch targets: 44px minimum */
  .carousel-arrow { width: 44px; height: 44px; }
  .wt-step-btn { width: 38px; height: 38px; }
  .carousel-dots { gap: 12px; margin-top: 22px; }
  .dot { width: 10px; height: 10px; }
  .dot::after { content: ""; position: absolute; inset: -14px; }
  .dot[aria-current="true"] { width: 22px; }
  .cta-btn, .footer-nav-btn, .session-opt, .slot-pill { padding: 11px 18px; }

  /* hotspots: larger targets, tooltips docked to the screen bottom */
  .hotspot { width: 32px; height: 32px; margin: -16px 0 0 -16px; font-size: 13px; }
  .hotspot-tip {
    position: fixed; left: 14px; right: 14px; bottom: 14px; top: auto;
    min-width: 0; max-width: none; width: auto;
    font-size: 13px; padding: 14px 16px;
    transform: translateY(8px);
  }
  .hotspot[aria-expanded="true"] .hotspot-tip { transform: translateY(0); }

  /* dense screenshots can be scrolled/pinched rather than shrunk illegibly */
  .image-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* …except the lab photo, which is deliberately fitted to its stage —
     a scroll container there would also break the 3D plate */
  .lab-image.image-wrap { overflow: hidden; }

  .lab-stage { min-height: 0; perspective: none; }
  .lab-overlay { inset: 10px 10px auto 10px; }
  .lab-badge { font-size: 9px; padding: 5px 10px; }
  .lab-rail { gap: 6px; padding: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .lab-rail::-webkit-scrollbar { display: none; }
  .lab-poi { flex: 0 0 auto; }
  .lab-rail-hint { display: none; }

  .crumb-bar { gap: 16px; padding: 12px 14px; }
  .crumb-value { font-size: 12.5px; }
  .detail-title-row h2 { font-size: 21px; }
  .kiosk-chrome { padding: 10px; font-size: 11px; }
  .chrome-pill { padding: 8px 12px; }

  .journey-rail { overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .journey-rail::-webkit-scrollbar { display: none; }
  .journey-stage { min-width: 104px; }

  .intro-banner { padding: 18px; }
  .intro-banner p { font-size: 13.5px; }
  .compliance-badge { padding: 9px 12px; }
  .plant-stat { padding: 10px 14px; flex: 1 1 auto; }

  /* 360° tour: the room keeps the screen, the chrome gets out of the way */
  .pano-topbar { padding: 12px; gap: 10px; }
  .pano-title { font-size: 15px; }
  .pano-exit span:last-child { display: none; }     /* icon-only exit */
  .pano-exit { padding: 11px; }
  .pano-btn { padding: 11px 14px; }                 /* 44px touch targets */
  .pano-btn.small { width: 42px; height: 42px; }
  .pano-dock { padding: 12px; gap: 10px; }
  .pano-scenes { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .pano-scenes::-webkit-scrollbar { display: none; }
  .pano-scene-btn { flex: 0 0 auto; }
  .pano-hint { bottom: 92px; font-size: 10.5px; white-space: normal; max-width: 86vw; text-align: center; }
  .pano-pin-card i { display: none; }               /* label only at phone size */
  .tour-open .wrap { filter: none; }                /* blur is expensive on mobile GPUs */

  /* the bar stays up on touch: there is no hover to reveal it */
  .vp-bar { opacity: 1; transform: none; left: 8px; right: 8px; bottom: 8px; gap: 8px; padding: 7px 10px; }
  .vp-time { display: none; }                   /* the scrub track carries position */
  .vp-bigplay { padding: 8px 16px 8px 8px; }
  .vp-bigplay-ring { width: 38px; height: 38px; }
  .plant-filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .plant-filters::-webkit-scrollbar { display: none; }
  .plant-filter { flex: 0 0 auto; }
  .testimonial-card { padding: 24px 20px; }
  .testimonial-quote { font-size: 15.5px; }

  /* the stage owns the height now — the viewer just fills it */
  .panorama-viewer { height: 100%; }
  .plant-viewport { height: 390px; }

  /* lighten GPU-heavy effects on phones */
  .bg-grain { display: none; }
}

@media (max-width: 480px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-value { font-size: 27px; }
  .client-grid { grid-template-columns: repeat(2, 1fr); }
  .lab-hero-sub { max-width: none; }
  .photo-strip { gap: 6px; padding: 10px; }
  .stat-row { grid-template-columns: 1fr; }
}

/* ===================== print / PDF leave-behind ===================== */

@media print {
  @page { margin: 16mm; }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }

  /* hide anything interactive or decorative */
  .bg-layer, .bg-grain, .cursor-dot, .cursor-ring,
  .chapter-rail, .chapter-handoff, .theme-toggle, .lang-toggle, .topbar-right .cta-btn,
  .carousel-arrow, .carousel-dots, .back-btn, .intro-close,
  .detail-footer-nav, .detail-cta-line, .chrome-right,
  .mini-carousel-viewport, .skip-link, .hotspot, .wt-bar, .wt-dots,
  .session-toggle, .cal-card, .booking-form-card, .journey-line::after,
  .vp-bar, .vp-bigplay, .vp-scrim, .plant-filters,
  .lab-overlay, .lab-rail, .lab-backdrop, .lab-gloss {
    display: none !important;
  }

  /* the lab photo prints as a plain, flat, full-width picture */
  .lab-stage { max-height: none !important; aspect-ratio: auto !important; background: none !important; display: block !important; }
  .lab-plate { transform: none !important; height: auto !important; width: 100% !important; }
  .lab-image.image-wrap { height: auto !important; width: 100% !important; box-shadow: none !important; opacity: 1 !important; }

  /* print every page section, not just the visible one */
  .page { display: block !important; opacity: 1 !important; transform: none !important; page-break-before: always; }
  .page:first-of-type { page-break-before: avoid; }

  /* flatten the 3D carousel into a readable list */
  .carousel-viewport, .plant-viewport { height: auto !important; overflow: visible !important; mask-image: none !important; -webkit-mask-image: none !important; perspective: none !important; }
  .carousel-track { height: auto !important; display: block !important; }
  .carousel-card {
    position: static !important; transform: none !important;
    opacity: 1 !important; filter: none !important;
    width: 100% !important; max-width: 420px;
    margin: 0 0 10mm 0; page-break-inside: avoid;
  }

  .reveal { opacity: 1 !important; transform: none !important; }

  .kpi-tile, .case-card, .story-card, .plant-stat, .faq-item {
    border: 1px solid #ccc !important; box-shadow: none !important;
    page-break-inside: avoid;
  }
  .faq-a { max-height: none !important; }
  .faq-a p { display: block !important; }

  .roi-output, .testimonial-card { background: #f3f3f3 !important; color: #000 !important; }

  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}
