/* Surviving the Red Chapatti — quiet, archival styling.
   Designed to let the photographs and the words carry the weight. */

:root {
  --paper:      #f5f1e8;
  --paper-2:    #efe9dc;
  --ink:        #26231d;
  --ink-soft:   #4a463d;
  --ink-faint:  #6f6a5e;
  --line:       #d8d0bf;
  --line-soft:  #e4ddcd;
  --slate:      #44525a;
  --slate-deep: #303b41;
  --accent:     #7c2d24;   /* a deep, muted oxblood — the "red chapatti", used sparingly */
  --accent-ink: #6a271f;
  --flag-red:   #b3271d;   /* the red disc of the flag — the "red chapatti" itself */
  --measure:    47.5rem;   /* comfortable reading width */

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, "Times New Roman", serif;
  --sans:  "Gill Sans", "Gill Sans MT", "Seravek", "Optima", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* aged map shows in the margins, dimmed by a translucent paper wash */
  background-color: #cdbb95;
  background-image:
    linear-gradient(rgba(238,231,216,0.40), rgba(238,231,216,0.40)),
    url(aged-map.svg);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* the content rests on a centred "sheet" of paper; the map is visible beyond it */
.page {
  max-width: 78rem;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--paper);
  background-image:
    radial-gradient(120% 80% at 50% -10%, #faf7f0 0%, rgba(250,247,240,0) 60%),
    linear-gradient(rgba(0,0,0,0.012), rgba(0,0,0,0.012));
  box-shadow: 0 0 5rem rgba(46,35,20,0.28);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }

::selection { background: rgba(124,45,36,0.16); }

/* ---- Skip link / accessibility ---- */
.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 100;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--slate); outline-offset: 3px; }

/* ---- Layout helpers ---- */
.wrap { width: 100%; max-width: 70rem; margin: 0 auto; padding: 0 1.5rem; }
.reading { max-width: var(--measure); margin-left: auto; margin-right: auto; }

.eyebrow {
  font-family: var(--sans);
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 0.6rem;
}

/* ---- Site header ---- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(245,241,232,0.85);
  backdrop-filter: saturate(120%) blur(4px);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding-top: 0.95rem; padding-bottom: 0.95rem;
}
.site-title {
  font-family: var(--serif);
  font-size: 1.12rem; font-weight: 600; letter-spacing: 0.01em;
  margin: 0; color: var(--ink);
}
.site-title a { color: inherit; text-decoration: none; }
.site-nav { font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0.04em; }
.site-nav a {
  color: var(--ink-soft); text-decoration: none; margin-left: 1.3rem;
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a:first-child { margin-left: 0; }

/* ---- Hero (story landing) ---- */
.hero { border-bottom: 1px solid var(--line); }
.hero-inner {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center;
  padding-top: 4.5rem; padding-bottom: 4rem;
}
.hero-text .kicker {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.76rem; color: var(--accent); margin: 0 0 1.1rem;
}
.hero-text h1 {
  font-size: clamp(2.4rem, 5vw, 3.6rem); line-height: 1.05; margin: 0 0 1rem;
  font-weight: 600; letter-spacing: -0.01em;
}
.hero-text h1 .sun {
  display: inline-block; width: 0.58em; height: 0.58em; border-radius: 50%;
  background: var(--flag-red); margin-left: 0.34em; vertical-align: 0.04em;
}
.hero-text .lede { font-size: 1.28rem; color: var(--ink-soft); margin: 0 0 1rem; font-style: italic; }
.hero-text .hero-stakes { font-size: 1.06rem; color: var(--ink-soft); margin: 0 0 0.2rem; max-width: 32rem; }
.hero-text .meta {
  font-family: var(--sans); font-size: 0.82rem; letter-spacing: 0.03em;
  color: var(--ink-faint); border-top: 1px solid var(--line); padding-top: 1.1rem; margin-top: 1.4rem;
}
.portrait-frame {
  background: #fff; padding: 0.7rem; border: 1px solid var(--line);
  box-shadow: 0 18px 40px -24px rgba(38,35,29,0.55);
}
.portrait-frame img { filter: saturate(0.96); }
.portrait-frame figcaption {
  font-family: var(--sans); font-size: 0.74rem; color: var(--ink-faint);
  text-align: center; padding-top: 0.6rem; letter-spacing: 0.02em;
}

/* ---- Generic page header ---- */
.page-head { padding: 3rem 0 1.5rem; border-bottom: 1px solid var(--line); margin-bottom: 2.5rem; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0.2rem 0 0.6rem; font-weight: 600; }
.page-head p { color: var(--ink-soft); margin: 0; max-width: var(--measure); }

/* ---- Section intro on landing ---- */
.section { padding: 3.5rem 0; }
.section + .section { border-top: 1px solid var(--line-soft); }
.section h2 { font-size: 1.7rem; font-weight: 600; margin: 0 0 1rem; }

.dedication {
  font-style: italic; color: var(--ink-soft);
  border-left: 2px solid var(--accent); padding: 0.2rem 0 0.2rem 1.4rem;
  max-width: var(--measure);
}

/* ---- The wait (missing → found) ---- */
.wait { max-width: var(--measure); margin: 0 auto; }
.wait h2 { font-size: clamp(1.7rem, 3.6vw, 2.35rem); line-height: 1.16; margin: 0 0 1.3rem; }
.wait-body p { margin: 0 0 1.15rem; color: var(--ink-soft); }
.wait-body p:last-child { margin-bottom: 0; }

.docs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2.4rem;
  max-width: 50rem; margin: 3rem auto 0; align-items: end;
}
.doc { margin: 0; text-align: center; }
.doc-date {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.8rem; color: var(--accent); margin: 0 0 0.8rem;
}
.doc-view {
  display: block; width: 100%; background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; font: inherit; color: inherit;
}
.doc img {
  width: 100%; max-height: 25rem; object-fit: contain; object-position: top;
  background: #fff; padding: 0.6rem; border: 1px solid var(--line);
  box-shadow: 0 14px 32px -26px rgba(38,35,29,0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.doc-view:hover img, .doc-view:focus-visible img {
  transform: translateY(-3px); box-shadow: 0 18px 36px -22px rgba(38,35,29,0.6);
}
.doc figcaption {
  font-family: var(--sans); font-size: 0.8rem; line-height: 1.5; color: var(--ink-faint);
  margin-top: 0.75rem;
}
.wait-gap {
  text-align: center; font-family: var(--sans); text-transform: uppercase;
  letter-spacing: 0.14em; font-size: 0.8rem; color: var(--ink-faint);
  margin: 1.8rem auto 0; max-width: 36rem;
}
.wait-section { padding-bottom: 1.5rem; }
.wait-section + .section { padding-top: 2.5rem; }
.pullquote.wait-quote { max-width: var(--measure); margin: 2.2rem auto 0; }
.pullquote cite {
  display: block; font-family: var(--sans); font-style: normal;
  font-size: 0.76rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-faint); margin-top: 1rem;
}

/* ---- Edition cards ---- */
.editions-section .editions { margin-top: 1.8rem; }
.editions { display: grid; grid-template-columns: 1fr 1fr; gap: 1.6rem; margin-top: 1.5rem; }
.editions-note { max-width: var(--measure); margin: 1.7rem 0 0; color: var(--ink-soft); font-style: italic; }
.card {
  display: flex; flex-direction: column;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 1.8rem 1.7rem; text-decoration: none; color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover { border-color: var(--slate); transform: translateY(-2px); box-shadow: 0 16px 34px -26px rgba(38,35,29,0.5); }
.card .eyebrow { color: var(--accent); }
.card h3 { font-size: 1.5rem; margin: 0 0 0.3rem; font-weight: 600; }
.card .card-sub {
  font-family: var(--sans); font-size: 0.84rem; letter-spacing: 0.02em;
  color: var(--accent-ink); margin: 0 0 0.9rem;
}
.card p { margin: 0 0 1.2rem; color: var(--ink-soft); font-size: 1.04rem; }
.card .go {
  margin-top: auto; font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent-ink);
}
.card:hover .go { color: var(--accent); }

.secondary-links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin-top: 1.8rem; font-family: var(--sans); font-size: 0.86rem; }

/* ---- Support / charity panel ---- */
.support {
  background: var(--paper-2); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: 2.2rem 2.2rem 2.4rem; max-width: 48rem;
}
.support .eyebrow { color: var(--accent); }
.support h2 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 600; }
.support p { margin: 0 0 1rem; color: var(--ink-soft); }
.btn {
  display: inline-block; margin-top: 0.6rem;
  font-family: var(--sans); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  background: var(--accent); color: #f6f3ec; padding: 0.85rem 1.5rem; text-decoration: none;
  transition: background-color 0.2s ease;
}
.btn:hover { background: var(--accent-ink); color: #fff; }

/* ---- Contents list ---- */
.contents { list-style: none; margin: 0; padding: 0; max-width: 44rem; }
.contents .part-label {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.18em;
  font-size: 0.74rem; color: var(--accent); margin: 2.2rem 0 0.4rem; padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
.contents li a {
  display: flex; align-items: baseline; gap: 1rem;
  padding: 0.85rem 0.2rem; border-bottom: 1px solid var(--line-soft);
  text-decoration: none; color: var(--ink);
}
.contents li a:hover { color: var(--accent); }
.contents .num {
  font-family: var(--sans); font-size: 0.78rem; color: var(--ink-faint);
  min-width: 2.4rem; letter-spacing: 0.08em;
}
.contents .ch-title { font-size: 1.16rem; }

/* ---- Chapter reading view ---- */
.chapter { padding: 2.5rem 0 4rem; }
.chapter-head { text-align: center; margin-bottom: 2.8rem; }
.chapter-head .part-label {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: 0.2em;
  font-size: 0.74rem; color: var(--accent); margin: 0 0 0.8rem;
}
.chapter-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); font-weight: 600; margin: 0; line-height: 1.12; }
.chapter-head .rule {
  width: 3rem; height: 2px; background: var(--accent); margin: 1.4rem auto 0; opacity: 0.8;
}

.prose { }
.prose p { margin: 0 0 1.35rem; }
.prose > p:first-of-type::first-letter {
  font-size: 3.2rem; line-height: 0.8; float: left;
  padding: 0.1rem 0.6rem 0 0; color: var(--accent); font-weight: 600;
}
.prose h2 {
  font-size: 1.45rem; font-weight: 600; margin: 2.6rem 0 1rem;
  padding-top: 0.4rem;
}
.prose h3 { font-size: 1.18rem; font-weight: 600; margin: 2rem 0 0.8rem; font-family: var(--sans); letter-spacing: 0.02em; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.6rem auto; width: 60%; }
.prose em { font-style: italic; }
.prose strong { font-weight: 600; }

/* Figures inside prose */
figure.fig { margin: 2.6rem 0; }
figure.fig img {
  width: 100%; background: #fff; padding: 0.55rem; border: 1px solid var(--line);
  box-shadow: 0 14px 32px -26px rgba(38,35,29,0.55);
}
figure.fig figcaption {
  font-family: var(--sans); font-size: 0.82rem; line-height: 1.5; color: var(--ink-faint);
  margin-top: 0.7rem; padding-left: 0.1rem; border-left: 2px solid var(--line); padding-left: 0.8rem;
}
figure.fig.wide { max-width: 56rem; margin-left: auto; margin-right: auto; }

/* Pull quote */
.pullquote {
  font-size: 1.5rem; line-height: 1.4; color: var(--slate-deep); font-style: italic;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 1.6rem 0; margin: 2.6rem 0; text-align: center;
}

/* ---- Chapter pager ---- */
.pager {
  display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1.5rem;
  font-family: var(--sans);
}
.pager a { text-decoration: none; color: var(--ink-soft); max-width: 46%; }
.pager a:hover { color: var(--accent); }
.pager .dir { display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint); margin-bottom: 0.25rem; }
.pager .label { font-size: 1rem; font-family: var(--serif); }
.pager .next { text-align: right; margin-left: auto; }

.edition-switch {
  text-align: center; margin-top: 2.5rem; font-family: var(--sans); font-size: 0.84rem;
  color: var(--ink-faint);
}
.edition-switch a { white-space: nowrap; }

/* ---- Gallery ---- */
.gallery-group { margin: 2.6rem 0; }
.gallery-group h2 {
  font-size: 1.2rem; font-family: var(--sans); letter-spacing: 0.04em; font-weight: 600;
  border-bottom: 1px solid var(--line); padding-bottom: 0.5rem; margin: 0 0 1.6rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.6rem; }
.tile { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.tile figure { margin: 0; }
.tile img {
  width: 100%; background: #fff; padding: 0.5rem; border: 1px solid var(--line);
  box-shadow: 0 12px 28px -24px rgba(38,35,29,0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  aspect-ratio: 4 / 3; object-fit: cover;
}
.tile:hover img, .tile:focus-visible img { transform: translateY(-3px); box-shadow: 0 18px 34px -22px rgba(38,35,29,0.55); }
.tile figcaption { font-family: var(--sans); font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.6rem; line-height: 1.45; }

/* ---- Lightbox ---- */
/* A soft, frosted modal over the page — the paper-and-map background stays
   visible behind, rather than a hard black-out. */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(38,31,20,0.34);
  backdrop-filter: blur(4px) saturate(115%);
  -webkit-backdrop-filter: blur(4px) saturate(115%);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 2.5rem;
}
.lightbox.open { display: flex; }
.lightbox figure {
  margin: 0; max-width: min(92vw, 58rem); max-height: 92vh;
  display: flex; flex-direction: column; text-align: center;
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 40px 90px -34px rgba(20,16,10,0.7);
  padding: 0.9rem 0.9rem 1.05rem;
}
.lightbox img {
  max-width: 100%; max-height: 76vh; width: auto; margin: 0 auto;
  background: #fff; padding: 0.5rem; border: 1px solid var(--line-soft);
}
.lightbox figcaption {
  color: var(--ink-soft); font-family: var(--sans); font-size: 0.84rem; line-height: 1.5;
  margin: 0.85rem auto 0; max-width: 42rem;
}
.lightbox .close, .lightbox .nav-btn {
  position: absolute; display: flex; align-items: center; justify-content: center;
  background: rgba(245,241,232,0.92); border: 1px solid var(--line); color: var(--ink);
  border-radius: 50%; cursor: pointer; line-height: 1; font-family: var(--sans);
  box-shadow: 0 8px 20px -12px rgba(20,16,10,0.6); opacity: 0.92;
}
.lightbox .close { top: 1rem; right: 1.4rem; width: 2.4rem; height: 2.4rem; font-size: 1.4rem; }
.lightbox .nav-btn { top: 50%; transform: translateY(-50%); width: 3rem; height: 3rem; font-size: 1.8rem; }
.lightbox .nav-btn:hover, .lightbox .close:hover { opacity: 1; background: #fff; }
.lightbox .prev { left: 0.8rem; }
.lightbox .next { right: 0.8rem; }

/* ---- The Men (roll of names) ---- */
.roll { columns: 2; column-gap: 3rem; max-width: 46rem; list-style: none; padding: 0; }
.roll li { break-inside: avoid; padding: 0.5rem 0 0.5rem 1.9rem; text-indent: -1.9rem;
  border-bottom: 1px solid var(--line-soft); font-size: 1.1rem; }
.roll li .place { color: inherit; opacity: 0.82; font-size: 0.96rem; }
.key-note { font-style: italic; color: var(--ink-soft); margin-top: 2.6rem; }

/* fate is shown by shape, by colour, and by a hidden text label — never by colour alone.
   The three hues are all dark (oxblood / deep green / charcoal) so coloured names stay calm. */
.man-dead     { color: var(--accent); }   /* ● oxblood red  */
.man-remained { color: #4f6233; }          /* ◆ deep green    */
.man-gone     { color: var(--ink); }       /* ■ charcoal      */

.marker { display: inline-block; width: 1.5rem; margin-right: 0.35rem; text-indent: 0;
  text-align: center; font-size: 1.45rem; line-height: 1; vertical-align: -0.1em; }

.fate-key { list-style: none; padding: 1.2rem 1.4rem; margin: 1rem 0 0; max-width: 46rem;
  background: var(--paper-2); border: 1px solid var(--line);
  font-family: var(--sans); font-size: 1rem; }
.fate-key li { display: flex; align-items: baseline; gap: 0.3rem; padding: 0.45rem 0; }
.fate-key .marker { width: 1.7rem; font-size: 1.7rem; }

/* visually hidden — read by screen readers, not shown */
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--line); margin-top: 4rem; padding: 2.5rem 0 3rem;
  font-family: var(--sans); font-size: 0.82rem; color: var(--ink-faint);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.6rem 2rem; justify-content: space-between; }
.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 760px) {
  body { font-size: 1.1rem; }
  .hero-inner { grid-template-columns: 1fr; gap: 2.2rem; padding-top: 3rem; padding-bottom: 3rem; }
  .portrait-frame { max-width: 22rem; margin: 0 auto; }
  .docs { grid-template-columns: 1fr; gap: 2.6rem; max-width: 22rem; }
  .doc img { max-height: none; }
  .editions { grid-template-columns: 1fr; }
  .roll { columns: 1; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .site-nav a:first-child { margin-left: 0; }
  .prose > p:first-of-type::first-letter { font-size: 2.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- Print ---- */
@media print {
  .site-header, .site-footer, .pager, .edition-switch, .site-nav, .lightbox { display: none; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .page { background: #fff; box-shadow: none; max-width: none; }
  figure.fig img, .portrait-frame { box-shadow: none; }
}
