/* style.css — PAGE/MISC LAYER (responsive, themes, a11y, media strip). See base.css/components.css for base+components. */
/* ===== RESPONSIVE ===== */
/* Breakpoint aligned to JS: nav.js matchMedia('(max-width: 768px)') — CSS must agree or the drawer is unreachable at exactly 768px */
@media (max-width: 768px) {
    .nav-menu {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: auto;
        /* Fixed grid items size to their grid area (measured 186px at 320px) — force full-bleed instead.
           left/right (not width:100vw, which includes the scrollbar on Android and clips on iOS). */
        left: 0;
        right: 0;
        width: auto;
        max-width: none;
        justify-self: stretch;
        /* Height tracks visualViewport (--app-height, set by nav.js) so the iOS keyboard/URL bar
           resize cannot clip drawer items; vh first for Safari <15.4 (no dvh). */
        height: 100vh;
        height: 100dvh;
        height: var(--app-height, 100vh); /* JS sets px; vh (not dvh) fallback so Safari <15.4 keeps a height */
        bottom: auto;
        background: var(--bg-secondary);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.25rem;
        /* Drawer must scroll: Guides submenu is 20+ items and overflowed a 568px viewport, clipping top items.
           Side insets: on notched phones in landscape the fixed drawer would clip under the notch/Dynamic Island. */
        padding: calc(64px + 1rem + env(safe-area-inset-top, 0px)) calc(1.5rem + env(safe-area-inset-right, 0px)) calc(2rem + env(safe-area-inset-bottom, 0px)) calc(1.5rem + env(safe-area-inset-left, 0px));
        overflow-y: auto;
        overflow-x: hidden;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        z-index: 999;
    }
    .nav-menu.open {
        display: flex;
    }
    .nav-menu .nav-item {
        width: 100%;
        text-align: center;
    }
    .nav-menu .nav-link {
        font-size: var(--text-lg);
        padding: 0.75rem 1rem;
        min-height: 44px;
        justify-content: center;
    }
    /* Mobile accordion trigger (button) mirrors .nav-link sizing — it had no base style (37x19px measured) */
    .nav-menu .submenu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        width: 100%;
        min-height: 44px;
        padding: 0.75rem 1rem;
        font-size: var(--text-lg);
        font-family: var(--font-body);
        background: transparent;
        border: none;
        color: var(--text-nav);
        cursor: pointer;
    }
    .nav-menu .submenu-toggle[aria-expanded="true"] .chevron {
        transform: rotate(180deg);
    }
    .nav-menu .submenu-toggle .chevron {
        width: 10px;
        height: 10px;
    }
    /* Duplicate News/Guides link (aria-hidden focusable) — hide on mobile where the toggle replaces it */
    .nav-item:has(> .submenu-toggle) > .nav-link,
    .nav-item > .submenu-toggle + .nav-link { /* sibling fallback: works without :has() (FF<121/Safari<15.4) */
        display: none;
    }
    /* Dropdowns are accordion-gated on .is-open (JS toggles it + aria-expanded).
       Previously forced visible, so the 20-item Guides panel always expanded and overflowed the drawer. */
    .nav-menu .dropdown {
        position: static;
        transform: none;
        opacity: 0;
        visibility: hidden;
        display: none;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 0.5rem 0;
        min-width: auto;
    }
    .nav-menu .nav-item .dropdown:not(.is-open) {
        display: none;
        opacity: 0;
        visibility: hidden;
    }
    .nav-menu .dropdown.is-open {
        display: block;
        opacity: 1;
        visibility: visible;
    }
    .nav-menu .dropdown-inner {
        grid-template-columns: 1fr;
        max-width: none;
    }
    .nav-menu .dropdown-item {
        min-height: 44px;
    }
    .nav-menu .dropdown-item-desc {
        white-space: normal;
    }
    .nav-toggle {
        display: flex;
        z-index: 1001;
        min-width: 44px;
        min-height: 44px;
        align-items: center;
        justify-content: center;
    }
    .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    .nav-right {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    /* Mobile nav: logo / toggle / theme share one row — auto columns so the
       logo is not crushed to ~0px and the theme toggle does not overflow 320px */
    .nav-container {
        grid-template-columns: auto 1fr auto;
        gap: 0.5rem;
        /* Notched phones (viewport-fit=cover): header must clear the status
           bar / landscape notch instead of sitting underneath it. */
        height: calc(64px + env(safe-area-inset-top, 0px));
        padding: env(safe-area-inset-top, 0px) calc(0.75rem + env(safe-area-inset-right, 0px)) 0 calc(0.75rem + env(safe-area-inset-left, 0px));
    }
    /* Touch: manipulation removes the double-tap-zoom delay / gestural
       wait on every drawer control (click follows tap with no 300ms lag
       on modern browsers, but touch-action:auto still allows zoom gestures
       to swallow the first tap on iOS Safari). */
    .nav-toggle, .nav-menu .submenu-toggle, .nav-menu .nav-link, .nav-menu .dropdown-item {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
    .nav-toggle {
        grid-column: 2;
        justify-self: center;
    }
    .nav-menu {
        grid-column: 1 / -1;
    }

    /* Logo smaller on very small screens */
    .nav-logo {
        font-size: 1.125rem;
        gap: 0.4rem;
        min-width: 0;
    }
    .nav-logo .logo-icon {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Extra small mobile: 320px - 374px */
@media (max-width: 374px) {
    /* 320px bar budget: logo text (~90px) + toggle (44) + mode/theme (~230) cannot fit one row.
       Icon-only logo: the link keeps aria-label="Daily Leonida Home" for AT; the mark stays visible. */
    .nav-logo {
        font-size: 0;
        gap: 0;
        width: 28px;
        flex-shrink: 0;
    }
    .nav-logo .logo-icon {
        width: 1.75rem;
        height: 1.75rem;
    }
    .mode-toggle {
        min-height: 44px;
        padding: 0.4rem 0.5rem;
        font-size: 0.6875rem;
    }
    .nav-right {
        gap: 0.25rem;
    }
}

/* Small mobile: 375px - 389px */
@media (min-width: 375px) and (max-width: 389px) {
}

/* iPhone 12/13/14: 390px - 429px */
@media (min-width: 390px) and (max-width: 429px) {
}

/* Larger mobile: 430px - 767px */
@media (min-width: 430px) and (max-width: 768px) {
    .nav-logo {
        font-size: 1.125rem;
    }
}

@media (min-width: 769px) {
    .nav-toggle { display: none; }
    .nav-menu {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        gap: 0;
        padding: 0;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        box-shadow: none;
        overflow: visible;
        transform: none;
        opacity: 1;
        visibility: visible;
    }
    .nav-menu .nav-item {
        width: auto;
        text-align: left;
        border-bottom: none;
    }
    .nav-menu .nav-link {
        font-size: 1rem;
        padding: 0.5rem 1.25rem;
        min-height: 44px;
        justify-content: flex-start;
    }
    .nav-menu .submenu-toggle {
        display: none;
    }
    .nav-right {
        margin-left: auto;
    }
    .nav-container {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .nav-menu {
        grid-column: 2;
    }
    .nav-toggle {
        grid-column: auto;
        justify-self: auto;
    }
}

/* ===== SR ONLY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border-width: 0;
}


/* ===== THEME SWITCHING ===== */
/* Theme 1: Rockstar Classic (Default) - Official Rockstar aesthetic */

/* Theme-specific body backgrounds */
body {
    transition: background-color var(--duration-slow) var(--ease-out-quart), color var(--duration-slow) var(--ease-out-quart);
}

/* Rockstar theme: pure black, gold accents, cinematic */
html.theme-rockstar body::before {
    background: 
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(255, 171, 0, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 80%, rgba(255, 212, 168, 0.03) 0%, transparent 60%);
}


/* ===== ACCESSIBILITY (WCAG 2.2 AA) ===== */
*:focus-visible {
    scroll-margin-top: 96px;
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

.icon-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-grid;
    place-items: center;
    padding: 10px;
}

p a {
    padding-block: 0.25em;
}

/* ===== VIEW TRANSITIONS API ===== */
@view-transition {
    navigation: auto;
}

/* ===== HOVER GATING ===== */
@media (hover: hover) and (pointer: fine) {
    .card {
        transition: transform 200ms ease-out, box-shadow 200ms ease-out;
    }
    .card:hover {
        transform: translateY(-4px);
    }
}

/* ===== CONTENT VISIBILITY ===== */
.below-the-fold {
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
}

/* ===== REDUCED MOTION (SEMANTIC) ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
        scroll-behavior: auto;
    }
    .card { transform: none; }
}

/* ===== FEATURED IMAGES ===== */
.featured-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    transition: transform var(--duration-slower) var(--ease-out-expo);
}

.featured-image:hover {
    transform: scale(1.02);
}

.mb-6 {
    margin-bottom: 1.5rem;
}

/* ===== UTILITY CLASSES ===== */
.my-4 {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

/* ===== MEDIA STRIP (Rockstar-style horizontal scroller) ===== */
.media-strip-section {
    padding: 4rem 0;
    overflow: hidden;
}

.media-strip-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-tertiary);
    -webkit-overflow-scrolling: touch;
    padding: 0 2rem 1rem;
}

.media-strip-wrapper::-webkit-scrollbar {
    height: 6px;
}

.media-strip-wrapper::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.media-strip-wrapper::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

.media-strip {
    display: flex;
    gap: 1rem;
    width: max-content;
}

.media-strip-item {
    position: relative;
    flex-shrink: 0;
    width: 320px;
    height: 180px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--duration-normal) var(--ease-out-expo);
}

.media-strip-item:hover {
    transform: scale(1.03);
}

.media-strip-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slower) var(--ease-out-expo);
}

.media-strip-item:hover img {
    transform: scale(1.08);
}

.media-strip-item span {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    background: linear-gradient(180deg, transparent, rgba(0,0,0,0.8));
    color: var(--text-on-image);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

@media (max-width: 768px) {
    .media-strip-item {
        width: 260px;
        height: 146px;
    }
}

/* ===== RESPONSIVE TYPOGRAPHY ===== */
@media (max-width: 640px) {
    :root {
        --text-fluid-display: clamp(2.25rem, 6vw + 1rem, 4rem);
        --text-fluid-3xl: clamp(1.75rem, 5vw + 0.5rem, 3rem);
        --text-fluid-2xl: clamp(1.5rem, 4vw + 0.5rem, 2.25rem);
    }
    h1, h2, h3 { text-wrap: balance; }
    p { max-width: 100%; }
}

@media (min-width: 1440px) {
    :root {
        --text-fluid-display: clamp(4.5rem, 4vw + 2rem, 8rem);
    }
}

/* Print typography */
@media print {
    body { font-family: Georgia, 'Times New Roman', serif; color: #000; background: #fff; }
    h1, h2, h3, h4, h5, h6 { font-family: Georgia, serif; color: #000; }
    a { color: #000; text-decoration: underline; }
}

/* ===== TYPOGRAPHY NORMALIZATION (Major Third 1.25) ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    text-align: center;
}
body, p {
    font-family: var(--font-body);
    text-align: left;
}
nav, .nav-container, .nav-menu, .nav-item, .nav-link, .nav-logo {
    text-align: center;
}
.eyebrow, .label, .badge, .stat-value {
    font-family: var(--font-accent);
}

/* Shared footer centering (overrides typography normalization) */
footer { margin-top: auto; }
footer, footer p, .footer-bottom, .footer-grid, .footer-brand, .footer-desc, .footer-column h4 { text-align: center; }
.footer-grid { justify-items: center; justify-content: center; }
.footer-social { justify-content: center; display: flex; gap: 0.75rem; }
.footer-links { align-items: center; justify-content: center; text-align: center; }
.footer-bottom { justify-content: center; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }

/* ===== A11Y QA ADDITIONS (WCAG 2.2) ===== */
/* Focus ring must survive inside the scrolling drawer: inset offset keeps the 3px ring unclipped by overflow */
@media (max-width: 768px) {
    .nav-menu :focus-visible {
        outline-offset: -3px;
    }
    .nav-toggle:focus-visible {
        outline: 3px solid var(--focus-ring);
        outline-offset: 2px;
    }
}
/* 4K / ultrawide: cap the centered desktop nav instead of stretching logo-to-theme across 3840px */
@media (min-width: 2560px) {
    .nav-container {
        max-width: 2400px;
    }
}

/* Mobile perf: backdrop-filter blur(24px) over scrolling content janks on iOS/Android GPUs.
   Nav/drawer sit on solid black, so a cheaper blur (or none under reduced-motion) is invisible. */
@media (pointer: coarse) {
    nav.scrolled { -webkit-backdrop-filter: blur(12px) saturate(140%); }
}
@media (prefers-reduced-motion: reduce) {
    nav.scrolled { -webkit-backdrop-filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ===== MOBILE TOUCH TARGETS + NAV LOGO (audit 2026-11-10) =====
   Project rule: every tappable control is at least 48px high (WCAG 2.5.5 is 44px; we go higher).
   Inline <a> elements ignore min-height, so the link groups below are made inline-flex. */
@media (max-width: 1024px), (pointer: coarse) {
    .nav-toggle, .mode-toggle { min-width: 48px; min-height: 48px; }
    .mode-toggle,
    .btn,
    .age-gate__btn { min-height: 48px; }
    .footer-column li a,
    .footer-links a,
    .featured-link,
    .guide-card-link {
        display: inline-flex;
        align-items: center;
        min-width: 48px;
        min-height: 48px;
    }
    .footer-desc { font-size: 1rem; } /* body-copy floor */
    .social-link { min-width: 48px; min-height: 48px; }
}

/* Nav at <=480px: the wordmark can't fit beside the theme toggle and hamburger. It was being
   clipped to "Dai..."; it now collapses to its icon. The link keeps aria-label="Daily Leonida Home". */
@media (max-width: 480px) {
    .nav-logo { font-size: 0; gap: 0; min-width: 48px; min-height: 48px; justify-content: center; flex-shrink: 0; }
    .nav-logo .logo-icon { width: 1.75rem; height: 1.75rem; }
}

/* Byline: the editorial desk is a real, accountable identity and links to the
   standards page that says who writes and corrects the site. */
.byline a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.byline a:hover { opacity: 0.8; }
