
:root {
  --deep: #ebe1d1;
  --sheet: rgba(255, 252, 246, 0.9);
  --sheet-edge: rgba(255, 255, 255, 0.75);
  --surface: rgba(255, 255, 255, 0.6);
  --shadow: rgba(84, 50, 20, 0.32);
  --ink: #1f1c18;
  --muted: #6b6258;
  --line: rgba(90, 62, 36, 0.15);
  --accent: #b24a26;
  --accent-ink: #fffaf4;
  --accent-soft: #f6e1d3;
  --free: #2f6b4f;
  --free-soft: #e0efe5;
  --glow-1: rgba(224, 120, 72, 0.55);
  --glow-2: rgba(242, 186, 92, 0.5);
  --glow-3: rgba(128, 170, 138, 0.48);
  --glow-4: rgba(158, 138, 206, 0.36);
  --contour: rgba(110, 66, 34, 0.26);
  --grain-blend: multiply;
  --grain-opacity: 0.2;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Source Serif Pro", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --deep: #0e0c0a;
    --sheet: rgba(24, 21, 18, 0.88);
    --sheet-edge: rgba(255, 240, 220, 0.07);
    --surface: rgba(255, 255, 255, 0.035);
    --shadow: rgba(0, 0, 0, 0.65);
    --ink: #ede6dc;
    --muted: #a69c8e;
    --line: rgba(255, 236, 214, 0.1);
    --accent: #e8825a;
    --accent-ink: #1a1410;
    --accent-soft: #3a241a;
    --free: #7cc6a0;
    --free-soft: #1a2e23;
    --glow-1: rgba(206, 92, 50, 0.42);
    --glow-2: rgba(196, 136, 60, 0.24);
    --glow-3: rgba(40, 122, 110, 0.42);
    --glow-4: rgba(96, 74, 176, 0.38);
    --contour: rgba(255, 214, 170, 0.14);
    --grain-blend: soft-light;
    --grain-opacity: 0.35;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--deep); }
body {
  margin: 0;
  color: var(--ink);
  font: 17px/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Backdrop: drifting dusk light, a topographic map, and paper grain. */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.backdrop .glow {
  position: absolute; inset: -25%;
  background:
    radial-gradient(38% 42% at 24% 26%, var(--glow-1), transparent 70%),
    radial-gradient(34% 38% at 80% 20%, var(--glow-2), transparent 70%),
    radial-gradient(40% 44% at 72% 80%, var(--glow-3), transparent 70%),
    radial-gradient(30% 36% at 18% 84%, var(--glow-4), transparent 70%);
  animation: drift 60s ease-in-out infinite alternate;
  will-change: transform;
}
.backdrop .lines {
  position: absolute; inset: 0; background: var(--contour);
  -webkit-mask: url(/contours.svg?v=1x2jk1q) center / cover no-repeat;
  mask: url(/contours.svg?v=1x2jk1q) center / cover no-repeat;
}
.backdrop .grain {
  position: absolute; inset: 0;
  background: url(/grain.svg?v=1x2jk1q) repeat;
  mix-blend-mode: var(--grain-blend); opacity: var(--grain-opacity);
}
@keyframes drift {
  0% { transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(2%, 3%, 0) rotate(5deg) scale(1.06); }
  100% { transform: translate3d(4%, -1%, 0) rotate(-3deg) scale(1.02); }
}
@media (prefers-reduced-motion: reduce) { .backdrop .glow { animation: none; } }

header.site, footer.site {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  max-width: 1100px; width: 100%; margin: 0 auto; padding: 22px 24px;
}
header.site .brand {
  font: 600 26px/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
header.site .brand span { color: var(--accent); }
header.site nav {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; font-size: 15px;
  padding: 6px 6px 6px 18px; border-radius: 999px;
  background: var(--sheet); border: 1px solid var(--sheet-edge);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 30px -20px var(--shadow);
}
header.site nav a:not(.button) { color: var(--ink); text-decoration: none; }
header.site nav a:not(.button):hover { color: var(--accent); }
header.site nav form { margin: 0; padding-right: 12px; }
.balance { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-variant-numeric: tabular-nums; }
footer.site { margin-top: auto; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); text-decoration: underline; }

/* The reading sheet floats on the backdrop. */
main {
  width: calc(100% - 32px); max-width: 760px; margin: 8px auto 48px;
  padding: 48px 60px 60px;
  background: var(--sheet);
  border: 1px solid var(--sheet-edge);
  border-radius: 28px;
  box-shadow: 0 60px 120px -60px var(--shadow), 0 12px 32px -20px var(--shadow);
}
main.wide { max-width: 1100px; }

.flash {
  max-width: 760px; width: calc(100% - 32px); margin: 0 auto 12px; padding: 11px 18px;
  background: var(--free-soft); color: var(--free); border-radius: 14px; font-size: 15px;
  box-shadow: 0 10px 30px -22px var(--shadow);
}
.flash.error { background: var(--accent-soft); color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(34px, 6vw, 48px); margin: 0 0 12px; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 15px/1 var(--sans); padding: 12px 20px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  text-decoration: none; cursor: pointer; transition: transform .08s ease, filter .15s ease;
}
button:hover, .button:hover { filter: brightness(1.06); }
button:active, .button:active { transform: translateY(1px); }
button.secondary, .button.secondary { background: transparent; color: var(--ink); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { border-color: var(--ink); filter: none; }
button.small, .button.small { padding: 8px 14px; font-size: 14px; }
button.danger { background: transparent; color: var(--accent); border-color: var(--accent); }
button.linkish { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; font-weight: 400; }
button.linkish:hover { color: var(--accent); filter: none; }

/* Home */
.intro { padding: 0 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.intro .row-between h1 { margin: 0; }
.intro .row-between + p { margin-top: 12px; }
.intro p { color: var(--muted); font-size: 18px; max-width: 560px; }
.entries { list-style: none; margin: 0; padding: 0; }
.entry { padding: 28px 0; border-bottom: 1px solid var(--line); }
.entries li:last-child .entry { border-bottom: 0; padding-bottom: 0; }
.share { margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.share code { font: 12px var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; user-select: all; }
.entry h2 { font-size: 28px; margin: 4px 0 8px; }
.entry h2 a { color: var(--ink); text-decoration: none; }
.entry h2 a:hover { color: var(--accent); }
.entry .excerpt { font-family: var(--serif); font-size: 18px; color: var(--muted); margin: 0 0 12px; }
.meta { color: var(--muted); font-size: 14px; margin: 0; letter-spacing: 0.02em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.chip {
  display: inline-block; font-size: 13px; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.chip.free, .chip.pass { background: var(--free-soft); border-color: transparent; color: var(--free); }
.chip.owned { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.open { background: var(--free-soft); border-color: transparent; color: var(--free); }
.empty { color: var(--muted); padding: 32px 0 8px; }
.empty p { margin: 0 0 8px; max-width: 34em; }

/* Thought */
.thought header { margin: 0 0 24px; }
.thought h1 { margin-top: 8px; }
.prose { font: 20px/1.75 var(--serif); }
.prose p { margin: 0 0 1.1em; }
.prose h2 { font-size: 28px; margin: 1.6em 0 .5em; }
.prose h3 { font-size: 23px; margin: 1.4em 0 .4em; }
.prose h4, .prose h5 { font-size: 20px; margin: 1.2em 0 .4em; }
.prose blockquote { margin: 1.4em 0; padding: 0 0 0 20px; border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }
.prose hr { border: 0; text-align: center; margin: 2em 0; }
.prose hr::after { content: "· · ·"; color: var(--muted); letter-spacing: .5em; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose code { font: .85em var(--mono); background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }
.prose pre { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; overflow-x: auto; }
.prose pre code { background: none; border: 0; padding: 0; font-size: 15px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li { margin: .3em 0; }
.teaser { max-height: 13em; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent); mask-image: linear-gradient(to bottom, #000 45%, transparent); }
.colophon { text-align: center; color: var(--muted); font-size: 14px; margin: 48px 0 0; }
.back { margin-top: 48px; font-size: 15px; }

.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; margin: 0 0 28px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); font-size: 15px; color: var(--muted);
}
.banner.pass { background: var(--free-soft); border-color: transparent; color: var(--free); }
.banner form { margin: 0; }

.paywall { margin: 8px 0 0; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.paywall h2 { margin: 0 0 18px; font-size: 26px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.options.single { grid-template-columns: 1fr; }
.option { padding: 20px; border-radius: 14px; border: 1px solid var(--line); display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.option.primary { border-color: var(--accent); }
.option h3 { margin: 0; font-size: 20px; }
.option p { margin: 0; color: var(--muted); font-size: 15px; }
.option form { margin: 4px 0 0; }
.option .button, .option button { margin-top: 4px; }
.option .price { font: 600 30px/1.1 var(--serif); color: var(--ink); }
.option .count { color: var(--free); font-weight: 600; }
.note { color: var(--muted); font-size: 14px; }
.meter { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.meter i { width: 10px; height: 10px; border-radius: 50%; background: var(--free); display: block; }
.meter i.taken { background: var(--line); }

/* Panels & forms */
.panel h2 { font-size: 22px; margin: 36px 0 12px; }
.panel > h1:first-child { margin-top: 0; }
.panel.narrow { max-width: 420px; }
.narrow-form { max-width: 420px; margin-top: 12px; }
.lede { color: var(--muted); font-size: 18px; }
.stack { display: grid; gap: 16px; margin: 24px 0; }
label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
label.inline { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin-right: 20px; }
input, textarea {
  font: 16px/1.4 var(--sans); color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; width: 100%;
}
input[type=radio] { width: auto; accent-color: var(--accent); }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; }
textarea.mono { font: 15px/1.6 var(--mono); }
.small { font-size: 13px; font-weight: 400; }
.muted { color: var(--muted); }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
legend { font-size: 14px; font-weight: 600; padding: 0 6px; }

.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin: 28px 0; }
.pack { margin: 0; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.pack p { margin: 0; }
.pack-name { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.pack-credits { font: 600 40px/1.1 var(--serif); }
.pack-credits span { font: 400 16px var(--sans); color: var(--muted); }
.pack-price { font-size: 18px; }
.pack-unit { color: var(--muted); font-size: 13px; margin-bottom: 10px !important; }
div.pack .pack-unit { margin-bottom: 0 !important; }
.pricing-band { margin-top: 40px; padding-top: 32px; border-top: 1px solid var(--line); }
.pricing-band h2 { margin: 0 0 6px; font-size: 26px; }
.pricing-band .packs { margin: 20px 0 12px; }
.prose.legal { font: 16.5px/1.7 var(--sans); }
.prose.legal h1 { font-size: clamp(32px, 5vw, 42px); }
.prose.legal h2 { font-size: 22px; margin: 1.8em 0 .5em; }
.prose.legal li { margin: .45em 0; }
.prose.legal .meta { margin-bottom: 1.6em; }
.actions.left { justify-content: flex-start; margin-top: 28px; }

ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
ul.plain li span { font-size: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plus { color: var(--free); }
.minus { color: var(--muted); }

/* Admin */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 20px 0 28px; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 4px 0 0; font: 600 24px/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.admin-table { min-width: 640px; }
.editor { display: grid; gap: 18px; margin-top: 20px; }
.editor button[type=submit] { justify-self: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: end; }
.danger-zone { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); }
.search { display: flex; gap: 10px; margin: 20px 0; max-width: 480px; }
.adjust { display: flex; gap: 6px; margin: 0; }
.adjust input { padding: 6px 8px; font-size: 14px; }
.adjust input[type=number] { width: 80px; }

/* Landing */
.hero { text-align: center; padding: 20px 0 8px; }
.hero .eyebrow { margin: 0; font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
.hero h1 { font-size: clamp(64px, 13vw, 128px); line-height: 0.95; letter-spacing: -0.035em; margin: 14px 0 20px; }
.hero h1 span { color: var(--accent); }
.hero .lede { max-width: 28em; margin: 0 auto 28px; font: 21px/1.55 var(--serif); color: var(--muted); }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 0; }
.features { list-style: none; margin: 44px 0 0; padding: 32px 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.features h3 { font-size: 19px; margin: 0 0 6px; }
.features p { margin: 0; color: var(--muted); font-size: 15px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  header.site { padding: 14px 12px; flex-wrap: wrap; }
  header.site nav { gap: 12px; padding-left: 14px; font-size: 14px; }
  main { width: calc(100% - 16px); padding: 30px 20px 40px; border-radius: 20px; margin-bottom: 24px; }
  .flash { width: calc(100% - 16px); }
  .features { grid-template-columns: 1fr; gap: 18px; }
  .backdrop .lines { -webkit-mask-position: right top; mask-position: right top; }
  .options, .grid3 { grid-template-columns: 1fr; }
  .paywall { padding: 20px; }
  .prose { font-size: 19px; }
  .adjust { flex-wrap: wrap; }
}

/* ---- Opening canvas (first page of each visit) ---- */
.cover-toggle { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
body:has(.cover-toggle:not(:checked)) { overflow: hidden; }
.cover {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  background:
    radial-gradient(55% 50% at 18% 18%, rgba(255, 122, 92, .42), transparent 70%),
    radial-gradient(50% 45% at 86% 22%, rgba(196, 140, 255, .32), transparent 70%),
    radial-gradient(60% 55% at 80% 88%, rgba(96, 210, 180, .30), transparent 70%),
    radial-gradient(55% 50% at 14% 86%, rgba(255, 186, 102, .26), transparent 70%),
    radial-gradient(120% 90% at 50% 0%, #2d1a44 0%, #170f28 60%, #0d0918 100%);
  transition: opacity .9s ease .55s, visibility 0s linear 1.5s;
}
.cover canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(75% 70% at 50% 50%, transparent 55%, rgba(8, 5, 16, .55) 100%);
}
.cover-center {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; pointer-events: none;
  transition: opacity .5s ease, transform 1s cubic-bezier(.2, .7, .2, 1), filter .6s ease;
}
.cover-center::before {
  content: ""; position: absolute; width: min(760px, 96vw); height: min(460px, 70vh); z-index: -1;
  background: radial-gradient(closest-side, rgba(14, 9, 26, .72), rgba(14, 9, 26, .34) 62%, transparent);
}
.cover-center > * { animation: cover-rise 1.1s cubic-bezier(.2, .7, .2, 1) both; }
.cover-center > :nth-child(2) { animation-delay: .15s; }
.cover-center > :nth-child(3) { animation-delay: .3s; }
.cover-center > :nth-child(4) { animation-delay: .45s; }
.cover-center > :nth-child(5) { animation-delay: .9s; }
@keyframes cover-rise { from { opacity: 0; transform: translateY(16px); } }
.cover-title {
  margin: 0; color: #fff6ea;
  font: italic 500 clamp(84px, 16vw, 196px)/.9 var(--serif); letter-spacing: -.04em;
  text-shadow: 0 0 36px rgba(255, 170, 120, .45), 0 0 110px rgba(255, 110, 150, .35);
}
.cover-title span { color: #ff8a5c; }
.cover-line { margin: 30px 0 0; max-width: 26em; color: rgba(255, 242, 228, .92); font: 400 clamp(19px, 2.4vw, 25px)/1.45 var(--serif); }
.cover-line.small { margin-top: 6px; color: rgba(255, 226, 200, .72); font: 400 clamp(14px, 1.6vw, 16px)/1.5 var(--sans); }
.cover-button {
  pointer-events: auto; cursor: pointer; user-select: none;
  margin-top: 32px; display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 32px; border-radius: 999px;
  color: #23122a; font: 650 17px/1 var(--sans); letter-spacing: .01em;
  background: linear-gradient(120deg, #ffe0a8, #ffa27e 45%, #ff7fa8);
  box-shadow: 0 0 0 6px rgba(255, 190, 150, .12), 0 16px 44px -12px rgba(255, 120, 140, .75);
  transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s ease;
}
.cover-button span { transition: transform .25s cubic-bezier(.2, .7, .2, 1); }
.cover-button:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 0 9px rgba(255, 190, 150, .16), 0 22px 54px -12px rgba(255, 120, 140, .85); }
.cover-button:hover span { transform: translateX(4px); }
.cover-toggle:focus-visible + .cover .cover-button { outline: 2px solid #ffe0a8; outline-offset: 5px; }
.cover-hint { margin: 20px 0 0; color: rgba(255, 236, 220, .5); font: 13px/1 var(--sans); letter-spacing: .06em; }
@media (hover: none) { .cover-hint { display: none; } }

/* Coming in: the words drift forward and blur while the colours scatter. */
.cover-toggle:checked + .cover { opacity: 0; visibility: hidden; pointer-events: none; }
.cover-toggle:checked + .cover .cover-center { opacity: 0; transform: scale(1.1); filter: blur(8px); }

@media (prefers-reduced-motion: reduce) {
  .cover-center > * { animation: none; }
  .cover { transition: opacity .4s ease, visibility 0s linear .4s; }
  .cover-toggle:checked + .cover .cover-center { transform: none; filter: none; }
}
@media print { .cover, .cover-toggle { display: none; } }
