/* The Shattered Marches: the welcome page. A parish pamphlet more than a
   shop window: the game's own ink colour for paper, red rubrication, plates
   with captions. System serif faces only (the site's CSP allows no remote
   fonts), and no inline styles anywhere (it allows none of those either). */

:root {
  --paper: #efe6d4;
  --paper-deep: #e4d8c0;
  --ink: #1f1813;
  --ink-soft: #4a3d31;
  --muted: #6b5c4b;
  --rubric: #8e2c1c;
  --gold: #9a6a17;
  --rule: #b5a37f;
  --plate-edge: #2a221b;
  --water: #3f5d73;
  --wood: #d8ccb2;
  --house: #efe6d4;
  --button-ink: #efe6d4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --measure: 34em;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16120f;
    --paper-deep: #1f1914;
    --ink: #efe6d4;
    --ink-soft: #d8ccb6;
    --muted: #b3a58c;
    --rubric: #e07a5f;
    --gold: #d9a441;
    --rule: #5b4a34;
    --plate-edge: #5b4a34;
    --water: #7ea3bf;
    --wood: #2a241d;
    --house: #211b16;
    --button-ink: #16120f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16120f; --paper-deep: #1f1914; --ink: #efe6d4; --ink-soft: #d8ccb6; --muted: #b3a58c;
  --rubric: #e07a5f; --gold: #d9a441; --rule: #5b4a34; --plate-edge: #5b4a34; --water: #7ea3bf;
  --wood: #2a241d; --house: #211b16; --button-ink: #16120f; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.22rem);
  line-height: 1.6;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures oldstyle-nums;
  font-variant-numeric: oldstyle-nums;
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--rubric); text-underline-offset: 0.18em; }
a:focus-visible, .play:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }
::selection { background: var(--rubric); color: var(--paper); }

/* ---- the masthead ---- */
.masthead {
  max-width: 60rem;
  margin: 0 auto;
  padding: 2.2rem 0 2.5rem;
}
.running {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 1.2rem;
  margin: 0 0 2.4rem;
  padding: 0.4rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 3px double var(--ink);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  font-size: 0.95em;
  color: var(--ink-soft);
}
h1 {
  margin: 0;
  font-weight: 400;
  font-size: clamp(3rem, 1.4rem + 8vw, 7.4rem);
  line-height: 0.92;
  letter-spacing: -0.015em;
}
.deck {
  max-width: 30em;
  margin: 1.8rem 0 0;
  font-size: clamp(1.2rem, 1.05rem + 0.8vw, 1.6rem);
  line-height: 1.42;
  font-style: italic;
  color: var(--ink-soft);
}
.begin { margin-top: 2.2rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.6rem; }
.play {
  display: inline-block;
  padding: 0.72em 1.3em 0.68em;
  background: var(--rubric);
  color: var(--button-ink);
  text-decoration: none;
  font-size: 1.05em;
  letter-spacing: 0.02em;
  border: 1px solid var(--rubric);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--rubric);
  transition: background 0.15s ease;
}
.play:hover { background: var(--ink); border-color: var(--ink); }
.begin-note { margin: 0; max-width: 24em; font-size: 0.9em; color: var(--muted); }

/* ---- plates ---- */
.plate { margin: 0; }
.plate img {
  width: 100%;
  border: 1px solid var(--plate-edge);
  outline: 1px solid var(--rule);
  outline-offset: 5px;
  background: #0d0b09;
}
figcaption {
  margin-top: 0.95rem;
  font-size: 0.9em;
  line-height: 1.5;
  color: var(--muted);
  font-style: italic;
  max-width: 44em;
}
.plate-no { font-style: normal; font-variant-caps: all-small-caps; letter-spacing: 0.1em; color: var(--rubric); margin-right: 0.3em; }
.hero { max-width: 72rem; margin: 0 auto 1rem; }

/* ---- chapters ---- */
main { max-width: 64rem; margin: 0 auto; }
.chapter { padding: 4.5rem 0 1rem; border-top: 1px solid var(--rule); margin-top: 4rem; }
.chapter:first-child { margin-top: 3rem; }
.numeral {
  margin: 0;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.16em;
  color: var(--rubric);
  font-size: 1.05em;
}
h2 {
  margin: 0.2rem 0 1.8rem;
  font-weight: 400;
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem);
  line-height: 1.08;
  max-width: 16em;
}
h3 { margin: 0 0 0.35rem; font-size: 1.08em; font-weight: 600; font-style: italic; }
.cols { display: grid; grid-template-columns: minmax(0, var(--measure)) minmax(0, 1fr); gap: 1rem 3.2rem; align-items: start; }
.text p { margin: 0 0 1.05em; hyphens: auto; }
.text p.first::first-letter {
  float: left;
  font-size: 3.55em;
  line-height: 0.82;
  padding: 0.07em 0.09em 0 0;
  color: var(--rubric);
}
.wide-text { max-width: var(--measure); }

/* marginalia */
.margin { font-size: 0.88em; line-height: 1.5; color: var(--ink-soft); padding-top: 0.35rem; border-top: 1px solid var(--rule); }
.mnote { margin: 0.7rem 0 0; }
.mhead { font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--rubric); font-size: 1.06em; margin-right: 0.2em; }

.plate.right { margin: 2.8rem 0 0 auto; max-width: 52rem; }

/* ---- the extracts: a commonplace book ---- */
.extracts {
  list-style: none;
  counter-reset: extract;
  margin: 2.6rem 0 3.4rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.4rem 3.4rem;
}
.extracts li { counter-increment: extract; position: relative; padding-left: 2.4rem; }
.extracts li::before {
  content: counter(extract, lower-roman) ".";
  position: absolute;
  left: 0;
  top: 0.18em;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--rubric);
}
.extracts blockquote { margin: 0; }
.extracts blockquote p {
  margin: 0;
  font-size: 1.14em;
  line-height: 1.42;
  quotes: "\201C" "\201D";
}
.extracts blockquote p::before { content: open-quote; }
.extracts blockquote p::after { content: close-quote; }
.extracts .source { margin: 0.5rem 0 0; font-size: 0.86em; color: var(--muted); font-style: italic; }
.extracts li:nth-child(4) blockquote p { font-size: 1.32em; }
.extracts .dream blockquote p { font-style: italic; }
.extracts .dream { grid-column: 1 / -1; max-width: 36em; }

/* the map */
.map-plate { margin-top: 1rem; }
.map { display: block; width: 100%; height: auto; background: var(--paper-deep); border: 1px solid var(--plate-edge); }
.map .rule { fill: none; stroke: var(--ink); stroke-width: 1.4; }
.map .rule.thin { stroke-width: 0.6; }
.map .ink { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.map .fillhouse { fill: var(--house); }
.map .fillwood { fill: var(--wood); }
.map .water { fill: none; stroke: var(--water); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.map .water.thin { stroke-width: 1; opacity: 0.7; }
.map .road { fill: none; stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 7 4; stroke-linecap: round; }
.map .hachure { stroke: var(--ink-soft); stroke-width: 1; stroke-linecap: round; }
.map .pencil { fill: none; stroke: var(--muted); stroke-width: 0.9; stroke-dasharray: 2 5; opacity: 0.8; }
.map .under { fill: none; stroke: var(--rubric); stroke-width: 1.1; stroke-dasharray: 1 6; stroke-linecap: round; opacity: 0.85; }
.map .bridge { stroke-width: 2; }
.map text { font-family: var(--serif); fill: var(--ink); }
.map .label { font-size: 15px; font-style: italic; }
.map .label.small { font-size: 12px; fill: var(--ink-soft); }
.map .label.town { font-style: normal; font-size: 15px; letter-spacing: 0.22em; }
.map .label.river { fill: var(--water); font-size: 13px; }
.map .label.query { fill: var(--rubric); font-size: 22px; font-style: normal; }
.map .pencil-note { font-size: 13px; font-style: italic; fill: var(--muted); }
.map g text { fill: var(--ink); }

/* ---- how it plays ---- */
.points { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 3.4rem; margin: 2.4rem 0 3.2rem; }
.points section p { margin: 0; }
.points section:first-child { grid-column: 1 / -1; max-width: 42em; }
.points section:first-child h3 { font-size: 1.25em; }
.plates-pair { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 2.4rem; align-items: start; }
.plates-pair .plate:last-child { margin-top: 5rem; }

/* ---- the small print ---- */
.terms { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.75rem 1.4rem; }
.terms dt { font-variant-caps: all-small-caps; letter-spacing: 0.08em; color: var(--rubric); padding-top: 0.05em; white-space: nowrap; }
.terms dd { margin: 0; }
.margin-plate { margin: 0; }

/* ---- the end ---- */
.end {
  max-width: 64rem;
  margin: 5rem auto 0;
  padding: 3.4rem 0 3rem;
  border-top: 3px double var(--ink);
  text-align: left;
}
.last { margin: 0 0 1.6rem; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.3rem); line-height: 1.2; font-style: italic; max-width: 20em; }
.colophon { margin: 3rem 0 0; max-width: 34em; font-size: 0.82em; color: var(--muted); font-style: italic; }

/* ---- narrow screens ---- */
@media (max-width: 760px) {
  .masthead { padding-top: 1.2rem; }
  .running { margin-bottom: 1.6rem; justify-content: flex-start; gap: 0 0.9rem; font-size: 0.8em; letter-spacing: 0.09em; }
  .cols, .points, .extracts, .plates-pair { grid-template-columns: minmax(0, 1fr); }
  .plates-pair .plate:last-child { margin-top: 0; }
  .extracts { gap: 1.9rem; }
  .chapter { padding-top: 3rem; margin-top: 3rem; }
  .terms { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .terms dd { margin-bottom: 0.8rem; }
  .terms dt { white-space: normal; }
  .map .label.small, .map .pencil-note { font-size: 14px; }
}

@media print {
  body { background: #fff; color: #000; }
  .play, .begin-note { display: none; }
}
