/* Type is linked from the document head, one request per family.
   Fontshare's multi-family endpoint silently substituted Satoshi for
   Supreme when both were requested together, so they are kept apart. */

/* ==========================================================================
   The Gatehouse Peldon — an independent guide
   Visual world: cyanotype. The reservoir was engineered and dammed 1935-39;
   the drawing language of that object is a blueprint, not a mariner's chart.
   Two values, one accent, emphasis from weight and rule-work.
   Every contrast pair in this file is calculated. See BRIEF.md.
   ========================================================================== */

:root {
  /* --- ground and ink ---------------------------------------------------- */
  --deep:        #0C2740;  /* the ground, carries the whole surface           */
  --deep-2:      #071B2E;  /* masthead, footer, inset wells                   */
  --deep-3:      #12384F;  /* raised panels, table stripes                    */
  --ink-pale:    #DCE8F0;  /* body ink on deep. 12.21:1                       */
  --ink-mute:    #9DB8CC;  /* secondary on deep. 7.36:1                       */
  --cyan:        #6FA8C9;  /* line work, links. 5.88:1 on deep                */
  --plate:       #DDE6EC;  /* the light plate. Cool, deliberately not cream   */
  --plate-mute:  #40596B;  /* secondary on plate. 5.81:1                      */
  --brass:       #E0B04A;  /* the one accent. 7.59:1 on deep.
                              DARK GROUNDS ONLY — 1.58:1 on plate, never use  */

  --rule:        rgba(111, 168, 201, 0.28);
  --rule-strong: rgba(111, 168, 201, 0.52);
  --rule-plate:  rgba(12, 39, 64, 0.20);

  /* --- type -------------------------------------------------------------- */
  --face-display: 'Cabinet Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --face-body:    'Supreme', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  --t-display: clamp(2.1rem, 6.2vw, 5rem);      /* capped under the 6rem ceiling */
  --t-h2:      clamp(1.7rem, 3.1vw, 2.5rem);
  --t-h3:      clamp(1.12rem, 1.4vw, 1.35rem);
  --t-lead:    clamp(1.15rem, 1.4vw, 1.4rem);
  --t-body:    clamp(1rem, 0.32vw + 0.94rem, 1.125rem);
  --t-small:   0.875rem;
  --t-micro:   0.75rem;

  /* --- space ------------------------------------------------------------- */
  --s1: 0.25rem; --s2: 0.5rem;  --s3: 0.75rem; --s4: 1rem;
  --s5: 1.5rem;  --s6: 2rem;    --s7: 3rem;    --s8: 4rem;
  --s9: 6rem;    --s10: 8rem;   --s11: 10rem;

  /* 58ch, not 68ch: the ch unit is the width of the '0' glyph, which in Supreme
     is a good deal wider than the average lowercase letter: measured on the
     rendered page, one ch is 10.95px at an 18px body while the average character
     is 7.65px. So a 68ch column renders at about 90 real characters per line.
     52ch lands in the low 70s, which is what the 65-75 guidance is about.
     Measured on the built page, not assumed. */
  --measure: 52ch;
  --shell: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
}

/* ==========================================================================
   Reset and 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; }
}

body {
  background: var(--deep);
  color: var(--ink-pale);
  font-family: var(--face-body);
  font-size: var(--t-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a {
  color: var(--cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 160ms ease-out, text-decoration-color 160ms ease-out;
}
a:hover { color: var(--ink-pale); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 1px;
}

::selection { background: var(--brass); color: var(--deep-2); }

.skip {
  position: absolute; left: var(--s4); top: var(--s4);
  transform: translateY(-200%);
  background: var(--brass); color: var(--deep-2);
  padding: var(--s3) var(--s5);
  font-family: var(--face-display); font-weight: 700;
  text-decoration: none; z-index: 90;
  transition: transform 140ms ease-out;
}
.skip:focus { transform: translateY(0); color: var(--deep-2); }

/* ==========================================================================
   Type scale
   ========================================================================== */

h1, h2, h3 {
  font-family: var(--face-display);
  font-weight: 800;
  line-height: 1.03;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 { font-size: var(--t-display); letter-spacing: -0.04em; }
h2 { font-size: var(--t-h2); }
h3 {
  font-size: var(--t-h3);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

/* more space above a heading than below it */
h2 { margin-block: var(--s8) var(--s5); }
h3 { margin-block: var(--s7) var(--s3); }
h2:first-child, h3:first-child { margin-block-start: 0; }

p { max-width: var(--measure); }
p + p { margin-block-start: var(--s5); }

.lead {
  font-size: var(--t-lead);
  line-height: 1.5;
  color: var(--ink-pale);
  max-width: 46ch;
}

.note {
  font-size: var(--t-small);
  line-height: 1.6;
  color: var(--ink-mute);
  max-width: 50ch;
}

strong { font-weight: 700; color: #fff; }

/* the micro label is a chart instrument: figure labels, scale bars, legends,
   table headers. It is never an eyebrow above a heading. */
.micro {
  font-family: var(--face-body);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ==========================================================================
   Shell and grid
   ========================================================================== */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.band { padding-block: var(--s9); }
.band--tight { padding-block: var(--s8); }
.band--well { background: var(--deep-2); }

.grid {
  display: grid;
  /* minmax(0, 1fr), never plain 1fr: a bare 1fr track has an auto (min-content)
     floor, so a wide child — here the 1000px chart — pushes the track past the
     container and the whole page scrolls sideways on a phone. */
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--s6) var(--s5);
}
.grid > * { min-width: 0; }

/* Column spans. Note the `auto /` — writing `grid-column: span 4` sets the END to
   `span 4` and the START to auto, so a later `grid-column-start` overrides the start
   and leaves the end resolving to a single track. That silently collapses any
   offset column to one grid track. `auto / span 4` keeps the span on the end edge,
   where a start offset cannot clobber it. */
.col-4  { grid-column: auto / span 4; }
.col-5  { grid-column: auto / span 5; }
.col-6  { grid-column: auto / span 6; }
.col-7  { grid-column: auto / span 7; }
.col-8  { grid-column: auto / span 8; }
.col-12 { grid-column: 1 / -1; }
.start-2 { grid-column-start: 2; }
.start-6 { grid-column-start: 6; }
.start-7 { grid-column-start: 7; }
.start-9 { grid-column-start: 9; }

@media (max-width: 900px) {
  .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: 1 / -1; }
  .start-2, .start-6, .start-7, .start-9 { grid-column-start: 1; }
}

.rule {
  border: 0;
  border-block-start: 1px solid var(--rule);
  margin-block: var(--s7);
}

/* ==========================================================================
   Masthead
   ========================================================================== */

.masthead {
  background: var(--deep-2);
  border-block-end: 1px solid var(--rule);
}
.masthead__in {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s3) var(--s6);
  padding-block: var(--s5);
}

.wordmark {
  font-family: var(--face-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink-pale);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
}
.wordmark:hover { color: var(--ink-pale); }
.wordmark__mark { flex: 0 0 auto; }
.wordmark__t { display: block; }
.wordmark__sub {
  display: block;
  font-family: var(--face-body);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-block-start: 2px;
}

.nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
.nav a {
  font-size: var(--t-small);
  color: var(--ink-mute);
  text-decoration: none;
  padding-block: var(--s1);
  border-block-end: 1px solid transparent;
}
.nav a:hover { color: var(--ink-pale); border-block-end-color: var(--rule-strong); }
.nav a[aria-current="page"] {
  color: var(--ink-pale);
  border-block-end-color: var(--brass);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { padding-block: var(--s9) var(--s8); }
.hero__grid { align-items: start; }
.hero h1 { margin-block-end: var(--s5); }
.hero .lead { color: var(--ink-mute); }
.hero .lead strong { color: var(--ink-pale); font-weight: 500; }

.pagehead { padding-block: var(--s8) var(--s5); }
.pagehead h1 { max-width: 20ch; margin-block-end: var(--s5); }

.crumb {
  font-size: var(--t-small);
  color: var(--ink-mute);
  margin-block-end: var(--s6);
}
.crumb a { color: var(--ink-mute); }
.crumb a:hover { color: var(--ink-pale); }
.crumb span { padding-inline: var(--s2); color: var(--rule-strong); }

/* ==========================================================================
   The chart
   ========================================================================== */

.figure { margin: 0; }
.figure__cap {
  display: flex;
  flex-wrap: wrap;
  max-width: 52ch;
  gap: var(--s2) var(--s5);
  margin-block-start: var(--s4);
  padding-block-start: var(--s3);
  border-block-start: 1px solid var(--rule);
}
.figure__cap p { max-width: 48ch; font-size: var(--t-small); color: var(--ink-mute); }

.chart { width: 100%; height: auto; }
.chart .c-grat line { stroke: var(--cyan); stroke-width: 0.5; opacity: 0.16; }

.chart .c-water {
  fill: rgba(111, 168, 201, 0.20);
  stroke: var(--ink-pale);
  stroke-width: 2;
  stroke-linejoin: round;
}
.chart .c-land {
  fill: rgba(220, 232, 240, 0.06);
  stroke: var(--ink-pale);
  stroke-width: 1.4;
  stroke-linejoin: round;
}
.chart .c-parish {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.6;
  stroke-dasharray: 9 7;
  opacity: 0.85;
}

.chart .c-pin line { stroke: var(--brass); stroke-width: 2; }
.chart .c-pin-halo { fill: none; stroke: var(--brass); stroke-width: 1.4; opacity: 0.75; }
.chart .c-pin-dot  { fill: var(--brass); }
.chart .c-dot { fill: var(--ink-pale); opacity: 0.9; }
.chart .c-lead { stroke: var(--brass); stroke-width: 1; opacity: 0.55; }
.chart .c-lead-pale { stroke: var(--ink-mute); stroke-width: 1; opacity: 0.45; }
.chart .c-key-parish {
  stroke: var(--cyan); stroke-width: 1.6; stroke-dasharray: 9 7; opacity: 0.85;
}
.chart .c-legend .c-scale line { stroke: var(--ink-mute); stroke-width: 1.4; }

.chart .c-north line,
.chart .c-scale line,
.chart .c-off line { stroke: var(--ink-mute); stroke-width: 1.4; }
.chart .c-north-head { fill: var(--ink-mute); }

.chart text { font-family: var(--face-body); fill: var(--ink-mute); }
.chart .m-lbl {
  font-size: 15px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.chart .m-lbl-key { fill: var(--brass); font-weight: 700; letter-spacing: 0.12em; }
.chart .m-lbl-parish { fill: var(--cyan); letter-spacing: 0.16em; }
.chart .m-big {
  font-family: var(--face-display);
  font-size: 34px; font-weight: 800;
  letter-spacing: 0.01em; fill: var(--ink-pale);
  text-transform: none;
}
.chart .m-sub {
  font-size: 15px; letter-spacing: 0.12em;
  text-transform: uppercase; fill: var(--ink-mute);
}

/* SVG text scales with the viewBox, so a drawing rendered into a narrow column
   needs larger user-unit type to stay legible. The plates sit in a 4-column
   track — about 370px — where 15px user units render at barely 5px. */
.chart--plate .m-lbl { font-size: 27px; }
.chart--plate .m-big { font-size: 56px; }
.chart--plate .m-sub { font-size: 26px; }
.chart--plate .c-water { stroke-width: 3.5; }
.chart--plate .c-land { stroke-width: 2.6; }
.chart--plate .c-parish { stroke-width: 3; stroke-dasharray: 16 12; }
.chart--plate .c-dot { r: 6; }
.chart--plate .c-grat line { stroke-width: 1; }

@media (max-width: 900px) {
  /* same problem on a phone: bump the type and drop the minor place names so
     the key labels have room to be read */
  .chart .m-lbl { font-size: 21px; }
  .chart .m-big { font-size: 38px; }
  .chart .m-sub { font-size: 20px; }
  .chart .m-lbl-minor { display: none; }
  .chart .c-water { stroke-width: 3.5; }
  .chart .c-land { stroke-width: 2.4; }
  .chart .c-parish { stroke-width: 2.8; stroke-dasharray: 16 12; }
}

/* The one authored moment: the chart draws itself, the way a plotter would.
   Nothing else on the site animates on entry. */
@media (prefers-reduced-motion: no-preference) {
  .chart.is-drawing .c-shapes path {
    stroke-dasharray: var(--len);
    stroke-dashoffset: var(--len);
    animation: plot 2400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }
  .chart.is-drawing .c-water  { animation-delay: 120ms; }
  .chart.is-drawing .c-land   { animation-delay: 340ms; }
  .chart.is-drawing .c-parish { animation-delay: 0ms; }
  .chart.is-drawing :is(.c-marks, .c-type, .c-scale, .c-north, .c-off) {
    opacity: 0;
    animation: settle 700ms ease-out 1500ms forwards;
  }
  @keyframes plot   { to { stroke-dashoffset: 0; } }
  @keyframes settle { to { opacity: 1; } }
}

/* ==========================================================================
   Prose
   ========================================================================== */

.prose > * + * { margin-block-start: var(--s5); }
.prose h2 + p, .prose h3 + p { margin-block-start: 0; }
.prose ul { max-width: var(--measure); padding-inline-start: 0; list-style: none; }
.prose li { position: relative; padding-inline-start: var(--s5); }
.prose li + li { margin-block-start: var(--s3); }
.prose li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.72em;
  width: 12px; height: 1px;
  background: var(--cyan);
}

.pull {
  font-family: var(--face-display);
  font-weight: 500;
  font-size: clamp(1.35rem, 2.2vw, 1.9rem);
  line-height: 1.34;
  letter-spacing: -0.02em;
  color: var(--ink-pale);
  max-width: 26ch;
}
.pull cite {
  display: block;
  margin-block-start: var(--s4);
  font-family: var(--face-body);
  font-size: var(--t-small);
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.01em;
  color: var(--ink-mute);
  max-width: 34ch;
}

/* ==========================================================================
   The plate — one light panel per page, where the hard data lives
   ========================================================================== */

.plate {
  background: var(--plate);
  color: var(--deep);
  padding: clamp(var(--s6), 4vw, var(--s8));
}
.plate h2, .plate h3 { color: var(--deep-2); }
.plate p { color: var(--deep); }
.plate .micro { color: var(--plate-mute); }
.plate a { color: var(--deep-2); }
.plate a:hover { color: var(--plate-mute); }

.spec { width: 100%; border-collapse: collapse; text-align: left; }
.spec caption {
  text-align: left;
  padding-block-end: var(--s4);
  font-family: var(--face-body);
  font-size: var(--t-micro);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--plate-mute);
}
.spec th, .spec td {
  padding-block: var(--s3);
  padding-inline-end: var(--s5);
  border-block-start: 1px solid var(--rule-plate);
  vertical-align: baseline;
  font-size: var(--t-small);
  line-height: 1.55;
}
.spec th {
  font-family: var(--face-body);
  font-weight: 500;
  color: var(--plate-mute);
  width: 40%;
}
.spec td { color: var(--deep); font-variant-numeric: tabular-nums; }
.spec tr:last-child :is(th, td) { border-block-end: 1px solid var(--rule-plate); }

/* ==========================================================================
   The index — a ruled contents list, the way a technical volume does it.
   Deliberately not an icon-in-a-square card grid.
   ========================================================================== */

.index { border-block-start: 1px solid var(--rule-strong); }

.index__row {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--s2) var(--s6);
  align-items: baseline;
  /* the inset is set once, never animated — animating padding thrashes layout */
  padding: var(--s5) var(--s4);
  margin-inline: calc(var(--s4) * -1);
  border-block-end: 1px solid var(--rule);
  text-decoration: none;
  color: var(--ink-pale);
  transition: background-color 160ms ease-out;
}
.index__row > span {
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.index__row:hover,
.index__row:focus-visible {
  background: var(--deep-3);
  color: var(--ink-pale);
}
.index__row:hover > span,
.index__row:focus-visible > span {
  transform: translateX(6px);
}
@media (prefers-reduced-motion: reduce) {
  .index__row > span { transition: none; }
  .index__row:hover > span, .index__row:focus-visible > span { transform: none; }
}
.index__t {
  font-family: var(--face-display);
  font-weight: 700;
  font-size: clamp(1.15rem, 1.7vw, 1.5rem);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.index__row:hover .index__t { color: #fff; }
.index__d { color: var(--ink-mute); font-size: var(--t-small); line-height: 1.6; max-width: 50ch; }

@media (max-width: 700px) {
  .index__row { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Footer
   ========================================================================== */

.foot {
  background: var(--deep-2);
  border-block-start: 1px solid var(--rule);
  padding-block: var(--s8);
  margin-block-start: var(--s6);
}
.foot h2 {
  font-size: var(--t-h3);
  margin-block: 0 var(--s4);
}
.foot p { font-size: var(--t-small); color: var(--ink-mute); }
.foot p + p { margin-block-start: var(--s4); }
.foot__nav { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin-block-start: var(--s5); }
.foot__nav a { font-size: var(--t-small); color: var(--ink-mute); text-decoration: none; }
.foot__nav a:hover { color: var(--ink-pale); text-decoration: underline; }
.foot__meta {
  margin-block-start: var(--s7);
  padding-block-start: var(--s5);
  border-block-start: 1px solid var(--rule);
  max-width: none;
}
.foot__meta p {
  font-size: var(--t-micro);
  color: var(--ink-mute);
  letter-spacing: 0.02em;
  max-width: 52ch;
}

/* the standing honesty line. Quiet, but on every page. */
.colophon {
  border-inline-start: 1px solid var(--rule-strong);
  padding-inline-start: var(--s5);
  font-size: var(--t-small);
  color: var(--ink-mute);
  max-width: 52ch;
}
.colophon strong { color: var(--ink-pale); font-weight: 500; }

/* ==========================================================================
   Utilities
   ========================================================================== */

.stack-6 > * + * { margin-block-start: var(--s6); }
.stack-7 > * + * { margin-block-start: var(--s7); }
.vh {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
