/* Volatis — mobile-first reader styles. No external fonts. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1d1b18;
  --muted: #5d574e;
  --line: #e2ddd3;
  --accent: #8a4b12;
  --accent-text: #ffffff;
  --accent-soft: #f5eadc;
  --panel-bg: #f1efe9;
  --focus: #1b6fd6;
  --danger: #a32020;
  --reader-size: 18px;
  --reader-lh: 1.65;
  --reader-width: 38rem;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --reader-font: var(--font-serif);
  --bar-h: 56px;
  color-scheme: light;
}
[data-theme="paper"] {
  --bg: #f4ecd8; --surface: #fbf5e6; --text: #2b2418; --muted: #5f5240; --line: #ddd0b3;
  --accent: #7a4210; --accent-soft: #eadbbb; --panel-bg: #ece2c9;
}
[data-theme="dark"] {
  --bg: #15171a; --surface: #1d2024; --text: #e6e2da; --muted: #a8a196; --line: #33373d;
  --accent: #e3a35a; --accent-text: #15171a; --accent-soft: #2c2a26; --panel-bg: #23272c; --focus: #7db4ff; --danger: #ff8b8b;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #15171a; --surface: #1d2024; --text: #e6e2da; --muted: #a8a196; --line: #33373d;
    --accent: #e3a35a; --accent-text: #15171a; --accent-soft: #2c2a26; --panel-bg: #23272c; --focus: #7db4ff; --danger: #ff8b8b;
    color-scheme: dark;
  }
}
[data-font="sans"] { --reader-font: var(--font-sans); }
[data-spacing="compact"] { --reader-lh: 1.45; }
[data-spacing="roomy"] { --reader-lh: 1.9; }
[data-width="narrow"] { --reader-width: 32rem; }
[data-width="wide"] { --reader-width: 46rem; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-anchor: none; } /* the reader script keeps the place itself, the same way in every browser */
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 var(--font-sans);
  overflow-wrap: break-word;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 8px; top: -60px; background: var(--surface); color: var(--text); padding: 10px 14px; z-index: 50; border: 2px solid var(--focus); border-radius: 6px; }
.skip-link:focus { top: 8px; }
.proto-banner { background: #3b2a12; color: #fff3df; text-align: center; font-size: 13px; padding: 6px 16px; }
.note { color: var(--muted); font-size: 0.9rem; }

/* Buttons: 44px minimum touch targets */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 44px; padding: 10px 16px;
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.small { min-height: 36px; padding: 6px 10px; font-size: 14px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.badge { display: inline-block; font: 600 11px/1.6 var(--font-sans); letter-spacing: 0.03em; text-transform: uppercase; padding: 0 6px; border-radius: 4px; vertical-align: middle; }
.badge.draft { background: var(--accent-soft); color: var(--muted); border: 1px dashed var(--muted); }
.badge.author { background: var(--accent); color: var(--accent-text); }

/* Header & footer */
.site-header { display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); text-decoration: none; min-height: 44px; }
.brand img { border-radius: 50%; width: 36px; height: 36px; }
.header-story { color: var(--muted); text-decoration: none; font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; min-width: 0; }
.site-nav { margin-left: auto; display: flex; gap: 4px; }
.site-header.compact .site-nav { display: none; }
.site-nav a { color: var(--text); text-decoration: none; padding: 10px 10px; min-height: 44px; display: inline-flex; align-items: center; font-size: 15px; }
.site-footer { border-top: 1px solid var(--line); padding: 24px 16px calc(24px + var(--bar-h)); color: var(--muted); font-size: 14px; text-align: center; }
.page-home .site-footer, .page-story .site-footer, .page-admin .site-footer { padding-bottom: 24px; }

main { display: block; }
main > section, .prose-page, .story-page { max-width: 64rem; margin: 0 auto; padding: 0 16px; }

/* Homepage */
.hero { position: relative; }
.hero-art img { display: block; width: 100%; height: 120px; object-fit: cover; }
.hero-text { max-width: 64rem; margin: 0 auto; padding: 12px 16px 0; }
.hero-text h1 { margin: 0; font-size: 1.6rem; }
.hero-text p { margin: 4px 0 0; color: var(--muted); }
@media (min-width: 700px) { .hero-art img { height: 260px; } .hero-text h1 { font-size: 2rem; } }
.continue-card { margin-top: 16px !important; }
.continue-card h2 { font-size: 1rem; margin: 16px 0 8px; color: var(--muted); }
.continue-card .btn { width: 100%; justify-content: flex-start; text-align: left; }
@media (min-width: 700px) { .continue-card .btn { width: auto; } }
.story-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .story-grid { grid-template-columns: repeat(3, 1fr); } }
.story-card { display: grid; grid-template-columns: 104px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
@media (min-width: 900px) { .story-card { grid-template-columns: 1fr; align-content: start; } .story-card .cover { width: 160px; height: 240px; } }
.story-card .cover { width: 104px; height: auto; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; }
.story-card h3 { margin: 0 0 4px; font-size: 1.15rem; }
.story-card h3 a { color: var(--text); text-decoration: none; }
.story-card .meta { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.story-card .hook { margin: 0 0 10px; font-family: var(--font-serif); font-size: 15px; line-height: 1.55; }
.story-card .actions { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.soon { color: var(--muted); font-size: 14px; font-style: italic; }
.latest h2, #stories-h { font-size: 1.15rem; margin: 28px 0 12px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; min-height: 44px; }
.quiet-support { color: var(--muted); font-size: 14px; margin: 28px auto; max-width: 64rem; padding: 0 16px; }

/* Story page */
.story-top { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding-top: 16px; align-items: start; }
@media (min-width: 700px) { .story-top { grid-template-columns: 200px 1fr; gap: 24px; } }
.story-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; }
.story-top h1 { margin: 0 0 6px; font-size: 1.5rem; }
.story-top .meta { margin: 0 0 4px; color: var(--muted); font-size: 14px; }
.story-top .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.synopsis { font-family: var(--font-serif); font-size: 17px; line-height: 1.6; max-width: 40rem; }
.synopsis h2, .chapter-list h2 { font-family: var(--font-sans); font-size: 1.15rem; }
.content-notice { font-family: var(--font-sans); font-size: 14px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 10px; }
ol.chapters { list-style: none; padding: 0; margin: 0; }
ol.chapters a { display: grid; grid-template-columns: 3rem 1fr 1.5rem; align-items: center; min-height: 48px; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
ol.chapters .num { color: var(--muted); font-variant-numeric: tabular-nums; }
ol.chapters a.is-read .read-tick::before { content: "✓"; color: var(--muted); }
ol.chapters a.is-current { background: var(--accent-soft); font-weight: 600; }

/* Reader */
.reader { padding: 0 16px; }
.chapter { max-width: var(--reader-width); margin: 0 auto; }
.chapter-head { padding: 20px 0 8px; }
.chapter-story { margin: 0 0 4px; font-size: 14px; }
.chapter-story a { color: var(--muted); }
.chapter-head h1 { margin: 0; font-family: var(--reader-font); font-weight: 700; font-size: 1.55rem; outline: none; }
.chapter-num { display: block; font: 600 13px/1.4 var(--font-sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 2px; }
.chapter-meta { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.chapter-body { font-family: var(--reader-font); font-size: var(--reader-size); line-height: var(--reader-lh); hyphens: manual; }
.chapter-body p { margin: 0 0 1em; }
.chapter-body em { font-style: italic; }
.callout { font-family: var(--font-sans); font-size: 14px; line-height: 1.5; background: var(--accent-soft); border: 1px dashed var(--muted); border-radius: 8px; padding: 10px 12px; margin: 0 0 1.2em; }
.scene-break { text-align: center; margin: 1.6em 0; color: var(--muted); font-size: 0.9em; letter-spacing: 0.4em; }
.panel { font-family: var(--font-sans); font-size: calc(var(--reader-size) * 0.88); line-height: 1.45; background: var(--panel-bg); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 10px 12px; margin: 0 0 1.2em; }
.panel-title { margin: 0 0 6px !important; font-weight: 700; font-size: 0.85em; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.panel-row { display: flex; flex-wrap: wrap; gap: 0 0.6em; padding: 2px 0; }
.panel-key { font-weight: 600; min-width: 7.5em; }
.panel-val { flex: 1 1 12em; min-width: 0; }
.author-note { font-family: var(--font-sans); font-size: 15px; border-top: 1px solid var(--line); margin-top: 1.5em; padding-top: 0.5em; }
.author-note summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 600; }

.chapter-end { border-top: 1px solid var(--line); margin-top: 2em; padding: 16px 0 8px; text-align: center; }
.end-mark { color: var(--muted); font-size: 14px; margin: 0 0 12px; }
.end-actions { margin-bottom: 16px; }
.comments-btn .count:not(:empty)::before { content: " · "; }
.chapter-nav { display: grid; gap: 10px; }
.chapter-nav .next-link { width: 100%; }
.nav-row { display: flex; justify-content: space-between; gap: 10px; }
.caught-up { color: var(--muted); margin: 0; }
.load-status:empty { display: none; }
.load-status { margin-top: 12px; font-size: 14px; color: var(--muted); }
.load-status .btn { margin: 4px; }
.chapter + .chapter { margin-top: 32px; }
.chapter.placeholder { overflow: hidden; }
.chapter.placeholder .placeholder-note { color: var(--muted); text-align: center; padding-top: 40px; }
.stream-earlier { max-width: var(--reader-width); margin: 0 auto; padding: 16px 0 0; text-align: center; }
.stream-earlier .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ad slots (placeholders only; no ad code). Fixed reserved size, so a late, empty or failed ad never moves the text.
   Size and the sidebar breakpoints are appended by the build from content/site.json (ads.size). */
.chapter { position: relative; }
.ad-slot { text-align: center; }
.ad-end { margin: 32px auto 56px; display: flex; flex-direction: column; align-items: center; } /* 56px clear gap above the Comments/Next buttons */
.ad-label { margin: 0 0 6px; font: 600 11px/1.2 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ad-box { flex: none; width: var(--ad-w, 300px); height: var(--ad-h, 250px); overflow: hidden; contain: strict; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--line); border-radius: 6px; background: var(--panel-bg, transparent); color: var(--muted); font: 13px/1.4 var(--font-sans); }
.ad-box .ad-ph { padding: 0 16px; }
.ad-box .ad-sample { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px;
  background: var(--accent-soft); color: var(--text); }
.ad-box .ad-sample small { color: var(--muted); }
/* Desktop sidebar: in the margin beside the chapter opening; never overlaps the column; not sticky. */
.ad-side { display: none; position: absolute; top: 72px; left: calc(100% + 40px); width: var(--ad-w, 300px); }
.after-break .ad-side { visibility: hidden; } /* continuous reading: the between-chapter slot above is enough */

/* Bottom reader bar: always visible, labeled buttons, no hidden gestures */
.reader-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom)); padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
}
.bar-btn { min-height: 44px; min-width: 44px; padding: 8px 14px; font: 600 15px/1 var(--font-sans); color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.bar-resume { flex: 1; min-width: 0; min-height: 44px; padding: 8px 10px; font: 600 14px/1.1 var(--font-sans); color: var(--accent-text); background: var(--accent); border: none; border-radius: 10px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-progress { font-size: 13px; color: var(--muted); text-align: center; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-chapter main { padding-bottom: 8px; }

/* Dialog sheets: bottom sheet on phones, side panel on desktop */
dialog.sheet {
  border: none; padding: 0 16px 16px; margin: auto 0 0; width: 100%; max-width: 100%; max-height: 88vh; max-height: 88dvh;
  background: var(--surface); color: var(--text); border-radius: 16px 16px 0 0; overflow-y: auto; overscroll-behavior: contain;
}
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.45); }
@media (min-width: 900px) {
  dialog.sheet { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: 420px; border-radius: 0; }
}
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface); padding: 12px 0; border-bottom: 1px solid var(--line); margin-bottom: 8px; z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
.settings fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 8px 12px 12px; }
.settings legend { font-weight: 700; padding: 0 4px; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper legend { float: left; width: 100%; padding: 0; margin-bottom: 6px; }
.stepper output { min-width: 3ch; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.choice label { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.choice input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Comments */
.comments-chapter { margin: 0 0 8px; color: var(--muted); font-size: 14px; }
.status:empty { display: none; }
.status { padding: 8px 10px; border-radius: 8px; background: var(--accent-soft); font-size: 14px; margin-bottom: 8px; }
.status.error { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.comments-list { list-style: none; margin: 0; padding: 0; }
.comment { border-bottom: 1px solid var(--line); padding: 12px 0; }
.comment .replies { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.comment .replies .comment { border-bottom: none; padding-bottom: 4px; }
.comment-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font-size: 14px; }
.comment-name { font-weight: 700; }
.comment-time { color: var(--muted); font-size: 13px; }
.comment-body { margin: 6px 0; white-space: pre-wrap; font-size: 15px; line-height: 1.55; }
.comment-pending { font-size: 13px; color: var(--muted); font-style: italic; }
.comment-removed { color: var(--muted); font-style: italic; font-size: 14px; }
.comment-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.comment-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.comment-form h3 { font-size: 1rem; margin: 8px 0; }
.comment-form label { display: block; font-weight: 600; font-size: 14px; margin: 10px 0 4px; }
.comment-form input, .comment-form textarea { width: 100%; font: inherit; font-size: 16px; padding: 10px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.comment-form textarea { resize: vertical; min-height: 120px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.replying { font-size: 14px; color: var(--muted); }

.prose-page { max-width: 40rem; padding-bottom: 40px; }
.prose-page .table-wrap { overflow-x: auto; margin: 16px 0; }
.prose-page table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose-page th, .prose-page td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.prose-page th { font-weight: 600; }
.prose-page code { font-size: 0.92em; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: no-preference) {
  html:focus-within { scroll-behavior: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print { .reader-bar, .site-header, .chapter-end, .ad-slot, dialog { display: none !important; } }

/* release states (author preview and admin) */
.badge.status-published { background: #1f6b3a; color: #fff; }
.badge.status-scheduled { background: #24508f; color: #fff; }
.badge.status-paused { background: #8a4b0f; color: #fff; }
.badge.status-draft { background: var(--accent-soft); color: var(--muted); border: 1px dashed var(--muted); }
.author-banner { background: #1d3a5f; color: #eef4ff; }
.author-banner a { color: inherit; }
.chapter-status { margin: 8px 0 0; font: 600 13px var(--font-sans); color: var(--muted); }
.expectations { margin: 0 0 1em; padding-left: 1.2em; }
.expectations li { margin: 0 0 0.35em; }
.expect-h { font-size: 1rem; margin: 1.2em 0 0.4em; }

/* generated by src/build.mjs from content/site.json ads.size */
:root { --ad-w: 300px; --ad-h: 250px; }
@media (min-width: 77.50em) { [data-width="narrow"] .ad-side { display: block; } }
@media (min-width: 83.50em) { [data-width="medium"] .ad-side { display: block; } }
@media (min-width: 91.50em) { [data-width="wide"] .ad-side { display: block; } }
