/* ============================================================================
   Saltscar — site styles. Mobile-first. Dark mode via prefers-color-scheme
   (CSS only, no JS). Self-hosted fonts only (no third-party CDN).
   ========================================================================== */

/* ---- Fonts (self-hosted, variable) --------------------------------------- */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 200 800;
  font-style: italic;
  font-display: swap;
}

/* ---- Design tokens ------------------------------------------------------- */
:root {
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Newsreader", Georgia, "Times New Roman", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* palette (visual bible) */
  --slate: #3c5868;
  --terracotta: #b15a3c;
  --bone: #e7dcc9;
  --charcoal: #15181c;
  --amber: #d7a14a;
  --teal: #1d4a44;

  /* light theme (default) */
  --bg: #f4efe6;
  --bg-raised: #fbf8f2;
  --bg-sunken: #ece4d6;
  --ink: #23201b;
  --ink-soft: #5a534a;
  --ink-faint: #8b8276;
  --rule: #d9cfbe;
  --accent: #9c4a2e;
  --accent-ink: #fbf8f2;
  --link: #8a4226;
  --focus: #2f5d8a;

  /* fluid type scale */
  --step--1: clamp(0.83rem, 0.79rem + 0.18vw, 0.94rem);
  --step-0: clamp(1.05rem, 1rem + 0.28vw, 1.2rem);
  --step-1: clamp(1.26rem, 1.17rem + 0.45vw, 1.55rem);
  --step-2: clamp(1.5rem, 1.34rem + 0.8vw, 2rem);
  --step-3: clamp(1.8rem, 1.5rem + 1.5vw, 2.7rem);
  --step-4: clamp(2.1rem, 1.6rem + 2.6vw, 3.6rem);

  --measure: 38rem;
  --wrap: 66rem;
  --space: clamp(1rem, 0.8rem + 1vw, 1.6rem);
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 8px 24px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121519;
    --bg-raised: #1a1e23;
    --bg-sunken: #0d0f12;
    --ink: #e7dcc9;
    --ink-soft: #b3aa9a;
    --ink-faint: #7d756a;
    --rule: #2a2f36;
    --accent: #d7a14a;
    --accent-ink: #15181c;
    --link: #e0b25f;
    --focus: #7fb0e0;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 30px rgba(0, 0, 0, 0.45);
  }
}

/* ---- Reset / base -------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  overflow-wrap: break-word;
}
img, picture, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 560; line-height: 1.12; letter-spacing: -0.01em; }

.wrap { width: min(100% - 2 * var(--space), var(--wrap)); margin-inline: auto; }
.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.eyebrow, .section-heading + * { margin-top: 0; }

.icon { width: 1.4em; height: 1.4em; flex: none; }

/* ---- Header / footer ----------------------------------------------------- */
.site-header { border-bottom: 1px solid var(--rule); background: var(--bg); }
.site-header__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: 0.9rem; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--ink); }
.brand__mark { color: var(--accent); font-size: 1.1em; }
.brand__name { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); letter-spacing: 0.02em; }
.site-nav { display: flex; gap: clamp(0.8rem, 3vw, 1.6rem); font-family: var(--font-ui); font-size: var(--step--1); }
.site-nav a { color: var(--ink-soft); text-decoration: none; padding: 0.4rem 0; }
.site-nav a:hover { color: var(--ink); }

.site-footer { margin-top: clamp(3rem, 8vw, 6rem); border-top: 1px solid var(--rule); background: var(--bg-sunken); }
.site-footer__inner { padding-block: clamp(2rem, 5vw, 3.5rem); display: grid; gap: 1.2rem; text-align: center; }
.social-row { list-style: none; padding: 0; display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.social-row a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; color: var(--ink-soft);
  border: 1px solid var(--rule);
}
.social-row a:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.site-footer__nav { display: flex; gap: 1rem 1.4rem; justify-content: center; flex-wrap: wrap; font-family: var(--font-ui); font-size: var(--step--1); }
.site-footer__nav a { color: var(--ink-soft); }
.site-footer__legal { color: var(--ink-faint); font-size: var(--step--1); font-family: var(--font-ui); }

/* ---- Buttons / badges ---------------------------------------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.4rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 44px;
  padding: 0.6rem 1.25rem; border-radius: 999px; font-family: var(--font-ui);
  font-size: var(--step--1); font-weight: 600; letter-spacing: 0.01em;
  text-decoration: none; border: 1.5px solid transparent; cursor: pointer;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { filter: brightness(1.07); }
.btn--ghost { border-color: var(--rule); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--accent); color: var(--link); }

.badge {
  display: inline-block; font-family: var(--font-ui); font-size: 0.72rem;
  font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 0.25rem 0.6rem; border-radius: 999px; border: 1px solid var(--rule);
  color: var(--ink-soft);
}
.badge--ongoing { color: var(--teal); border-color: color-mix(in srgb, var(--teal) 50%, transparent); }
.badge--complete { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
@media (prefers-color-scheme: dark) {
  .badge--ongoing { color: #6fb6ac; }
}

.byline { font-family: var(--font-ui); font-size: var(--step--1); color: var(--ink-soft); }
.eyebrow { font-family: var(--font-ui); font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.section-heading { font-size: var(--step-2); margin-bottom: 1.2rem; }

/* ---- Home ---------------------------------------------------------------- */
.hero-home { background: linear-gradient(160deg, var(--bg-raised), var(--bg)); border-bottom: 1px solid var(--rule); }
.hero-home__inner { text-align: center; padding-block: clamp(3rem, 10vw, 6.5rem); display: grid; gap: 0.8rem; justify-items: center; }
.hero-home__mark { color: var(--accent); font-size: clamp(2rem, 6vw, 3rem); }
.hero-home__title { font-size: var(--step-4); letter-spacing: 0.01em; }
.hero-home__tagline { font-family: var(--font-display); font-style: italic; font-size: var(--step-2); color: var(--ink-soft); max-width: 30ch; }
.hero-home__blurb { max-width: var(--measure); color: var(--ink-soft); }

.reading-now { padding-block: clamp(2.5rem, 7vw, 4.5rem); }

.story-feature { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: center; margin-bottom: clamp(2rem, 5vw, 3rem); }
.story-feature__media { display: block; min-width: 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.story-feature__img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.story-feature__title { font-size: var(--step-3); margin-block: 0.3rem 0.6rem; }
.story-feature__title a { color: inherit; text-decoration: none; }
.story-feature__title a:hover { color: var(--link); }
.story-feature__blurb { color: var(--ink-soft); margin-top: 0.8rem; max-width: 46ch; }

@media (min-width: 48rem) {
  .story-feature { grid-template-columns: 26rem minmax(0, 1fr); }
  .story-feature--compact { grid-template-columns: 20rem minmax(0, 1fr); }
  .story-feature__img { aspect-ratio: 4 / 5; }
}

.story-list { display: grid; gap: clamp(1.5rem, 4vw, 2.5rem); }

/* ---- Story detail -------------------------------------------------------- */
.story-hero { position: relative; }
.story-hero__media { max-height: 70vh; overflow: hidden; }
.story-hero__img { width: 100%; max-height: 70vh; object-fit: cover; }
.story-hero__body { padding-block: clamp(1.8rem, 5vw, 3rem); max-width: 48rem; }
.story-hero__title { font-size: var(--step-4); margin-block: 0.4rem 0.7rem; }
.story-hero__blurb { color: var(--ink-soft); font-size: var(--step-1); max-width: var(--measure); margin-top: 1rem; }

.chapter-index { padding-block: clamp(2rem, 6vw, 3.5rem); }
.chapter-grid { display: grid; gap: clamp(1rem, 3vw, 1.6rem); grid-template-columns: 1fr; }
@media (min-width: 34rem) { .chapter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 56rem) { .chapter-grid { grid-template-columns: repeat(3, 1fr); } }

.chapter-card {
  display: grid; text-decoration: none; color: inherit; background: var(--bg-raised);
  border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.chapter-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.chapter-card__media { display: block; }
.chapter-card__img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.chapter-card__text { padding: 0.9rem 1rem 1.1rem; display: grid; gap: 0.2rem; }
.chapter-card__num { font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.chapter-card__title { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.2; }
.chapter-card__av { font-family: var(--font-ui); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-top: 0.3rem; }

/* ---- Chapter reading page ------------------------------------------------ */
.chapter-hero__media { max-height: 56vh; overflow: hidden; }
.chapter-hero__img { width: 100%; max-height: 56vh; object-fit: cover; }
.chapter-hero__body { padding-block: clamp(1.5rem, 4vw, 2.5rem); max-width: 48rem; }
.chapter-hero__crumb { font-family: var(--font-ui); font-size: var(--step--1); margin-bottom: 0.8rem; }
.chapter-hero__crumb a { color: var(--ink-soft); text-decoration: none; }
.chapter-hero__crumb a:hover { color: var(--link); text-decoration: underline; }
.chapter-hero__eyebrow { font-family: var(--font-ui); font-size: var(--step--1); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
.chapter-hero__title { font-size: var(--step-4); margin-block: 0.3rem 1rem; }

/* Listen / Watch bar */
.listen-watch { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-block: 1.2rem; }
.listen-watch__link {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px;
  padding: 0.5rem 1rem; border-radius: 999px; border: 1.5px solid var(--rule);
  font-family: var(--font-ui); font-size: var(--step--1); font-weight: 600;
  text-decoration: none; color: var(--ink);
}
.listen-watch__link:hover { border-color: var(--accent); color: var(--link); }

/* Spread (share) controls — RECESSIVE: quiet, dim, low-contrast, never competing.
   Class names avoid "share" so Safari content blockers don't hide them. */
.spread {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1rem; opacity: 0.6; font-family: var(--font-ui);
  transition: opacity 0.2s;
}
.spread:hover, .spread:focus-within { opacity: 1; }
.spread__label { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); }
.spread__buttons { display: flex; gap: 0.15rem; flex-wrap: wrap; }
.spread__btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent;
  color: var(--ink-faint); cursor: pointer; text-decoration: none;
}
/* Keep the native-share button hidden until JS confirms Web Share support
   (class display rule would otherwise defeat the [hidden] attribute). */
.spread__btn[hidden] { display: none; }
.spread__btn:hover { color: var(--ink); background: var(--bg-sunken); }
.spread__btn .icon { width: 1.15em; height: 1.15em; }
.spread__feedback { font-size: var(--step--1); color: var(--ink-soft); }

/* Reading prose */
.prose { max-width: var(--measure); margin-inline: auto; }
.chapter-body { padding-block: clamp(1.5rem, 4vw, 2.5rem) clamp(2rem, 6vw, 4rem); }
.prose p { margin-block: 0 1.15em; }
.prose p:first-of-type { margin-top: 0; }
.prose em { font-style: italic; }
.prose a { color: var(--link); }
/* Drop-cap-ish opener for each part's first paragraph */
.part > p:first-of-type::first-line { font-variant: small-caps; letter-spacing: 0.01em; }

.part__marker {
  text-align: center; font-family: var(--font-ui); font-size: 0.72rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 1.4rem;
}
.part__marker span { position: relative; }

/* Scene-break ornament between parts */
.scene-break {
  border: 0; height: auto; margin-block: clamp(2.2rem, 6vw, 3.4rem);
  text-align: center; overflow: visible;
}
.scene-break::before {
  content: "✶   ✶   ✶";
  color: var(--accent); letter-spacing: 0.5em; font-size: 0.9rem;
  opacity: 0.8;
}

/* Chapter foot */
.chapter-foot { padding-bottom: clamp(2rem, 6vw, 4rem); display: grid; gap: clamp(1.6rem, 4vw, 2.4rem); }
.next-chapter {
  display: grid; gap: 0.25rem; padding: 1.2rem 1.4rem; border-radius: var(--radius);
  background: var(--bg-raised); border: 1px solid var(--rule); text-decoration: none;
  color: inherit; transition: border-color 0.15s, transform 0.15s;
}
.next-chapter:hover { border-color: var(--accent); transform: translateY(-2px); }
.next-chapter__label { font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.next-chapter__title { font-family: var(--font-display); font-size: var(--step-2); }

/* Follow CTA — PROMINENT: high visual weight, the primary call to action. */
.follow-cta {
  border-radius: var(--radius); padding: clamp(1.6rem, 5vw, 2.8rem);
  background: linear-gradient(150deg, var(--slate), var(--charcoal));
  color: var(--bone); box-shadow: var(--shadow); text-align: center;
}
.follow-cta--frontier {
  background: linear-gradient(150deg, var(--terracotta), var(--charcoal));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 55%, transparent), var(--shadow);
}
.follow-cta__inner { display: grid; gap: 0.7rem; justify-items: center; }
.follow-cta__eyebrow { font-family: var(--font-ui); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); }
.follow-cta__title { font-size: var(--step-2); color: var(--bone); }
.follow-cta__title em { font-style: italic; }
.follow-cta__body { color: color-mix(in srgb, var(--bone) 82%, transparent); max-width: 44ch; }
.follow-cta .placeholder-note { color: color-mix(in srgb, var(--bone) 55%, transparent); }
.follow-cta__links { list-style: none; padding: 0; margin-top: 0.6rem; display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.follow-cta__link {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 44px;
  padding: 0.55rem 1.1rem; border-radius: 999px; text-decoration: none;
  font-family: var(--font-ui); font-weight: 600; font-size: var(--step--1);
  background: rgba(255, 255, 255, 0.12); color: var(--bone);
  border: 1px solid rgba(255, 255, 255, 0.18); backdrop-filter: blur(2px);
}
.follow-cta__link:hover { background: var(--amber); color: var(--charcoal); border-color: var(--amber); }

.back-to-story { font-family: var(--font-ui); font-size: var(--step--1); }
.back-to-story a { color: var(--ink-soft); }

/* ---- Author -------------------------------------------------------------- */
.author { padding-block: clamp(2rem, 6vw, 3.5rem); max-width: 52rem; }
.author__head { display: grid; gap: 1.4rem; align-items: center; margin-bottom: 1.8rem; }
.author__portrait { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-width: 12rem; }
.author__img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.author__name { font-size: var(--step-3); }
.author__bio { margin-inline: 0; }
.author__stories { margin-top: 2.4rem; }
@media (min-width: 40rem) { .author__head { grid-template-columns: 12rem minmax(0, 1fr); } }

.link-list { list-style: none; padding: 0; display: grid; gap: 0.7rem; }
.link-list li { display: flex; align-items: center; gap: 0.7rem; }

/* ---- Legal / imprint ----------------------------------------------------- */
.legal { padding-block: clamp(2rem, 6vw, 3.5rem); }
.legal h2 { font-size: var(--step-3); margin-top: 2rem; }
.legal h3 { font-size: var(--step-1); margin-top: 1.6rem; margin-bottom: 0.3rem; }
.legal p { margin-bottom: 1em; color: var(--ink-soft); }
.legal hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.4rem; }

/* ---- 404 ----------------------------------------------------------------- */
.not-found { text-align: center; padding-block: clamp(4rem, 12vw, 8rem); display: grid; gap: 1rem; justify-items: center; }
.not-found__mark { color: var(--accent); font-size: 2.5rem; }
.not-found h1 { font-size: var(--step-3); }
.not-found p { color: var(--ink-soft); max-width: 40ch; }

/* ---- Stories index ------------------------------------------------------- */
.stories-index { padding-block: clamp(2.5rem, 7vw, 4.5rem); }
