/* ============================================================
   Veteran Benefits Directory — Design System v2
   Style: Accessible & Ethical | WCAG AAA
   Fonts: Lexend (headings) + Source Sans 3 (body)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700&family=Source+Sans+3:wght@300;400;500;600;700&display=swap');

/* ===== DESIGN TOKENS ===== */
:root {
    --color-primary:      #0F172A;   /* Deep navy */
    --color-primary-mid:  #1E293B;   /* Mid navy (secondary nav bg) */
    --color-accent:       #0369A1;   /* Accessible blue */
    --color-accent-hover: #0284C7;   /* Lighter blue for hover */
    --color-patriot:      #DC2626;   /* Patriotic red — subtle only */
    --color-gold:         #D97706;   /* Amber gold — stars only */
    --color-bg:           #F8FAFC;
    --color-card:         #FFFFFF;
    --color-text:         #020617;
    --color-text-light:   #64748B;
    --color-border:       #E2E8F0;
    --color-muted:        #E8ECF1;

    --font-heading: 'Lexend', system-ui, sans-serif;
    --font-body:    'Source Sans 3', system-ui, sans-serif;

    --radius-sm:   6px;
    --radius-md:   12px;
    --radius-lg:   20px;
    --radius-pill: 9999px;

    --shadow-card:  0 2px 8px rgba(0, 0, 0, 0.07);
    --shadow-hover: 0 8px 24px rgba(3, 105, 161, 0.15);

    --transition: 150ms ease-out;
}

/* ===== DARK MODE ===== */
[data-theme="dark"] {
    --color-primary:      #0F172A;
    --color-primary-mid:  #1E293B;
    --color-accent:       #38BDF8;
    --color-accent-hover: #7DD3FC;
    --color-bg:           #0F172A;
    --color-card:         #1E293B;
    --color-text:         #F1F5F9;
    --color-text-light:   #94A3B8;
    --color-border:       #334155;
    --color-muted:        #1E293B;
    --shadow-card:        0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-hover:       0 8px 24px rgba(56, 189, 248, 0.15);
}

[data-theme="dark"] body {
    background: var(--color-bg);
    color: var(--color-text);
}

[data-theme="dark"] .card-front,
[data-theme="dark"] .card-back,
[data-theme="dark"] .benefit-card {
    background: var(--color-card);
    border-color: var(--color-border);
}

[data-theme="dark"] .breadcrumb {
    color: var(--color-text-light);
}

[data-theme="dark"] .footer {
    background: #020617;
}

[data-theme="dark"] .home-hero {
    background: linear-gradient(135deg, #020617 0%, #0F172A 100%);
}

[data-theme="dark"] .category-hero {
    background: var(--color-card);
    color: var(--color-text);
}

[data-theme="dark"] .subcategory-btn {
    background: var(--color-card);
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] .subcategory-btn.active {
    background: var(--color-accent);
    color: #0F172A;
    border-color: var(--color-accent);
}

[data-theme="dark"] .sort-select {
    background: var(--color-card);
    color: var(--color-text);
    border-color: var(--color-border);
}

[data-theme="dark"] .tips-section {
    background: var(--color-card);
    border-color: var(--color-border);
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--color-card) !important;
    color: var(--color-text) !important;
    border-color: var(--color-border) !important;
}

/* ===== DARK MODE TOGGLE BUTTON (fixed floating) ===== */
.dark-mode-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary-mid);
    border: 2px solid var(--color-border);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--transition), box-shadow var(--transition);
}

.dark-mode-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* ===== RESET ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== ACCESSIBILITY: SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-accent);
    color: white;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    border-radius: var(--radius-sm);
    z-index: 9999;
    transition: top var(--transition);
}
.skip-link:focus {
    top: 1rem;
}

/* ===== ACCESSIBILITY: FOCUS RINGS ===== */
:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===== ACCESSIBILITY: REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ===== BASE ===== */
body {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.6;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* ===== HEADER & NAV ===== */
.header {
    background: var(--color-primary);
    color: white;
    padding: 1rem 1rem 0;
    padding-top: env(safe-area-inset-top);
    text-align: center;
    border-bottom: 3px solid var(--color-patriot);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
    color: white;
}
.header h1 span { color: #F97316; }
[data-theme="dark"] .header h1 span { color: #FB923C; }

.nav-links {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    flex-wrap: wrap;
    padding-bottom: 0;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: background var(--transition), color var(--transition);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.nav-links a.active {
    background: var(--color-accent);
    color: white;
}

/* Secondary nav row (About / FAQ / Contact) */
.nav-secondary {
    background: var(--color-primary-mid);
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    padding: 0 1rem;
    flex-wrap: wrap;
    margin: 0 -1rem;
}

.nav-secondary a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: color var(--transition);
}

.nav-secondary a:hover {
    color: white;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    max-width: 1400px;
    margin: 1.25rem auto 0;
    padding: 0 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
    font-family: var(--font-body);
}

.breadcrumb a {
    color: var(--color-accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.container--narrow {
    max-width: 1000px;
}

/* ===== CATEGORY HERO ===== */
.category-hero {
    background: var(--color-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.category-hero h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.category-hero p {
    font-size: 1.1rem;
    color: var(--color-text-light);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ===== AUTH GATE — blur overlay for non-logged-in users on category pages ===== */
.benefits-gate-area {
    position: relative;
}
.benefits-gate-area.gated .benefits-grid {
    filter: blur(6px);
    max-height: 640px;
    overflow: hidden;
    pointer-events: none;
    user-select: none;
}
.benefits-gate-area.gated::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 340px;
    background: linear-gradient(to bottom, transparent 0%, var(--color-bg) 70%);
    pointer-events: none;
    z-index: 1;
}
.auth-gate-overlay {
    display: none;
    position: absolute;
    bottom: 0; left: 0; right: 0;
    z-index: 2;
    justify-content: center;
    padding: 0 1rem 2rem;
}
.benefits-gate-area.gated .auth-gate-overlay {
    display: flex;
}
.auth-gate-card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    max-width: 480px;
    width: 100%;
}
.auth-gate-lock { font-size: 2.25rem; margin-bottom: 0.75rem; }
.auth-gate-card h3 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.65rem;
}
.auth-gate-card p {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.6;
    margin-bottom: 1.4rem;
}
.auth-gate-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}
.auth-gate-actions .gate-btn-primary {
    background: var(--color-accent);
    color: #fff;
    border: 2px solid var(--color-accent);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    transition: opacity 0.15s;
}
.auth-gate-actions .gate-btn-primary:hover { opacity: 0.88; }
.auth-gate-actions .gate-btn-outline {
    background: transparent;
    color: var(--color-accent);
    border: 2px solid var(--color-accent);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.15s;
}
.auth-gate-actions .gate-btn-outline:hover { background: var(--color-bg); }
@media (max-width: 480px) {
    .auth-gate-card { padding: 1.5rem 1rem; }
    .auth-gate-actions { flex-direction: column; }
    .auth-gate-actions .gate-btn-primary,
    .auth-gate-actions .gate-btn-outline { text-align: center; }
}

/* ===== EDITORIAL INTRO — SEO content blocks on category pages ===== */
.editorial-intro {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.75rem 2.25rem;
    margin-bottom: 1.5rem;
}
.editorial-intro h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 1.25rem 0 0.4rem;
}
.editorial-intro h3:first-child { margin-top: 0; }
.editorial-intro p {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.75;
    margin-bottom: 0.65rem;
}
.editorial-intro p:last-child { margin-bottom: 0; }
.editorial-intro a { color: var(--color-accent); text-decoration: none; }
.editorial-intro a:hover { text-decoration: underline; }
@media (max-width: 600px) {
    .editorial-intro { padding: 1.25rem 1rem; }
}

/* ===== SUBCATEGORY FILTER PILLS ===== */
.subcategory-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: var(--color-card);
    padding: 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.subcategory-btn {
    padding: 0.5rem 1.1rem;
    background: var(--color-muted);
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: all var(--transition);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.subcategory-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-card);
}

.subcategory-btn.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* ===== SORT CONTROLS ===== */
.sort-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.result-count {
    font-family: var(--font-body);
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
}

.sort-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-card);
    font-family: var(--font-body);
    font-size: 0.95rem;
    cursor: pointer;
    color: var(--color-text);
    min-height: 44px;
}

.sort-select:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* ===== BENEFITS GRID ===== */
.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== AD SLOT ===== */
/* Sibling of .benefits-grid — never a child. renderFlatBatch() wipes grid.innerHTML
   on every filter/sort; slots inside the grid would be destroyed. Placement: after
   <div id="benefitsGrid"> in the DOM. See ads.js and RESEARCH.md Pitfall 1. */
.ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100px;   /* reserve space to prevent layout shift before AdSense fills */
    margin: 1rem 0 2rem; /* matches the grid's vertical rhythm */
    position: relative;
}

/* Muted "Advertisement" label above the slot so users know what they are seeing */
.ad-slot::before {
    content: "Advertisement";
    position: absolute;
    top: -1.2rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    font-family: var(--font-body, sans-serif);
    color: var(--color-text-light);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    pointer-events: none;
}

/* FTC affiliate disclosure banner — placed above affiliate links on pages with
   affiliate content. Always visible; never hidden or toggled (FTC Pitfall 5).
   Source: RESEARCH.md Pattern 6 / ftc.gov endorsement guides. */
.affiliate-disclosure {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0 1rem;
    font-family: var(--font-body, sans-serif);
    font-size: 0.78rem;
    color: var(--color-text-light);
    background: transparent;
    border-left: 3px solid var(--color-border, #e2e8f0);
    border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
    line-height: 1.5;
}

/* ADS-04 / D-10: Sponsored card label — subtle, positioned top-right of card front.
   position:absolute works because .card-front is a positioned ancestor.
   Uses muted color to signal "paid placement" without disrupting card hierarchy. */
.sponsored-label {
    position: absolute;
    top: 0.4rem;
    right: 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-text-light);
    opacity: 0.75;
    pointer-events: none; /* does not interfere with card flip click */
    z-index: 1;
}

/* ===== FLIP CARDS ===== */
.benefit-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
    perspective: 1000px;
    height: 300px;
}

.benefit-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

/* Keyboard focus ring — paired with tabindex=0 + role=button on the card.
   :focus-visible only triggers for keyboard nav, not mouse-click focus, so
   it doesn't pollute the click experience. WCAG 2.4.7 compliance. */
.benefit-card:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 3px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.benefit-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.card-front {
    background: var(--color-card);
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid var(--color-border);
}

/* Card back: navy → accent blue gradient (replaces old navy → red) */
.card-back {
    background: linear-gradient(145deg, var(--color-primary) 0%, #0F4C81 100%);
    color: white;
    transform: rotateY(180deg);
    overflow-y: auto;
}

/* ===== CARD CONTENT ===== */
.company-icon {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
}

.company-logo {
    width: 80px;
    height: 80px;
    background: var(--color-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    border: 1px solid var(--color-border);
    overflow: hidden;
    padding: 6px;
}

.company-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.company-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.discount-badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    background: var(--color-accent);
    color: white;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 700;
    font-family: var(--font-body);
    margin-top: 0.5rem;
    letter-spacing: 0.02em;
}

/* FREE badge keeps patriotic red — it's special */
.discount-badge.free-badge {
    background: var(--color-patriot);
}

.discount-badge.no-discount-badge {
    background: var(--color-muted);
    color: var(--color-text-light);
    font-size: 0.8rem;
}

.subcategory-tag {
    font-size: 0.8rem;
    color: var(--color-text-light);
    margin-top: 0.5rem;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.benefit-summary {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    margin-bottom: 1rem;
}

.benefit-meta {
    font-family: var(--font-body);
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 1rem;
}

.benefit-link {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background: white;
    color: var(--color-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: auto;
    transition: background var(--transition), transform var(--transition);
}

.benefit-link:hover {
    background: var(--color-muted);
    transform: scale(1.03);
}

/* ===== PORTAL VERIFICATION SYSTEM ===== */

/* --- Portal badge pill (shown on card front) --- */
.portal-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    margin-top: 0.4rem;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}

/* Free portals (ID.me, SheerID): teal */
.portal-badge--free {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
    border: 1px solid rgba(13, 148, 136, 0.3);
}

/* Paid portals (WeSalute+, GovX+): amber */
.portal-badge--paid {
    background: rgba(217, 119, 6, 0.12);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, 0.3);
}

[data-theme="dark"] .portal-badge--free {
    background: rgba(13, 148, 136, 0.2);
    color: #2dd4bf;
    border-color: rgba(13, 148, 136, 0.4);
}

[data-theme="dark"] .portal-badge--paid {
    background: rgba(217, 119, 6, 0.2);
    color: #fbbf24;
    border-color: rgba(217, 119, 6, 0.4);
}

/* Portal-exclusive deals: violet — distinct from free (teal) and paid (amber) */
.portal-badge--exclusive {
    background: rgba(124, 58, 237, 0.1);
    color: #7c3aed;
    border: 1px solid rgba(124, 58, 237, 0.3);
    font-weight: 700;
    letter-spacing: 0.02em;
}

[data-theme="dark"] .portal-badge--exclusive {
    background: rgba(167, 139, 250, 0.15);
    color: #a78bfa;
    border-color: rgba(167, 139, 250, 0.35);
}

/* --- Portal card left-border colors ---
   Border applied to both .card-front and .card-back so it persists on flip.
*/

/* Free portals (ID.me, SheerID, GovX): teal */
.portal-card--free .card-front,
.portal-card--free .card-back,
.portal-card--freemium .card-front,
.portal-card--freemium .card-back {
    border-left: 4px solid #0d9488;
}

.portal-card--free .card-front,
.portal-card--freemium .card-front {
    background-color: rgba(13, 148, 136, 0.04);
}

/* Paid portals (WeSalute+): amber */
.portal-card--paid .card-front,
.portal-card--paid .card-back {
    border-left: 4px solid #d97706;
}

.portal-card--paid .card-front {
    background-color: rgba(217, 119, 6, 0.05);
}

[data-theme="dark"] .portal-card--free .card-front,
[data-theme="dark"] .portal-card--freemium .card-front {
    background-color: rgba(13, 148, 136, 0.09);
}

[data-theme="dark"] .portal-card--paid .card-front {
    background-color: rgba(217, 119, 6, 0.09);
}

/* --- Last verified date (shown on card back) --- */
.community-badge {
    display: inline-block;
    margin-top: 0.5rem;
    padding: 3px 10px;
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.last-verified {
    font-family: var(--font-body);
    font-size: 0.72rem;
    opacity: 0.55;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    letter-spacing: 0.01em;
}

/* --- Stale data warning badge (shown on card front when lastVerified > 180 days) ---
   Intentionally subtle — this is informational, not alarming.
   Amber colour matches the --color-gold token already used in the design system.
*/
.stale-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    /* Amber / warm-yellow — uses the existing gold token, falling back to hex */
    background: rgba(217, 119, 6, 0.10);   /* #D97706 at 10% opacity */
    color: #92400e;                         /* dark amber — readable on white */
    border: 1px solid rgba(217, 119, 6, 0.28);
    cursor: default;
    margin-top: 4px;
}

/* Dark mode: lighten the text and border so it stays readable on dark cards */
[data-theme="dark"] .stale-badge {
    background: rgba(251, 191, 36, 0.12);  /* amber-400 at 12% */
    color: #fbbf24;                         /* amber-400 — bright enough on dark bg */
    border-color: rgba(251, 191, 36, 0.30);
}

/* --- Portal filter row (second filter row on category pages) --- */
.portal-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 0 10px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 0.25rem;
}

/* Portal filter pill buttons — same shape as subcategory-btn but with color accents */
.portal-filter-btn {
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    border: 2px solid var(--color-border);
    background: var(--color-card);
    color: var(--color-text-light);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.portal-filter-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* "All" active state: accent blue border + light bg */
.portal-filter-btn.active {
    background: rgba(3, 105, 161, 0.1);
    border-color: var(--color-accent);
    color: var(--color-accent);
    font-weight: 700;
}

/* Free portals (ID.me, SheerID, GovX): teal border, matching card color */
.portal-filter-btn[data-portal="idme"].active,
.portal-filter-btn[data-portal="sheerid"].active,
.portal-filter-btn[data-portal="govx"].active {
    background: rgba(13, 148, 136, 0.12);
    border-color: #0d9488;
    border-width: 2px;
    color: #0d9488;
    font-weight: 700;
}

/* Paid portals (WeSalute+): amber border, matching card color */
.portal-filter-btn[data-portal="wesalute"].active {
    background: rgba(217, 119, 6, 0.12);
    border-color: #d97706;
    border-width: 2px;
    color: #d97706;
    font-weight: 700;
}

/* GovX info button and tooltip */
.portal-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid currentColor;
    background: transparent;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    color: inherit;
    padding: 0;
    margin-left: 4px;
    position: relative;
    vertical-align: middle;
}

.portal-info-btn .portal-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #f1f5f9;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    padding: 8px 10px;
    border-radius: 6px;
    white-space: nowrap;
    max-width: 220px;
    white-space: normal;
    width: 220px;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.portal-info-btn .portal-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.portal-info-btn:hover .portal-tooltip,
.portal-info-btn:focus .portal-tooltip {
    display: block;
}

/* Small label above the portal filter row */
.portal-filters-label {
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-top: 8px;
    padding-bottom: 2px;
    width: 100%;
}

[data-theme="dark"] .portal-filter-btn {
    background: var(--color-card);
    color: var(--color-text-light);
    border-color: var(--color-border);
}

/* ===== TIPS SECTION ===== */
.tips-section {
    background: var(--color-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-top: 3rem;
    box-shadow: var(--shadow-card);
}

.tips-section h3 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.tips-section ul {
    list-style: none;
    padding: 0;
}

.tips-section li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    font-family: var(--font-body);
}

.tips-section li:last-child {
    border-bottom: none;
}

.tip-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    line-height: 1.6;
}

/* ===== BANNER ===== */
.banner {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
    color: white;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    text-align: center;
}

.banner h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--color-primary);
    color: #94A3B8;
    text-align: center;
    padding: 2.5rem 1rem;
    margin-top: 4rem;
    border-top: 3px solid var(--color-patriot);
    font-family: var(--font-body);
}

.footer a {
    color: white;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

.footer .disclaimer {
    margin-top: 1rem;
    font-size: 0.8rem;
    opacity: 0.65;
    line-height: 1.7;
}

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-block;
    padding: 0.875rem 1.75rem;
    background: var(--color-accent);
    color: white;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 1rem;
    transition: background var(--transition);
    border: none;
    cursor: pointer;
    min-height: 44px;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
}

/* ===== SVG LOGO FALLBACK ===== */
.logo-svg-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
}

.logo-svg-fallback span {
    color: white;
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

/* ===== HOME PAGE — HERO ===== */
.home-hero {
    background: linear-gradient(160deg, var(--color-primary) 0%, #0C3060 100%);
    color: white;
    padding: 4rem 1rem 3.5rem;
    text-align: center;
}

.home-hero h2 {
    font-family: var(--font-heading);
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.home-hero p {
    font-family: var(--font-body);
    font-size: 1.15rem;
    opacity: 0.88;
    margin-bottom: 2rem;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.7;
}

/* ===== HOME PAGE — SEARCH BAR ===== */
.home-search-bar {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.home-search-bar input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: none;
    outline: none;
    color: var(--color-text);
    background: white;
    min-height: 52px;
}

.home-search-bar input:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: -3px;
}

.home-search-bar button {
    padding: 1rem 1.75rem;
    background: var(--color-accent);
    color: white;
    border: none;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    min-height: 52px;
}

.home-search-bar button:hover {
    background: var(--color-accent-hover);
}

.home-search-bar button:disabled {
    background: var(--color-text-light);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ===== HOME PAGE — STATS BAR ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.25rem 1rem;
    background: var(--color-card);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 1rem;
    background: var(--color-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text);
}

.stat-pill-accent {
    color: var(--color-accent);
    border-color: var(--color-accent);
    background: #EFF6FF;
}

/* ===== HOME PAGE — CATEGORY CARDS ===== */
.category-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.category-card {
    background: var(--color-card);
    border-radius: var(--radius-md);
    padding: 1.75rem 1.25rem;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    box-shadow: var(--shadow-card);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
}

.category-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.category-card-icon {
    font-size: 2.25rem;
    line-height: 1;
}

.category-card-label {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.category-card-count {
    font-family: var(--font-body);
    font-size: 0.825rem;
    color: var(--color-text-light);
    font-weight: 500;
}

/* ===== HOME PAGE — SEARCH RESULTS ===== */
.search-results-section {
    display: none;
    margin-bottom: 2rem;
}

.search-results-section.visible {
    display: block;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-results-header h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--color-primary);
}

.search-clear-btn {
    background: none;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-text-light);
    transition: border-color var(--transition), color var(--transition);
    min-height: 44px;
}

.search-clear-btn:hover {
    border-color: var(--color-patriot);
    color: var(--color-patriot);
}

/* ===== FAQ PAGE STYLES (moved from faq.html inline) ===== */
.page-title {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title h2 {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.page-title p {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: var(--color-text-light);
    line-height: 1.7;
}

.search-faq {
    width: 100%;
    padding: 0.875rem 1.25rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-card);
    transition: border-color var(--transition);
    min-height: 48px;
}

.search-faq:focus-visible {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(3, 105, 161, 0.15);
}

.faq-categories {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.category-tag {
    padding: 0.5rem 1.1rem;
    background: var(--color-muted);
    border: 2px solid transparent;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: all var(--transition);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.category-tag:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-card);
}

.category-tag.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.faq-list {
    background: var(--color-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.faq-item {
    border-bottom: 1px solid var(--color-border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-question {
    padding: 1.25rem 1.5rem;
    background: var(--color-card);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--transition);
    min-height: 60px;
}

.faq-question:hover {
    background: var(--color-bg);
}

.faq-question h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text);
    flex: 1;
    margin-right: 1rem;
    letter-spacing: -0.01em;
}

.faq-icon {
    font-size: 1.3rem;
    color: var(--color-accent);
    transition: transform 0.25s ease-out;
    flex-shrink: 0;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

/* Active FAQ item: accent left border */
.faq-item.active .faq-question {
    border-left: 3px solid var(--color-accent);
    padding-left: calc(1.5rem - 3px);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.faq-item.active .faq-answer {
    max-height: 600px;
}

.faq-answer-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    font-family: var(--font-body);
    color: var(--color-text-light);
    line-height: 1.8;
    font-size: 0.975rem;
}

.faq-answer-content a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

.faq-answer-content a:hover {
    text-decoration: underline;
}

.faq-answer-content ul {
    margin: 0.875rem 0 0.875rem 1.5rem;
}

.faq-answer-content li {
    margin-bottom: 0.5rem;
}

/* FAQ help/contact section */
.help-section {
    background: var(--color-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-top: 3rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
}

.help-section h3 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.help-section p {
    font-family: var(--font-body);
    color: var(--color-text-light);
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.2rem;
    }

    .nav-links a {
        font-size: 0.875rem;
        padding: 0.5rem 0.6rem;
    }

    .category-hero h2,
    .page-title h2 {
        font-size: 1.75rem;
    }

    .home-hero h2 {
        font-size: 2rem;
    }

    .home-hero p {
        font-size: 1rem;
    }

    .home-search-bar {
        flex-direction: column;
        border-radius: var(--radius-sm);
    }

    .home-search-bar input,
    .home-search-bar button {
        border-radius: 0;
        width: 100%;
    }

    .category-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .benefits-grid {
        grid-template-columns: 1fr;
    }

    .sort-controls {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .category-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stats-bar {
        gap: 0.5rem;
    }

    .stat-pill {
        font-size: 0.825rem;
        padding: 0.375rem 0.75rem;
    }
}

@media (min-width: 1024px) {
    .header {
        padding: 1rem 2rem 0;
        text-align: left;
        display: flex;
        align-items: stretch;
        flex-direction: column;
    }

    .header-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        max-width: 1400px;
        margin: 0 auto;
        padding-bottom: 0;
    }

    .nav-links {
        justify-content: center;
        gap: 0.1rem;
    }

    .nav-secondary {
        justify-content: center;
        max-width: 1400px;
        margin: 0 auto;
        width: 100%;
        padding: 0;
    }
}

/* ============================================================
   MOBILE APP SHELL — Bottom Tab Bar + Overlays
   Shown only on screens < 768px (phone-sized)
   ============================================================ */

/* Hide desktop nav on mobile, keep slim title bar */
@media (max-width: 767px) {
    .nav-links,
    .nav-secondary { display: none; }

    .header {
        padding: 0.75rem 1rem;
        text-align: center;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .header h1 { font-size: 1.1rem; margin-bottom: 0; }

    /* Push page content above the tab bar */
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }

    /* Move dark mode toggle so it doesn't clash with tab bar */
    .dark-mode-toggle {
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        right: 1rem;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    /* When the A-Z index bar is visible, shift the toggle left so it doesn't overlap */
    body.has-alpha-bar .dark-mode-toggle {
        right: calc(2px + 32px + 8px); /* 2px bar offset + 28px bar width + 8px gap */
    }
}

/* ===== BOTTOM TAB BAR ===== */
.bottom-tab-bar {
    display: none; /* desktop: hidden */
}

@media (max-width: 767px) {
    .bottom-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(60px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--color-primary);
        border-top: 1px solid var(--color-border);
        z-index: 996;
        justify-content: space-around;
        align-items: stretch;
    }
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    padding: 0.5rem 0;
    font-family: var(--font-body);
    transition: color var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.tab-item.active,
.tab-item:hover {
    color: var(--color-accent-hover);
}

.tab-icon {
    font-size: 1.35rem;
    line-height: 1;
}

.tab-label {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ===== MOBILE OVERLAYS (bottom sheets) ===== */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1002;
    background: rgba(0, 0, 0, 0.55);
    align-items: flex-end;
}

.mobile-overlay.open {
    display: flex;
}

.overlay-sheet {
    background: var(--color-card);
    border-radius: 20px 20px 0 0;
    padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    animation: sheetSlideUp 0.22s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.overlay-handle {
    width: 36px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 0 auto 1rem;
}

.overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.overlay-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-text);
}

.overlay-close {
    background: var(--color-muted);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    color: var(--color-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

/* Browse overlay — 2-col category grid */
.category-grid-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.category-card-mobile {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1.1rem 0.75rem;
    text-align: center;
    text-decoration: none;
    color: var(--color-text);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    transition: background var(--transition), transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.category-card-mobile:active { transform: scale(0.96); background: var(--color-muted); }
.cat-icon  { font-size: 1.6rem; line-height: 1; }
.cat-name  { font-size: 0.82rem; font-weight: 700; color: var(--color-text); }
.cat-count { font-size: 0.68rem; color: var(--color-text-light); }

/* Search overlay */
.search-overlay-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    margin-bottom: 0.75rem;
    box-sizing: border-box;
}

.search-overlay-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.search-go-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    margin-bottom: 0.75rem;
}

.search-hint {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.82rem;
    font-family: var(--font-body);
}

/* More overlay */
.more-links {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.more-link-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.1rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    font-family: var(--font-body);
    font-size: 0.95rem;
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.more-link-item:active { background: var(--color-muted); }
.more-link-icon { font-size: 1.2rem; }

/* ============================================================
   ALPHA SCROLL — Alphabetical section headers + A-Z index bar
   Used on large category pages (Shopping, etc.)
   ============================================================ */

/* Grid switches from CSS grid to block when alpha mode is active */
.benefits-grid.alpha-mode {
    display: block;
}

.alpha-section {
    margin-bottom: 0.5rem;
}

/* Sticky letter header — stays visible as user scrolls through a section */
.alpha-header {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-accent);
    padding: 0.5rem 0 0.375rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--color-accent);
    position: sticky;
    top: 140px; /* below sticky site header (~140px on desktop) */
    background: var(--color-bg);
    z-index: 10;
}

/* Cards within each letter section use the same grid as .benefits-grid */
.alpha-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

/* ===== A-Z INDEX BAR (fixed right strip) ===== */
.alpha-index-bar {
    position: fixed;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 200; /* above content, below header/overlays */
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 5px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.10);
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.alpha-index-bar::-webkit-scrollbar { display: none; }

.alpha-index-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 20px;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--color-accent);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 4px;
    transition: background var(--transition), color var(--transition);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
    user-select: none;
}

.alpha-index-letter:hover {
    background: var(--color-muted);
    color: var(--color-text);
}

.alpha-index-letter.active {
    background: var(--color-accent);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
}

/* Discount-band mode: widen bar and buttons to fit multi-character labels like "MIL PRICE" */
.alpha-index-bar.discount-mode {
    right: 4px;
    padding: 5px 2px;
}
.alpha-index-bar.discount-mode .alpha-index-letter {
    width: 52px;
    height: 18px;
    font-size: 9px;
    letter-spacing: 0.01em;
    padding: 0 2px;
}
.alpha-index-bar.discount-mode .alpha-index-letter.active {
    border-radius: 4px; /* pill shape doesn't work for wide labels — use rounded rect */
    width: 52px;
    height: 18px;
}

[data-theme="dark"] .alpha-index-bar {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.45);
}

@media (max-width: 767px) {
    /* On mobile: anchor to bottom above the tab bar */
    .alpha-index-bar {
        right: 2px;
        top: auto;
        bottom: calc(68px + env(safe-area-inset-bottom, 0px));
        transform: none;
        max-height: calc(100svh - 140px - env(safe-area-inset-bottom, 0px));
    }

    /* Mobile header is shorter — adjust sticky offset */
    .alpha-header {
        top: 54px;
    }

    /* Single column on phones */
    .alpha-cards {
        grid-template-columns: 1fr;
    }
}

/* =====================================================
   VIEW TRANSITIONS — smooth page-to-page navigation
   ===================================================== */
@view-transition {
  navigation: auto;
}

/* Fade transition for the whole page */
::view-transition-old(root) {
  animation: 180ms ease-out both fade-out;
}
::view-transition-new(root) {
  animation: 220ms ease-in both fade-in;
}

@keyframes fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

/* =====================================================
   SCROLL-TRIGGERED CARD ANIMATIONS
   ===================================================== */

/* Initial state: cards start invisible and slightly below position */
.card-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Triggered state: card has entered the viewport */
.card-animate.card-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for the first batch of cards */
.card-animate:nth-child(1)  { transition-delay: 0ms; }
.card-animate:nth-child(2)  { transition-delay: 40ms; }
.card-animate:nth-child(3)  { transition-delay: 80ms; }
.card-animate:nth-child(4)  { transition-delay: 120ms; }
.card-animate:nth-child(5)  { transition-delay: 160ms; }
.card-animate:nth-child(6)  { transition-delay: 200ms; }
.card-animate:nth-child(7)  { transition-delay: 240ms; }
.card-animate:nth-child(8)  { transition-delay: 280ms; }
.card-animate:nth-child(9)  { transition-delay: 320ms; }
.card-animate:nth-child(10) { transition-delay: 360ms; }
/* Cards beyond 10 have no extra delay — they animate immediately on scroll */
.card-animate:nth-child(n+11) { transition-delay: 0ms; }

/* Respect reduced motion — show cards instantly with no animation */
@media (prefers-reduced-motion: reduce) {
  .card-animate {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ===== REPORT MODAL ===== */
.report-btn {
  display: block;
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: var(--color-text-light, #888);
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.25rem 0;
  text-decoration: underline;
  text-align: center;
  width: 100%;
}
.report-btn:hover { color: var(--color-accent, #e05); }

.report-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.report-modal {
  background: var(--color-surface, #fff);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 360px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.report-modal h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.report-modal .report-company {
  color: var(--color-text-light, #888);
  font-size: 0.8rem;
  margin-bottom: 1rem;
}
.report-modal label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  cursor: pointer;
  font-size: 0.9rem;
}
.report-modal .report-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.report-modal .report-submit {
  flex: 1;
  padding: 0.6rem;
  background: var(--color-accent, #1a73e8);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.report-modal .report-cancel {
  padding: 0.6rem 1rem;
  background: none;
  border: 1px solid var(--color-border, #ddd);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-text, #333);
}

/* ============================================================
   RESOURCES PAGE — tactical / intel-briefing aesthetic
   Shared by /resources.html (gated) and /resources-preview.html (public).
   See docs/mockup-archive/ for earlier design directions considered.
   See DESIGN.md "VBD ↔ NikoServes Handoff" for color-scope rules.
   ============================================================ */

/* Resources-page-only tokens (scoped overrides; not global) */
.resources-page {
    --rx-bg:        #0A0E14;      /* hero / ticker / footer */
    --rx-panel:     #FFFFFF;      /* card body */
    --rx-panel-dim: #F3F1EB;      /* page canvas */
    --rx-ink:       #0F172A;      /* card text + frame */
    --rx-ink-soft:  #475569;
    --rx-ink-muted: #8A918E;
    --rx-gold:      #F5B800;      /* tactical primary CTA */
    --rx-red:       #B9321F;      /* DM code color */
    --rx-cyan:      #00E5FF;      /* @NikoServes accent — handle only */
}
.resources-page {
    background: var(--rx-panel-dim);
    font-family: 'Inter', 'Lexend', system-ui, sans-serif;
}

/* ─── Top ticker ─── */
.rx-ticker {
    background: var(--rx-bg);
    color: var(--rx-gold);
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 10.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 7px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--rx-gold);
}
.rx-ticker .dot {
    display: inline-block; width: 6px; height: 6px;
    background: var(--rx-cyan); border-radius: 50%;
    margin-right: 8px; vertical-align: middle;
    box-shadow: 0 0 8px var(--rx-cyan);
    animation: rx-pulse 2s infinite;
}
@keyframes rx-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.rx-ticker-left, .rx-ticker-right { display: flex; gap: 14px; align-items: center; }
.rx-ticker-right { color: rgba(255,255,255,0.6); }
@media (max-width: 640px) { .rx-ticker-right { display: none; } }

/* ─── Tactical header row ─── */
.rx-header {
    background: var(--rx-bg);
    color: #fff;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.rx-logo { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.rx-logo-mark { width: 30px; height: 30px; }
.rx-logo-text {
    font-family: 'Inter', sans-serif; font-weight: 700; font-size: 15px; letter-spacing: -0.01em;
}
.rx-logo-tag {
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 9.5px; color: var(--rx-gold);
    letter-spacing: 0.18em; text-transform: uppercase; margin-top: 2px;
}
.rx-nav {
    display: flex; gap: 22px;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
}
.rx-nav a { color: rgba(255,255,255,0.7); text-decoration: none; }
.rx-nav a:hover { color: var(--rx-gold); }
@media (max-width: 720px) { .rx-nav { display: none; } }

/* ─── Hero ─── */
.rx-hero {
    background: var(--rx-bg);
    color: #fff;
    padding: 64px 32px 48px;
    position: relative; overflow: hidden;
}
.rx-hero::before {
    content: ''; position: absolute; inset: 0;
    background:
        linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}
.rx-hero-inner { max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
.rx-hero-stamps {
    display: flex; gap: 14px; margin-bottom: 28px;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 10.5px; letter-spacing: 0.22em; text-transform: uppercase;
    flex-wrap: wrap;
}
.rx-hero-stamp { padding: 5px 11px; border: 1px solid var(--rx-gold); color: var(--rx-gold); }
.rx-hero-stamp.cyan { border-color: var(--rx-cyan); color: var(--rx-cyan); }
.rx-hero-stamp.red { border-color: var(--rx-red); color: var(--rx-red); }
.rx-h1 {
    font-family: 'Inter', sans-serif; font-weight: 800;
    font-size: clamp(36px, 6vw, 68px); line-height: 0.98;
    letter-spacing: -0.03em; margin: 0 0 24px;
    text-transform: uppercase; color: #fff;
}
.rx-h1 .accent {
    display: block; font-size: 0.6em; font-weight: 600;
    letter-spacing: 0.02em; color: var(--rx-cyan);
    text-transform: none; font-family: 'JetBrains Mono', 'DM Mono', monospace;
    margin-top: 14px;
}
.rx-strap {
    max-width: 620px; font-size: 16px; color: rgba(255,255,255,0.7);
    line-height: 1.55; margin: 0 0 36px;
}
.rx-strap strong { color: #fff; font-weight: 600; }

/* Stat grid */
.rx-stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    border: 1px solid rgba(255,255,255,0.15);
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
}
@media (max-width: 640px) { .rx-stats { grid-template-columns: repeat(2, 1fr); } }
.rx-stat-cell { padding: 18px 18px 16px; border-right: 1px solid rgba(255,255,255,0.08); }
.rx-stat-cell:last-child { border-right: none; }
@media (max-width: 640px) {
    .rx-stat-cell:nth-child(2) { border-right: none; }
    .rx-stat-cell:nth-child(1), .rx-stat-cell:nth-child(2) { border-bottom: 1px solid rgba(255,255,255,0.08); }
}
.rx-stat-label { font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--rx-gold); margin-bottom: 6px; }
.rx-stat-value { font-family: 'Inter', sans-serif; font-weight: 800; font-size: 26px; color: #fff; letter-spacing: -0.02em; }
.rx-stat-sub { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 2px; letter-spacing: 0.12em; text-transform: uppercase; }

/* ─── Grid ─── */
.rx-grid-wrap {
    max-width: 1200px; margin: 0 auto;
    padding: 56px 20px 80px;
}
.rx-section-head {
    display: flex; align-items: baseline; justify-content: space-between;
    margin-bottom: 24px; gap: 14px; flex-wrap: wrap;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    border-bottom: 1px solid var(--rx-ink);
    padding-bottom: 12px;
}
.rx-section-title { margin: 0; font-size: 12.5px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 600; color: var(--rx-ink); }
.rx-section-meta { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--rx-ink-muted); }

.rx-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px;
}
@media (max-width: 720px) { .rx-grid { grid-template-columns: 1fr; gap: 16px; } }

/* ─── Tactical Card ─── */
.t-card {
    background: var(--rx-panel);
    border: 1.5px solid var(--rx-ink);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.t-card:hover { transform: translateY(-2px); box-shadow: 6px 6px 0 var(--rx-ink); }

.t-strip {
    background: var(--rx-bg); color: #fff;
    padding: 8px 16px;
    display: flex; justify-content: space-between; align-items: center;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
}
.t-strip .num { color: var(--rx-gold); font-weight: 600; }
.t-strip .date { color: rgba(255,255,255,0.55); }

.t-thumb {
    aspect-ratio: 21/9;
    background: linear-gradient(135deg, #25F4EE, #000, #FE2C55);
    position: relative;
    border-bottom: 1.5px solid var(--rx-ink);
    overflow: hidden;
}
.t-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-thumb-fallback.t-thumb-tt { background: linear-gradient(135deg, #25F4EE 0%, #000 55%, #FE2C55 100%); }
.t-thumb-fallback.t-thumb-ig { background: linear-gradient(135deg, #F58529 0%, #DD2A7B 55%, #8134AF 100%); }
.t-thumb-fallback.t-thumb-both { background: linear-gradient(135deg, #25F4EE 0%, #8134AF 50%, #FE2C55 100%); }
.t-thumb::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.15) 100%);
    pointer-events: none;
}
.t-classified {
    position: absolute; top: 50%; right: 18px;
    transform: translateY(-50%) rotate(-3deg);
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    color: var(--rx-gold); border: 2px solid var(--rx-gold);
    padding: 6px 16px;
    font-size: 12px; font-weight: 600;
    letter-spacing: 0.18em; text-transform: uppercase;
    background: rgba(10,14,20,0.65); backdrop-filter: blur(4px);
}

.t-body { padding: 18px 18px 20px; }
.t-head {
    font-family: 'Inter', sans-serif; font-weight: 800;
    font-size: 18px; line-height: 1.2; color: var(--rx-ink);
    margin: 0 0 8px;
    text-transform: uppercase; letter-spacing: -0.015em;
}
.t-desc {
    font-family: 'Inter', sans-serif; font-size: 13.5px;
    color: var(--rx-ink-soft); line-height: 1.5;
    margin: 0 0 16px;
}
.t-keypair {
    display: grid; grid-template-columns: auto 1fr;
    gap: 8px 16px;
    border-top: 1px dashed #cbd5e1; border-bottom: 1px dashed #cbd5e1;
    padding: 12px 0; margin: 0 0 16px;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 11px;
}
.t-keypair dt { color: var(--rx-ink-muted); text-transform: uppercase; letter-spacing: 0.14em; font-weight: 500; }
.t-keypair dd { margin: 0; color: var(--rx-ink); font-weight: 500; letter-spacing: 0.05em; }
.t-keypair dd.dm { color: var(--rx-red); font-weight: 600; letter-spacing: 0.12em; }
.t-keypair dd.dm.redacted { color: var(--rx-ink-muted); letter-spacing: 0.04em; }

.t-actions { display: flex; gap: 0; }
.t-btn {
    padding: 12px 16px;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 11.5px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.1em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    border: 1px solid var(--rx-ink);
    background: transparent;
    text-decoration: none;
    display: inline-flex; align-items: center; justify-content: center;
    box-sizing: border-box;
}
.t-btn-primary { flex: 1; background: var(--rx-gold); color: var(--rx-bg); }
.t-btn-primary:hover { background: var(--rx-bg); color: var(--rx-gold); }
.t-platform-link {
    width: 44px; color: var(--rx-ink);
    border-left: none;
}
.t-platform-link:hover { background: var(--rx-ink); color: var(--rx-gold); }
.t-platform-link svg { width: 16px; height: 16px; }

/* Empty state */
.t-empty {
    grid-column: 1 / -1;
    text-align: center; padding: 3rem 1rem;
    color: var(--rx-ink-muted);
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 13px; letter-spacing: 0.08em;
}

/* ─── Footer ─── */
.rx-footer {
    background: var(--rx-bg); color: rgba(255,255,255,0.6);
    border-top: 2px solid var(--rx-gold);
    padding: 36px 24px 28px;
}
.rx-footer-inner {
    max-width: 1200px; margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
    gap: 24px; flex-wrap: wrap;
    font-family: 'JetBrains Mono', 'DM Mono', monospace;
    font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
}
.rx-footer-brand {
    display: flex; align-items: center; gap: 12px; color: #fff;
}
.rx-footer-brand svg { width: 30px; height: 30px; }

/* =======================================================================
   UNLOCKABLE BENEFITS — gold glow + unlock badges
   Vendor cards with active credit-card unlocks get a gold border + glow to
   signal "there's an alternate path to value here beyond the direct discount."
   See docs/superpowers/plans/2026-04-18-unlockable-benefits-plan.md
   ======================================================================= */

.benefit-card.has-unlocks .card-front,
.benefit-card.has-unlocks .card-back {
    border: 2px solid var(--color-gold);
    box-shadow: 0 0 14px rgba(217, 119, 6, 0.22), var(--shadow-card);
}
.benefit-card.has-unlocks:hover .card-front,
.benefit-card.has-unlocks:hover .card-back {
    box-shadow: 0 0 22px rgba(217, 119, 6, 0.35), var(--shadow-hover);
}

/* Compact indicator on the card front — appears below existing badges */
.unlock-front-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 10px;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.12), rgba(217, 119, 6, 0.06));
    color: var(--color-gold);
    border: 1px solid rgba(217, 119, 6, 0.3);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Full unlock list on the card back — shown after flip */
.unlock-back-section {
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: rgba(217, 119, 6, 0.05);
    border-left: 3px solid var(--color-gold);
    border-radius: var(--radius-sm);
    text-align: left;
}
.unlock-back-header {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-gold);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.unlock-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.unlock-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    line-height: 1.35;
}
.unlock-product {
    font-weight: 600;
    color: var(--color-primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.unlock-icon {
    font-size: 13px;
}
.unlock-summary {
    color: var(--color-text);
}
.unlock-value {
    color: var(--color-gold);
    font-weight: 700;
    white-space: nowrap;
}
.unlock-timelimit {
    display: inline-block;
    margin-left: 4px;
    padding: 0 5px;
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-patriot);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.unlock-guide {
    color: var(--color-accent);
    font-size: 11px;
    text-decoration: none;
    font-weight: 600;
}
.unlock-guide:hover { text-decoration: underline; }

[data-theme="dark"] .unlock-back-section {
    background: rgba(217, 119, 6, 0.08);
}
[data-theme="dark"] .unlock-product {
    color: var(--color-text);
}

/* Stale-unlock indicator — dimmed gold + amber clock marker */
.benefit-card.has-stale-unlock .card-front,
.benefit-card.has-stale-unlock .card-back {
    border-color: rgba(217, 119, 6, 0.55);
    box-shadow: 0 0 12px rgba(217, 119, 6, 0.18), var(--shadow-card);
}
.unlock-front-badge[title*="outdated"] {
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.18), rgba(220, 38, 38, 0.08));
    border-color: rgba(220, 38, 38, 0.3);
}
