/* Marlo — reading-first styles. Tokens on :root, dark via the system or the reader's toggle. */
@font-face { font-family: "Literata"; src: url("/fonts/literata.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Literata"; src: url("/fonts/literata-italic.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/fonts/fraunces.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }

:root {
  --paper: #f6f1e7; --paper-2: #efe7d8; --card: #fbf8f2; --ink: #1d1a16; --ink-2: #4a433a; --muted: #7a6f61;
  --rule: #ddd2bf; --accent: #a8461f; --accent-ink: #fff8f0; --focus: #2f6db5;
  --serif: "Literata", Georgia, "Times New Roman", serif; --display: "Fraunces", "Literata", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --measure: 36rem; --reader-size: 1.1875rem; --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15130f; --paper-2: #1d1a15; --card: #1f1c17; --ink: #ece4d6; --ink-2: #c9bfae; --muted: #968a78;
    --rule: #37312a; --accent: #e08a5f; --accent-ink: #1a120c; --focus: #8bb8ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15130f; --paper-2: #1d1a15; --card: #1f1c17; --ink: #ece4d6; --ink-2: #c9bfae; --muted: #968a78;
  --rule: #37312a; --accent: #e08a5f; --accent-ink: #1a120c; --focus: #8bb8ff; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.6 var(--serif); min-height: 100vh; display: flex; flex-direction: column; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: 68rem; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }

/* header / footer */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { font: 600 1.5rem/1 var(--display); letter-spacing: -0.01em; text-decoration: none; }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font: 500 0.9375rem/1 var(--sans); }
.nav a { text-decoration: none; color: var(--ink-2); padding: 8px 0; }
.nav a[aria-current="page"], .nav a:hover { color: var(--accent); }
main { flex: 1; padding: 32px 0 96px; }
.site-foot { border-top: 1px solid var(--rule); color: var(--muted); font: 0.875rem/1.5 var(--sans); padding: 24px 0 88px; }
.site-foot .wrap { display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: space-between; }

/* type */
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 3.4vw, 1.875rem); }
h3 { font-size: 1.2rem; }
.kicker { font: 600 0.75rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 12px; }
.lede { font-size: 1.1875rem; color: var(--ink-2); max-width: 38rem; margin: 0 0 24px; }
.muted { color: var(--muted); }
.small { font: 0.875rem/1.45 var(--sans); }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; font: 600 0.9375rem/1 var(--sans); padding: 12px 18px; border-radius: 999px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); text-decoration: none; cursor: pointer; }
.btn:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* home */
.hero { padding: 24px 0 40px; border-bottom: 1px solid var(--rule); margin-bottom: 40px; }
.hero h1 { font-size: clamp(2.5rem, 9vw, 4.5rem); margin-bottom: 12px; }
.feature { display: grid; gap: 20px; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 24px; margin-bottom: 48px; }
.feature h2 { margin-bottom: 8px; }
.continue { display: none; margin: -24px 0 40px; }
.continue.show { display: block; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.section-head a { font: 500 0.9375rem/1 var(--sans); }

/* covers + book grid */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 28px 20px; margin-bottom: 48px; }
.book-card { text-decoration: none; display: block; }
.book-card h3 { margin: 12px 0 2px; font-size: 1.0625rem; }
.cover { aspect-ratio: 2 / 3; border-radius: 4px 8px 8px 4px; overflow: hidden; box-shadow: 0 1px 2px rgb(0 0 0 / 0.12), 0 10px 24px -12px rgb(0 0 0 / 0.35); position: relative; background: var(--paper-2); }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.type { display: flex; flex-direction: column; justify-content: space-between; padding: 14% 12%; color: #fbf6ec; }
.cover.type::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6%; background: rgb(0 0 0 / 0.18); }
.cover.type .t { font: 600 clamp(1rem, 4.2cqi, 1.5rem)/1.1 var(--display); container-type: inline-size; }
.cover.type .a { font: 500 0.6875rem/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; opacity: 0.85; }
.cover.c0 { background: #6b2f1f; } .cover.c1 { background: #24443f; } .cover.c2 { background: #3b3358; }
.cover.c3 { background: #6a5426; } .cover.c4 { background: #2b3f5c; } .cover.c5 { background: #5a2a3e; }
.badge { display: inline-block; font: 600 0.6875rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--rule); }

/* book page */
.book-top { display: grid; gap: 28px; grid-template-columns: minmax(0, 1fr); margin-bottom: 40px; }
.book-top .cover { max-width: 220px; }
@media (min-width: 720px) { .book-top { grid-template-columns: 240px minmax(0, 1fr); gap: 40px; align-items: start; } .book-top .cover { max-width: none; } }
.blurb { color: var(--ink-2); max-width: 40rem; white-space: pre-line; }
.toc { list-style: none; padding: 0; margin: 0 0 40px; border-top: 1px solid var(--rule); max-width: 46rem; }
.toc li { border-bottom: 1px solid var(--rule); }
.toc a { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: 4px 8px; padding: 16px 0; text-decoration: none; }
.toc .n { font: 600 0.875rem/1.6 var(--sans); color: var(--muted); }
.toc .ti { font: 600 1.125rem/1.35 var(--display); }
.toc .su { grid-column: 2; color: var(--muted); font-size: 0.9375rem; }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 40px; }
.downloads a { font: 600 0.8125rem/1 var(--sans); letter-spacing: 0.04em; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; background: var(--card); }
.downloads a:hover { border-color: var(--accent); }

/* reader */
.reader { max-width: var(--measure); margin: 0 auto; }
.reader-head { text-align: center; margin: 8px 0 40px; }
.reader-head .kicker a { text-decoration: none; }
.reader-head h1 { font-size: clamp(1.9rem, 6vw, 2.75rem); }
.prose { font-size: var(--reader-size); line-height: 1.75; hyphens: auto; -webkit-hyphens: auto; }
.prose p { margin: 0; text-indent: 1.4em; }
.prose > p:first-child, .prose hr + p, .prose h2 + p, .prose h3 + p, .prose h4 + p, .prose blockquote + p { text-indent: 0; }
.prose > p:first-child::first-letter { font-family: var(--display); float: left; font-size: 3.4em; line-height: 0.82; padding: 0.08em 0.09em 0 0; color: var(--accent); }
.prose hr.scene-break { border: 0; text-align: center; margin: 1.6em 0; }
.prose hr.scene-break::after { content: "⁂"; color: var(--muted); font-size: 1.1em; }
.prose blockquote { margin: 1em 0 1em 1.2em; padding-left: 1em; border-left: 2px solid var(--rule); color: var(--ink-2); font-style: italic; }
.prose blockquote p { text-indent: 0; }
.prose h2, .prose h3, .prose h4 { margin: 1.6em 0 0.6em; text-align: center; }
.prose ul, .prose ol { margin: 0.6em 0; }
.reader-tools { position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; gap: 6px; padding: 8px 0; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(6px); }
.reader-tools button { font: 600 0.8125rem/1 var(--sans); min-width: 40px; min-height: 36px; border-radius: 8px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer; }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 56px 0 0; border-top: 1px solid var(--rule); padding-top: 20px; }
.chapter-nav a { text-decoration: none; display: block; padding: 8px 0; }
.chapter-nav .next { text-align: right; grid-column: 2; }
.chapter-nav .lbl { display: block; font: 600 0.75rem/1 var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.chapter-nav .ttl { font: 600 1.0625rem/1.3 var(--display); }

/* lists, prose pages */
.page { max-width: 42rem; }
.page p { margin: 0 0 1em; }
.upcoming { list-style: none; padding: 0; display: grid; gap: 20px; }
.upcoming li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 20px; align-items: start; }
.empty { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 28px; color: var(--muted); text-align: center; }

/* music player (stays put across page changes) */
.player { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; max-width: calc(100% - 32px); border-radius: 999px; background: var(--card); border: 1px solid var(--rule); box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.35); font: 500 0.875rem/1.2 var(--sans); }
.player[hidden] { display: none; }
.player button { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 0.875rem; }
.player .pt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }

/* print (also the PDF download) */
@media print {
  .site-head, .site-foot, .player, .reader-tools, .chapter-nav { display: none !important; }
  body { background: #fff; color: #000; }
}
