/* ==========================================================================
   Responsive rules. Desktop-first; breakpoints at 1180, 960, 720 and 480px.
   ========================================================================== */

@media (max-width: 1180px) {
  .main-nav a { padding: 8px 7px; font-size: .88rem; }
  .search input, .search input[type="search"] { width: 170px; }
  .search input:focus, .search input[type="search"]:focus { width: 200px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sector-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .hero-legend { display: none; }
}

@media (max-width: 960px) {
  :root { --header-h: 60px; }
  .nav-toggle { display: inline-grid; }
  .main-nav {
    position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0; background: var(--surface); flex-direction: column; align-items: stretch;
    padding: 16px var(--gutter) 32px; gap: 2px; margin: 0; transform: translateY(-8px); opacity: 0; transition: transform .25s, opacity .25s, visibility 0s .25s; overflow: auto; z-index: 90;
    visibility: hidden; pointer-events: none;
  }
  .main-nav.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; transition: transform .25s, opacity .25s; }
  .main-nav a { padding: 14px 8px; font-size: 1.05rem; border-bottom: 1px solid var(--line); border-radius: 0; }
  .main-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--amber); padding-left: 14px; }
  .main-nav .mobile-only { display: block; }
  .header-tools .btn-primary { display: none; }
  .header-tools .search { display: none; }
  .mobile-search { display: block; margin-bottom: 10px; }
  .mobile-search input { width: 100%; }
  .mobile-search input:focus { width: 100%; }
  .mobile-search .search-results { position: static; width: 100%; box-shadow: none; margin-top: 8px; max-height: none; }

  .hero-copy { position: relative; left: auto; top: auto; max-width: none; padding: 24px var(--gutter) 4px; }
  .hero-grid { display: flex; flex-direction: column; }

  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sector-layout { grid-template-columns: 1fr; }
  .sector-panel { position: static; max-height: none; }
  .catalogue-layout { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; display: none; }
  .filters.is-open { display: block; }
  .filters-toggle { display: inline-flex; }
  .product-detail { grid-template-columns: 1fr; }
  .pd-media { position: static; max-width: 520px; }
  .finder-layout { grid-template-columns: 1fr; }
  .finder-results { position: static; }
  .flow-diagram { grid-template-columns: 1fr; gap: 0; }
  .flow-step { margin: 0 0 22px; }
  .flow-step:not(:last-child)::after { right: auto; left: 30px; top: 100%; width: 2px; height: 22px; background: repeating-linear-gradient(180deg, var(--teal) 0 4px, transparent 4px 9px); }
  .cta-band { grid-template-columns: 1fr; }
  .cta-band-actions { justify-content: flex-start; }
  .contact-layout, .about-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stack { grid-template-columns: 1fr 1fr; }

  /* Hotspots become compact numbered markers; labels move to the list */
  .scene-stage.is-compact .hotspot { padding: 4px; gap: 0; min-height: 40px; min-width: 40px; justify-content: center; }
  .scene-stage.is-compact .hotspot-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .scene-stage.is-compact .hotspot-num { width: 30px; height: 30px; font-size: .85rem; }
}

@media (min-width: 961px) {
  .main-nav .mobile-only, .mobile-search { display: none; }
}

@media (max-width: 720px) {
  body { font-size: 15.5px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .challenge-list { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .solution-list { grid-template-columns: 1fr; }
  .activity-index { columns: 1; }
  .opt-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
  .section-head { align-items: start; }

  /* Activity drawer becomes a full-height bottom sheet */
  .drawer { top: auto; left: 0; width: 100%; height: 94vh; height: 94dvh; border-radius: 18px 18px 0 0; transform: translateY(102%); }
  .drawer.is-open { transform: none; }
  .drawer-head { border-radius: 18px 18px 0 0; padding: 14px 16px 12px; position: relative; }
  .drawer-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line-strong); }
  .drawer-body { padding: 14px; }
  .drawer-foot { padding: 10px 14px; }
  .drawer-foot .btn { flex: 1 1 auto; }
  .reco { grid-template-columns: 1fr; }
  .reco img { width: 100%; max-width: 160px; height: auto; }

  /* Comparison: stack label above values so nothing overflows */
  .cmp-row { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .cmp-row > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line); padding: 6px 12px; font-size: .78rem; }
  .cmp-row > div:nth-child(2) { border-left: 0; }
  .cmp-row > div { padding: 8px 10px; font-size: .84rem; }
  .cmp-head > div:first-child { display: none; }
  .cmp-head img { width: 72px; }

  .stack { grid-template-columns: 1fr; }
  .compare-tray { flex-wrap: wrap; }
  .compare-tray .tray-label { width: 100%; }
  .product-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { flex: 1 1 auto; }
}

@media (max-width: 480px) {
  .header-inner { gap: 10px; }
  .brand-name { font-size: 1.05rem; }
  .scene-tooltip { display: none; }
  .scene-toolbar .hint { display: none; }
}

@media print {
  .site-header, .site-footer, .compare-tray, .drawer-foot, .hotspot-layer { display: none !important; }
  .drawer { position: static; transform: none; box-shadow: none; width: 100%; }
}
