/* ============================================================
   Field notes — design system (v2: wider, more playful)
   ============================================================
   Palette draws from the materials of the place: cream paper,
   iron-red Rif earth, warm olive secondary. Typography is
   Spectral throughout — Production Type's screen serif.

   Layout philosophy: a wide page that lets images and titles
   breathe out beyond the reading column. Asymmetric image
   placement (left/right floats and full-bleed breaks) keeps the
   long-form essay rhythm playful without breaking documentary
   register. Pull quotes and Roman-numeral section openings
   give the page magazine-style structure.
   ============================================================ */

@import url("/css/spectral.css");
@import url("/css/leaflet.css");

:root {
  /* --- Palette --- */
  --paper:        #F5EFE2;
  --paper-deep:   #ECE3CE;
  --paper-darker: #E0D5BB;
  --ink:          #1F1A14;
  --ink-soft:     #3C342A;
  --olive:        #6E6543;
  --olive-soft:   #8D8568;
  --rust:         #A8451E;
  --rust-deep:    #732C13;
  --rust-soft:    #C97351;
  --hairline:     #D9CFB8;

  /* --- Type --- */
  --serif: "Spectral", "Iowan Old Style", "Apple Garamond", Georgia, serif;
  --leading: 1.62;

  /* --- Layout --- */
  --measure:       42rem;     /* reading column ~750px */
  --measure-wide:  60rem;     /* widened images, hero text */
  --measure-full:  78rem;     /* near-page-edge breakouts */
  --gutter:        2rem;
  --gutter-wide:   3rem;
}

/* ----- Reset, lite ----- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 19px;
  line-height: var(--leading);
  font-feature-settings: "kern", "liga", "onum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a {
  color: var(--rust);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--rust) 30%, transparent);
  transition: color 120ms, border-color 120ms;
}
a:hover { color: var(--rust-deep); border-bottom-color: var(--rust-deep); }

/* ----- Containers ----- */
.wrap        { max-width: var(--measure);      margin: 0 auto; padding: 0 var(--gutter); }
.wrap-wide   { max-width: var(--measure-wide); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-full   { max-width: var(--measure-full); margin: 0 auto; padding: 0 var(--gutter); }

/* ----- Site header ----- */
.site-header {
  padding: 3rem 0 2.2rem;
  border-bottom: 1px solid var(--hairline);
}
.site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  max-width: var(--measure-full);
  margin: 0 auto;
  padding: 0 var(--gutter-wide);
}
.site-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.7rem;
  letter-spacing: -0.012em;
  margin: 0;
}
.site-title a { color: var(--ink); border: 0; }
.site-title a:hover { color: var(--rust); }
.site-tagline {
  font-style: italic;
  color: var(--olive);
  font-size: 0.95rem;
  margin: 0;
}

/* ============================================================
   HOME
   ============================================================ */

.home-hero {
  margin: 0 0 3rem;
  position: relative;
  background: var(--paper-deep);
  overflow: hidden;
}
.home-hero img {
  width: 100%;
  height: 56vh;
  min-height: 380px;
  max-height: 640px;
  object-fit: cover;
  display: block;
  filter: saturate(0.92) contrast(1.02);
}
.home-hero .credit-overlay {
  position: absolute;
  bottom: 0.6rem;
  right: 0.9rem;
  font-size: 0.72rem;
  color: var(--paper);
  font-style: italic;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  background: rgba(0,0,0,0.18);
  padding: 0.2rem 0.55rem;
  border-radius: 2px;
}
.home-hero .credit-overlay a { color: var(--paper); border: 0; }

.home-intro {
  max-width: var(--measure-wide);
  margin: 0 auto 5rem;
  padding: 0 var(--gutter-wide);
}
.home-intro h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 1.2rem;
  max-width: 22ch;
}
.home-intro h1 em {
  color: var(--rust);
  font-style: normal;
}
.home-intro p {
  font-size: 1.25rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0 0 1rem;
  max-width: 36rem;
}

/* Episode list on home: cards have a wide layout too. */
.episode-list {
  list-style: none;
  padding: 0;
  margin: 0 auto 6rem;
  max-width: var(--measure-wide);
  padding: 0 var(--gutter-wide);
  display: flex;
  flex-direction: column;
  gap: 4rem;
}
.episode-card {
  border-top: 1px solid var(--hairline);
  padding-top: 2.2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.4rem;
}
.episode-meta {
  font-style: italic;
  color: var(--olive);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  margin: 0;
  text-transform: uppercase;
  font-variant-numeric: lining-nums;
  letter-spacing: 0.06em;
}
.episode-meta .sep { color: var(--olive-soft); margin: 0 0.55em; }
.episode-card h2 {
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.12;
  margin: 0;
}
.episode-card h2 a { color: var(--ink); border: 0; }
.episode-card h2 a:hover { color: var(--rust); }
.episode-card .subtitle {
  font-size: 1.1rem;
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
  max-width: 36rem;
}
.episode-card .player { margin: 0.6rem 0 0; }
.episode-card .read-on {
  display: inline-block;
  margin-top: 0.4rem;
  font-style: italic;
  font-size: 1rem;
}
.episode-card .read-on::after { content: " →"; font-style: normal; }

/* ----- Audio player ----- */
audio {
  width: 100%;
  max-width: 600px;
  height: 42px;
  filter: sepia(0.18) saturate(0.85) hue-rotate(-12deg);
}

/* ============================================================
   EPISODE
   ============================================================ */

.episode-header {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 2.5rem var(--gutter-wide) 2rem;
}
.episode-header .episode-meta { margin-bottom: 0.8rem; }
.episode-header h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.018em;
  line-height: 1.07;
  margin: 0 0 0.8rem;
  max-width: 22ch;
}
.episode-header .subtitle {
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  color: var(--ink-soft);
  font-style: italic;
  margin: 0 0 2rem;
  max-width: 38rem;
  line-height: 1.4;
}
.episode-header .player { margin: 1rem 0; max-width: 600px; }

/* ----- Map ----- */
.map-wrap {
  max-width: var(--measure-full);
  margin: 3rem auto 4rem;
  padding: 0 var(--gutter);
}
.map-wrap .map-caption {
  font-size: 0.88rem;
  font-style: italic;
  color: var(--olive);
  margin: 0.8rem auto 0;
  line-height: 1.55;
  max-width: 40rem;
}
#map {
  width: 100%;
  height: 540px;
  border: 1px solid var(--hairline);
  background: var(--paper-deep);
}
.leaflet-container { font-family: var(--serif); }

/* ----- Body prose ----- */
.prose {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
  font-size: 1.08rem;
  line-height: var(--leading);
  counter-reset: section;
}

/* Numbered sections — Roman numerals in rust before each H2. */
.prose h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.4vw, 1.85rem);
  letter-spacing: -0.005em;
  color: var(--ink);
  margin: 4.5rem 0 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--hairline);
  counter-increment: section;
  line-height: 1.2;
}
.prose h2::before {
  content: counter(section, upper-roman);
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.18em;
  color: var(--rust);
  margin-bottom: 0.7rem;
  text-transform: uppercase;
}

.prose h3 {
  font-weight: 700;
  font-size: 1.2rem;
  margin: 2.6rem 0 0.8rem;
}
.prose p {
  margin: 0 0 1.15rem;
  hyphens: auto;
}
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 1.5rem; margin: 0 0 1.2rem; }
.prose li { margin-bottom: 0.4rem; }

/* Pull quotes (markdown blockquotes get treated as pull quotes). */
.prose blockquote {
  margin: 2.4rem -1rem;
  padding: 0.4rem 0 0.4rem 1.6rem;
  border-left: 3px solid var(--rust);
  color: var(--ink);
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.45rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
  font-weight: 400;
  max-width: 30rem;
}
.prose blockquote p { margin: 0; }

.prose hr {
  border: 0;
  text-align: center;
  margin: 3rem auto;
  width: 100%;
  height: 1.5rem;
  position: relative;
}
.prose hr::before {
  content: "❦";
  font-size: 1.4rem;
  color: var(--rust);
  font-style: normal;
  display: inline-block;
}

/* Drop cap on first paragraph after each H2 (and the very first paragraph). */
.prose > p:first-of-type::first-letter,
.prose > h2 + p::first-letter {
  font-size: 4em;
  float: left;
  line-height: 0.85;
  padding: 0.06em 0.1em 0 0;
  color: var(--rust);
  font-weight: 700;
  font-feature-settings: "lnum";
}

/* ============================================================
   FIGURES — variable placement (positions: column/wide/full/left/right)
   ============================================================ */

figure.figure {
  margin: 2.8rem 0;
  padding: 0;
}
figure.figure img {
  width: 100%;
  border: 1px solid var(--hairline);
  background: var(--paper-deep);
}
figure.figure figcaption {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--olive);
  margin: 0.85rem 0 0;
  line-height: 1.55;
  max-width: 38rem;
}
figure.figure figcaption .credit {
  display: block;
  margin-top: 0.3rem;
  color: var(--olive-soft);
  font-size: 0.78rem;
  font-style: normal;
  letter-spacing: 0.01em;
}
figure.figure figcaption .credit a {
  color: var(--olive);
  border-bottom-color: color-mix(in oklab, var(--olive) 30%, transparent);
}

/* Default position: same width as reading column (the .prose container). */
figure.figure.column { /* default — no override needed */ }

/* Wide: extends ~9rem to either side of the reading column. */
figure.figure.wide {
  margin-left: calc(-1 * (var(--measure-wide) - var(--measure)) / 2);
  margin-right: calc(-1 * (var(--measure-wide) - var(--measure)) / 2);
  width: calc(var(--measure-wide) - 2 * var(--gutter));
  max-width: calc(100vw - 2 * var(--gutter));
}

/* Full-bleed: pushes near page edges, dramatic. */
figure.figure.full {
  margin-left: calc(-1 * (var(--measure-full) - var(--measure)) / 2);
  margin-right: calc(-1 * (var(--measure-full) - var(--measure)) / 2);
  width: calc(var(--measure-full) - 2 * var(--gutter));
  max-width: calc(100vw - 2 * var(--gutter));
}
figure.figure.full figcaption {
  margin-left: calc((var(--measure-full) - var(--measure)) / 2);
}

/* Left float — body text wraps right. Best for portraits / squares. */
figure.figure.left {
  float: left;
  width: 50%;
  max-width: 22rem;
  margin: 0.4rem 2rem 1.2rem 0;
}

/* Right float — body text wraps left. */
figure.figure.right {
  float: right;
  width: 50%;
  max-width: 22rem;
  margin: 0.4rem 0 1.2rem 2rem;
}

/* Clear floats after each section so the next H2 starts fresh. */
.prose h2 { clear: both; }

/* Responsive: collapse breakouts on narrow screens. */
@media (max-width: 900px) {
  figure.figure.wide,
  figure.figure.full {
    margin-left: 0;
    margin-right: 0;
    width: 100%;
  }
  figure.figure.full figcaption { margin-left: 0; }
}
@media (max-width: 720px) {
  figure.figure.left,
  figure.figure.right {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 2rem 0;
  }
}

/* ============================================================
   FOOTER + EPISODE NAV
   ============================================================ */

.episode-nav {
  max-width: var(--measure-wide);
  margin: 4.5rem auto 0;
  padding: 2.5rem var(--gutter-wide) 0;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--hairline);
  font-style: italic;
  color: var(--olive);
}
.episode-nav .label {
  font-size: 0.78rem;
  display: block;
  color: var(--olive-soft);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
  font-style: normal;
}

.site-footer {
  border-top: 1px solid var(--hairline);
  margin-top: 5rem;
  padding: 2.5rem 0 4rem;
  font-size: 0.9rem;
  color: var(--olive);
  font-style: italic;
}
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  max-width: var(--measure-full);
  margin: 0 auto;
  padding: 0 var(--gutter-wide);
}
.site-footer a {
  color: var(--olive);
  border-bottom-color: color-mix(in oklab, var(--olive) 30%, transparent);
}
.site-footer a:hover { color: var(--rust); border-bottom-color: var(--rust); }

::selection { background: color-mix(in oklab, var(--rust) 22%, transparent); }

/* ----- Responsive baseline ----- */
@media (max-width: 720px) {
  body { font-size: 17px; }
  .episode-header h1 { font-size: 2rem; }
  .home-intro h1 { font-size: 2rem; }
  .episode-card h2 { font-size: 1.5rem; }
  #map { height: 420px; }
  .prose { font-size: 1.02rem; }
}
