/* ============================================================
   SWEET LAND OF LIBERTY — design system
   1940s memoir: aged paper, Caslon book typography,
   typewriter-stamped travel documents, silver-gelatin photos.
   ============================================================ */

:root {
  --paper:      #f1eadb;
  --paper-deep: #e8dfca;
  --ink:        #29231a;
  --ink-soft:   #5e5544;
  --ink-faint:  #8a806b;
  --rule:       #cdc2a8;
  --accent:     #8a3b22;   /* oxblood — stamps, drop caps, links */
  --sea:        #3d5244;   /* deep bottle green */
  --serif-display: 'Libre Caslon Display', 'Libre Caslon Text', Georgia, serif;
  --serif-body:    'EB Garamond', Georgia, 'Times New Roman', serif;
  --mono:          'Courier Prime', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 1.2rem;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* paper grain + vignette, fixed behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(78, 62, 38, 0.10) 100%);
}

main, header, footer, nav.site { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------- site nav ---------- */
nav.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--rule);
}
nav.site .brand {
  font-family: var(--serif-display);
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}
nav.site .links {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
nav.site .links a { color: var(--ink-soft); margin-left: 1.4rem; }
nav.site .links a:hover { color: var(--accent); text-decoration: none; }

/* ---------- index: hero ---------- */
.hero {
  position: relative;
  height: clamp(300px, 54vh, 580px);
  overflow: hidden;
  max-width: 1400px;        /* don't spread edge-to-edge on ultrawide screens */
  margin-inline: auto;      /* centre the plate against the parchment */
}
.hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  filter: sepia(0.14) contrast(1.02);
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(41,35,26,0.14) 0%, transparent 30%, transparent 86%, var(--paper) 100%);
}

.masthead {
  text-align: center;
  max-width: 46rem;
  margin: 1.4rem auto 0;
  position: relative;
  z-index: 2;
  padding: 0 1.5rem;
}
.masthead .kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.masthead h1 {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: 0.02em;
  margin: 0.9rem 0 0.5rem;
}
.masthead .subtitle {
  font-style: italic;
  font-size: 1.3rem;
  color: var(--ink-soft);
}
.masthead .byline {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  margin-top: 1.6rem;
  color: var(--ink);
}

.ornament {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: center;
  margin: 2.6rem auto;
  color: var(--ink-faint);
}
.ornament::before, .ornament::after {
  content: "";
  height: 1px;
  width: 5.5rem;
  background: var(--rule);
}

.intro {
  max-width: 38rem;
  margin: 0 auto;
  padding: 0 1.5rem;
  text-align: center;
}
.intro blockquote {
  font-style: italic;
  font-size: 1.32rem;
  line-height: 1.7;
}
.intro p.context {
  margin-top: 1.6rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
  text-align: left;
}
.cta-row { text-align: center; margin: 2.8rem 0 1rem; }
.cta {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  padding: 0.95rem 2.2rem;
  border: 1px solid var(--ink);
  transition: background 0.25s ease, color 0.25s ease;
}
.cta:hover { background: var(--accent); border-color: var(--accent); text-decoration: none; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; }
.cta-ghost {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  padding: 0.95rem 2.2rem;
  border: 1px solid var(--ink-faint);
  transition: border-color 0.25s ease, color 0.25s ease;
}
.cta-ghost:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------- journey map ---------- */
.journey-head {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 0;
}
.journey-head .kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
}
.journey-head h1 {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  margin: 0.8rem 0 1rem;
}
.journey-head .lede {
  font-style: italic;
  font-size: 1.12rem;
  color: var(--ink-soft);
  line-height: 1.7;
}
.map-figure {
  max-width: 46rem;
  margin: 3rem auto 0;
  padding: 0 1.2rem;
}
.map-cap {
  text-align: center;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.map-cap .map-title {
  font-family: var(--serif-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}
.map-cap .map-sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.map-svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--ink-faint);
  outline: 1px solid var(--ink-faint);
  outline-offset: 4px;
  box-shadow: 0 4px 22px rgba(60, 48, 28, 0.2);
  background: var(--paper-deep);
}
.map-legend {
  list-style: none;
  max-width: 30rem;
  margin: 2.8rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  gap: 0.7rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.map-legend li { display: flex; align-items: center; gap: 0.8rem; }
.map-legend .lg { flex-shrink: 0; width: 18px; height: 18px; display: inline-block; }
.map-legend .lg-route { height: 0; border-top: 3px solid var(--accent); width: 22px; }
.map-legend .lg-home {
  width: 12px; height: 12px; background: var(--accent);
  transform: rotate(45deg); border: 1.5px solid var(--paper);
  outline: 1px solid var(--ink-faint);
}
.map-legend .lg-stop {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); border: 1.5px solid var(--paper); outline: 1px solid var(--ink-faint);
}
.map-legend .lg-camp {
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--paper); outline: 1px solid var(--ink-faint);
  box-shadow: inset 0 0 0 2px var(--ink);
}

/* per-chapter minimap */
.mini-map-link {
  display: block;
  width: 15rem;
  max-width: 70%;
  margin: 1.8rem auto 0;
  text-decoration: none;
}
.mini-map-link:hover { text-decoration: none; }
.mini-map { margin: 0; }
.mini-map .map-svg {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--ink-faint);
  outline: none;
  box-shadow: none;
  background: var(--paper-deep);
}
.mini-map figcaption {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 0.55rem;
}
.mini-map-link:hover figcaption { color: var(--accent); }

/* ---------- index: contents ---------- */
.contents {
  max-width: 44rem;
  margin: 4rem auto 5rem;
  padding: 0 1.5rem;
}
.contents > h2 {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.85rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
  margin-bottom: 2.5rem;
}
.section-head {
  font-family: var(--serif-display);
  font-size: 1.5rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  margin: 2.8rem 0 0.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
}
.section-head .range {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
ol.toc { list-style: none; }
ol.toc li { border-bottom: 1px solid var(--rule); }
ol.toc a {
  display: grid;
  grid-template-columns: 3.4rem 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.85rem 0.4rem;
  color: var(--ink);
  transition: background 0.2s ease, padding-left 0.2s ease;
}
ol.toc a:hover {
  background: var(--paper-deep);
  padding-left: 0.9rem;
  text-decoration: none;
}
ol.toc .num {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--accent);
}
ol.toc .t { font-size: 1.18rem; }
ol.toc .meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  text-transform: uppercase;
  text-align: right;
}
@media (max-width: 38rem) {
  ol.toc a { grid-template-columns: 2.6rem 1fr; }
  ol.toc .meta { grid-column: 2; text-align: left; }
}

/* ---------- chapter page ---------- */
.chapter-head {
  text-align: center;
  padding: 4.5rem 1.5rem 0;
  max-width: 44rem;
  margin: 0 auto;
}
.chapter-head .kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  color: var(--accent);
}
.chapter-head h1 {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  line-height: 1.15;
  margin: 1rem 0 0;
}

/* the journey card — a stamped wartime travel document */
.journey-card {
  max-width: 30rem;
  margin: 2.6rem auto 0;
  border: 1px solid var(--ink-faint);
  outline: 1px solid var(--ink-faint);
  outline-offset: 3px;
  padding: 1.3rem 1.6rem 1.1rem;
  text-align: left;
  font-family: var(--mono);
  position: relative;
  background: var(--paper-deep);
}
.journey-card .doc-no {
  position: absolute;
  top: 0.55rem;
  right: 0.8rem;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
}
.journey-card dl { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1.1rem; }
.journey-card dt {
  font-size: 0.68rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 0.18rem;
}
.journey-card dd {
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}

/* illustrations */
figure.illustration {
  margin: 0 auto;
}
figure.illustration img {
  width: 100%;
  filter: sepia(0.12) contrast(1.01);
  border: 1px solid var(--rule);
  box-shadow: 0 2px 14px rgba(60, 48, 28, 0.18);
}
figure.illustration figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 0.7rem;
  line-height: 1.6;
}
figure.hero-fig {
  max-width: 50rem;
  padding: 0 1.5rem;
  margin-top: 3.2rem;
}
figure.inline-fig {
  margin: 2.4rem 0;
}

/* prose */
article.prose {
  max-width: 38rem;
  margin: 3.5rem auto 0;
  padding: 0 1.5rem 2rem;
}
article.prose p {
  margin-bottom: 1.35rem;
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}
article.prose > p:first-of-type::first-letter {
  font-family: var(--serif-display);
  font-size: 4.6rem;
  line-height: 0.78;
  float: left;
  padding: 0.32rem 0.6rem 0 0;
  color: var(--accent);
}

/* chapter prev/next */
.chapter-nav {
  max-width: 38rem;
  margin: 3rem auto 4rem;
  padding: 1.6rem 1.5rem 0;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
}
.chapter-nav a { color: var(--ink); max-width: 46%; }
.chapter-nav a:hover { text-decoration: none; color: var(--accent); }
.chapter-nav .dir {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-faint);
  display: block;
  margin-bottom: 0.25rem;
}
.chapter-nav .next { text-align: right; margin-left: auto; }

/* ---------- audio player bar ---------- */
body.has-player { padding-bottom: 6.5rem; }

.player {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  border-top: 3px double var(--ink-faint);
  padding: 0.7rem 1.2rem 0.85rem;
  font-family: var(--mono);
}
.player .row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  max-width: 52rem;
  margin: 0 auto;
}
.player button {
  background: none;
  border: 1px solid var(--ink-faint);
  color: var(--paper);
  font-family: var(--mono);
  cursor: pointer;
  border-radius: 0;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.player button:hover { border-color: var(--paper); }
.player .play {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}
.player .label {
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8ad93;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player .label strong { color: var(--paper); font-weight: 400; }
.player .scrub { flex: 1; display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.player input[type="range"] {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 3px;
  background: linear-gradient(to right, var(--accent) var(--fill, 0%), #4d4536 var(--fill, 0%));
  outline: none;
  cursor: pointer;
}
.player input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.player input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.player .times {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: #b8ad93;
}
.player .speed, .player .skip {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.5rem;
  flex-shrink: 0;
}
@media (max-width: 42rem) {
  .player .label { display: none; }
}

/* ---------- listen (audiobook) page ---------- */
.listen-head {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto;
  padding: 4rem 1.5rem 0;
}
.listen-head .kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--accent);
}
.listen-head h1 {
  font-family: var(--serif-display);
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 3.8rem);
  margin: 0.8rem 0 1rem;
}
.listen-head .lede {
  font-style: italic;
  font-size: 1.12rem;
  color: var(--ink-soft);
  line-height: 1.7;
}
ol.parts {
  list-style: none;
  max-width: 44rem;
  margin: 3rem auto 0;
  padding: 0 1.5rem;
}
li.part {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
li.part:first-child { border-top: 1px solid var(--rule); }
.part-play {
  flex-shrink: 0;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  margin-top: 0.15rem;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.part-play:hover { background: var(--ink); color: var(--paper); }
li.part.is-playing .part-play { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.part-body { flex: 1; min-width: 0; }
.part-head {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 0.35rem;
}
.part-label {
  font-family: var(--serif-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}
li.part.is-playing .part-label { color: var(--accent); }
.part-range {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-left: auto;
  white-space: nowrap;
}
ul.part-chapters { list-style: none; margin: 0.5rem 0 0; }
ul.part-chapters li { border-bottom: 1px solid var(--rule); }
ul.part-chapters li:last-child { border-bottom: none; }
ul.part-chapters a {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0.3rem;
  color: var(--ink);
  transition: background 0.2s ease, padding-left 0.2s ease;
}
ul.part-chapters a:hover { background: var(--paper-deep); padding-left: 0.7rem; text-decoration: none; }
ul.part-chapters .cn { font-family: var(--mono); font-size: 0.78rem; color: var(--accent); }
ul.part-chapters .ct { font-size: 1.05rem; }
.listen-note {
  max-width: 44rem;
  margin: 2.4rem auto 4rem;
  padding: 0 1.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* keep the three-item nav tidy on small phones */
@media (max-width: 32rem) {
  nav.site { flex-wrap: wrap; gap: 0.45rem 0; padding: 0.85rem 1.1rem; }
  nav.site .brand { font-size: 0.82rem; letter-spacing: 0.14em; }
  nav.site .links { width: 100%; }
  nav.site .links a { margin-left: 0; margin-right: 1.2rem; }
}

/* ---------- footer ---------- */
footer.colophon {
  border-top: 1px solid var(--rule);
  margin-top: 2rem;
  padding: 2.2rem 1.5rem 2.6rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  line-height: 2;
}

/* page-load reveal */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); animation: rise 0.7s ease forwards; }
  .reveal.d1 { animation-delay: 0.1s; }
  .reveal.d2 { animation-delay: 0.22s; }
  .reveal.d3 { animation-delay: 0.34s; }
  @keyframes rise { to { opacity: 1; transform: none; } }
}
