/**
 * Horizon Theme — Responsive / Mobile Layer (MT-8)
 * All breakpoint overrides in one auditable file.
 * Complements the desktop-first rules in hp-base / hp-components / hp-shop /
 * hp-vault. Load order: after hp-age-gate, before hp-child (functions.php).
 */

/* ==========================================================================
   ≤ 768px — GP mobile nav breakpoint
   Hamburger fires here (GP inline CSS shows .menu-toggle at this width).
   ========================================================================== */

@media (max-width: 768px) {

  /* ── Hamburger toggle: WCAG 2.5.5 44×44 px minimum tap target ──
     The icon itself is visually sufficient on both skins; no border.
     min-width/min-height expand the invisible hit area only. */
  .hp .menu-toggle {
    min-width:  44px !important;
    min-height: 44px !important;
  }

  /* ── The header tools ride in the header bar, not inside the hamburger ──
     `HORIZON-20260828-001` (search), `-002` (account + cart). Alex, 2026-08-28.
     The nav items from `-20260827-037`/`-050` are behind the toggle at this
     width, so all three cost two taps.

     `hp_render_mobile_header_tools()` renders .hp-header-tools as a direct child
     of .inside-header, which is `display:flex; justify-content:space-between`.
     ⭐ ORDER IS SET EXPLICITLY RATHER THAN RELYING ON DOM ORDER: this element
     arrives on `generate_after_header_content`, and whether that lands before or
     after GP's own mobile-toggle wrapper is GP's business, not ours. `order`
     makes the result the same either way. `margin-left:auto` pushes the group to
     the right so the logo keeps the left edge - space-between alone would strand
     it mid-bar.

     ⭐ ONE flex container rather than three loose children, so the whole group
     moves as a unit and only ONE auto margin competes with GP's (see below). */
  .hp .inside-header .hp-header-tools {
    display: flex;
    align-items: center;
    gap: var(--hp-sp-1);
    order: 8;
    margin-left: auto;
    margin-right: var(--hp-sp-1);
    z-index: 3;
  }
  .hp .inside-header .hp-header-tool {
    position: relative;   /* anchor for the cart count badge */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width:  44px;     /* WCAG 2.5.5, same as the hamburger above */
    min-height: 44px;
    color: var(--hp-text);
    text-decoration: none;
  }

  /* Cart count — PLACEMENT ONLY. The appearance is shared with the nav badge and
     lives in hp-components.css (`HORIZON-20260828-003`); this block held a full
     copy of it until the nav one was built and the duplication became real.
     Anchored to the 44px square, which centres a 22px icon, so 2px/2px puts the
     badge on the icon's top-right corner. */
  .hp .inside-header .hp-header-tool__count {
    top: 2px;
    right: 2px;
  }

  /* ⛔ GP's own main.min.css sets `.mobile-menu-control-wrapper { margin-left: auto }`.
     TWO auto margins in one flex row SPLIT the free space instead of one
     absorbing it, so the first build left search stranded mid-bar at x=168 with
     94px of gap either side - evenly spaced, which reads as deliberate and is
     why it needed measuring rather than looking. Zeroing GP's lets ours absorb
     the lot and parks search against the hamburger. (0,1,2,0) beats GP's
     (0,0,1,0), so no !important. */
  .hp .inside-header #mobile-menu-control-wrapper {
    order: 9;
    margin-left: 0;
  }

  /* ⛔ AND THE NAV ITEMS GO AWAY HERE, OR OPENING THE HAMBURGER SHOWS A SECOND
     COPY OF ALL THREE.

     ⛔⛔ DESCENDANT, NOT CHILD. `.main-nav` is the `<div id="primary-menu">`; the
     items are in a `<ul id="menu-primary">` INSIDE it, so `.main-nav > li`
     matches NOTHING. `-001`'s first build used `>` and silently did nothing - the
     item only looked hidden because GP collapses the whole nav, and it would have
     reappeared the moment anyone opened the hamburger.

     ✅ The other `.main-nav > li` rules further down this file had the same bug
     and were CORRECTED in `HORIZON-20260828-005`, together with the scroll
     containment that made correcting them safe. See the block above them.

     ⭐ Matches the shared `hp-nav-tool` class, so a fourth tool added to
     hp_header_tools() is hidden here automatically. `hp-nav-cta` and
     `hp-nav-live` are different classes and are untouched. */
  .hp #site-navigation .main-nav li.hp-nav-tool {
    display: none !important;
  }

  /* ⛔⛔ TWO FIXES THAT MUST STAY TOGETHER (`HORIZON-20260828-012`).
     Alex, 2026-08-28: the header icons jump down when the hamburger opens, and
     the menu appears instantly where the links drawer slides.

     1. THE 20px JUMP. `.inside-header` is `display:flex; flex-wrap: wrap`, and
        GeneratePress gives `#site-navigation` **`flex-basis: 100%`** plus a
        ~25.5px top margin. While collapsed it is `display:none` so it is not a
        flex item at all; the moment `.toggled` lands it becomes one, its 100%
        basis forces a SECOND FLEX LINE, and every item on the first line is
        pushed down. Measured on `star`: icons and hamburger both +20px, while
        the header's own height never changed - which is why it reads as the
        icons drifting rather than the header growing. Collapsing it to a
        zero-width, zero-basis, zero-margin item removes the second line.
        ⛔ Do NOT "fix" this by giving `#site-navigation` a position: the panel
        below is `position:absolute` and currently resolves against
        `.site-header`; positioning its parent would re-anchor it and move the
        whole menu.
        ⚠️ Only the `hp-*` themes need this. Measured: `commerce` keeps
        `#site-navigation` at `display:block` in BOTH states so it never flips,
        and `featurenews` sets `flex-wrap: nowrap`. Neither shifts.

     2. THE ANIMATION. GP shows the menu by flipping `display`, and `display`
        CANNOT be transitioned - which is exactly why this felt different from
        the "My Links" drawer. That drawer stays in the DOM and slides on
        `transform` with `visibility`, so it can animate. Same technique here:
        keep the nav rendered, move the hide onto `visibility`, and transition
        transform + opacity with the DRAWER'S OWN timing
        (`.35s cubic-bezier(.4,0,.2,1)`) so the two feel identical.
        ⛔ `visibility` is switched at 0s on OPEN and delayed 0.35s on CLOSE.
        Never transition it symmetrically: a stalled transition would then leave
        the menu invisible while `.toggled` is set. The delay on close is what
        lets the fade-out play before it is hidden.
        ⭐ `pointer-events: none` while closed so the invisible panel cannot
        swallow taps meant for the page underneath. */
  .hp .inside-header #site-navigation {
    flex: 0 0 0;
    width: 0;
    margin-top: 0;
  }
  .hp #site-navigation.main-navigation {
    display: block !important;   /* keep it rendered so the panel can animate */
  }
  .hp #site-navigation.main-navigation .inside-navigation {
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1),
                opacity   .35s cubic-bezier(.4, 0, .2, 1),
                visibility 0s linear .35s;
  }
  .hp #site-navigation.main-navigation.toggled .inside-navigation {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    transition: transform .35s cubic-bezier(.4, 0, .2, 1),
                opacity   .35s cubic-bezier(.4, 0, .2, 1),
                visibility 0s;
  }

  @media (prefers-reduced-motion: reduce) {
    .hp #site-navigation.main-navigation .inside-navigation,
    .hp #site-navigation.main-navigation.toggled .inside-navigation {
      transition: none;
      transform: none;
    }
  }

  /* ── Expanded mobile nav panel: full-bleed opaque surface ──
     #site-navigation lives inside .inside-header (padding: 0 var(--hp-content-pad)).
     position:absolute with left:0;right:0 breaks out of that padding and anchors
     to the positioned .site-header, so the panel spans the full viewport width.
     The hp-base.css background:transparent !important is beaten by !important here. */
  .hp #site-navigation.main-navigation .inside-navigation {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--hp-header-h);
    z-index: 99;
    background: var(--hp-bg-surface) !important;
    border-bottom: 1px solid var(--hp-border);
    padding: var(--hp-sp-4) 0 var(--hp-sp-6);

    /* ⛔⛔ SCROLL CONTAINMENT - THIS IS A LIVE BUG FIX, NOT POLISH
       (`HORIZON-20260828-005`). Measured on `streamer` at 375x667 BEFORE any
       other change: the open menu ran 102px past the bottom of the viewport,
       the panel had `overflow: visible` with `max-height: none` so it could not
       scroll, and `hp-menu-open` locks `body { overflow: hidden }` so the PAGE
       could not scroll either. The last item - the **Subscribe CTA** - was
       simply unreachable on a common phone.

       ⭐ The allowance is DERIVED, not guessed: this panel is `top:
       var(--hp-header-h)` inside `.site-header`, and the header itself sits
       below the announcement bar, so its viewport offset is header + bar.
       Measured live: bar 56px + header 72px = a panel top of exactly 128px.
       ⚠️ The theme's own JS comment says the bar is 38px - THAT IS STALE; it
       measures 56px. Do not re-derive this from the comment.
       ⚠️ 56px is conservative on a tenant with NO announcement bar: the menu is
       shorter than it strictly could be, which costs nothing because it scrolls.
       Erring generous never overflows; erring tight cuts off the CTA again.

       `dvh` second so it wins where supported - mobile browsers shrink the
       visual viewport as the URL bar collapses and `vh` does not follow. */
    max-height: calc(100vh - var(--hp-header-h) - 56px);
    max-height: calc(100dvh - var(--hp-header-h) - 56px);
    overflow-y: auto;
    overscroll-behavior: contain;   /* do not chain the scroll to the locked body */
    -webkit-overflow-scrolling: touch;
  }

  /* ⛔⛔ EVERY RULE BELOW USED TO SAY `.main-nav > li` AND MATCHED NOTHING
     (`HORIZON-20260828-005`). `.main-nav` is the `<div id="primary-menu">`; the
     items live in a `<ul id="menu-primary">` INSIDE it, so a child combinator
     selects nothing at all. They were dead from the day they were written, and
     the mobile nav you see is produced by `hp-base.css`'s `.main-nav ul li`
     rules, which use the correct descendant form.

     ⚠️ FIXING THE SELECTOR IS A VISIBLE CHANGE, NOT A NO-OP - measured before
     committing: rows 60px -> 92px, link text 14px -> 16px (BOTH SUPERSEDED at `-20260828-009`/`-010`: rows are 48px, text 14px - see the block below), and `star`'s panel
     521px → 777px. That is what the author intended ("generous", "premium
     feel"), but it had never once rendered. ⛔ It is only SAFE because the
     scroll containment above landed in the same change: without it the taller
     rows pushed `star` 93px off an unscrollable panel. If these two are ever
     separated, the containment goes first.

     ⭐ To revert just the sizing and keep the real fixes, delete the
     `ul > li > a` block below - the CTA and the containment are independent. */

  /* Full-width stacked nav items — no separator lines (premium feel) */
  .hp #site-navigation .main-nav ul > li {
    display: block !important;
  }
  .hp #site-navigation .main-nav ul > li > a {
    display: block !important;
    padding: var(--hp-sp-2) var(--hp-sp-6) !important;
    /* ⛔⛔ THESE FOUR OVERRIDE THE `display: block` ABOVE, AND THAT IS THE POINT.
       GeneratePress sets `line-height: 60px` on nav links (full header height).
       With this block's old 16px vertical padding that produced **92px rows** -
       measured, only **5 of 10** items fitting on a 375x667 phone. Alex,
       2026-08-28: too big. Killing GP's line-height and pinning a 48px
       min-height puts **10 of 10** in view on the same phone.
       ⭐ 48px is a FLOOR, not a preference: Material's 48dp, and above the 44px
       WCAG 2.5.5 / Apple HIG minimum this theme already asserts for its own
       hamburger a few rules up. ⛔ Do not shave it to fit more items.
       (`HORIZON-20260828-009`) */
    display: flex !important;
    align-items: center !important;
    min-height: 48px !important;
    line-height: 1.4 !important;
    font-size: var(--hp-text-sm) !important;
    letter-spacing: 0.05em !important;
  }

  /* Subscribe CTA pill: generous padding, no forced borders.
     ⭐ THIS ONE WAS A REAL VISUAL DEFECT, not just dead code. Measured on
     `streamer`: the "pill" rendered as a FULL-BLEED 375px band with LEFT-aligned
     text, because only `hp-base.css`'s colour rules were reaching it. Corrected,
     it is a 327px inset centred button. Live on cherrycravin, fetish, intimate
     and streamer; `baileyfox` and `star` have no `hp-nav-cta` item. */
  .hp #site-navigation .main-nav ul > li.hp-nav-cta {
    padding: var(--hp-sp-3) var(--hp-sp-6) var(--hp-sp-2);
    margin-top: var(--hp-sp-1);
  }
  .hp #site-navigation .main-nav ul > li.hp-nav-cta > a {
    display: block !important;
    text-align: center !important;
    /* ⛔ The anchor is `display: flex` now (see the nav-link block above), so
       `text-align` no longer centres its text - `justify-content` does. Without
       this line the Subscribe CTA silently reverts to LEFT-aligned, which is the
       exact defect `-20260828-005` was fixed for. (`HORIZON-20260828-009`) */
    justify-content: center !important;
    padding: var(--hp-sp-4) !important;
    border-radius: var(--hp-r-sm) !important;
  }

  /* Live Now pill — mirror Subscribe CTA mobile treatment.
     ⚠️ SELECTOR FIXED BUT STILL UNEXERCISED: `hp_inject_live_nav_item()` only
     emits `li.hp-nav-live` when a tenant sets `currently_live` + `live_url`, and
     measured 2026-08-28 NO tenant has one. Kept rather than deleted because it
     mirrors the CTA treatment above, which is now verified to render correctly -
     but it has never been seen, so look at it the first time a tenant goes live. */
  .hp #site-navigation .main-nav ul > li.hp-nav-live {
    padding: var(--hp-sp-3) var(--hp-sp-6) var(--hp-sp-2);
    margin-top: var(--hp-sp-1);
  }
  .hp #site-navigation .main-nav ul > li.hp-nav-live > a {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: var(--hp-sp-4) !important;
    border-radius: var(--hp-r-sm) !important;
  }
}

/* ==========================================================================
   ≤ 640px — Mobile (primary breakpoint)
   ========================================================================== */

@media (max-width: 640px) {

  /* ── Section padding: 5 rem → 3 rem ──
     .hp-section { padding: var(--hp-sp-20) 0 } = 80 px is excessive on
     a 390 px screen. Tighten all sections; tight variant proportionally. */
  .hp-section {
    padding-top:    var(--hp-sp-12);
    padding-bottom: var(--hp-sp-12);
  }
  .hp-section--tight {
    padding-top:    var(--hp-sp-8);
    padding-bottom: var(--hp-sp-8);
  }

  /* ── Typography ──
     h1/h2 are already scaled in hp-base.css @600px; add h3/h4 here. */
  h3 { font-size: var(--hp-text-xl); }   /* 1.25 rem (was 1.5 rem) */
  h4 { font-size: var(--hp-text-lg); }   /* 1.125 rem (was 1.25 rem) */

  /* ── Inner-page header: compact at mobile ── */
  .hp-page-header {
    padding: var(--hp-sp-8) 0 var(--hp-sp-6);
  }
  .hp-page-header__title {
    font-size: var(--hp-text-3xl);   /* 2 rem (was 2.75 rem) */
  }

  /* (Hero inner bottom-padding override lives in the Hero-typography block
     below — keep all hero overrides together to avoid a duplicate selector
     inside this same 640px media query.) */

  /* ── About — At-a-Glance: override the inline repeat(2,1fr) grid ──
     The grid is an inline style so we need a more-specific selector +
     !important to win. */
  .hp-about-glance .hp-container > div {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* ── Large inline gaps that become excessive when auto-fit stacks ──
     Covers: About intro (portrait+bio), Collabs "Better With Company",
     Best Sellers exclusive content, Live Streams "Unmissable" section —
     all use gap:var(--hp-sp-16) = 4 rem as an inline style. */
  .hp-section .hp-container > div[style*="gap:var(--hp-sp-16)"],
  .hp-section .hp-container > div[style*="gap: var(--hp-sp-16)"] {
    gap: var(--hp-sp-8) !important;
  }

  /* ── Merch / shop filter bar: horizontal scroll, no wrap ── */
  .hp-category-filter {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    padding-bottom: var(--hp-sp-1); /* room for any scrollbar on some browsers */
  }
  .hp-category-filter::-webkit-scrollbar { display: none; }
  .hp-category-filter__tab {
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* Vault / portfolio filter bar */
  .hp-filter-bar__inner {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
  }
  .hp-filter-bar__inner::-webkit-scrollbar { display: none; }
  .hp-filter-tab {
    white-space: nowrap;
    flex-shrink: 0;
    min-height: 44px;
  }

  /* ── Live-now banner: flex layout so text + button don't collide ── */
  .hp-live-now-banner .hp-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--hp-sp-3);
    flex-wrap: wrap;
  }
  .hp-live-now-banner .hp-container > span {
    flex: 1 1 auto;
    min-width: 0;
  }
  .hp-live-now-banner .hp-container .hp-btn {
    flex-shrink: 0;
  }

  /* ── Platform links bar: wrap into rows + smaller tap targets ──
     Platforms bar on Shows / Live Streams pages — 5-7 icons at 80 px each
     overflows 390 px. Wrap into 2 rows and reduce the min-width.
     overflow:hidden on the bar prevents any pill from bleeding off-screen. */
  .hp-platform-bar {
    overflow: hidden;
  }
  .hp-platform-links {
    flex-wrap: wrap !important;
    gap: var(--hp-sp-2) !important;
  }
  .hp-platform-link {
    min-width: 3.5rem !important;
    /* 7rem, not 5rem: CHATURBATE is ~72px at this size and 5rem left only
       ~64px of content box, so the label wrapped and broke MID-WORD.
       Confirmed on a real iPhone 2026-08-29. */
    max-width: 7rem !important;
    padding: var(--hp-sp-2) !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: var(--hp-sp-1) !important;
  }
  .hp-platform-link__name {
    max-width: 100%;
    /* Never break a brand name mid-word. If one is ever still too long an
       ellipsis is honest; "CHATURBA/TE" is not. */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ── Subscribe CTA: show text before portrait when stacked ──
     DOM order is photo-first; on mobile, swap so the offer is above the fold.
     margin:0 auto centres the portrait card in the 1-col grid column.
     max-height:none overrides the 768px cap (360 px) in hp-components.css which
     narrows the photo to ~270 px via aspect-ratio — let it fill the full column. */
  .hp-subscribe-cta__photo {
    order: 1;
    margin: 0 auto;
    max-height: none;
  }

  /* ── Subscribe CTA section: tighten own padding at mobile ──
     .hp-subscribe-cta { padding: var(--hp-sp-24) 0 } = 96 px is not a
     .hp-section element so the section-padding override above does not apply.
     Match standard mobile section rhythm instead. */
  .hp-subscribe-cta {
    padding: var(--hp-sp-12) 0;
  }

  /* ── Portrait-pull: text first, portrait below on mobile ──
     auto-fit + portrait grids (Live Streams "Unmissable", Collabs "Better With
     Company") place the portrait LEFT on desktop via order:-1. When the grid
     stacks to 1-col at mobile that inline order bubbles the portrait to the TOP,
     showing image before context/CTA. .hp-portrait-pull flips it below text. */
  .hp-portrait-pull {
    order: 1 !important;
  }

  /* ── Collab roster cards: portrait placeholder → square ──
     Cards without a real image carry aspect-ratio:3/4; at 358 px content width
     that's ≈ 477 px of beige placeholder. Collapse to a square (1:1) so the
     name / role text is immediately visible without scrolling through empty space. */
  .hp-collab-portrait {
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
  }

  /* ── Roster heading: tighten margin-bottom at mobile ──
     Centered eyebrow+h2 heading blocks (collab roster, best-sellers sections)
     use margin-bottom:var(--hp-sp-12) = 48 px. Halve it for tighter rhythm. */
  .hp-section .hp-container > div[style*="text-align:center"][style*="margin-bottom:var(--hp-sp-12)"] {
    margin-bottom: var(--hp-sp-6) !important;
  }

  /* ── Portfolio / About CTA split: collapse 1fr 1fr → single column ──
     The inline grid-template-columns:minmax(0,1fr) minmax(0,1fr) can't be overridden without
     !important on a class selector. hp-cta-split is added in page-portfolio.php
     and any other template using the same pattern. */
  .hp-cta-split {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: var(--hp-sp-8) !important;
  }

  /* ── WooCommerce checkout: first/last name row → stacked ──
     hp-shop.css keeps .form-row-first/.form-row-last as inline-block at 50%
     with no mobile override. At 390 px that's ~175 px per input — too cramped.
     Stack to full-width here at ≤640 px. */
  .woocommerce-checkout .col2-set .form-row-first,
  .woocommerce-checkout .col2-set .form-row-last {
    display: block !important;
    width: 100% !important;
  }

  /* ── WooCommerce My Account: sidebar nav stacks vertically ── */
  .woocommerce-MyAccount-navigation ul {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--hp-border);
    border-radius: var(--hp-r-md);
    overflow: hidden;
    margin-bottom: var(--hp-sp-6);
  }
  .woocommerce-MyAccount-navigation ul li {
    border-bottom: 1px solid var(--hp-border);
    display: block !important;
  }
  .woocommerce-MyAccount-navigation ul li:last-child { border-bottom: none; }
  .woocommerce-MyAccount-navigation ul li a {
    display: block;
    padding: var(--hp-sp-3) var(--hp-sp-4);
  }

  /* ── Hero typography: scale down for compact 52vh banners ──
     Desktop hero (100svh) has plenty of room for the full type scale.
     Interior heroes at 52vh (≈330px on a 390px screen) need a tighter
     stack so the eyebrow / title / tagline / CTA all fit above the fold.
     Spacing reductions match hp-section tightening above. */
  /* Consistent lift across all hero pages — clears MY LINKS on home (100svh)
     and standardises the content position on interior heroes (70vh). */
  .hp-hero__inner {
    padding-bottom: var(--hp-sp-12);   /* 3rem — was 4rem from the 768px rule */
    transform: translateY(-8rem);
  }
  .hp-hero__eyebrow {
    margin-bottom: var(--hp-sp-2);     /* 0.5rem — was 1rem */
  }
  .hp-hero__title {
    /* Single smooth clamp: tapers 48px (≥640px) → 32px (≤360px) with no
       boundary step. Replaces the old two-tier 640/480 clamps that shared
       9vw but had different ceilings and jumped ~0.5rem at the 480px line. */
    font-size: clamp(2rem, 8vw, 3rem);
    margin-bottom: var(--hp-sp-2);          /* 0.5rem — was 1rem */
  }
  .hp-hero__tagline {
    font-size: var(--hp-text-xl);      /* 1.25rem — was 1.5rem */
    margin-bottom: var(--hp-sp-6);
  }
}

/* ==========================================================================
   ≤ 600px — Header sticky breakpoint
   GP's JS may add inline padding-top to body for the fixed header; once the
   header is position:sticky (hp-base.css line 767) that offset is dead weight
   and creates a cream strip between the sticky bar and hero sections.
   ========================================================================== */

@media (max-width: 600px) {
  body.hp {
    padding-top: 0 !important;
  }

  /* ── Inner-page header: remove dead-weight margin-top ──
     hp-base.css sets .hp-page-header { margin-top: var(--hp-header-h) } (72 px)
     to clear a FIXED header. At ≤600 px the header becomes position:sticky
     (hp-base.css), so the offset is unnecessary dead space. */
  .hp-page-header {
    margin-top: 0;
  }

}

/* ==========================================================================
   ≤ 768px — GP inline-mobile-toggle header fix
   GeneratePress forces #site-navigation to flex-basis:100% at ≤768px so it
   wraps onto its own row inside the header flex container. With a fixed/sticky
   header height of 72px and two rows, align-content:stretch gives each row
   ~36px — the collapsed (empty) nav row appears as a dark band below the
   branding because the header background is transparent. Hiding the nav
   element when not toggled collapses that second flex row to zero height.
   When the hamburger is tapped GP adds .toggled → the :not() stops applying
   → the dropdown opens normally.
   ========================================================================== */
@media (max-width: 768px) {
  .hp #site-navigation:not(.toggled) {
    display: none !important;
  }
}

/* ==========================================================================
   ≤ 480px — Small phones
   ========================================================================== */

@media (max-width: 480px) {

  /* ── Merch + WooCommerce product grid → single column ──
     At 540 px both grids stay 2-column (hp-components.css + hp-shop.css).
     On very small phones (≤ 480 px) collapse to 1-column for comfortable
     card sizing. */
  .hp-merch-grid,
  .woocommerce ul.products {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* ── Subscription tier cards: full width ── */
  .hp-tier-card {
    width: 100% !important;
    max-width: 360px !important;
  }

  /* ── Hero tagline: drop to body-size on small phones ──
     The title already tapers smoothly via the single clamp in the 640px
     block (clamp(2rem,8vw,3rem)), so it needs no further override here;
     only the tagline steps down to keep the CTA visible in a ~270px hero. */
  .hp-hero__tagline {
    font-size: var(--hp-text-base);    /* 1rem — was 1.25rem at 640px */
  }

  /* ── Schedule calendar: abbreviate day headers at small screens ── */
  .hp-calendar__day-header {
    font-size: 0.6rem;
    padding: var(--hp-sp-1) 0;
  }
  .hp-calendar__cell {
    min-height: 36px;
    font-size: 0.65rem;
  }

  /* ── Schedule calendar scroll container ──
     7 columns at 390 px = ~51 px per col — cells too tight to tap accurately.
     Wrap the calendar in .hp-calendar-scroll (added in page-schedule.php) and
     let it scroll horizontally; the grid holds a comfortable minimum width. */
  .hp-calendar-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .hp-calendar-scroll::-webkit-scrollbar { display: none; }
  .hp-calendar {
    min-width: 380px;
  }
}

/* ==========================================================================
   ≤ 380px — Very small phones (iPhone SE 1st gen, Android budget devices)
   ========================================================================== */

@media (max-width: 380px) {

  /* ── Best-sellers inline grids: force 1-col to prevent overflow ──
     page-best-sellers.php uses inline minmax(320px,1fr) grids. At viewports
     narrower than ~352px (320 px min + 2×16 px content-pad) the grid can't fit
     even one column at its minimum, producing horizontal overflow. Force 1fr. */
  .hp-section .hp-container > div[style*="minmax(320px"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

}

/* ==========================================================================
   Global overrides (all viewports)
   Loaded after hp-base / hp-components / hp-shop / hp-vault — wins by
   source order on equal-specificity rules.
   ========================================================================== */

/* ── Platform links: suppress iOS tap highlight + kill inherited stroke ──
   iOS Safari renders a semi-transparent blue highlight on <a> tap; setting to
   transparent removes it. stroke: none kills any blue stroke from stroke-based
   SVG icons that inherit stroke="currentColor" from the anchor element. */
.hp-platform-link {
  -webkit-tap-highlight-color: transparent;
}
.hp-platform-link svg {
  stroke: none;
}

/* ── Legal page titles: body-weight heading instead of display serif ──
   page-legal.php renders all five legal pages (Privacy Policy, Terms of
   Service, Returns, Shipping, 18 USC 2257). h1.hp-legal-page-header__title
   inherits the display serif by default; a body-weight heading reads better
   for legal prose. */
.hp-legal-page-header__title {
  font-family: var(--hp-font-body);
  font-weight: 500;
  letter-spacing: 0;
}

/* ── Brand icons in platform bar: full text color, gold on hover ──
   hp-components.css sets fill:var(--hp-text-muted) on .hp-platform-link svg
   (specificity 0,1,1). Brand icons carry class .hp-icon--brand; targeting
   .hp-platform-link .hp-icon--brand wins at specificity 0,2,0, restoring
   recognisable marks to full text contrast. */
.hp-platform-link .hp-icon--brand {
  fill: var(--hp-text);
}
.hp-platform-link:hover .hp-icon--brand {
  fill: var(--hp-gold);
}

/* ==========================================================================
   Reduced motion — WCAG 2.3.3
   Suppress or replace all animations / transitions for users who prefer it.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

  /* Kill all transitions and animations globally */
  *, *::before, *::after {
    animation-duration:        0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration:       0.01ms !important;
    scroll-behavior:           auto  !important;
  }

  /* Named animations that must be fully suppressed */
  .hp-badge--live::before {
    animation: none !important;   /* live-badge pulse */
  }
  .hp-btn--loading::after {
    animation: none !important;   /* loading spinner rotation */
  }
  .hp-toast__progress {
    animation: none !important;   /* toast auto-dismiss bar */
    width: 0 !important;          /* collapsed so the bar is invisible */
  }
  html {
    scroll-behavior: auto !important;
  }
}
