/* ==========================================================================
   sections.css — shared styling for the BoredGames network hub pages
   (/history, /math, /writing, /try)

   Design tokens below MIRROR the :root block in index.html, which remains the
   single source of truth (see DESIGN.md). If you change a token in index.html,
   update it here too. Per-page accent is set via the data-section class on
   <body> (e.g. <body class="section-history">).
   ========================================================================== */

:root {
    /* Brand & surfaces — mirrored from index.html */
    --color-brand: #2563eb;
    --color-brand-dark: #1d4ed8;
    --color-ink: #0f172a;
    --gradient-hero: linear-gradient(165deg, #0c1929 0%, #1e3a8a 42%, #0f766e 100%);
    --gradient-cta: linear-gradient(180deg, var(--color-brand) 0%, var(--color-brand-dark) 100%);
    --surface-app: #f8fafc;
    --surface-tint: #f1f5f9;

    /* Radius scale — 4px base */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50px;

    /* Layout */
    --content-max: 800px;
    --grid-max: 1100px;

    /* Type scale — 1.25 ratio from 16px body */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --leading-tight: 1.25;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;

    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-body: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

    /* Default accent (overridden per section) */
    --accent: var(--color-brand);
    --accent-dark: var(--color-brand-dark);
    --accent-tint: #eff4ff;
}

/* Per-section accents — distinct identity, one cohesive system */
.section-history { --accent: #b45309; --accent-dark: #92400e; --accent-tint: #fdf6ec; }
.section-math    { --accent: #4f46e5; --accent-dark: #4338ca; --accent-tint: #eef0fe; }
.section-writing { --accent: #0d9488; --accent-dark: #0f766e; --accent-tint: #ecfdf8; }
.section-try     { --accent: #ea580c; --accent-dark: #c2410c; --accent-tint: #fff2ea; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-md);
    line-height: var(--leading-relaxed);
    color: var(--color-ink);
    background: var(--surface-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a { color: var(--accent-dark); }

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: #fff;
    color: var(--color-ink);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---- Site header / nav (consistent with /about) ------------------------- */
.site-header {
    background: var(--gradient-hero);
    color: #fff;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.25);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-content {
    max-width: var(--grid-max);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.logo {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    text-decoration: none;
    white-space: nowrap;
}
.nav-links {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    align-items: center;
}
.nav-links a {
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--font-size-sm);
    padding: 0.35rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-links a:hover { color: #fff; border-bottom-color: rgba(255, 255, 255, 0.7); }
.nav-links a[aria-current="page"] { color: #fff; border-bottom-color: #fff; }

/* ---- Hero --------------------------------------------------------------- */
.hero {
    position: relative;
    background: var(--gradient-hero);
    color: #fff;
    padding: clamp(3rem, 8vw, 6rem) 1.5rem clamp(3.5rem, 9vw, 6.5rem);
    overflow: hidden;
}
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 90% 55% at 12% 8%, rgba(255, 255, 255, 0.08), transparent 55%),
        radial-gradient(ellipse 75% 55% at 100% 90%, rgba(255, 255, 255, 0.10), transparent 48%);
}
.hero-inner { position: relative; z-index: 1; max-width: var(--content-max); margin: 0 auto; }
.eyebrow {
    font-family: var(--font-display);
    font-size: var(--font-size-sm);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.eyebrow .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent); }
.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5.5vw, 3.6rem);
    line-height: var(--leading-tight);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-wrap: balance;
    margin-bottom: 1rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.hero .lede {
    font-size: clamp(1.05rem, 2.4vw, 1.3rem);
    line-height: var(--leading-snug);
    color: rgba(255, 255, 255, 0.92);
    max-width: 38ch;
    margin-bottom: 2rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}
.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; }

/* ---- Buttons (mirrors index.html .btn family) --------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.75rem;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-body);
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s ease;
}
.btn:focus-visible { outline: 3px solid rgba(255, 255, 255, 0.85); outline-offset: 3px; }
.btn-primary {
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
    color: #fff;
    box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 38%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-secondary {
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-2px); }

/* ---- Stat strip --------------------------------------------------------- */
.stats {
    max-width: var(--grid-max);
    margin: -2.25rem auto 0;
    padding: 0 1.5rem;
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}
.stat {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.25rem;
    text-align: center;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08);
    border-top: 3px solid var(--accent);
}
.stat-num { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--accent-dark); display: block; line-height: 1.1; }
.stat-label { font-size: var(--font-size-sm); color: #64748b; margin-top: 0.35rem; }

/* ---- Sections ----------------------------------------------------------- */
main { display: block; }
.section { max-width: var(--grid-max); margin: 0 auto; padding: clamp(3rem, 7vw, 4.5rem) 1.5rem 0; }
.section-head { max-width: var(--content-max); margin: 0 auto 2rem; text-align: center; }
.section-head h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--color-ink);
    margin-bottom: 0.6rem;
}
.section-head p { color: #475569; font-size: var(--font-size-lg); max-width: 52ch; margin: 0 auto; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}
.card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 14px 36px rgba(15, 23, 42, 0.12); border-color: color-mix(in srgb, var(--accent) 35%, #e8edf3); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.card .icon {
    width: 3rem; height: 3rem;
    display: grid; place-items: center;
    font-size: 1.5rem;
    border-radius: var(--radius-md);
    background: var(--accent-tint);
    margin-bottom: 1rem;
}
.card h3 { font-family: var(--font-display); font-size: var(--font-size-xl); font-weight: 600; letter-spacing: -0.01em; margin-bottom: 0.4rem; }
.card p { color: #475569; font-size: var(--font-size-md); line-height: var(--leading-normal); flex: 1; }
.card .more { margin-top: 1rem; font-weight: 600; color: var(--accent-dark); font-size: var(--font-size-sm); }
.card:hover .more { text-decoration: underline; }

/* ---- Closing CTA -------------------------------------------------------- */
.cta-band { max-width: var(--grid-max); margin: clamp(3rem, 7vw, 4.5rem) auto 0; padding: 0 1.5rem; }
.cta-card {
    background: var(--gradient-hero);
    border-radius: var(--radius-xl);
    padding: clamp(2.5rem, 6vw, 3.5rem);
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.cta-card::after {
    content: '';
    position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(ellipse 70% 60% at 80% 10%, rgba(255,255,255,0.10), transparent 50%);
}
.cta-card > * { position: relative; z-index: 1; }
.cta-card h2 { font-family: var(--font-display); font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.75rem; }
.cta-card p { color: rgba(255, 255, 255, 0.92); font-size: var(--font-size-lg); max-width: 46ch; margin: 0 auto 1.75rem; }

.note { color: rgba(255,255,255,0.7); font-size: var(--font-size-sm); margin-top: 1rem; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer {
    margin-top: clamp(3rem, 7vw, 4.5rem);
    background: #0b1220;
    color: rgba(255, 255, 255, 0.75);
    padding: 2.5rem 1.5rem;
}
.footer-inner { max-width: var(--grid-max); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-nav a { color: rgba(255, 255, 255, 0.8); text-decoration: none; font-size: var(--font-size-sm); font-weight: 500; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-copy { font-size: var(--font-size-sm); color: rgba(255, 255, 255, 0.55); }

@media (max-width: 640px) {
    .nav-links { gap: 0.85rem; }
    .nav-links a { font-size: var(--font-size-xs); }
    .cta-row .btn { width: 100%; }
}
