/* Stories at Dusk: warm paper, ink, one brick-red accent. Built for 30-65+ readers on phones inside the Facebook
   in-app browser: big serif text, generous line height, no pop-ups, nothing that moves the text while you read. */
:root {
  --paper: #fbf8f3;
  --paper-2: #f3ede3;
  --ink: #1f1b16;
  --ink-2: #4a4239;
  --muted: #7a6f63;
  --rule: #e4dbcd;
  --accent: #a3361f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e4dc;
  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --text-size: 21px;
  --measure: 40rem;
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1a1714; --paper-2: #24201b; --ink: #ece5da; --ink-2: #cfc6b8; --muted: #9c9182;
    --rule: #3a342c; --accent: #e07a5f; --accent-ink: #1a1714; --accent-soft: #3a261f;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); line-height: 1.5; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* Masthead */
/* Not sticky: on a phone a pinned header would eat a quarter of the screen while reading. */
.masthead { background: var(--paper); border-bottom: 1px solid var(--rule); }
.wordmark { display: block; text-align: center; padding: 14px 16px 6px; font-family: var(--serif); font-weight: 700; font-size: 1.35rem; letter-spacing: 0.01em; text-decoration: none; }
.cats { display: flex; gap: 6px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; justify-content: safe center; -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
@media (min-width: 900px) { .cats { -webkit-mask-image: none; mask-image: none; } }
.cats::-webkit-scrollbar { display: none; }
.cats a { flex: none; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 6px 12px; border-radius: 999px; background: var(--paper-2); }
.cats a:hover { background: var(--accent-soft); color: var(--accent); }

/* Shared bits */
.kicker { display: inline-block; margin: 0 0 8px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); text-decoration: none; }
.meta { margin: 0; font-size: 0.85rem; color: var(--muted); }
.section-title { font-family: var(--serif); font-size: 1.4rem; margin: 40px 0 16px; padding-top: 16px; border-top: 2px solid var(--ink); }

/* Home and category lists */
.home { max-width: 72rem; margin: 0 auto; padding: 0 16px 48px; }
.intro { text-align: center; padding: 32px 0 24px; }
.intro-title { font-family: var(--serif); font-weight: 600; font-size: clamp(1.4rem, 4.5vw, 2.2rem); line-height: 1.25; margin: 0 auto; max-width: 30ch; }
.intro-blurb { color: var(--ink-2); max-width: 40ch; margin: 12px auto 0; }
.grid { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card-link { display: block; text-decoration: none; }
.card-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 25%; border-radius: var(--radius); background: var(--paper-2); }
.card-text { padding: 12px 2px 0; }
.card-title { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; margin: 0 0 8px; }
.card-link:hover .card-title { color: var(--accent); }
.card-big .card-link { display: grid; gap: 0; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); }
.card-big .card-img { aspect-ratio: 4 / 3; border-radius: 0; }
.card-big .card-text { padding: 18px 18px 22px; }
.card-big .card-title { font-size: clamp(1.5rem, 5vw, 2.1rem); line-height: 1.2; }
.card-summary { font-family: var(--serif); font-size: 1.05rem; color: var(--ink-2); margin: 0 0 12px; }
.card-summary-compact { font-size: 0.95rem; line-height: 1.45; margin: 0 0 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (min-width: 800px) {
  .card-big .card-link { grid-template-columns: 1.1fr 1fr; align-items: center; }
  .card-big .card-img { aspect-ratio: 4 / 5; max-height: 560px; height: 100%; }
  .card-big .card-text { padding: 32px; }
}
.empty { color: var(--muted); }

/* Story page */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.1s linear; }
.story, .page { max-width: var(--measure); margin: 0 auto; padding: 0 16px 56px; }
.story-head { padding: 20px 0 14px; }
.series-crumb { display: block; font-size: 0.86rem; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0 0 10px; }
.series-crumb:hover { text-decoration: underline; }
.chapter-steps { margin: 0 0 12px; }
.chapter-steps-meta { display: flex; justify-content: space-between; align-items: center; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; }
.chapter-steps-track { height: 6px; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.chapter-steps-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.headline { font-family: var(--serif); font-size: clamp(1.75rem, 6.5vw, 2.6rem); line-height: 1.15; font-weight: 700; margin: 0 0 14px; letter-spacing: -0.01em; text-wrap: balance; }
.chapter-main-title { font-size: clamp(1.65rem, 6vw, 2.35rem); margin: 4px 0 12px; }
.reader-tools { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule); }
.fiction-tag { margin-right: auto; font-size: 0.8rem; font-style: italic; color: var(--muted); }
.reader-tools button { font: 600 0.9rem var(--sans); color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule); border-radius: 10px; min-width: 48px; min-height: 40px; cursor: pointer; }
.reader-tools button:active { background: var(--accent-soft); }
.chapter-img { margin: 0 -16px 12px; }
.chapter-img-inline { margin: 22px -16px; }
.chapter-img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
@media (min-width: 680px) { .chapter-img { margin: 0 0 12px; } .chapter-img-inline { margin: 24px 0; } .chapter-img img { border-radius: var(--radius); } }

.prose { font-family: var(--serif); font-size: var(--text-size); line-height: 1.82; color: var(--ink); overflow-wrap: break-word; }
.prose p { margin: 0 0 1.25em; }
.prose .discussion { margin: 1.6em 0 0; padding: 18px 20px; background: var(--paper-2); border-left: 4px solid var(--accent); border-radius: 6px; font-weight: 600; }
.chapter-heading { font-size: 1.18em; line-height: 1.3; margin: 1em 0 0.9em; text-align: center; }
.chapter-heading::after { content: ""; display: block; width: 48px; height: 2px; background: var(--accent); margin: 14px auto 0; }
.prose a { color: var(--accent); }
.ad-slot { margin: 30px 0; min-height: 250px; padding: 10px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); font-family: var(--sans); }
.ad-slot::before { content: "Advertisement"; display: block; text-align: center; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

/* End of chapter */
.next-chapter { margin: 36px 0 28px; padding: 24px 20px; border-radius: var(--radius); background: var(--accent-soft); text-align: center; }
.next-label { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.next-title { font-family: var(--serif); font-size: 1.3rem; line-height: 1.3; margin: 8px 0 10px; }
.next-teaser { font-family: var(--serif); font-style: italic; color: var(--ink-2); margin: 0 0 18px; }
.next-meta { margin: 12px 0 0; font-size: 0.82rem; color: var(--muted); }
.read-cta { display: inline-block; margin-top: 12px; font-weight: 700; color: var(--accent); }
.btn-next { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 58px; padding: 14px 20px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-size: 1.1rem; font-weight: 700; text-decoration: none; box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-next span { font-size: 1.3em; transition: transform 0.15s; }
.btn-next:hover span { transform: translateX(3px); }
.the-end { text-align: center; font-size: 2rem; color: var(--accent); margin: 32px 0 0; }
.read-next .grid { grid-template-columns: 1fr; }
@media (min-width: 640px) { .read-next .grid { grid-template-columns: repeat(3, 1fr); } .read-next .card-title { font-size: 1.02rem; } }

.toc { list-style: none; margin: 32px 0 0; padding: 16px 0 0; border-top: 1px solid var(--rule); counter-reset: none; }
.toc li + li { margin-top: 8px; }
.toc li a { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); font-family: var(--serif); background: var(--paper); }
.toc li a::after { content: "›"; margin-left: auto; font: 700 1.4rem var(--sans); color: var(--accent); }
.toc li[aria-current] a { background: var(--paper-2); }
.toc li[aria-current] a::after { content: "Reading"; font: 600 0.75rem var(--sans); color: var(--muted); }
.toc-n { flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--accent-soft); font: 700 0.8rem var(--sans); color: var(--accent); }
.toc li[aria-current] a { color: var(--ink); font-weight: 700; }
.toc li[aria-current] .toc-n { background: var(--accent); color: var(--accent-ink); }

/* Share bar */
.share-bar { margin: 24px 0 0; padding: 14px 16px; border-radius: var(--radius); background: var(--paper-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.share-label { font-size: 0.85rem; font-weight: 700; color: var(--ink-2); }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font: 600 0.82rem var(--sans); text-decoration: none; cursor: pointer; }
.share-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* You may also like: compact rows */
.more .section-title { margin-top: 40px; }
.more-list { list-style: none; margin: 0; padding: 0; }
.more-list li + li { border-top: 1px solid var(--rule); }
.more-list a { display: flex; gap: 14px; align-items: flex-start; padding: 16px 0; text-decoration: none; }
.more-list img { flex: none; width: 92px; height: 115px; object-fit: cover; object-position: 50% 25%; border-radius: 10px; background: var(--paper-2); }
.more-text { display: flex; flex-direction: column; min-width: 0; }
.more-text .kicker { margin-bottom: 4px; font-size: 0.7rem; }
.more-title { font-family: var(--serif); font-weight: 700; font-size: 1.08rem; line-height: 1.3; margin-bottom: 5px; }
.more-excerpt { font-family: var(--serif); font-size: 0.92rem; line-height: 1.42; color: var(--ink-2); margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.more-list a:hover .more-title { color: var(--accent); }

/* Static pages */
.prose-page { font-size: 1.05rem; padding-top: 28px; }
.prose-page h2 { font-size: 1.2rem; margin: 1.8em 0 0.6em; }

/* Footer */
.site-foot { border-top: 1px solid var(--rule); background: var(--paper-2); padding: 32px 16px 40px; text-align: center; font-size: 0.88rem; color: var(--ink-2); }
.foot-name { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink); margin: 0 0 6px; }
.foot-note { max-width: 40ch; margin: 0 auto 16px; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-bottom: 14px; }
.foot-links a { text-decoration: none; font-weight: 600; }
.foot-copy { margin: 0; color: var(--muted); font-size: 0.8rem; }

/* Numbered story pages + "More stories" (reader.js loads the next page in place). */
.pager { margin: 36px auto 8px; max-width: 28rem; text-align: center; font-family: var(--sans); }
.load-more { display: flex; align-items: center; justify-content: center; min-height: 54px; border: 1.5px solid var(--accent); border-radius: 12px; color: var(--accent); font-size: 1.05rem; font-weight: 700; text-decoration: none; }
.load-more[aria-busy="true"] { opacity: .6; pointer-events: none; }
.pager-pages { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0 0; color: var(--muted); font-size: .92rem; }
.pager-pages a { color: var(--ink-2); }

/* Same-site page changes cross-fade instead of flashing white (Chrome 126+, Safari 18.2+; others just navigate). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
