/* ==========================================================================
   The Trading Quest
   Dark first, light on request. Tokens up top, components below.
   ========================================================================== */

:root {
    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Space Grotesk', var(--font-sans);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;

    --container: 1180px;
    --container-narrow: 740px;
    --gutter: clamp(16px, 4vw, 32px);

    --ease: cubic-bezier(.2, .7, .2, 1);
}

[data-theme='dark'] {
    color-scheme: dark;
    --bg: #07090d;
    --bg-soft: #0c1016;
    --surface: #10151d;
    --surface-2: #151c26;
    --border: #1e2733;
    --border-strong: #2b3747;
    --text: #e8edf3;
    --text-soft: #b4c0cd;
    --muted: #7d8b9b;
    --accent: #34d399;
    --accent-2: #2dd4bf;
    --accent-strong: #10b981;
    --accent-ink: #03140d;
    --accent-soft: rgba(52, 211, 153, .12);
    --up: #34d399;
    --down: #f87171;
    --plan: #8b9bb0;
    --warn: #fbbf24;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 20px 50px -20px rgba(0, 0, 0, .6);
    --glow: rgba(52, 211, 153, .18);
    --grid-line: rgba(255, 255, 255, .045);
}

[data-theme='light'] {
    color-scheme: light;
    --bg: #f6f7f9;
    --bg-soft: #eef1f4;
    --surface: #ffffff;
    --surface-2: #f3f5f8;
    --border: #e3e7ed;
    --border-strong: #cfd6df;
    --text: #0b1220;
    --text-soft: #334155;
    --muted: #64748b;
    --accent: #059669;
    --accent-2: #0d9488;
    --accent-strong: #047857;
    --accent-ink: #ffffff;
    --accent-soft: rgba(5, 150, 105, .09);
    --up: #059669;
    --down: #dc2626;
    --plan: #94a3b8;
    --warn: #d97706;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -12px rgba(15, 23, 42, .12);
    --glow: rgba(16, 185, 129, .14);
    --grid-line: rgba(15, 23, 42, .05);
}

/* Base
   ========================================================================== */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    transition: background-color .3s var(--ease), color .3s var(--ease);
}

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -.02em;
    line-height: 1.1;
}

p { margin: 0; }

::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.mono { font-family: var(--font-mono); font-feature-settings: 'zero' 1; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.center { text-align: center; }

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

.skip-link {
    position: absolute; left: 16px; top: -60px; z-index: 100;
    padding: 10px 16px; border-radius: var(--radius-sm);
    background: var(--accent); color: var(--accent-ink); font-weight: 600;
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.container--narrow { max-width: calc(var(--container-narrow) + var(--gutter) * 2); }

/* Brand mark: the logo PNG used as a mask, so it can take any color */

.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 18px; font-weight: 500; letter-spacing: -.02em; white-space: nowrap; }
.brand b { font-weight: 700; color: var(--accent); }

.brand__mark {
    display: inline-block;
    width: 28px;
    aspect-ratio: 640 / 741;
    background: var(--accent);
    -webkit-mask: url("../images/logo-mark.fd7a8c67bd08.png") center / contain no-repeat;
    mask: url("../images/logo-mark.fd7a8c67bd08.png") center / contain no-repeat;
    flex-shrink: 0;
}

/* Ticker
   ========================================================================== */

.ticker {
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
    white-space: nowrap;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.ticker__track { display: flex; width: max-content; animation: ticker 45s linear infinite; }
.ticker:hover .ticker__track { animation-play-state: paused; }
.ticker__group { display: flex; }
.ticker__item { padding: 8px 22px; border-right: 1px solid var(--border); }
.ticker__item b { color: var(--text-soft); font-weight: 500; margin-right: 6px; }
.ticker__item em { font-style: normal; }

@keyframes ticker { to { transform: translateX(-50%); } }

/* Navigation
   ========================================================================== */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 68px; }

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-soft);
    font-size: 15px;
    font-weight: 500;
    transition: color .15s, background-color .15s;
}
.nav__links a:hover { color: var(--text); background: var(--surface-2); }
.nav__links a[aria-current='page'] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }

.nav__actions { display: flex; align-items: center; gap: 8px; }
.icon-btn.nav__toggle { display: none; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    cursor: pointer;
    transition: color .15s, border-color .15s, transform .15s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.95); }
.icon-btn svg { width: 18px; height: 18px; }

[data-theme='dark'] .icon-sun { display: block; }
[data-theme='dark'] .icon-moon { display: none; }
[data-theme='light'] .icon-sun { display: none; }
[data-theme='light'] .icon-moon { display: block; }

@media (max-width: 860px) {
    .icon-btn.nav__toggle { display: inline-grid; }
    .btn.nav__cta { display: none; }
    .nav__links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 12px var(--gutter) 20px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .2s var(--ease), transform .2s var(--ease), visibility .2s;
    }
    .nav__links a { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 16px; }
    .nav.is-open .nav__links { opacity: 1; visibility: visible; transform: none; }
}

/* Buttons, pills, tags
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 22px;
    border: 1px solid transparent;
    border-radius: 999px;
    font: 600 15px/1 var(--font-sans);
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s, transform .15s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn--sm { height: 38px; padding: 0 16px; font-size: 14px; }

.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 0 0 0 var(--glow), 0 8px 24px -8px var(--glow);
}
.btn--primary:hover { background: var(--accent-strong); box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 30px -8px var(--glow); }
[data-theme='dark'] .btn--primary:hover { background: #4ee2ad; }

.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
}

.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--up); }
.live-dot::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background: var(--up); animation: ping 1.8s var(--ease) infinite;
}
.live-dot--wait, .live-dot--wait::after { background: var(--warn); }

.notice { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; padding: 18px 22px; border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--warn) 8%, transparent); color: var(--text-soft); }
.notice .live-dot { margin-top: 8px; flex-shrink: 0; }
.notice strong { color: var(--text); }

@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.tag {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
    transition: background-color .15s;
}
.tag:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

.eyebrow {
    display: inline-block;
    margin-bottom: 14px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.label { display: block; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: 14px; }

.link-arrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; font-size: 15px; }
.link-arrow span { transition: transform .2s var(--ease); }
.link-arrow:hover span, a:hover > .link-arrow span { transform: translateX(4px); }

.gradient-text {
    background: linear-gradient(100deg, var(--accent) 10%, var(--accent-2) 55%, #a7f3d0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
[data-theme='light'] .gradient-text { background-image: linear-gradient(100deg, #047857, #0d9488 60%, #059669); }

/* Hero
   ========================================================================== */

.hero { position: relative; padding: clamp(48px, 8vw, 96px) 0 clamp(40px, 6vw, 72px); overflow: hidden; }

.hero__bg {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(600px 400px at 78% 30%, var(--glow), transparent 70%),
        radial-gradient(500px 300px at 10% 0%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px,
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px;
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 40%, transparent 100%);
    mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 40%, transparent 100%);
}

.hero__grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 5vw, 64px); align-items: center; }

.hero__title {
    margin: 22px 0 22px;
    font-size: clamp(42px, 6.4vw, 78px);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.02;
}

.hero__lead { max-width: 540px; color: var(--text-soft); font-size: clamp(17px, 1.6vw, 19px); line-height: 1.65; }

.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero__actions--center { justify-content: center; }

@media (max-width: 960px) {
    .hero__grid { grid-template-columns: 1fr; }
}

/* Terminal card */

.terminal {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.terminal::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 45%, transparent), transparent 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.terminal__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-soft);
}
.dots { display: flex; gap: 6px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.dots i:first-child { background: #f87171; opacity: .8; }
.dots i:nth-child(2) { background: #fbbf24; opacity: .8; }
.dots i:nth-child(3) { background: #34d399; opacity: .8; }

.terminal__body { display: grid; gap: 22px; padding: 22px; }

.terminal__balance strong { display: block; margin: 4px 0 2px; font-size: clamp(34px, 4vw, 44px); font-weight: 600; letter-spacing: -.04em; line-height: 1.1; }

.delta { font-family: var(--font-mono); font-size: 13px; }

/* Stats */

.stats { display: grid; gap: 12px; }
.stats--3 { grid-template-columns: repeat(3, 1fr); }
.stats--4 { grid-template-columns: repeat(4, 1fr); }
.stat { display: grid; gap: 4px; align-content: start; min-width: 0; }
.stat strong { font-size: 18px; font-weight: 600; letter-spacing: -.02em; overflow-wrap: anywhere; }
.terminal .stat { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-soft); }
.terminal .stat .label { font-size: 11px; }

.stats--cards { margin-bottom: 20px; }
.stats--cards .stat { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stats--cards .stat strong { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.03em; }

@media (max-width: 860px) { .stats--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) {
    .stats--3 { grid-template-columns: 1fr 1fr; }
    .stats--3 .stat:last-child { grid-column: span 2; }
}

/* Progress */

.progress { display: grid; gap: 8px; }
.progress__head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.progress__track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.progress__fill {
    position: relative;
    height: 100%;
    min-width: 10px;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-strong), var(--accent), var(--accent-2));
    box-shadow: 0 0 16px var(--glow);
}
.progress .hint { font-size: 12px; }
.progress--lg .progress__track { height: 16px; }
.progress__scale { position: relative; height: 18px; color: var(--muted); font-size: 12px; }
.progress__scale span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.progress__scale span::before { content: ''; position: absolute; left: 50%; top: -12px; width: 1px; height: 6px; background: var(--border-strong); }
.progress__scale span:first-child { transform: none; }
.progress__scale span:first-child::before { left: 0; }
.progress__scale span:last-child { transform: translateX(-100%); }
.progress__scale span:last-child::before { left: auto; right: 0; }
.progress--lg { margin-bottom: 16px; }

/* Chart
   ========================================================================== */

.chart { position: relative; margin: 0; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart__grid line { stroke: var(--border); stroke-width: 1; }
.chart__xtick { stroke: var(--grid-line); stroke-dasharray: 2 4; }
.chart__labels text { fill: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.chart__plan { fill: none; stroke: var(--plan); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: .8; }
.chart__actual { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart__today { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 3 3; opacity: .6; }
.chart__dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart__pulse { fill: var(--accent); opacity: .5; transform-box: fill-box; transform-origin: center; animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(3.2); opacity: 0; } }

.chart__legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; color: var(--muted); font-size: 13px; }
.chart__legend span { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; width: 18px; height: 0; border-top: 2.5px solid var(--accent); }
.swatch--plan { border-top: 2px dashed var(--plan); }
.swatch--today { border-top: 2px dashed var(--warn); width: 12px; }

.chart--compact .chart__legend { font-size: 12px; margin-top: 10px; gap: 6px 14px; }
.chart--compact .swatch--today, .chart--compact .chart__legend span:last-child { display: none; }

/* Sections
   ========================================================================== */

.section { padding: clamp(48px, 7vw, 88px) 0; }
.section--tight { padding: clamp(32px, 5vw, 56px) 0 clamp(24px, 4vw, 48px); }
.section--flush { padding-top: 0; }
.section + .section { padding-top: 0; }

.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.section__head h2 { font-size: clamp(28px, 3.4vw, 40px); }

.page-head { padding: clamp(48px, 7vw, 88px) 0 clamp(32px, 4vw, 48px); }
.page-head h1 { font-size: clamp(38px, 5.4vw, 64px); font-weight: 700; letter-spacing: -.035em; }
.page-head .lead { max-width: 640px; margin-top: 18px; color: var(--text-soft); font-size: clamp(17px, 1.6vw, 19px); }
.page-head--center { text-align: center; }
.page-head--center .lead { margin-left: auto; margin-right: auto; }

.section__head--center { justify-content: center; text-align: center; }
.section__head--spaced { margin-top: clamp(56px, 7vw, 88px); }

/* Two sides of the blog */

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.side {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: clamp(24px, 3.5vw, 36px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .25s, transform .25s var(--ease), box-shadow .25s;
}
.side:hover { border-color: var(--border-strong); transform: translateY(-3px); box-shadow: var(--shadow); }
.side--accent { background: radial-gradient(420px 220px at 100% 0%, var(--glow), transparent 70%), var(--surface); }
.side__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 6px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.side__icon svg { width: 24px; height: 24px; }
.side h3 { font-size: clamp(22px, 2.4vw, 26px); }
.side p { color: var(--text-soft); }
.side .link-arrow { margin-top: auto; padding-top: 8px; }

.checklist { display: grid; gap: 10px; margin: 4px 0 8px; padding: 0; list-style: none; }
.checklist li { position: relative; padding-left: 28px; color: var(--text-soft); font-size: 15px; }
.checklist li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2334d399' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}

@media (max-width: 760px) { .sides { grid-template-columns: 1fr; } }

/* Rules */

.rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--border); overflow: hidden; }
.rule { padding: 26px; background: var(--surface); transition: background-color .2s; }
.rule:hover { background: var(--surface-2); }
.rule__num { display: block; margin-bottom: 18px; color: var(--accent); font-size: 13px; }
.rule h3 { margin-bottom: 8px; font-size: 19px; }
.rule p { color: var(--text-soft); font-size: 15px; }
.rule b { color: var(--text); font-weight: 600; }

@media (max-width: 960px) { .rules { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .rules { grid-template-columns: 1fr; } }

/* Cards
   ========================================================================== */

.grid { display: grid; gap: 24px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 960px) { .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid--3 { grid-template-columns: 1fr; } }

.card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    transition: transform .25s var(--ease), border-color .25s, box-shadow .25s;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card__media img { transform: scale(1.04); }

.card__placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 70% 30%, var(--glow), transparent 60%),
        linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 24px 24px,
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 24px 24px,
        var(--surface-2);
}
.card__placeholder .brand__mark { width: 56px; opacity: .8; }

.card__body { display: flex; flex-direction: column; gap: 12px; padding: 20px 22px 24px; flex: 1; }
.card__title { font-size: 21px; line-height: 1.25; }
.card__title a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .3s var(--ease); }
.card__title a:hover { background-size: 100% 1px; }
.card__intro { color: var(--text-soft); font-size: 15px; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 13px; }

/* Featured post */

.featured {
    display: grid;
    grid-template-columns: 1.25fr 1fr;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    transition: border-color .25s, box-shadow .25s;
}
.featured:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.featured__media { display: block; min-height: 320px; background: var(--surface-2); overflow: hidden; }
.featured__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.featured:hover .featured__media img { transform: scale(1.03); }
.featured__body { display: flex; flex-direction: column; justify-content: center; gap: 16px; padding: clamp(24px, 4vw, 48px); }
.featured__title { font-size: clamp(26px, 3vw, 36px); line-height: 1.15; }
.featured__body p { color: var(--text-soft); font-size: 17px; }

@media (max-width: 860px) {
    .featured { grid-template-columns: 1fr; }
    .featured__media { min-height: 0; aspect-ratio: 16 / 9; }
}

/* Empty state */

.empty { display: grid; justify-items: center; gap: 12px; padding: 64px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); text-align: center; }
.empty .brand__mark { width: 40px; margin-bottom: 8px; opacity: .7; }
.empty h2 { font-size: 24px; }
.empty p { color: var(--muted); }

/* Blog index
   ========================================================================== */

.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-top: 36px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 500;
    transition: border-color .15s, color .15s, background-color .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-current='page'] { background: var(--text); border-color: var(--text); color: var(--bg); }
.chip__count { color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.chip[aria-current='page'] .chip__count { color: inherit; opacity: .6; }

.search { position: relative; flex: 0 1 300px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 40px; height: 42px; border-radius: 999px; }

.results-note { margin-bottom: 24px; color: var(--muted); }
.results-note a { color: var(--accent); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 48px; font-size: 14px; }

@media (max-width: 620px) { .search { flex-basis: 100%; } }

/* Post detail
   ========================================================================== */

.read-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 3px; pointer-events: none; }
.read-progress span { display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: 0 50%; background: linear-gradient(90deg, var(--accent-strong), var(--accent-2)); box-shadow: 0 0 10px var(--glow); }

.post__head { padding: clamp(40px, 6vw, 72px) 0 clamp(28px, 4vw, 40px); }
.back-link { display: inline-block; margin-bottom: 28px; color: var(--muted); font-size: 14px; font-weight: 500; transition: color .15s; }
.back-link:hover { color: var(--text); }
.post__title { margin: 18px 0; font-size: clamp(36px, 5vw, 56px); font-weight: 700; letter-spacing: -.035em; line-height: 1.06; }
.post__intro { color: var(--text-soft); font-size: clamp(18px, 1.9vw, 21px); line-height: 1.55; }

.byline { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--border); font-size: 14px; }
.byline div { display: grid; line-height: 1.35; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--border); }
.avatar .brand__mark { width: 20px; }

.post__cover-wrap { max-width: 1040px; margin-bottom: clamp(32px, 5vw, 56px); }
.post__cover { width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--border); }

.draft-banner { margin-bottom: 24px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius-sm); background: color-mix(in srgb, var(--warn) 10%, transparent); color: var(--warn); font-size: 14px; font-weight: 500; }

.post__share { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 56px; padding: 20px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.share { display: flex; gap: 8px; }
.icon-btn.is-copied { color: var(--accent); border-color: var(--accent); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 32px; }
.post-nav__link { display: grid; gap: 6px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .2s, transform .2s var(--ease); }
.post-nav__link:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-nav__link strong { font-family: var(--font-display); font-size: 17px; line-height: 1.3; }
.post-nav__link--next { text-align: right; }
@media (max-width: 620px) { .post-nav { grid-template-columns: 1fr; } .post-nav__link--next { text-align: left; } }

/* Prose: styles for article bodies written in HTML */

.prose { color: var(--text-soft); font-size: 18px; line-height: 1.78; }
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3, .prose h4 { color: var(--text); letter-spacing: -.025em; }
.prose h2 { margin-top: 2em; font-size: clamp(26px, 2.8vw, 32px); line-height: 1.2; }
.prose h3 { margin-top: 1.8em; font-size: 23px; line-height: 1.25; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose strong, .prose b { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); transition: text-decoration-color .15s; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .5em; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 4px 0 4px 24px; border-left: 3px solid var(--accent); color: var(--text); font-family: var(--font-display); font-size: 1.15em; font-style: normal; }
.prose img, .prose video { width: 100%; height: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.prose figure { margin-left: 0; margin-right: 0; }
.prose figcaption { margin-top: 10px; color: var(--muted); font-size: 14px; text-align: center; }
.prose hr { height: 1px; margin: 3em 0; border: 0; background: var(--border); }
.prose code { padding: .15em .4em; border-radius: 6px; background: var(--surface-2); color: var(--text); font-family: var(--font-mono); font-size: .86em; }
.prose pre { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); overflow-x: auto; font-size: 15px; line-height: 1.6; }
.prose pre code { padding: 0; background: none; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; }
.prose th, .prose td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }
.prose th { color: var(--text); font-weight: 600; }

/* Panels, tables, forms
   ========================================================================== */

.panel { margin-bottom: 20px; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 24px; }
.panel__head h2 { font-size: 22px; }

.table-wrap { overflow-x: auto; margin: 0 -8px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.table td { padding: 14px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; }
.table a { color: var(--accent); }

input[type='text'], input[type='email'], input[type='search'], textarea {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    font: 400 16px/1.5 var(--font-sans);
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
textarea { height: auto; min-height: 160px; padding: 14px 16px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }

.form { display: grid; gap: 24px; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 14px; font-weight: 600; }
.field--error input, .field--error textarea { border-color: var(--down); }
.field__error, .form__error { color: var(--down); font-size: 13px; }
.form .btn { justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 620px) { .form__row { grid-template-columns: 1fr; } }

.hint.center { margin-top: 24px; }
.hint a { color: var(--accent); }

/* About */

.about-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-top: 48px; }
.about-card { display: grid; gap: 6px; padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color .2s, transform .2s var(--ease); }
.about-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.about-card strong { font-family: var(--font-display); font-size: 22px; letter-spacing: -.02em; }
.about-card strong.mono { font-family: var(--font-mono); }
.about-card .link-arrow { margin-top: 8px; font-size: 14px; }
@media (max-width: 720px) { .about-cards { grid-template-columns: 1fr; } }

/* Newsletter
   ========================================================================== */

.newsletter {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 32px;
    padding: clamp(28px, 5vw, 56px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    isolation: isolate;
}
.newsletter__glow {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(500px 260px at 100% 100%, var(--glow), transparent 70%),
        linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px;
}
.newsletter h2 { font-size: clamp(28px, 3.4vw, 40px); }
.newsletter p { margin-top: 12px; color: var(--text-soft); font-size: 17px; }
.newsletter__form { display: flex; gap: 10px; }
.newsletter__form input { height: 52px; border-radius: 999px; padding: 0 20px; }
.newsletter__form .btn { height: 52px; }

@media (max-width: 860px) { .newsletter { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .newsletter__form { flex-direction: column; } }

/* Toasts
   ========================================================================== */

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px 14px 18px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 15px;
    animation: toast-in .35s var(--ease);
}
.toast--error { border-left-color: var(--down); }
.toast--info { border-left-color: var(--accent-2); }
.toast span { flex: 1; }
.toast__close { padding: 0 4px; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }

/* Footer
   ========================================================================== */

.footer { margin-top: 24px; padding: 64px 0 32px; border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; }
.footer__about p { max-width: 360px; margin-top: 16px; color: var(--muted); font-size: 15px; }
.footer h4 { margin-bottom: 14px; color: var(--text); font-family: var(--font-sans); font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.footer ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.footer ul a { color: var(--muted); font-size: 15px; transition: color .15s; }
.footer ul a:hover { color: var(--accent); }

.socials { display: flex; gap: 8px; margin-top: 20px; }
.socials a { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); transition: color .15s, border-color .15s; }
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.socials svg { width: 16px; height: 16px; }

.disclaimer { margin-top: 48px; padding: 20px 22px; border: 1px solid var(--border); border-radius: var(--radius); color: var(--muted); font-size: 13px; line-height: 1.7; }
.disclaimer strong { color: var(--text-soft); }

.footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 28px; color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
    .footer__grid { grid-template-columns: 1fr 1fr; }
    .footer__about { grid-column: 1 / -1; }
}

/* Motion preferences */

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