/* MindForge — self-contained styles, system fonts only (no external requests). */

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

:root {
    --bg: #f6f1ea;
    --surface: #fffaf3;
    --surface-2: #efe6da;
    --ink: #1f1a17;
    --muted: #6b5f55;
    --line: #dccfbf;
    --ember: #d9531e;
    --ember-2: #f29a2e;
    --steel: #2f4858;
    --ok: #2e8b57;
    --bad: #c0392b;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(60, 35, 15, 0.08);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14110f;
        --surface: #1d1916;
        --surface-2: #27211c;
        --ink: #f3ebe1;
        --muted: #a8998b;
        --line: #3a312a;
        --ember: #ff6a2b;
        --ember-2: #ffb347;
        --steel: #8fb3c7;
        --ok: #4cc38a;
        --bad: #ff6b5b;
        --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    }
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    overflow-x: hidden;
}

a { color: inherit; }

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(16px, 4vw, 48px);
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.01em;
}

.brand-mark { width: 28px; height: 28px; }
.brand-mark path { fill: var(--steel); }
.brand-mark circle { fill: var(--ember); }

.topnav { display: flex; align-items: center; gap: 1.2rem; font-size: 0.95rem; }
.topnav a { text-decoration: none; color: var(--muted); }
.topnav a:hover { color: var(--ember); }
.topnav .lang {
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--line);
    border-radius: 6px;
}

main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* Hero */
.hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 2rem;
    padding: clamp(2.5rem, 7vw, 5.5rem) 0 3rem;
}

.kicker {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ember);
    margin-bottom: 1rem;
}

.hero h1 {
    font-size: clamp(2.3rem, 6vw, 4.2rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    font-weight: 800;
}

.hero h1 em {
    font-style: normal;
    background: linear-gradient(90deg, var(--ember), var(--ember-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lead { margin: 1.4rem 0 2rem; font-size: 1.08rem; color: var(--muted); max-width: 36em; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.btn {
    display: inline-block;
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    padding: 0.8rem 1.4rem;
    border-radius: 10px;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: default; }

.btn-primary { background: var(--ember); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--ember) 35%, transparent); }
.btn-primary:hover { background: color-mix(in srgb, var(--ember) 88%, #000); }
.btn-ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--ember); }

.stats { display: flex; gap: 2rem; margin-top: 2.4rem; flex-wrap: wrap; }
.stats dt { font-size: 1.8rem; font-weight: 800; color: var(--steel); }
.stats dd { font-size: 0.85rem; color: var(--muted); }

.hero-art { display: flex; justify-content: center; }
.anvil { width: min(100%, 380px); height: auto; }
.anvil .links line { stroke: var(--line); stroke-width: 2; }
.anvil .nodes circle { fill: var(--steel); animation: pulse 3.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.anvil .nodes circle:nth-child(2n) { animation-delay: 0.8s; }
.anvil .nodes circle:nth-child(3n) { animation-delay: 1.6s; }
.anvil .nodes .core { fill: var(--ember); }
.anvil .anvil-body { fill: var(--steel); opacity: 0.9; }
.anvil .sparks circle { fill: var(--ember-2); transform-box: fill-box; animation: spark 2.4s ease-out infinite; }
.anvil .sparks circle:nth-child(1) { --dx: -40px; --dy: -50px; }
.anvil .sparks circle:nth-child(2) { --dx: 35px; --dy: -60px; animation-delay: 0.4s; }
.anvil .sparks circle:nth-child(3) { --dx: -60px; --dy: -20px; animation-delay: 0.9s; }
.anvil .sparks circle:nth-child(4) { --dx: 55px; --dy: -25px; animation-delay: 1.3s; }
.anvil .sparks circle:nth-child(5) { --dx: 5px; --dy: -70px; animation-delay: 1.8s; }

@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes spark {
    0% { transform: translate(0, 0); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .anvil .nodes circle, .anvil .sparks circle { animation: none; }
}

/* Sections */
section h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); letter-spacing: -0.02em; margin-bottom: 0.6rem; }
.section-desc { color: var(--muted); margin-bottom: 1.6rem; }

.skills { padding: 3rem 0; border-top: 1px solid var(--line); }
.skill-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1.6rem; }
.skill {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: var(--shadow);
}
.skill-num { font-family: var(--mono); color: var(--ember); font-size: 0.85rem; }
.skill h3 { margin: 0.5rem 0; font-size: 1.15rem; }
.skill p { color: var(--muted); font-size: 0.95rem; }

/* Games */
.play { padding: 3rem 0; border-top: 1px solid var(--line); }

.tabs { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tab {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
}
.tab.active { background: var(--steel); border-color: var(--steel); color: var(--bg); }

.game {
    display: none;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: clamp(1rem, 3vw, 2rem);
    box-shadow: var(--shadow);
    text-align: center;
}
.game.active { display: block; }
.game-desc { color: var(--muted); margin-bottom: 1rem; }

.hud {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-family: var(--mono);
    font-size: 0.95rem;
    margin-bottom: 1rem;
    min-height: 1.5em;
}

.game-result { min-height: 1.6em; margin: 1rem 0; font-weight: 700; color: var(--steel); }

.schulte-grid, .seq-grid {
    display: grid;
    gap: 6px;
    margin: 0 auto;
    width: min(100%, 360px);
}
.schulte-grid { grid-template-columns: repeat(5, 1fr); }
.seq-grid { grid-template-columns: repeat(3, 1fr); width: min(100%, 300px); gap: 10px; }

.cell {
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    font-size: clamp(1rem, 4vw, 1.4rem);
    cursor: pointer;
    user-select: none;
}
.cell.hit { background: color-mix(in srgb, var(--ok) 25%, var(--surface-2)); color: var(--muted); }
.cell.miss { animation: shake 0.25s; background: color-mix(in srgb, var(--bad) 30%, var(--surface-2)); }
.cell:disabled { cursor: default; }

.seq-cell { border-radius: 12px; }
.seq-cell.lit { background: var(--ember); border-color: var(--ember); box-shadow: 0 0 18px var(--ember); }
.seq-cell.wrong { background: var(--bad); border-color: var(--bad); }

@keyframes shake {
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

.stroop-word {
    font-size: clamp(2rem, 9vw, 3.6rem);
    font-weight: 900;
    letter-spacing: 0.04em;
    margin: 0.5rem 0 1.2rem;
    min-height: 1.3em;
}

.stroop-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; max-width: 420px; margin: 0 auto; }
.stroop-options button {
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    padding: 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink);
}
.stroop-options button:disabled { cursor: default; opacity: 0.6; }

/* Ink colours for Stroop — chosen to read in both themes */
.ink-0 { color: #d63031; }
.ink-1 { color: #1e9e57; }
.ink-2 { color: #2d6cdf; }
.ink-3 { color: #d4a300; }

/* Beta form */
.beta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
    margin: 3rem 0 4rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border-radius: calc(var(--radius) + 6px);
    background: var(--steel);
    color: #f6f1ea;
}
.beta p { opacity: 0.85; margin-top: 0.6rem; }

.lead-form { display: flex; flex-direction: column; gap: 0.7rem; }
.lead-form input, .lead-form select {
    font: inherit;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #fffaf3;
    color: #1f1a17;
}
.lead-form input:focus, .lead-form select:focus { outline: 2px solid var(--ember-2); }

.form-message { padding: 0.7rem 1rem; border-radius: 10px; font-weight: 600; }
.form-message.success { background: rgba(46, 139, 87, 0.25); }
.form-message.error { background: rgba(192, 57, 43, 0.3); }

@media (prefers-color-scheme: dark) {
    .beta { background: #223744; }
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem 16px 3rem;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
}
.footer .copy { font-family: var(--mono); font-size: 0.8rem; margin-top: 0.3rem; }

/* Responsive */
@media (max-width: 900px) {
    .skill-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    .hero { grid-template-columns: 1fr; }
    .hero-art { order: -1; }
    .anvil { width: min(70%, 260px); }
    .beta { grid-template-columns: 1fr; }
    .topnav a:not(.lang) { display: none; }
}

@media (max-width: 480px) {
    .skill-grid { grid-template-columns: 1fr; }
    .stats { gap: 1.2rem; }
}
