@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/assets/fraunces-latin-wght-normal.7f9d191d99.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 800;
  font-display: swap;
  src: url('/assets/fraunces-latin-wght-italic.bceec2ef4d.woff2') format('woff2');
}

:root {
  --paper: #f7f1e8;
  --surface: #fffaf3;
  --ink: #2b211d;
  --muted: #65554b;
  --line: #e2d5c4;
  --accent: #9e3434;
  --accent-ink: #ffffff;
  --accent-soft: #f3e1d9;
  --focus: #1d5fb8;
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --radius: 10px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #17120f;
    --surface: #221b17;
    --ink: #f3e9de;
    --muted: #c4b4a6;
    --line: #3b3029;
    --accent: #f0998a;
    --accent-ink: #1c120f;
    --accent-soft: #3a2621;
    --focus: #8ab8ff;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #17120f;
  --surface: #221b17;
  --ink: #f3e9de;
  --muted: #c4b4a6;
  --line: #3b3029;
  --accent: #f0998a;
  --accent-ink: #1c120f;
  --accent-soft: #3a2621;
  --focus: #8ab8ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
  min-height: 100vh;
  min-height: 100svh; /* phones: measure with the address bar showing, so short pages never scroll into empty space */
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
img { max-width: 100%; height: auto; display: block; }
picture img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.9rem, 1.4rem + 2.4vw, 2.75rem); }
h2 { font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); }
p { margin: 0 0 1em; }

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

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 10px 14px; border-radius: 6px;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.fixture-banner {
  background: #ffe28a; color: #2b2100; text-align: center;
  padding: 8px var(--gutter); font-size: 0.95rem;
}

/* ---------- Wordmark ---------- */
.wordmark { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; white-space: nowrap; color: var(--ink); }
.wm-luv { font-style: italic; font-weight: 650; color: var(--accent); }
.wm-and { font-style: italic; font-weight: 400; font-size: 0.72em; color: var(--muted); }
.wordmark-hero { font-size: clamp(2.4rem, 1.4rem + 5.4vw, 4.6rem); line-height: 1.05; white-space: normal; }
.wordmark-hero .wm-luv, .wordmark-hero .wm-brownie { white-space: nowrap; }
.wordmark-small { font-size: 1.15rem; }

/* ---------- Header / footer ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--paper); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.home-link { text-decoration: none; font-size: 1.3rem; padding: 6px 0; }
.site-header nav, .site-footer nav { display: flex; gap: 4px; }
.site-header nav a, .site-footer nav a {
  color: var(--ink); text-decoration: none; padding: 10px 10px; border-radius: 6px; font-weight: 500;
}
.site-header nav a:hover, .site-footer nav a:hover { background: var(--accent-soft); }
.site-header nav a[aria-current='page'] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
@media (max-width: 480px) {
  .home-link { font-size: 1.05rem; }
  .site-header nav { gap: 0; }
  .site-header nav a { padding: 10px 7px; font-size: 0.95rem; }
}
@media (max-width: 399px) {
  /* Phones: the menu gets its own row under the wordmark instead of running off the edge */
  .header-inner { flex-wrap: wrap; justify-content: center; gap: 0; min-height: 0; padding-block: 8px 2px; }
  .home-link { padding: 2px 0; }
  .site-header nav { width: 100%; justify-content: center; gap: 4px; }
}
.site-footer { border-top: 1px solid var(--line); margin-top: 64px; padding: 24px 0 32px; color: var(--muted); font-size: 0.95rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.footer-inner p { margin: 0; }
.copyright { order: 3; flex-basis: 100%; font-size: 0.85rem; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; flex-direction: column; justify-content: center;
  min-height: 48px; padding: 10px 20px; border-radius: 999px;
  border: 1.5px solid var(--ink); color: var(--ink); background: transparent;
  text-decoration: none; font-weight: 600; line-height: 1.2;
}
.button:hover { background: var(--accent-soft); }
.button-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button-primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.button-sub { font-weight: 400; font-size: 0.85rem; opacity: 0.9; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.eyebrow { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--muted); margin: 0 0 0.35em; }
.meta { color: var(--muted); font-size: 0.95rem; }
.hint { color: var(--muted); font-size: 0.95rem; max-width: 46ch; }

/* ---------- Home ---------- */
.hero { padding-top: clamp(32px, 6vw, 72px); padding-bottom: 24px; }
.hero-title { margin-bottom: 0.3em; }
.lede { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); max-width: 40ch; }
.soon { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--muted); }

.newest { margin-top: 24px; }
.newest-card {
  display: grid; gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.6);
  padding: 20px;
}
.newest-art { display: block; justify-self: center; max-width: 360px; width: 100%; }
.cover { border-radius: 4px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 8px 24px rgb(60 30 20 / 0.12); }
.newest-text h2 a { color: var(--ink); text-decoration: none; }
.newest-text h2 a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
@media (min-width: 760px) {
  .newest-card { grid-template-columns: minmax(240px, 360px) 1fr; padding: 32px; gap: 40px; }
}

/* ---------- Meet the characters ---------- */
.cast { margin-top: 56px; scroll-margin-top: 16px; }
.cast-intro { display: grid; gap: 20px; align-items: center; margin-bottom: 28px; }
.cast-together { max-width: 340px; width: 100%; justify-self: center; }
.cast-together img, .character-portrait img { border-radius: 8px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 8px 24px rgb(60 30 20 / 0.12); }
.cast-tagline { font-family: var(--serif); font-style: italic; font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.6rem); line-height: 1.3; max-width: 26ch; color: var(--ink); }
.themes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.themes li { font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--muted); }
.themes li + li::before { content: '·'; margin-right: 14px; color: var(--accent); }
@media (min-width: 760px) {
  .cast-intro { grid-template-columns: 340px 1fr; gap: 40px; }
}

.cast-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .cast-grid { grid-template-columns: 1fr 1fr; } }
.character {
  display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 16px; align-items: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) * 1.6);
  padding: 16px;
}
@media (min-width: 560px) { .character { grid-template-columns: 180px 1fr; padding: 20px; gap: 20px; } }
.character h3 { font-size: clamp(1.5rem, 1.3rem + 1vw, 1.9rem); margin-bottom: 0.1em; color: var(--accent); font-style: italic; }
.character-title { font-family: var(--serif); font-size: 1.1rem; margin-bottom: 0.6em; }
.character-essence { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.8em; }
.traits { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.traits li {
  font-size: 0.85rem; line-height: 1.3; padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--ink);
}
@media (max-width: 559px) {
  /* Phones: portrait beside the name, traits run full width underneath */
  .character-text { display: contents; }
  .character h3, .character-title, .character-essence { grid-column: 2; }
  .character-portrait { grid-row: span 3; }
  .traits { grid-column: 1 / -1; }
}

/* ---------- Archive ---------- */
.archive { padding-top: 32px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 12px; }
.tab { padding: 10px 18px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.tab:hover { background: var(--accent-soft); }
.tab[aria-current='page'] { background: var(--ink); color: var(--paper); }
.archive-note { color: var(--muted); max-width: 60ch; }

.episode-list { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.episode-link {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start;
  padding: 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.episode-link:hover { border-color: var(--accent); }
@media (min-width: 560px) { .episode-link { grid-template-columns: 120px 1fr; padding: 16px; gap: 20px; } }
.thumb img { border-radius: 3px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); }
.episode-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.episode-number { font-family: var(--serif); font-weight: 650; font-size: 1.25rem; }
.episode-title { font-family: var(--serif); font-size: 1.1rem; }
.episode-desc { color: var(--muted); }
.badge {
  display: inline-block; vertical-align: 0.15em; margin-left: 6px;
  font: 600 0.72rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-ink); padding: 4px 7px; border-radius: 999px;
}

/* ---------- Reader ---------- */
.reader { padding-top: 16px; }
.reader-head { text-align: center; padding: 24px 0 20px; }
.reader-desc { max-width: 52ch; margin-inline: auto; }

/* Horizontal page viewer: one whole page at a time, sized to fit the screen. */
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1056px; margin: 0 auto; padding: 0 var(--gutter) 6px;
}
.viewer-label { font-family: var(--serif); font-weight: 600; font-size: 0.95rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-close {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 0.95rem; text-decoration: none;
}
.viewer-close:hover { border-color: var(--accent); }
@media (max-width: 480px) { .viewer-title { display: none; } }
.viewer { margin-top: 4px; }
.pages {
  margin: 0; padding: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.pages::-webkit-scrollbar { display: none; }
.pages:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: 0; }
.page {
  position: relative; /* keeps the hidden page label inside its slide */
  flex: 0 0 100%; min-width: 0;
  scroll-snap-align: center; scroll-snap-stop: always;
  display: flex; justify-content: center; align-items: flex-start;
}
.page figure { margin: 0; display: flex; justify-content: center; width: 100%; }
.page picture { display: contents; }
.page img {
  width: auto; height: auto; max-width: 100%;
  max-height: calc(100vh - 10rem);
  max-height: calc(100svh - 10rem);
  background: var(--surface);
}
@media (max-width: 699px) {
  /* Phones: favour full width; the controls can sit just below the fold. */
  .page img { max-height: calc(100vh - 6.75rem); max-height: calc(100svh - 6.75rem); }
}
@media (min-width: 700px) {
  .page img { border-radius: 4px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 10px 30px rgb(60 30 20 / 0.12); }
  .page { padding: 0 var(--gutter) 12px; }
}

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 10px auto 0; padding: 0 var(--gutter); }
.pager-btn {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 1.6rem; line-height: 1; text-decoration: none;
}
.pager-btn span { margin-top: -3px; }
.pager-btn:hover { border-color: var(--accent); }
.pager-btn[aria-disabled='true'] { opacity: 0.35; cursor: default; }
.pager-btn[aria-disabled='true']:hover { border-color: var(--line); }
.dots { display: flex; flex-wrap: wrap; justify-content: center; }
.dot { width: 28px; height: 44px; display: grid; place-items: center; border-radius: 8px; }
.dot::before {
  content: ''; width: 10px; height: 10px; border-radius: 999px;
  border: 1.5px solid var(--muted); background: transparent;
}
.dot:hover::before { background: var(--accent-soft); }
.dot[aria-current='true']::before { width: 20px; background: var(--accent); border-color: var(--accent); }
@media (min-width: 700px) { .dot { width: 32px; } }
/* Phones turn pages by swiping, so the dots get the whole row. */
@media (max-width: 480px) {
  .pager-btn { display: none; }
  .pager { padding: 0 8px; }
  .dot { width: 24px; }
}
.pager-status { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 2px 0 0; }
@media (prefers-reduced-motion: no-preference) {
  .dot::before { transition: width 0.2s, background-color 0.2s; }
}

.story-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin: 8px 0; max-width: 920px; margin-inline: auto;
}
.story-nav-bottom { margin-top: 32px; }
.story-nav > * {
  display: flex; flex-direction: column; gap: 2px; justify-content: center;
  min-height: 56px; padding: 10px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none;
}
.story-nav a:hover { border-color: var(--accent); }
.nav-next { text-align: right; align-items: flex-end; }
.nav-dir { font-weight: 650; font-size: 0.95rem; }
.nav-ep { color: var(--muted); font-size: 0.875rem; }
.nav-none { border-style: dashed !important; background: transparent !important; }
.nav-none .nav-dir { color: var(--muted); }
.nav-archive { grid-column: 1 / -1; grid-row: 2; align-items: center; font-weight: 600; text-align: center; }
@media (min-width: 640px) {
  .story-nav { grid-template-columns: 1fr auto 1fr; }
  .nav-archive { grid-column: auto; grid-row: auto; padding-inline: 20px !important; }
}
/* Phones: keep the top bar to one compact row so the art starts sooner. */
@media (max-width: 639px) {
  .story-nav-top { grid-template-columns: 1fr auto 1fr; gap: 8px; }
  .story-nav-top > * { min-height: 48px; padding: 8px 12px; }
  .story-nav-top .nav-archive { grid-column: auto; grid-row: auto; font-size: 0.9rem; }
  .story-nav-top .nav-ep { display: none; }
  .story-nav-top .nav-none { visibility: hidden; }
  .story-nav-top .nav-dir { font-size: 0.95rem; }
  .story-nav-top .dir-long { display: none; }
  .reader-head { padding: 16px 0 14px; }
}

/* ---------- Contact ---------- */
.contact-form { display: grid; gap: 18px; margin-top: 24px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; }
.optional { font-weight: 400; color: var(--muted); }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
}
.field input:hover, .field textarea:hover { border-color: var(--muted); }
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--ink); }
.field textarea { resize: vertical; min-height: 9rem; }
.field-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.cf-turnstile { min-height: 65px; }
.form-status { margin: 0; min-height: 1.6em; color: var(--muted); }
.form-status.is-error { color: var(--accent); font-weight: 600; }
.contact-form button[disabled] { opacity: 0.6; cursor: progress; }
.contact-thanks { margin-top: 24px; outline: none; }

/* ---------- Prose ---------- */
.prose { max-width: 680px; padding-top: 40px; }
.prose p { font-size: 1.1rem; }

@media (prefers-reduced-motion: no-preference) {
  .button, .tab, .episode-link, .story-nav a { transition: background-color 0.15s, border-color 0.15s, color 0.15s; }
}

@media print {
  .site-header nav, .story-nav, .site-footer nav, .skip-link { display: none !important; }
}
