/* ============================================================
   Sitewide mobile breakpoints. ONLY applies at narrow widths
   (max-width:720px / 480px) — desktop view is untouched.
   Loaded from /scripts/nav.js so every page gets it for free.
   ============================================================ */

/* ============================================================
   Nav collapses to the hamburger below 1100px.
   The full desktop nav (logo + 4 link groups + sign-in/account +
   CTA) needs ~1070px wide signed-out, ~1220px signed-in. Below that
   the flex row crowds and the uppercase labels wrap onto 2-3 lines,
   bursting the fixed 64px bar. Collapsing to the hamburger here keeps
   the bar a clean single row at every width between this and 720px
   (the former dead-zone). The page CONTENT columns stay desktop until
   720px — only the nav switches early. nav-inner keeps its 48px
   padding in this range so the logo stays aligned with page content.
   ============================================================ */
@media (max-width: 1100px) {
  #site-nav .nav-links { display: none !important; }
  #site-nav .nav-links.mobile-open {
    display: flex !important;
    position: fixed;
    top: 64px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: #161410;
    border-bottom: 1px solid var(--border);
    padding: 8px 12px 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    max-height: calc(100vh - 64px);
    overflow-y: auto;
  }
  body.bounty-active #site-nav .nav-links.mobile-open { top: 96px; }
  #site-nav .nav-links.mobile-open > a,
  #site-nav .nav-links.mobile-open .nav-dropdown {
    width: 100%;
    padding: 14px 12px;
    border-bottom: 1px solid var(--border);
  }
  #site-nav .nav-links.mobile-open .nav-dropdown {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }
  #site-nav .nav-links.mobile-open .nav-dropdown-trigger {
    width: 100%;
    padding: 14px 12px;
    justify-content: space-between;
  }
  /* M2 (2026-07-17): the sheet's dropdown groups are TAP-TO-EXPAND now, not
     force-opened — the old always-open panels made a 703px wall. nav.js
     toggles .open on the group; collapsed panels take no space. */
  #site-nav .nav-links.mobile-open .nav-dropdown-panel {
    position: static !important;
    transform: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
    min-width: 0 !important;
    padding: 0 0 8px 16px !important;
    margin: 0;
    display: none;
  }
  #site-nav .nav-links.mobile-open .nav-dropdown.open .nav-dropdown-panel {
    display: block;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  #site-nav .nav-links.mobile-open .nav-dropdown.open .nav-dropdown-caret { transform: rotate(180deg); }
  /* Descriptions drop out of the sheet (they stay on desktop hover panels),
     and the four not-yet-live platforms collapse to the one summary line. */
  #site-nav .nav-links.mobile-open .nav-dropdown-item-desc { display: none !important; }
  #site-nav .nav-links.mobile-open .nav-dropdown-item.soon { display: none !important; }
  #site-nav .nav-links.mobile-open .nav-more-soon { display: block !important; }
  #site-nav .nav-links.mobile-open .nav-dropdown-item { padding: 12px 14px; }
  #site-nav .nav-links.mobile-open .nav-dropdown-item-title { margin-bottom: 0; }
  /* The sheet glides in instead of popping (guarded for reduced motion),
     and the page behind it can't scroll while it's open. */
  #site-nav .nav-links.mobile-open { animation: o2iNavSheetIn 0.18s ease-out; }
  @media (prefers-reduced-motion: reduce) {
    #site-nav .nav-links.mobile-open { animation: none; }
  }

  /* Hamburger toggle button — injected into the nav by nav.js */
  #site-nav .nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px; height: 44px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    padding: 0;
    margin-left: auto;
  }
  #site-nav .nav-burger svg { width: 18px; height: 18px; }
}

/* M2: nav-sheet scroll lock + slide-in keyframes (used by the <=1100px
   hamburger sheet above; nav.js toggles html.nav-sheet-open). */
html.nav-sheet-open, html.nav-sheet-open body { overflow: hidden; }
@keyframes o2iNavSheetIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 720px and below (tablet portrait + phone landscape) ---------- */
@media (max-width: 720px) {

  /* Tighter container padding — 48px is way too much on a 360px screen */
  .container { padding: 0 20px !important; }

  /* ---------- Nav ---------- */
  /* On true phone widths, tighten the bar padding (logo no longer needs
     to align with the 48px content column — that drops to 20px too) and
     shrink the CTA so logo + burger + CTA fit a 360px row. */
  #site-nav .nav-inner { padding: 0 16px !important; gap: 12px !important; }
  /* 44px min tap height on the bar controls (Apple HIG). The 64px bar has room;
     inner padding keeps the visual size compact. 2026-07-11. */
  /* box-sizing:border-box is the real fix (Robert 2026-07-19: "Get my report is
     taller than the other nav boxes"). The burger + account chip are <button>s
     (UA default border-box) so min-height:44px renders exactly 44px; the CTA is
     an <a> that defaults to content-box, so on pages without a universal
     *{box-sizing:border-box} reset (e.g. /me/) it became 44 + 6+6 pad + 1+1
     border = 58px, standing taller. Forcing border-box makes min-height:44px the
     whole box = 44px, matching the other two. Keep min-height:44px (tap target). */
  #site-nav .nav-cta { box-sizing: border-box !important; margin-left: 8px !important; padding: 6px 14px !important; font-size: 0.7rem !important; min-height: 44px !important; }
  /* Signed-in account chip: the avatar + full-name trigger is what burst
     the 64px bar on phones (the CTA rendered half off-screen — the friend-
     demo "button cut off on iPhone" bug). font-size:0 collapses the raw
     name text node; the avatar keeps its own explicit font-size and the
     caret svg its explicit width/height, so the chip shrinks to avatar+caret. */
  #site-nav .nav-account-trigger { font-size: 0 !important; gap: 5px !important; padding: 6px 8px !important; min-height: 44px !important; }
  #site-nav .nav-signin { box-sizing: border-box !important; padding: 8px 10px !important; font-size: 0.7rem !important; min-height: 44px !important; }
  #site-nav .nav-right { gap: 8px !important; min-width: 0; }

  /* ---------- Hero ---------- */
  .hero { padding: 80px 0 24px !important; }
  .hero-grid { grid-template-columns: 1fr !important; gap: 28px !important; }
  .hero h1 { font-size: clamp(1.8rem, 8vw, 2.6rem) !important; }
  .hero-sub { font-size: 0.98rem !important; line-height: 1.6 !important; }

  /* Problem section is self-responsive now (own carousel/grid breakpoints in
     index.html) — no shared mobile override needed. */

  /* ---------- Stat grid ---------- */
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: 8px !important; }
  .stat-card { padding: 16px 14px !important; }
  .stat-card .n { font-size: 1.6rem !important; }
  .stat-card .l { font-size: 0.66rem !important; }
  .stat-card .sub-stat,
  .stat-card .sub { font-size: 0.7rem !important; padding-top: 8px !important; margin-top: 10px !important; }

  /* ---------- Hero card / mint card ---------- */
  .hero-card,
  .mint-card,
  .mint-header { padding: 24px 20px !important; }
  .hero-card h1 { font-size: clamp(1.6rem, 6vw, 2.2rem) !important; }
  .hero-card .sub,
  .mint-card p,
  .mint-header p { font-size: 0.92rem !important; }

  /* ---------- Window band ---------- */
  .window-band { grid-template-columns: 1fr !important; padding: 14px 16px !important; }
  .window-band .meta { font-size: 0.78rem !important; }

  /* ---------- TOC ---------- */
  .toc { padding: 14px 16px !important; }
  .toc ul { columns: 1 !important; }
  .toc li { font-size: 0.84rem !important; }

  /* ---------- Tables (FB + IG report data tables) ---------- */
  /* Wrap tables in horizontal-scroll containers so they don't burst pages */
  .fb-report table,
  .audit table,
  table.report-table { display: block; overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
  .fb-report th, .fb-report td { padding: 8px 10px !important; font-size: 0.78rem !important; }

  /* ---------- KV (definition list) ---------- */
  .fb-report .kv { grid-template-columns: 1fr !important; gap: 4px 0 !important; }
  .fb-report .kv dt { padding-top: 10px; }

  /* ---------- AI analyst ---------- */
  .ai-analyst,
  .fb-report .ai-analyst { padding: 22px 18px !important; }
  .ai-response,
  .fb-report .ai-response { padding: 16px 18px !important; font-size: 0.88rem !important; line-height: 1.65 !important; }
  .ai-chat-row { flex-direction: column !important; gap: 8px !important; }
  .ai-input { width: 100% !important; }

  /* ---------- Monetize bar ---------- */
  .monetize,
  .fb-report .monetize { padding: 28px 20px !important; }
  .monetize h3,
  .fb-report .monetize h3 { font-size: 1.4rem !important; }
  .monetize a,
  .fb-report .monetize a { padding: 12px 22px !important; font-size: 0.78rem !important; display: block !important; margin: 6px 0 !important; }

  /* ---------- Value cards (math reveal) ---------- */
  .value-grid,
  .fb-report .value-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .value-card,
  .fb-report .value-card { padding: 22px 20px !important; }
  .value-card .value-n,
  .fb-report .value-card .value-n { font-size: 2.4rem !important; }

  /* ---------- Sections / h2 ---------- */
  .fb-report h2 { font-size: clamp(1.3rem, 5vw, 1.7rem) !important; margin: 44px 0 8px !important; }

  /* ---------- Locations map ---------- */
  .fb-report .locations-map,
  .audit .locations-map { height: 320px !important; }

  /* ---------- Upload zone ---------- */
  .upload-zone { padding: 40px 22px !important; }

  /* ---------- Footer ---------- */
  .footer-inner { flex-direction: column !important; align-items: flex-start !important; gap: 16px !important; }
  .footer-links { flex-wrap: wrap; gap: 16px !important; }
}

/* ---------- 480px and below (phone portrait) ---------- */
@media (max-width: 480px) {
  .container { padding: 0 14px !important; }
  #site-nav .nav-inner { padding: 0 12px !important; gap: 8px !important; }
  #site-nav .nav-cta { padding: 6px 10px !important; font-size: 0.64rem !important; }
  .stat-grid { grid-template-columns: 1fr !important; }
  .fb-report .wrap { padding: 24px 14px 80px !important; }
  .stat-card .n { font-size: 1.5rem !important; }
}
