/* Shared styles for the Brain Puzzlr Retro and Jr. pages. Each page picks a
   theme with a class on <body>. */
:root { --focus: #f59e0b; }

.theme-retro {
    --bg: #150a2e;
    --bg-alt: #1f1042;
    --card: #2a1755;
    --line: rgba(255, 255, 255, 0.16);
    --ink: #f7f2ff;
    --muted: #cfc4ea;
    --accent: #ffd76a;
    --hero: linear-gradient(180deg, #0d0620 0%, #2b1060 62%, #5a1a78 100%);
    --hero-ink: #ffffff;
    --hero-muted: #e6dcfa;
    --button-bg: #ffd76a;
    --button-ink: #1d0f3f;
    --tile-1: #ff5fb0;
    --tile-2: #38d9e8;
    --tile-3: #ffd76a;
    --footer: #0d0620;
}

.theme-jr {
    --bg: #fffaf3;
    --bg-alt: #f1f4ff;
    --card: #ffffff;
    --line: #dde3f5;
    --ink: #22337d;
    --muted: #4c5a8f;
    --accent: #c2286e;
    --hero: linear-gradient(120deg, #fff1d9 0%, #ffe3f0 50%, #dfeaff 100%);
    --hero-ink: #22337d;
    --hero-muted: #3f4f8c;
    --button-bg: #22337d;
    --button-ink: #ffffff;
    --tile-1: #ff6f91;
    --tile-2: #18b8b4;
    --tile-3: #ffb020;
    --footer: #22337d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
}

a { color: inherit; }
a:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
img { display: block; max-width: 100%; }

.wrap { width: min(100% - 40px, 1120px); margin: 0 auto; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 0 0;
    color: var(--hero-ink);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    text-decoration: none;
}

.mark {
    display: grid;
    grid-template-columns: repeat(2, 14px);
    grid-template-rows: repeat(2, 14px);
    gap: 3px;
}

.mark span { border-radius: 5px; }
.mark span:nth-child(1) { background: #ff5d6c; }
.mark span:nth-child(2) { background: #ffc947; }
.mark span:nth-child(3) { background: #18b8b4; }
.mark span:nth-child(4) { background: #7c3aed; }

.navlinks {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 0.95rem;
    font-weight: 700;
}

.navlinks a { text-decoration: none; }
.navlinks a:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero { background: var(--hero); color: var(--hero-ink); }
.hero-copy { padding: 64px 0 40px; text-align: center; }

.eyebrow {
    margin: 0 0 16px;
    color: var(--hero-muted);
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1 {
    margin: 0;
    font-size: clamp(2.8rem, 8vw, 5.6rem);
    line-height: 0.98;
}

.lede {
    max-width: 620px;
    margin: 20px auto 0;
    color: var(--hero-muted);
    font-size: clamp(1.1rem, 2vw, 1.3rem);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 30px;
}

.coming-soon,
.button,
.secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    border-radius: 8px;
    padding: 0 20px;
    font-weight: 800;
    text-decoration: none;
}

.coming-soon,
.button { background: var(--button-bg); color: var(--button-ink); }
.secondary-button { border: 1px solid currentColor; }

.hero-art { padding-bottom: 48px; }
.hero-art img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(13, 16, 38, 0.3);
}

.section { padding: 64px 0; }
.section-alt { background: var(--bg-alt); }

.section-header { max-width: 680px; margin-bottom: 28px; }

.section-header h2,
.final-cta h2 {
    margin: 0 0 10px;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.05;
}

.section-header p,
.final-cta p { margin: 0; color: var(--muted); font-size: 1.08rem; }

.games-grid { display: grid; gap: 16px; }
.theme-jr .games-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Five games: two wide cards above three narrower ones. */
.theme-retro .games-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.theme-retro .game-card { grid-column: span 2; }
.theme-retro .game-card:nth-child(-n+2) { grid-column: span 3; }

.game-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
}

.game-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.game-copy { padding: 18px 20px 20px; }

.game-tag {
    display: block;
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.game-card h3 { margin: 0 0 4px; font-size: 1.25rem; line-height: 1.15; }
.game-card p { margin: 0; color: var(--muted); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.feature {
    padding: 24px;
    border: 1px solid var(--line);
    border-top-width: 5px;
    border-radius: 10px;
    background: var(--card);
}

.feature:nth-child(1) { border-top-color: var(--tile-1); }
.feature:nth-child(2) { border-top-color: var(--tile-2); }
.feature:nth-child(3) { border-top-color: var(--tile-3); }
.feature h3 { margin: 0 0 8px; font-size: 1.25rem; }
.feature p { margin: 0; color: var(--muted); }

.final-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
}

footer { background: var(--footer); color: #e2e8f0; }

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 0;
    font-size: 0.95rem;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: #fff; text-underline-offset: 4px; }

@media (max-width: 860px) {
    .navlinks { display: none; }
    .feature-grid { grid-template-columns: 1fr; }
    .theme-jr .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-retro .games-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-retro .game-card,
    .theme-retro .game-card:nth-child(-n+2) { grid-column: span 1; }
    .theme-retro .game-card:first-child { grid-column: span 2; }
    .theme-jr .game-card:last-child { grid-column: span 2; }
    .final-cta, .footer-inner { align-items: flex-start; flex-direction: column; }
    .section { padding: 48px 0; }
}

/* Phones: compact rows, so nine or five cards don't become a very long page. */
@media (max-width: 520px) {
    .wrap { width: min(100% - 32px, 1120px); }
    .hero-copy { padding-top: 44px; }
    .hero-actions > * { width: 100%; }
    .theme-jr .games-grid,
    .theme-retro .games-grid { grid-template-columns: 1fr; }
    .theme-retro .game-card,
    .theme-retro .game-card:nth-child(-n+2),
    .theme-retro .game-card:first-child,
    .theme-jr .game-card:last-child { grid-column: auto; }
    .game-card { display: flex; align-items: stretch; }
    .game-card img { flex: 0 0 104px; width: 104px; aspect-ratio: auto; }
    .game-copy { padding: 14px 16px; }
    .game-card h3 { font-size: 1.1rem; }
    .game-card p { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}
