/* ═══════════════════════════════════════════════════════════════════════
 * GLX Studio corp site — responsive layer
 * ───────────────────────────────────────────────────────────────────────
 * site.css was authored desktop-only (no media queries). This file adds
 * the responsive behavior for the SHARED design-refresh classes so the
 * homepage, nav, and footer adapt on phone and tablet. Load AFTER
 * site.css AND site-supplement.css so equal-specificity overrides win.
 *
 * Breakpoints:
 *   ≤1024px  tablet tier  — reduce column counts, keep multi-column
 *   ≤900px   nav collapse — hamburger drawer (see responsive.js)
 *   ≤768px   phone tier   — single-column stacking, fluid type
 *   ≤480px   small phone  — final tightening
 *
 * Priority order per the brief: phone first, then tablet.
 * ═══════════════════════════════════════════════════════════════════════ */

/* ── Global safety guards (all viewports) ─────────────────────────────── */
html, body { max-width: 100%; overflow-x: hidden; }
img, video { max-width: 100%; height: auto; }

/* Fluid hero headline everywhere — caps at the original 64px on desktop,
 * scales down on small screens instead of overflowing. */
.hero-h1 { font-size: clamp(32px, 7vw, 64px); }

/* Hamburger button — hidden on desktop, shown by the nav-collapse query.
 * Injected into .topnav by responsive.js. */
.nav-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  margin: -6px 0;
  padding: 0;
  background: transparent;
  border: 1px solid var(--surface-tertiary);
  border-radius: 10px;
  cursor: pointer;
  flex: none;
}
.nav-toggle-bars { position: relative; width: 20px; height: 14px; }
.nav-toggle-bars span {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--text-standard); border-radius: 2px;
  transition: transform 180ms ease, opacity 140ms ease, top 180ms ease;
}
.nav-toggle-bars span:nth-child(1) { top: 0; }
.nav-toggle-bars span:nth-child(2) { top: 6px; }
.nav-toggle-bars span:nth-child(3) { top: 12px; }
.topnav.is-open .nav-toggle-bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.topnav.is-open .nav-toggle-bars span:nth-child(2) { opacity: 0; }
.topnav.is-open .nav-toggle-bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }


/* ═══════════════════════════════════════════════════════════════════════
 * TABLET TIER  (≤1024px)
 * ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .container, .container--narrow { padding: 0 24px; }

  /* 4-up feature grid → 2-up */
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }

  /* 5-column footer → 3 columns; brand column (first child) spans the row */
  .footer-grid { grid-template-columns: repeat(3, 1fr); gap: 36px 32px; }
  .footer-grid > :first-child { grid-column: 1 / -1; }

  /* Trust logo wall: 3 → keep but tighten */
  .results-trust-grid { gap: 12px 18px; }
}


/* ═══════════════════════════════════════════════════════════════════════
 * NAV COLLAPSE  (≤900px) — hamburger drawer
 * Behavior wired in responsive.js (tap to open, tap nav items to expand
 * dropdowns, ESC / click-outside to close).
 * ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }

  .topnav { flex-wrap: wrap; padding: 14px 20px; gap: 0; }
  .topnav-logo { flex: 1; }

  /* Hide the desktop link row + actions until the drawer opens */
  .topnav-links,
  .topnav-actions { display: none; flex-basis: 100%; width: 100%; }

  .topnav.is-open .topnav-links {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 2px; margin-top: 14px;
    border-top: 1px solid var(--surface-tertiary); padding-top: 10px;
  }
  .topnav.is-open .topnav-actions {
    display: flex; flex-direction: column; align-items: stretch;
    gap: 10px; margin-top: 12px;
  }

  /* Each item full width; comfortable 44px+ tap rows */
  .nav-item { display: block; width: 100%; }
  .topnav-links > .topnav-link,
  .nav-item > .topnav-link {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 12px 8px; font-size: 16px;
    border-radius: 8px;
  }
  .topnav-link:hover { background: var(--surface-secondary); }
  .topnav-link .caret { width: 12px; height: 12px; opacity: 0.8; }

  /* Dropdown → in-flow accordion (overrides the desktop hover panel) */
  .nav-dropdown {
    position: static; transform: none;
    min-width: 0; box-shadow: none; border: none;
    background: transparent;
    padding: 2px 0 6px 10px; margin: 0;
    display: none; opacity: 1; visibility: visible; pointer-events: auto;
  }
  .nav-item.is-expanded .nav-dropdown { display: block; }
  .nav-item.is-expanded > .topnav-link .caret { transform: rotate(180deg); }
  .nav-dropdown a { padding: 10px 12px; }
  .nav-dropdown a strong { font-size: 15px; }

  /* Drawer actions: full-width, tappable */
  .topnav-actions .topnav-signin {
    padding: 12px 8px; text-align: left; font-size: 16px;
  }
  .topnav-actions .btn-cta {
    width: 100%; height: 46px; justify-content: center; font-size: 15px;
  }
}


/* ═══════════════════════════════════════════════════════════════════════
 * PHONE TIER  (≤768px) — single-column stacking
 * ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .container, .container--narrow { padding: 0 20px; }
  .section { padding: 56px 0; }
  .section--tight { padding: 40px 0; }

  /* ── Hero → stacked ── */
  .hero {
    grid-template-columns: 1fr; gap: 28px;
    padding: 28px 20px 44px;
  }
  .hero-sub { max-width: none; }
  .hero-actions { flex-wrap: wrap; gap: 10px; }
  .hero-actions .btn-cta,
  .hero-actions .btn-storybuilder { width: 100%; justify-content: center; }
  .hero-stats { flex-wrap: wrap; gap: 18px 28px; }

  /* Product mock: drop to one column and hide decorative side panels so
   * the main visual reads cleanly instead of squashing 3 fixed columns. */
  .hero-product { grid-template-columns: 1fr; min-height: 0; }
  .hero-product .mp-nav { display: none; }
  .mp { grid-template-columns: 1fr; }
  .mp-nav { display: none; }
  .mp-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Process steps: 5-track row → vertical, drop the arrow tracks ── */
  .process { padding: 48px 20px; }
  .process-steps { grid-template-columns: 1fr; gap: 22px; }
  .process-arrow { display: none; }
  .process-step-body { max-width: none; }
  .process-title { font-size: clamp(22px, 6vw, 28px); }

  /* ── Features → 2-up (icons stay compact and legible) ── */
  .features { padding: 48px 20px 56px; }
  .features-grid { grid-template-columns: repeat(2, 1fr); gap: 22px; }
  .feature-body { max-width: none; }

  /* ── "See GLX in action" panel → stacked ── */
  .action-panel { grid-template-columns: 1fr; margin: 0 20px 48px; }
  .action-side { padding: 28px 24px; }
  .action-h { font-size: clamp(22px, 6vw, 28px); }
  .action-product { min-height: 0; padding: 12px; }
  /* Editor mock: show only the stage, hide left/right inspector columns */
  .ep-body { grid-template-columns: 1fr; }
  .ep-left, .ep-right { display: none; }

  /* ── Results → stacked ── */
  .results {
    grid-template-columns: 1fr; gap: 28px;
    padding: 48px 20px 56px;
  }
  .results-left p { max-width: none; }
  .results-trust-grid { grid-template-columns: repeat(3, 1fr); }

  /* ── Section headers ── */
  .section-h { margin-bottom: 36px; }
  .section-h h2 { font-size: clamp(26px, 6vw, 36px); }

  /* ── Bottom CTA bar → stacked ── */
  .bottom-cta {
    flex-direction: column; align-items: flex-start; gap: 16px;
    padding: 24px 20px;
  }
  .bottom-cta-h { max-width: none; }
  .bottom-cta-actions { width: 100%; flex-wrap: wrap; gap: 10px; }
  .bottom-cta-actions .btn-cta,
  .bottom-cta-actions .btn-ghost { flex: 1 1 auto; justify-content: center; }

  /* ── Final CTA (homepage closing block, defined in page-inline CSS) ── */
  .final-cta { padding: 56px 20px; }
  .final-cta h2 { font-size: clamp(28px, 7vw, 44px); }
  .final-cta p { font-size: 16px; }

  /* ── Footer → 2 columns, stacked legal row ── */
  .footer { padding: 44px 20px 28px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 28px 24px; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
  .footer-bottom {
    flex-direction: column; align-items: flex-start; gap: 12px;
  }
  .footer-legal { flex-wrap: wrap; gap: 12px 20px; }
  .footer-col a { padding: 8px 0; }   /* taller tap targets */
}


/* ═══════════════════════════════════════════════════════════════════════
 * SMALL PHONE  (≤480px) — final tightening
 * ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
  .mp-grid { grid-template-columns: 1fr; }
  .results-trust-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 16px; }
  .hero-stat { flex: 1 1 100%; }
}
