/* ═══════════════════════════════════════════════════════════════════════════
   AUREUS CLASSIC — SHARED MOBILE LAYER

   Why this file exists: every landing page used to re-implement its own phone
   rules inside its inline <style> block. index.html was the only page that got
   them, so faq.html / trial.html / checkout.html stayed desktop-width, and the
   duplicate `.nav-links` markup drifted apart page by page.

   This file owns exactly two things, for every landing page:
     1. the mobile navigation (toggle button + slide-down sheet)
     2. the shared page furniture at phone widths (container padding, tap
        targets, unbreakable-content guards)

   It is linked LAST, immediately before </head>, so on equal specificity it
   wins against each page's own <style> block. Page-specific phone rules still
   belong in that page's own style block — not here.

   Grid rules here deliberately use class selectors identical to the pages'
   base rules (e.g. `.plan-options`), because an INLINE `style="grid-..."`
   cannot be overridden by any stylesheet. Pages must not carry inline grid
   templates; `scripts/check_mobile.py` fails the build if one reappears.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Desktop: the toggle does not exist. Base rule, no media query, so it cannot
   be defeated by a later page rule of the same specificity. */
.nav-toggle {
    display: none;
}

@media (max-width: 820px) {

    /* ── 1. NAVIGATION ─────────────────────────────────────────────────── */

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        min-width: 44px;
        padding: 0;
        margin-left: 0.75rem;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(212, 175, 55, 0.35);
        border-radius: 10px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .nav-toggle:focus-visible {
        outline: 2px solid var(--gold-primary, #d4af37);
        outline-offset: 2px;
    }

    .nav-toggle-bars,
    .nav-toggle-bars::before,
    .nav-toggle-bars::after {
        display: block;
        width: 18px;
        height: 2px;
        border-radius: 2px;
        background: var(--gold-primary, #d4af37);
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .nav-toggle-bars {
        position: relative;
    }

    .nav-toggle-bars::before,
    .nav-toggle-bars::after {
        content: "";
        position: absolute;
        left: 0;
    }

    .nav-toggle-bars::before { top: -6px; }
    .nav-toggle-bars::after  { top: 6px; }

    body.nav-open .nav-toggle-bars { background: transparent; }
    body.nav-open .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
    body.nav-open .nav-toggle-bars::after  { transform: translateY(-6px) rotate(-45deg); }

    /* The sheet. `position: absolute` under a fixed/sticky header anchors it
       to the header's own box, so `top: 100%` is always exactly below it. */
    #primary-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 0.35rem 1rem 0.75rem;
        background: rgba(6, 8, 13, 0.98);
        border-bottom: 1px solid rgba(212, 175, 55, 0.28);
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
        max-height: 72vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.nav-open #primary-nav {
        display: flex;
    }

    /* Every item is a full-width 44px tap target, whatever markup the page
       used (a div of <a>, a <ul> of <li><a>, or a mix of links and buttons). */
    #primary-nav > a,
    #primary-nav > li,
    #primary-nav > li > a,
    #primary-nav .nav-link,
    #primary-nav .btn-primary,
    #primary-nav .btn-secondary,
    #primary-nav .btn-telegram-nav {
        display: block;
        width: 100%;
        min-height: 44px;
        margin: 0;
        padding: 0.8rem 0.25rem;
        font-size: 0.95rem;
        text-align: left;
        border-radius: 0;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
        background: none;
        color: var(--text-main, #f0f4f8);
        text-decoration: none;
        white-space: normal;
    }

    #primary-nav > li {
        padding: 0;
        border-bottom: none;
    }

    #primary-nav .btn-primary {
        color: var(--gold-primary, #d4af37);
        font-weight: 800;
        border-bottom: none;
    }

    /* ── 2. SHARED FURNITURE ───────────────────────────────────────────── */

    /* Never let a literal-width element push the layout wider than the screen.
       (Height is left alone so logos keep their aspect.) */
    img,
    video {
        max-width: 100%;
    }

    h1, h2, h3, h4, p, a, span, li, td, th {
        overflow-wrap: break-word;
    }

    /* Tables are the classic phone-width offender. */
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    /* Grid items default to `min-width: auto`, so a <select> sized by its
       longest <option> can force a track wider than the screen even though
       every element appears to fit. On checkout that pushed the page to 462px
       at a 390px viewport. Scoped to this breakpoint so desktop form layout is
       untouched. */
    .checkout-grid > * {
        min-width: 0;
    }

    select {
        width: 100%;
        max-width: 100%;
    }

    /* Crypto network buttons are a nowrap flex row; at 390px the last one sat
       51px past the right edge with no way to scroll to it. */
    .crypto-networks {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {

    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Stack the primary call-to-action pair on every page. */
    .hero-ctas {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .hero-ctas > a {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    /* Checkout: the payment-tier selector. Base rule is 3 columns, an inline
       style used to force 5 (which no stylesheet could beat). */
    .plan-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .checkout-card {
        padding: 1.25rem;
    }

    .navbar {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Trial navbar carries a status pill that no longer fits next to the
       toggle; the trial banner directly below the fold already states it. */
    .navbar .status-pill {
        display: none;
    }
}

@media (max-width: 420px) {
    .plan-options {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 821px) {
    /* If the viewport grows while the sheet is open, the JS closes it, but make
       the closed state authoritative so a stuck body class can never hide the
       desktop navigation. */
    #primary-nav {
        display: flex;
    }
}
