/* ==========================================================================
   stuartreyner.com — "deep space terminal"
   Dark by default; a warm "paper" light theme via the toggle.
   ========================================================================== */

:root {
  --bg: #07090f;
  --bg-raised: #0d121c;
  --panel: rgb(13 19 30 / 0.72);
  --line: #1d2a3b;
  --line-strong: #2b3d55;
  --text: #d5dce7;
  --text-strong: #f3f6fb;
  --muted: #7f8ca3;
  --accent: #5ce1f5;        /* phosphor cyan */
  --accent-dim: rgb(92 225 245 / 0.14);
  --accent-2: #ffb454;      /* sodium amber */
  --danger: #ff6b8b;
  --glow: 0 0 18px rgb(92 225 245 / 0.28);
  --star: rgb(255 255 255 / 0.7);
  --grid: rgb(92 225 245 / 0.035);
  --selection: rgb(92 225 245 / 0.28);

  --font-ui: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-head: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-prose: "Literata", Georgia, "Times New Roman", serif;

  --measure: 68ch;
  --wrap: 1120px;
  --radius: 4px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3efe6;
  --bg-raised: #fbf8f1;
  --panel: rgb(251 248 241 / 0.85);
  --line: #ddd5c4;
  --line-strong: #c7bca6;
  --text: #24262c;
  --text-strong: #101114;
  --muted: #6c6658;
  --accent: #00728a;
  --accent-dim: rgb(0 114 138 / 0.1);
  --accent-2: #a85a00;
  --danger: #b4234a;
  --glow: none;
  --star: rgb(36 38 44 / 0.18);
  --grid: rgb(0 114 138 / 0.04);
  --selection: rgb(0 114 138 / 0.18);
  color-scheme: light;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection); }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--text-strong);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

code, pre, kbd { font-family: var(--font-ui); }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
main.wrap { flex: 1; padding-block: 3rem 5rem; }

.accent { color: var(--accent); }
.muted { color: var(--muted); }
.sep { color: var(--line-strong); margin-inline: 0.15em; }

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--accent); color: var(--bg); padding: 0.5rem 1rem;
}
.skip-link:focus { top: 1rem; }

/* ---------- Background: starfield + faint grid ---------- */

.sky {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1px 1px at 12% 18%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 78% 12%, var(--star), transparent 60%),
    radial-gradient(1.5px 1.5px at 42% 64%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 88% 72%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 22% 86%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 63% 33%, var(--star), transparent 60%),
    radial-gradient(1.5px 1.5px at 6% 52%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 95% 40%, var(--star), transparent 60%),
    radial-gradient(ellipse 60% 40% at 85% -10%, var(--accent-dim), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 48px 48px;
}
.sky::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(1px 1px at 33% 8%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 52% 92%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 70% 55%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 15% 40%, var(--star), transparent 60%);
  animation: twinkle 6s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 1; } }

/* Neural-net canvas (assets/js/neural.js): faded at the edges, fainter off the home page. */
.neural {
  position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none;
  opacity: 0.6;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 65% 40%, #000 35%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 75% at 65% 40%, #000 35%, transparent 80%);
}
body:not(.is-home) .neural { opacity: 0.22; }
:root[data-theme="light"] .neural { opacity: 0.4; }
:root[data-theme="light"] body:not(.is-home) .neural { opacity: 0.15; }

/* Scroll reveal (assets/js/main.js) */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 4rem; flex-wrap: wrap;
}

.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text-strong); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; fill: none; stroke: var(--accent); stroke-width: 1.5; filter: drop-shadow(var(--glow)); }
.brand-mark .moon { fill: var(--accent-2); stroke: none; }
.brand:hover .brand-mark ellipse { stroke: var(--accent-2); }
.brand-name { font-weight: 700; letter-spacing: 0.02em; }

.site-nav { display: flex; align-items: center; gap: 0.5rem; }
.site-nav ul { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a {
  display: inline-block; padding: 0.35rem 0.65rem;
  color: var(--muted); border: 1px solid transparent; border-radius: var(--radius);
  font-size: 0.85rem; text-transform: lowercase;
}
.site-nav a:hover { color: var(--text-strong); text-decoration: none; border-color: var(--line); }
.site-nav a[aria-current="page"] { color: var(--accent); border-color: var(--line-strong); background: var(--accent-dim); }
.nav-idx { color: var(--accent-2); font-size: 0.7rem; margin-right: 0.4rem; opacity: 0.8; }

.theme-toggle {
  display: grid; place-items: center; width: 2.1rem; height: 2.1rem;
  background: none; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--line-strong); }
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); font-size: 0.78rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; padding-block: 1.25rem; }
.footer-inner p { margin: 0; }
.status-line { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; text-transform: uppercase; letter-spacing: 0.06em; }
.status-line .dot { width: 7px; height: 7px; border-radius: 50%; background: #3ddc84; box-shadow: 0 0 8px #3ddc84; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ---------- Shared bits ---------- */

.kicker { font-size: 0.8rem; color: var(--accent-2); margin: 0 0 0.75rem; letter-spacing: 0.02em; }
.kicker a { color: var(--accent-2); }
.label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }
.readout { font-family: var(--font-ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.dek { color: var(--muted); font-size: 1.05rem; max-width: 60ch; margin: 0; }

.tag {
  display: inline-block; font-size: 0.72rem; padding: 0.05rem 0.45rem; margin: 0 0.3rem 0.3rem 0;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}
.tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.btn {
  display: inline-block; padding: 0.65rem 1.1rem;
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: var(--bg); font-weight: 700; font-size: 0.85rem;
  box-shadow: var(--glow);
}
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn-ghost { background: transparent; color: var(--accent); box-shadow: none; }
.btn-ghost:hover { background: var(--accent-dim); }

.page-head { margin-bottom: 2.5rem; padding-bottom: 1.5rem; border-bottom: 1px dashed var(--line-strong); }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); }

.section-title { font-size: 1.1rem; margin-top: 3rem; }

/* ---------- Home ---------- */

.hero { padding-block: 3rem 4rem; max-width: 52rem; }
.prompt { color: var(--muted); font-size: 0.85rem; margin: 0 0 1.25rem; min-height: 1.6em; }
.caret {
  display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.15em;
  vertical-align: text-bottom; background: var(--accent); animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero-title {
  font-size: clamp(2.8rem, 9vw, 5.5rem); line-height: 0.95; letter-spacing: -0.035em;
  /* Padding gives descenders (the y) room inside the clipped background; the margin takes it back. */
  padding-bottom: 0.12em; margin-bottom: calc(1.25rem - 0.12em);
  background: linear-gradient(100deg, var(--text-strong) 30%, var(--accent) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-tagline { font-family: var(--font-prose); font-style: italic; font-size: clamp(1.15rem, 2.4vw, 1.4rem); color: var(--text); max-width: 38ch; margin: 0 0 2rem; }
.hero-tagline + .hero-intro { margin-top: -1rem; }
.hero-intro { font-family: var(--font-prose); font-size: 1.05rem; line-height: 1.65; color: var(--muted); max-width: 52ch; margin: 0 0 1.25rem; }
.hero-day { margin: 0 0 2rem; }
.hero-day .readout { font-size: 0.95rem; letter-spacing: 0.04em; margin-left: 0.3rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

/* Featured opening line: the first thing a visitor reads should be the fiction itself. */
.featured { max-width: 46rem; margin: 0 0 4rem; padding-left: 1.5rem; border-left: 2px solid var(--accent-2); }
.featured-hook { margin: 0.5rem 0 1rem; }
.featured-hook p {
  margin: 0; font-family: var(--font-prose); font-size: clamp(1.45rem, 3.4vw, 2.2rem);
  line-height: 1.35; color: var(--text-strong); text-wrap: balance;
}
.featured-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1rem; margin: 0 0 1.25rem; font-size: 0.8rem; }
.featured-title { font-family: var(--font-head); font-size: 1.1rem; color: var(--text-strong); }
.featured-title:hover { color: var(--accent); }

.dashboard { display: grid; gap: 1.5rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dashboard .panel-novel { grid-column: 1 / -1; }

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.dashboard .panel { margin-bottom: 0; }
/* HUD corner brackets */
.panel::before, .panel::after {
  content: ""; position: absolute; width: 12px; height: 12px; border: 1px solid var(--accent); opacity: 0.7;
}
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1rem; margin: 0; }
.panel-idx { font-family: var(--font-ui); font-size: 0.7rem; color: var(--accent-2); margin-right: 0.5rem; letter-spacing: 0.1em; }
.panel-link { font-size: 0.78rem; color: var(--muted); }
.panel-dek { margin: -0.5rem 0 0.75rem; font-family: var(--font-prose); font-style: italic; font-size: 0.95rem; color: var(--muted); }

.novel-title { font-family: var(--font-head); font-size: 1.5rem; color: var(--text-strong); margin: 0; }
.novel-logline { font-family: var(--font-prose); font-size: 1.05rem; line-height: 1.6; color: var(--text); max-width: 60ch; margin: 0 0 1.25rem; }
.codename { font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.15em; color: var(--accent-2); border: 1px solid currentColor; padding: 0.1rem 0.4rem; border-radius: 2px; vertical-align: middle; margin-left: 0.5rem; }

/* ---------- Novel status widget ---------- */

.novel-status { margin-top: 1rem; }
.readouts { display: flex; gap: 2.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.readout-block { display: flex; flex-direction: column; }
.readout.big { font-size: 2.2rem; line-height: 1.1; text-shadow: var(--glow); }
.readout.big small { font-size: 0.5em; margin-left: 0.1em; }

.meter {
  height: 14px; border: 1px solid var(--line-strong); border-radius: 2px; padding: 2px;
  background: repeating-linear-gradient(90deg, transparent 0 9px, var(--line) 9px 10px);
}
.meter span {
  display: block; height: 100%;
  background: repeating-linear-gradient(90deg, var(--accent) 0 8px, transparent 8px 10px);
  box-shadow: var(--glow);
}

.stages { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 1.25rem 0 0; counter-reset: stage; }
.stages li {
  counter-increment: stage;
  font-size: 0.72rem; padding: 0.25rem 0.6rem; border: 1px solid var(--line); border-radius: 2px; color: var(--muted);
}
.stages li::before { content: counter(stage, decimal-leading-zero) " "; opacity: 0.6; }
.stages li.is-done { color: var(--text); border-color: var(--line-strong); }
.stages li.is-done::after { content: " ✓"; color: #3ddc84; }
.stages li.is-current { color: var(--bg); background: var(--accent-2); border-color: var(--accent-2); font-weight: 700; }

/* ---------- Novel chart & log ---------- */

.chart { padding: 1.75rem 0 2rem; }
.chart-plot {
  position: relative; display: flex; align-items: flex-end; gap: 0.75rem;
  height: 170px; border-bottom: 1px solid var(--line-strong);
}
.chart-target { position: absolute; top: 0; left: 0; right: 0; border-top: 1px dashed var(--accent-2); }
.chart-target span { position: absolute; right: 0; top: -1.4rem; font-size: 0.68rem; color: var(--accent-2); }
.chart-bar {
  position: relative; flex: 1; max-width: 64px; height: var(--h);
  background: linear-gradient(to top, var(--accent-dim), var(--accent));
  border-radius: 2px 2px 0 0; min-height: 2px;
}
.chart-bar:hover { filter: brightness(1.25); text-decoration: none; }
.chart-value { position: absolute; top: -1.3rem; left: 50%; transform: translateX(-50%); font-size: 0.68rem; color: var(--text); white-space: nowrap; }
.chart-label { position: absolute; bottom: -1.6rem; left: 50%; transform: translateX(-50%); font-size: 0.66rem; color: var(--muted); white-space: nowrap; }

.log-list { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--line-strong); }
.log-item { position: relative; display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: 0.9rem 0 0.9rem 1.25rem; }
.log-item::before { content: ""; position: absolute; left: -5px; top: 1.35rem; width: 9px; height: 9px; background: var(--bg); border: 1px solid var(--accent); border-radius: 50%; }
.log-stamp { font-size: 0.78rem; color: var(--accent-2); padding-top: 0.15rem; }


/* ---------- Entry lists ---------- */

.entry-list { list-style: none; padding: 0; margin: 0; }
.entry { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; padding: 0.85rem 0; border-top: 1px solid var(--line); }
.entry:first-child { border-top: 0; }
.entry-date { font-size: 0.78rem; color: var(--muted); padding-top: 0.2rem; font-variant-numeric: tabular-nums; }
.entry-title { font-family: var(--font-head); font-size: 1.1rem; font-weight: 500; color: var(--text-strong); }
.entry-title:hover { color: var(--accent); }
.entry-dek { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; }
.entry-tags { margin: 0.4rem 0 0; }

.tag-cloud { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px dashed var(--line-strong); }
.tag-cloud h2 { font-family: var(--font-ui); margin-bottom: 0.75rem; }

/* ---------- Story cards ---------- */

.story-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.story-card {
  position: relative; display: flex; flex-direction: column; gap: 0.6rem;
  padding: 1.4rem; min-height: 220px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--text); overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.story-card::after {
  content: ""; position: absolute; inset: auto -40% -60% auto; width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-dim), transparent 70%); transition: transform 0.4s;
}
.story-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.story-card:hover::after { transform: scale(1.4); }
.story-card-meta { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--accent-2); letter-spacing: 0.08em; }
.story-card-title { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; color: var(--text-strong); line-height: 1.15; }
.story-card-dek { font-family: var(--font-prose); color: var(--muted); font-size: 0.98rem; line-height: 1.5; }
.story-card-foot { margin-top: auto; font-size: 0.72rem; color: var(--muted); }

/* ---------- Articles ---------- */

.article { max-width: var(--measure); margin-inline: auto; }
.article-head { margin-bottom: 2.5rem; }
.article-head h1 { font-size: clamp(2rem, 5.5vw, 3.1rem); letter-spacing: -0.025em; }
.article-head .dek { margin-bottom: 1rem; }
.meta { font-size: 0.8rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: 0; }
.meta .tag { margin: 0 0 0 0.25rem; }

.story-head { text-align: center; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.story-head .dek { margin-inline: auto; font-family: var(--font-prose); font-style: italic; }
.dossier {
  display: inline-grid; grid-template-columns: auto auto; gap: 0.25rem 1.25rem; text-align: left;
  margin: 1.5rem auto 0; font-size: 0.78rem;
}
.dossier div { display: contents; }
.dossier dt { color: var(--accent-2); text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.68rem; padding-top: 0.15rem; }
.dossier dd { margin: 0; color: var(--text); }

/* Prose */
.prose { font-family: var(--font-prose); font-size: 1.13rem; line-height: 1.75; color: var(--text); }
.prose > * + * { margin-top: 1.15em; }
.prose p { margin-block: 0; }
.prose h2 { font-size: 1.5rem; margin-top: 2.2em; }
.prose h2::before { content: "## "; color: var(--accent); font-family: var(--font-ui); font-size: 0.75em; opacity: 0.7; }
.prose h3 { font-size: 1.2rem; margin-top: 1.8em; }
.prose a { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose ul li::marker { color: var(--accent); content: "▹  "; }
.prose strong { color: var(--text-strong); }
.prose blockquote {
  margin-inline: 0; padding: 0.5rem 0 0.5rem 1.25rem;
  border-left: 2px solid var(--accent-2); font-style: italic; color: var(--text-strong);
}
.prose hr { border: 0; text-align: center; margin-block: 2.5em; }
.prose hr::after { content: "◇  ◇  ◇"; color: var(--accent); letter-spacing: 0.4em; }
.prose :not(pre) > code {
  font-size: 0.85em; padding: 0.1em 0.35em; border-radius: 3px;
  background: var(--bg-raised); border: 1px solid var(--line); color: var(--accent-2);
}

/* Fiction: tighter, bookish paragraphs */
.prose-fiction { font-size: 1.18rem; }
.prose-fiction > * + * { margin-top: 0; }
.prose-fiction p + p { text-indent: 1.5em; }
.prose-fiction > p:first-of-type::first-letter {
  float: left; font-family: var(--font-head); font-size: 3.6em; line-height: 0.85;
  padding: 0.08em 0.1em 0 0; color: var(--accent);
}
.prose-fiction hr + p { text-indent: 0; }
.end-mark { text-align: center; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.3em; margin: 3rem 0; }

/* Code blocks */
.prose pre {
  position: relative; overflow-x: auto; padding: 2.3rem 1.2rem 1.2rem;
  font-size: 0.84rem; line-height: 1.6;
  background: #05070c; color: #cbd5e1;
  border: 1px solid var(--line); border-radius: var(--radius);
}
:root[data-theme="light"] .prose pre { background: #1b1f27; border-color: #1b1f27; }
.prose pre[class*="language-"]::before {
  content: attr(class); position: absolute; top: 0.55rem; left: 1.2rem;
  font-size: 0.68rem; color: #6b7a90; text-transform: lowercase;
}
.prose pre::after {
  content: "● ● ●"; position: absolute; top: 0.5rem; right: 1rem; font-size: 0.6rem; letter-spacing: 0.15em; color: #34425a;
}
.token.comment, .token.prolog { color: #5c6b82; font-style: italic; }
.token.keyword, .token.important { color: #c792ea; }
.token.string, .token.inserted { color: #a5e075; }
.token.deleted { color: #ff6b8b; }
.token.number, .token.boolean, .token.constant { color: #ffb454; }
.token.function { color: #5ce1f5; }
.token.operator, .token.punctuation { color: #8b9bb4; }
.token.builtin, .token.class-name { color: #ffcb6b; }
.token.variable, .token.property { color: #f07178; }
.token.template-string .token.interpolation-punctuation { color: #89ddff; }

/* Pager */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.pager-link { display: flex; flex-direction: column; gap: 0.2rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); font-family: var(--font-head); color: var(--text-strong); }
.pager-link:hover { border-color: var(--accent); text-decoration: none; }
.pager-link.is-next { text-align: right; grid-column: 2; }
.pager-dir { font-family: var(--font-ui); font-size: 0.72rem; color: var(--muted); }

/* Reading progress */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 60; }
.read-progress span { display: block; height: 100%; width: 0; background: var(--accent); box-shadow: var(--glow); }

/* About */
.about .bio-card { margin-bottom: 2rem; }
.whoami {
  margin: 0; padding: 1.25rem 1.5rem; font-size: 0.85rem; line-height: 1.8;
  background: var(--bg-raised); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: var(--radius); color: var(--text); white-space: pre-wrap;
}

.lost .hero-title { background: none; color: var(--danger); }

/* ---------- Mailing list ---------- */

[hidden] { display: none !important; }
.danger { color: var(--danger); }
.narrow { max-width: 42rem; }

.newsletter { padding-bottom: 3rem; }
.newsletter-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; margin: 0; }
.newsletter-copy h2 { font-size: 1.4rem; }
.newsletter-copy p:last-child { margin-bottom: 0; }

.subscribe-form { min-width: 0; }
.subscribe-prompt { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.5rem; }
.subscribe-row { display: flex; gap: 0.5rem; }
.subscribe-input {
  flex: 1; min-width: 0; padding: 0.65rem 0.8rem;
  font: inherit; font-size: 0.9rem; color: var(--text-strong);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.subscribe-input::placeholder { color: var(--muted); opacity: 0.7; }
.subscribe-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.subscribe-submit { cursor: pointer; font-family: inherit; }
.subscribe-submit:disabled { opacity: 0.6; cursor: progress; }
.subscribe-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.subscribe-status { min-height: 1.4em; margin: 0.6rem 0 0; font-size: 0.8rem; }
.subscribe-status[data-tone="pending"] { color: var(--muted); }
.subscribe-status[data-tone="ok"] { color: #3ddc84; }
.subscribe-status[data-tone="error"] { color: var(--danger); }
.subscribe-fine { margin: 0.2rem 0 0; font-size: 0.7rem; color: var(--muted); }

.gate { max-width: 42rem; }
.gate-copy { margin-top: 0; }
.locked-note, .welcome-note, .confirm-error {
  padding: 0.75rem 1rem; margin: 0 0 1.25rem; font-size: 0.85rem;
  border: 1px solid var(--line-strong); border-left: 2px solid var(--accent-2); border-radius: var(--radius);
  background: var(--bg-raised);
}
.welcome-note { border-left-color: #3ddc84; }
.confirm-error { border-left-color: var(--danger); }

/* ---------- Tool cards ---------- */

.tool-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.tool-card {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 1.3rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}
.tool-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.tool-card-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.7rem; color: var(--accent-2); letter-spacing: 0.08em; text-transform: uppercase; }
.tool-card-title { font-family: var(--font-head); font-size: 1.25rem; font-weight: 700; color: var(--text-strong); }
.tool-card-dek { font-size: 0.85rem; color: var(--muted); }
.tool-card .lock { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.tool-card.is-locked .tool-card-title { opacity: 0.85; }
.is-member .tool-card .lock, .is-member .guest-only { display: none; }
.is-member .tool-card.is-locked .tool-card-title { opacity: 1; }

.btn-small { padding: 0.3rem 0.7rem; font-size: 0.75rem; box-shadow: none; }
.btn-small:hover { color: var(--bg); }

/* Task-list checkboxes in checklists */
.prose li:has(> input[type="checkbox"]) { list-style: none; }

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
  body { font-size: 14px; }
  .dashboard { grid-template-columns: 1fr; }
  .header-inner { padding-block: 0.6rem; }
  .site-nav { width: 100%; justify-content: space-between; }
  .site-nav a { padding: 0.3rem 0.45rem; }
  .entry, .log-item { grid-template-columns: 1fr; gap: 0.15rem; }
  .prose { font-size: 1.05rem; }
  .prose-fiction { font-size: 1.1rem; }
  .chart { gap: 0.35rem; }
  .pager { grid-template-columns: 1fr; }
  .pager-link.is-next { grid-column: 1; }
  .newsletter-panel { grid-template-columns: 1fr; gap: 1.25rem; }
  .subscribe-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
