/* =================================================================
   JJ Communication — design system (single source of truth)
   ----------------------------------------------------------------
   ONE typography scale, ONE colour palette, ONE component library.
   Every page uses these primitives. Inline <style> blocks on
   individual pages should only contain game-specific UI (canvases,
   game controls), never theme overrides.
   ================================================================= */


/* ──────────────────── DESIGN TOKENS ──────────────────── */

:root {
    --font-display: 'Outfit', 'Segoe UI', sans-serif;
    --font-body:    'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
    --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 2.5rem;   --s-8: 3rem;
    --s-9: 4rem;     --s-10: 5rem;    --s-11: 6rem;    --s-12: 8rem;

    --container: 1120px;

    --ink:           #0f0a1f;
    --ink-2:         #2a2240;
    --mute:          #6b5f8a;
    --line:          rgba(105, 38, 217, 0.14);
    --line-strong:   rgba(105, 38, 217, 0.28);

    --surface:       #ffffff;
    --surface-2:     #faf7ff;
    --surface-3:     #f4eeff;

    --purple-ink:    #0b0420;
    --purple-deep:   #1a0b3d;
    --purple-mid:    #2c1264;
    --purple-bright: #6926d9;

    --gold:          #FFD700;
    --gold-deep:     #FFA500;
    --gold-soft:     #FFE680;

    --green:         #00C853;
    --pink:          #FF4081;
    --cyan:          #00BCD4;

    --shadow-sm: 0 1px 2px rgba(15, 10, 31, 0.06);
    --shadow-md: 0 6px 18px rgba(15, 10, 31, 0.08);
    --shadow-lg: 0 18px 40px rgba(15, 10, 31, 0.12);

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-xl: 24px;
    --r-pill: 999px;
}


/* ──────────────────── RESET / BASE ──────────────────── */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--surface-2);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--purple-bright); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { font-family: var(--font-display); letter-spacing: -0.015em; margin: 0; }
p { margin: 0 0 var(--s-4); }
ul, ol { padding-left: 1.25rem; margin: 0 0 var(--s-4); }
hr { border: 0; height: 1px; background: var(--line); margin: var(--s-6) 0; }

button { font-family: inherit; cursor: pointer; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 var(--s-4); }
@media (min-width: 720px) { .container { padding: 0 var(--s-5); } }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}


/* ──────────────────── SITE HEADER ──────────────────── */

.site-header {
    background: linear-gradient(180deg, var(--purple-ink) 0%, var(--purple-deep) 100%);
    border-bottom: 1px solid rgba(255, 215, 0, 0.12);
    position: sticky;
    top: 0;
    z-index: 50;
}
.site-header .nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-5);
    padding: var(--s-3) 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: var(--s-3);
    color: #fff;
    text-decoration: none;
    font-family: var(--font-display);
    font-weight: 800;
}
.brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; flex: 0 0 auto; }
.brand-text { display: inline-flex; flex-direction: column; line-height: 1.05; }
.brand-text__eyebrow {
    color: rgba(255, 215, 0, 0.85);
    font-family: var(--font-body);
    font-size: 0.66rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-weight: 600;
}
.brand-text__name { color: #fff; font-size: 1.15rem; font-weight: 800; margin-top: 2px; }
.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: var(--s-5);
    align-items: center;
}
.nav-links a {
    color: rgba(255, 255, 255, 0.78);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 6px 2px;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.nav-links a:hover {
    color: var(--gold);
    text-decoration: none;
    border-bottom-color: var(--gold);
}
.nav-links a[aria-current="page"] {
    color: var(--gold);
    border-bottom-color: rgba(255, 215, 0, 0.45);
}


/* ──────────────────── SITE FOOTER ──────────────────── */

.site-footer {
    background: linear-gradient(180deg, var(--purple-deep) 0%, var(--purple-ink) 100%);
    color: rgba(255, 255, 255, 0.72);
    padding: var(--s-8) 0 var(--s-5);
    margin-top: var(--s-9);
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-6);
    margin-bottom: var(--s-6);
}
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--s-7); } }
.footer-section h3 {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0 0 var(--s-2);
    display: flex;
    align-items: center;
    gap: var(--s-2);
}
.footer-section h4 {
    color: var(--gold);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin: 0 0 var(--s-3);
}
.footer-section p {
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.93rem;
    line-height: 1.6;
    margin: 0;
    max-width: 320px;
}
.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
}
.footer-section a { color: rgba(255, 255, 255, 0.7); font-size: 0.92rem; }
.footer-section a:hover { color: var(--gold); text-decoration: none; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: var(--s-4);
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.82rem;
}
.footer-bottom p { margin: 0; }


/* ──────────────────── BUTTONS ──────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-2);
    padding: 0.75rem 1.35rem;
    border-radius: var(--r-pill);
    border: 0;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.06s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: linear-gradient(180deg, var(--gold-soft), var(--gold) 60%, var(--gold-deep));
    color: #2a1500;
    box-shadow: 0 4px 14px rgba(255, 215, 0, 0.35), inset 0 -2px 0 rgba(0,0,0,0.12);
}
.btn-primary:hover { box-shadow: 0 6px 22px rgba(255, 215, 0, 0.5), inset 0 -2px 0 rgba(0,0,0,0.12); }

.btn-ghost {
    background: transparent;
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.32);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.55); }

.btn-outline {
    background: transparent;
    color: var(--purple-bright);
    border: 1.5px solid var(--line-strong);
}
.btn-outline:hover { background: rgba(105, 38, 217, 0.06); }


/* ──────────────────── HOME: HERO ──────────────────── */

.home-hero {
    background: linear-gradient(165deg, var(--purple-ink) 0%, var(--purple-deep) 50%, var(--purple-mid) 100%);
    color: #fff;
    padding: var(--s-9) 0 var(--s-10);
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--r-xl) var(--r-xl);
    margin-bottom: var(--s-7);
}
.home-hero::before {
    content: "";
    position: absolute;
    top: -120px; right: -120px;
    width: 360px; height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.22), transparent 60%);
    pointer-events: none;
}
.home-hero .container { position: relative; z-index: 1; text-align: center; }
.home-hero__eyebrow {
    color: var(--gold);
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 600;
    margin: 0 0 var(--s-4);
}
.home-hero__title {
    font-size: clamp(2.1rem, 5.5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.05;
    margin: 0 auto var(--s-5);
    max-width: 18ch;
    color: #fff;
    text-wrap: balance;
}
.home-hero__title .accent {
    background: linear-gradient(90deg, var(--gold-soft), var(--gold) 50%, #FFB347);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}
.home-hero__lead {
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(1rem, 1.7vw, 1.08rem);
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto var(--s-6);
}
.home-hero__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: center; }


/* ──────────────────── HOME: PRODUCT ROW ──────────────────── */

.product-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-5);
    margin: 0 0 var(--s-8);
}
@media (min-width: 760px) { .product-row { grid-template-columns: 1fr 1fr; } }

.product-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--s-3);
    padding: var(--s-5);
    border-radius: var(--r-xl);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.product-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-strong);
    text-decoration: none;
}
.product-card::after {
    content: "";
    position: absolute;
    top: -80px; right: -80px;
    width: 200px; height: 200px;
    border-radius: 50%;
    pointer-events: none;
}
.product-card--games::after { background: radial-gradient(circle, rgba(105, 38, 217, 0.18), transparent 60%); }
.product-card--quiz::after  { background: radial-gradient(circle, rgba(255, 215, 0, 0.28), transparent 60%); }
.product-card__head { display: flex; align-items: center; gap: var(--s-3); position: relative; z-index: 1; }
.product-card__emoji { font-size: 2rem; flex: 0 0 auto; }
.product-card__title { font-size: 1.4rem; font-weight: 800; color: var(--ink); margin: 0; }
.product-card__sub { font-size: 0.88rem; color: var(--mute); margin: 2px 0 0; font-weight: 500; }
.product-card__body { font-size: 0.97rem; line-height: 1.6; color: var(--ink-2); margin: 0; position: relative; z-index: 1; }
.product-card__tags { display: flex; flex-wrap: wrap; gap: var(--s-1); position: relative; z-index: 1; }
.tag {
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    background: rgba(105, 38, 217, 0.08);
    color: var(--purple-bright);
    font-weight: 600;
}
.product-card--quiz .tag { background: rgba(255, 165, 0, 0.14); color: #92400e; }
.product-card__cta {
    font-weight: 700;
    color: var(--purple-bright);
    font-size: 0.95rem;
    margin-top: auto;
    padding-top: var(--s-1);
    position: relative;
    z-index: 1;
}
.product-card--quiz .product-card__cta { color: #c2410c; }


/* ──────────────────── PAGE HERO (for non-home pages) ──────────────────── */

.page-hero {
    background: linear-gradient(165deg, var(--purple-ink) 0%, var(--purple-deep) 60%, var(--purple-mid) 100%);
    color: #fff;
    padding: var(--s-7) 0 var(--s-7);
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--r-xl) var(--r-xl);
    margin-bottom: var(--s-6);
}
.page-hero::before {
    content: "";
    position: absolute;
    top: -90px; right: -90px;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.18), transparent 60%);
    pointer-events: none;
}
.page-hero .container { position: relative; z-index: 1; }
.page-hero__eyebrow {
    color: var(--gold);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 600;
    margin: 0 0 var(--s-2);
}
.page-hero__title {
    font-size: clamp(1.8rem, 4.5vw, 2.6rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 var(--s-3);
    max-width: 28ch;
    text-wrap: balance;
}
.page-hero__lead {
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(0.98rem, 1.6vw, 1.05rem);
    line-height: 1.6;
    max-width: 60ch;
    margin: 0;
}


/* ──────────────────── PROSE (article body) ──────────────────── */

.prose {
    max-width: 760px;
    margin: var(--s-7) auto;
    padding: 0;
    color: var(--ink-2);
    font-size: 1rem;
    line-height: 1.7;
}
.prose h2 {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--ink);
    margin: var(--s-7) 0 var(--s-3);
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: var(--s-5) 0 var(--s-2); }
.prose p { margin: 0 0 var(--s-4); }
.prose ul, .prose ol { margin: 0 0 var(--s-4); padding-left: 1.4rem; }
.prose li { margin: 0 0 var(--s-2); }
.prose li::marker { color: var(--purple-bright); }
.prose a { color: var(--purple-bright); font-weight: 600; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose code {
    background: var(--surface-3);
    color: var(--purple-bright);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
.prose hr { margin: var(--s-7) 0; }
.prose table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--s-4) 0;
    font-size: 0.95rem;
}
.prose th, .prose td {
    text-align: left;
    padding: var(--s-2) var(--s-3);
    border-bottom: 1px solid var(--line);
}
.prose th { font-weight: 700; color: var(--ink); background: var(--surface-3); }

/* About: values grid */
.values-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--s-4);
    margin: var(--s-5) 0;
    padding: 0;
    list-style: none;
}
.value-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5) var(--s-4);
    text-align: center;
}
.value-item .icon { font-size: 1.8rem; display: block; margin-bottom: var(--s-2); font-style: normal; }
.value-item h3 { font-size: 1rem; color: var(--ink); margin: 0 0 var(--s-1); }
.value-item p { font-size: 0.9rem; margin: 0; color: var(--mute); line-height: 1.5; }

/* FAQ */
.faq-list { list-style: none; padding: 0; margin: 0; }
.faq-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: var(--s-3);
    overflow: hidden;
}
.faq-item summary {
    list-style: none;
    cursor: pointer;
    padding: var(--s-4) var(--s-5);
    font-weight: 700;
    color: var(--ink);
    position: relative;
    padding-right: 3rem;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
    content: "+";
    position: absolute;
    right: var(--s-5);
    top: 50%;
    transform: translateY(-50%);
    color: var(--purple-bright);
    font-size: 1.4rem;
    font-weight: 700;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item .faq-answer {
    padding: 0 var(--s-5) var(--s-5);
    color: var(--ink-2);
    line-height: 1.65;
}
.faq-item .faq-answer p:last-child { margin-bottom: 0; }


/* ──────────────────── HOME: GAMES SECTION ──────────────────── */

.section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
}
.section-head h2 {
    font-size: clamp(1.6rem, 3vw, 1.9rem);
    font-weight: 700;
    margin: 0;
    color: var(--ink);
}
.section-head p { margin: 4px 0 0; color: var(--mute); font-size: 0.98rem; }
.filter-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
    background: transparent;
    border: 1.5px solid var(--line-strong);
    color: var(--ink-2);
    padding: 0.45rem 0.9rem;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}
.chip:hover { border-color: var(--purple-bright); color: var(--purple-bright); }
.chip.is-active, .chip[aria-pressed="true"] {
    background: var(--purple-bright);
    border-color: var(--purple-bright);
    color: #fff;
}


/* ──────────────────── GAME CARDS ──────────────────── */

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--s-4);
    margin: 0 0 var(--s-8);
    padding: 0;
    list-style: none;
}
.game-card {
    display: flex;
    flex-direction: column;
    gap: var(--s-1);
    padding: var(--s-4);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    color: var(--ink);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.game-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--line-strong);
    text-decoration: none;
}
.game-card__badge {
    align-self: flex-start;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    background: rgba(105, 38, 217, 0.1);
    color: var(--purple-bright);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.game-card__icon { font-size: 2rem; margin: var(--s-2) 0 0; line-height: 1; }
.game-card h3 { font-size: 1.05rem; font-weight: 700; margin: 0; color: var(--ink); }
.game-card p { font-size: 0.85rem; color: var(--mute); margin: 0; line-height: 1.45; }
.game-card__cta {
    margin-top: auto;
    padding-top: var(--s-2);
    color: var(--purple-bright);
    font-weight: 700;
    font-size: 0.85rem;
}


/* ──────────────────── GAMES PORTAL (games.html) ──────────────────── */

.games-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    list-style: none;
    padding: 0;
    margin: var(--s-4) 0 0;
}
.games-stats li {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 215, 0, 0.22);
    color: rgba(255, 255, 255, 0.95);
    padding: 5px 12px;
    border-radius: var(--r-pill);
    font-size: 0.84rem;
    font-weight: 600;
}


/* ──────────────────── GAME PAGE LAYOUT ──────────────────── */

.game-board {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-6);
    margin: var(--s-6) auto;
    max-width: 760px;
    box-shadow: var(--shadow-md);
    text-align: center;
}
.game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-2);
    justify-content: center;
    margin-top: var(--s-4);
}
.game-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-5);
    justify-content: center;
    color: var(--mute);
    font-weight: 600;
    margin-bottom: var(--s-4);
}
.game-stats strong { color: var(--ink); }
.game-msg { min-height: 1.6em; margin: var(--s-3) 0; color: var(--mute); font-size: 0.95rem; }

.game-panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--s-4);
    margin: 0 auto var(--s-7);
    max-width: 760px;
}
@media (min-width: 760px) { .game-panels { grid-template-columns: 1fr 1fr; } }

.game-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5);
    color: var(--ink-2);
}
.game-panel h2 { font-size: 1.15rem; color: var(--ink); margin: 0 0 var(--s-3); }
.game-panel ul, .game-panel ol { margin: 0; padding-left: 1.3rem; }
.game-panel li { margin: 0 0 var(--s-2); }
.game-panel p:last-child, .game-panel ul:last-child { margin-bottom: 0; }

.more-games { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.more-games a {
    background: var(--surface-3);
    color: var(--purple-bright);
    border: 1px solid var(--line);
    padding: 6px 12px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}
.more-games a:hover { background: rgba(105, 38, 217, 0.12); }


/* ──────────────────── CONTACT FORM ──────────────────── */

.contact-form { display: flex; flex-direction: column; gap: var(--s-3); margin: var(--s-5) 0; }
.contact-form label { font-weight: 600; color: var(--ink); font-size: 0.9rem; }
.contact-form input,
.contact-form textarea {
    width: 100%;
    background: var(--surface);
    border: 1.5px solid var(--line-strong);
    color: var(--ink);
    border-radius: var(--r-md);
    padding: 0.7rem 0.9rem;
    font-family: inherit;
    font-size: 1rem;
}
.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--purple-bright);
    box-shadow: 0 0 0 3px rgba(105, 38, 217, 0.15);
}
.contact-form button { align-self: flex-start; }


/* ──────────────────── PUBLISHER NOTE (home) ──────────────────── */

.publisher-note {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    padding: var(--s-5);
    border-radius: 0 var(--r-md) var(--r-md) 0;
    margin: var(--s-7) auto;
    max-width: 760px;
}
.publisher-note__label {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold-deep);
    font-weight: 700;
    margin: 0 0 var(--s-2);
}
.publisher-note__text {
    font-family: var(--font-display);
    font-size: 1.15rem;
    line-height: 1.5;
    color: var(--ink);
    font-weight: 500;
    margin: 0 0 var(--s-3);
}
.publisher-note__link { color: var(--purple-bright); font-weight: 700; font-size: 0.92rem; }


/* ──────────────────── MOBILE ──────────────────── */

@media (max-width: 760px) {
    .site-header .nav-bar { flex-wrap: wrap; gap: var(--s-3); padding: var(--s-3) 0; }
    .nav-links { width: 100%; justify-content: flex-end; gap: var(--s-4); flex-wrap: wrap; }
    .nav-links a { font-size: 0.88rem; }
    .brand-text__eyebrow { font-size: 0.6rem; }
    .brand-text__name { font-size: 1rem; }

    .home-hero { padding: var(--s-7) 0 var(--s-8); }
    .home-hero__title { max-width: 100%; }

    .page-hero { padding: var(--s-6) 0 var(--s-7); }
    .page-hero__title { max-width: 100%; }

    .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
    .game-card { padding: var(--s-3); }
    .game-card h3 { font-size: 0.95rem; }
    .game-card p { font-size: 0.78rem; }
    .game-card__icon { font-size: 1.5rem; }

    .section-head { flex-direction: column; align-items: stretch; }
    .filter-chips { overflow-x: auto; padding-bottom: 4px; }
    .chip { white-space: nowrap; flex: 0 0 auto; }

    .game-board { padding: var(--s-4); margin: var(--s-4) auto; }
    .prose, .publisher-note { margin: var(--s-5) auto; padding-left: var(--s-1); padding-right: var(--s-1); }
}

@media (max-width: 420px) {
    .home-hero__actions { flex-direction: column; }
    .home-hero__actions .btn { width: 100%; }
    .games-grid { grid-template-columns: 1fr; }
}


/* ──────────────────── GAME PAGE COMPATIBILITY ────────────────────
   The 15 game pages still use legacy class names in their markup
   (`.game-page-hero`, `.game-page-title`, `.game-play`, `.game-panel`,
   `.game-section-title`, `.game-more-grid`). We style those with the
   new brand language so all game pages match the rest of the site
   without rewriting their per-game HTML/JS.

   Each game page's inline <style> references CSS variables that don't
   exist anymore (`--game-text-on-play`, `--game-muted-on-play`).
   Redefine them HERE so the inline styles resolve to brand-correct
   colours on the now-light game-play card. */

body.page-game {
    --game-primary: var(--gold);
    --game-secondary: var(--purple-bright);
    --game-text-on-play: var(--ink);
    --game-muted-on-play: var(--ink-2);
    --game-surface: var(--surface);
    --game-surface-end: var(--surface-3);
    --color-text-muted: var(--mute);
}

body.page-game .game-page-main { padding-bottom: 0; }

body.page-game .game-page-hero {
    background: linear-gradient(165deg, var(--purple-ink) 0%, var(--purple-deep) 60%, var(--purple-mid) 100%);
    color: #fff;
    margin: 0 calc(-1 * var(--s-4)) var(--s-5);
    padding: var(--s-6) var(--s-4) var(--s-6);
    position: relative;
    overflow: hidden;
    text-align: left;
    max-width: none;
    border-radius: 0 0 var(--r-lg) var(--r-lg);
}
@media (min-width: 720px) {
    body.page-game .game-page-hero {
        margin: 0 calc(-1 * var(--s-5)) var(--s-5);
        padding: var(--s-7) var(--s-6) var(--s-7);
    }
}
body.page-game .game-page-hero::before {
    content: "";
    position: absolute;
    top: -90px; right: -90px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.22), transparent 60%);
    pointer-events: none;
    z-index: 0;
}
body.page-game .game-page-hero > * { position: relative; z-index: 1; }
body.page-game .game-page-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4.5vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    margin: 0 0 var(--s-2);
    background: none;
    -webkit-text-fill-color: initial;
    -webkit-background-clip: initial;
    background-clip: initial;
    max-width: 28ch;
    text-wrap: balance;
}
body.page-game .game-page-lead {
    color: rgba(255, 255, 255, 0.78);
    font-size: clamp(0.98rem, 1.6vw, 1.05rem);
    line-height: 1.6;
    max-width: 60ch;
    margin: 0;
}

/* The interactive area on each game page */
body.page-game .game-play {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: var(--s-5) var(--s-5) var(--s-5);
    margin: 0 auto var(--s-5);
    max-width: 760px;
    box-shadow: var(--shadow-md);
    color: var(--ink);
    text-align: center;
}
body.page-game .game-play-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-3);
}
body.page-game .game-play-info {
    width: 100%;
    color: var(--mute);
    font-weight: 600;
}
body.page-game .game-play-info--row {
    display: flex;
    gap: var(--s-5);
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}
body.page-game .game-play-info p { margin: 0; color: var(--mute); }
body.page-game .game-play-info span,
body.page-game .game-play-info strong { color: var(--ink); font-weight: 700; }

body.page-game .game-control {
    background: linear-gradient(180deg, var(--gold-soft), var(--gold) 60%, var(--gold-deep));
    color: #2a1500;
    border: 0;
    padding: 0.6rem 1.1rem;
    border-radius: var(--r-pill);
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
}
body.page-game .game-control:hover { box-shadow: 0 4px 14px rgba(255, 215, 0, 0.4); }
body.page-game .touch-controls { display: flex; gap: var(--s-2); flex-wrap: wrap; justify-content: center; }

/* Game UI rendering area: dark backdrop for canvas-based games only.
   #game-board is reused across games with very different layouts
   (Minesweeper = grid of cells, Tetris = grid of blocks, etc.) so
   we don't force display: block on it — each game's inline <style>
   owns its own layout. */
body.page-game .game-play canvas {
    background: var(--purple-ink);
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    max-width: 100%;
    margin: 0 auto;
    display: block;
}

body.page-game .game-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-5);
    margin: 0 auto var(--s-4);
    max-width: 760px;
    color: var(--ink-2);
}
body.page-game .game-panel:last-of-type { margin-bottom: var(--s-8); }
body.page-game .game-section-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--ink);
    margin: 0 0 var(--s-3);
    background: none;
    -webkit-text-fill-color: initial;
    -webkit-background-clip: initial;
    background-clip: initial;
}
body.page-game .game-panel ul,
body.page-game .game-panel ol { margin: 0; padding-left: 1.3rem; }
body.page-game .game-panel li { margin: 0 0 var(--s-2); }
body.page-game .game-panel p:last-child,
body.page-game .game-panel ul:last-child { margin-bottom: 0; }

body.page-game .game-more-intro { color: var(--mute); margin: 0 0 var(--s-3); }
body.page-game .game-more-grid { display: flex; flex-wrap: wrap; gap: var(--s-2); }
body.page-game .game-more-grid a {
    background: var(--surface-3);
    color: var(--purple-bright);
    border: 1px solid var(--line);
    padding: 6px 12px;
    border-radius: var(--r-pill);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
}
body.page-game .game-more-grid a:hover { background: rgba(105, 38, 217, 0.12); }

/* Per-game-specific styles in inline <style> blocks override on top of this */


/* ──────────────────── MEMORY MATCH ──────────────────── */

.memory-game {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--s-3);
    max-width: 480px;
    margin: 0 auto;
}
.memory-card {
    aspect-ratio: 1 / 1;
    background: linear-gradient(160deg, var(--purple-bright) 0%, var(--purple-mid) 100%);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: transparent;
    user-select: none;
    transition: transform 0.18s ease, background 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.memory-card:hover { transform: translateY(-2px); }
.memory-card.flipped {
    background: linear-gradient(160deg, var(--gold-soft) 0%, var(--gold) 60%, var(--gold-deep) 100%);
    color: #2a1500;
    transform: scale(0.97);
    cursor: default;
}
@media (max-width: 520px) {
    .memory-game { gap: var(--s-2); max-width: 360px; }
    .memory-card { font-size: 1.8rem; }
}


/* Tetris and other canvas/grid games keep their own per-game layout
   in their inline <style> blocks. We only set CSS variables so they
   resolve to brand colours instead of legacy ones. */


/* ──────────────────── RPS / TIC-TAC-TOE / WORD / MATH ──────────────────── */

.rps-choices { display: flex; gap: var(--s-3); justify-content: center; margin-bottom: var(--s-4); }
.rps-choice {
    font-size: 2.4rem;
    background: var(--surface-3);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-md);
    padding: 14px 22px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.rps-choice:hover { transform: scale(1.06); border-color: var(--purple-bright); background: rgba(105, 38, 217, 0.06); }
#result { font-size: 1.05rem; color: var(--ink); margin: var(--s-3) 0; min-height: 2.5em; font-weight: 600; }
.rps-score { color: var(--mute); font-weight: 600; }
.rps-score strong, .rps-score span { color: var(--ink); }

/* Tic-Tac-Toe + Simon Says + Math + Word: use brand text colors on light card */
body.page-game #ttt-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-2);
    max-width: 280px;
    margin: 0 auto;
}
body.page-game #ttt-board > * {
    aspect-ratio: 1 / 1;
    background: var(--surface-3);
    border: 1.5px solid var(--line-strong);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    cursor: pointer;
    font-weight: 800;
    color: var(--purple-bright);
}
body.page-game #ttt-board > *:hover { background: rgba(105, 38, 217, 0.06); }

/* =========================================================================
   Ad slots — fixed dimensions, zero CLS

   Each <ins class="adsbygoogle"> sits inside a container that reserves
   the exact ad size + 24px for the "Advertisement" label, so layout
   does not shift when AdSense fills the slot. Dimensions match the
   fixed-size unit configured in AdSense console — do not change without
   regenerating the corresponding ad unit there.
   ========================================================================= */
.ad-slot {
    position: relative;
    margin: 28px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.025);
    border-radius: 8px;
    overflow: hidden;
}
.ad-slot::before {
    content: "Advertisement";
    position: absolute;
    top: 4px; left: 50%;
    transform: translateX(-50%);
    font-size: 9.5px;
    letter-spacing: 1.2px;
    color: rgba(0, 0, 0, 0.4);
    text-transform: uppercase;
    pointer-events: none;
    z-index: 1;
}
.ad-slot .adsbygoogle {
    display: inline-block !important;
    z-index: 2;
}

/* 300x250 medium rectangle — primary fixed unit. */
.ad-slot--rect {
    width: 300px;
    height: 280px;
    padding-top: 24px;
}

/* 320x100 large mobile banner — bottom-of-content position. */
.ad-slot--banner {
    width: 320px;
    height: 124px;
    padding-top: 24px;
}

/* In-feed variant: sits inside the games grid spanning the full row.
   Spanning is necessary so the 300px fixed width above doesn't force
   every grid column to 300px (which collapses the multi-column game
   layout). We then cap the visible container at ~336px so the 300×250
   ad sits centered with breathing room — without this, the container
   stretches the full row width (e.g. 1072px on desktop) leaving a
   vast empty band around a small ad. */
.ad-slot--infeed {
    grid-column: 1 / -1;
    width: 336px;
    max-width: 100%;
    min-width: 0;
    margin: var(--s-2) auto;
}

/* Matched-content / multiplex — recommendation grid.
   AdSense's autorelaxed sizing scales height proportional to width
   (~width × 1.1 unfilled, ~width × 0.7 filled). Cap the width at 720px
   so the slot stays around 500-600px tall even on wide desktop —
   wider than that and it dominates the viewport.
   Also cap max-height as a safety net for any pathological case. */
.ad-slot--multiplex {
    width: 100%;
    max-width: 720px;
    min-height: 280px;
    max-height: 600px;
    padding-top: 24px;
    margin-left: auto;
    margin-right: auto;
}
.ad-slot--multiplex .adsbygoogle {
    display: block !important;
    width: 100%;
    max-height: 576px;     /* match parent inner area (600 - 24 padding) */
}

/* Spacer before bottom-of-screen ads — keeps ~60px clear from the
   preceding CTA button to prevent misclick policy violations. */
.ad-spacer-cta {
    height: 60px;
    pointer-events: none;
}
