/* Fort Ink: survey sheet */

@font-face {
  font-family: "Brygada 1918";
  src: url("../fonts/brygada1918-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Paper and ink, carried over from the old site's greys and warmed slightly */
  --paper: #e4e2de;
  --paper-hi: #eeece8;
  --ink: #1d1c1a;
  --ink-2: #4b4945;
  --rule: #c2bfb9;
  --contour: #b6b3ad;
  --contour-index: #918e88;
  --charcoal: #262523;
  --on-dark: #eceae5;
  --on-dark-2: #b7b4ae;
  --rule-dark: #47453f;
  /* The one accent: fountain-pen blue. It marks actions and the thing the reader is pointing at. */
  --blue: #1f3d94;
  --blue-deep: #172f78;
  --blue-on-dark: #a9bbf4;

  --serif: "Brygada 1918", "Iowan Old Style", Georgia, serif;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(20px, 5vw, 64px);
  --max: 1240px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 24px; scrollbar-color: var(--contour-index) var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  caret-color: var(--blue);
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg, canvas { display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
::selection { background: var(--blue); color: var(--paper-hi); }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 1.4rem + 4.2vw, 4.5rem); line-height: 1.03; letter-spacing: -0.022em; }
h2 { font-size: clamp(2rem, 1.4rem + 2.2vw, 3.25rem); line-height: 1.06; letter-spacing: -0.018em; }
h3 { font-size: clamp(1.5rem, 1.3rem + 0.7vw, 1.875rem); line-height: 1.15; letter-spacing: -0.01em; }
p { text-wrap: pretty; }
.lead { font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem); line-height: 1.45; }

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

.skip {
  position: absolute; left: 12px; top: 12px; z-index: 10;
  padding: 10px 14px; background: var(--ink); color: var(--paper); text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Map lettering: condensed capitals, used only for labels on the sheet */
.marker__name, .facts dt, .step__terms, .course__terms, .hero__note, .colophon {
  font-stretch: 78%;
  font-weight: 600;
  font-size: 0.8125rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.25;
}

/* Facts still to come from the owner. Visible on purpose until they are filled in. */
.todo { color: var(--ink-2); background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 0.05em 0.3em; border-radius: 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.systems .todo { color: var(--on-dark-2); background: color-mix(in srgb, var(--on-dark) 9%, transparent); }

/* Title strip */
.top { border-bottom: 1px solid var(--rule); }
.top__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; }
.brand__mark { width: 22px; height: 26px; fill: none; stroke: currentColor; stroke-width: 44; stroke-linejoin: round; stroke-linecap: round; }
.brand__name { white-space: nowrap; font-family: var(--serif); font-size: 1.3125rem; font-weight: 500; letter-spacing: -0.01em; }
.nav { display: flex; gap: clamp(14px, 3vw, 36px); }
.nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; font-size: 0.9375rem; text-decoration: none; white-space: nowrap; }
.nav a:hover { text-decoration: underline; }

/* Buttons and links */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.btn {
  display: inline-flex; align-items: center; min-height: 52px; padding: 0 26px;
  background: var(--blue); color: var(--paper-hi);
  font-weight: 600; font-size: 1.0625rem; text-decoration: none; border-radius: 3px;
  transition: background-color 180ms var(--ease), transform 180ms var(--ease);
}
.btn:hover { background: var(--blue-deep); }
.btn:active { transform: translateY(1px); }
.link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }
.link:hover { color: var(--blue); }

/* Hero: the sheet */
.hero { position: relative; overflow: hidden; background: url("../images/contours-fallback.svg") center / cover no-repeat; }
/* The live field replaces the still one as soon as the script runs */
.js .hero { background-image: none; }
/* Without the script there is no clearing, so the copy gets its own patch of bare paper */
html:not(.js) .hero__copy { background: var(--paper); box-shadow: 0 0 0 20px var(--paper); }
.field { position: absolute; inset: 0; width: 100%; height: 100%; --contour: #b6b3ad; --contour-index: #918e88; --contour-hot: #1f3d94; }
.hero__in {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 6fr); gap: clamp(24px, 4vw, 64px);
  align-items: center;
  min-height: clamp(580px, calc(100svh - 69px), 800px);
  padding-block: clamp(56px, 8vh, 96px) clamp(72px, 10vh, 112px);
}
.hero__copy { max-width: 41rem; }
.hero__copy .lead { margin-top: 28px; max-width: 34rem; color: var(--ink-2); }
.hero__copy .actions { margin-top: 36px; }

.hero__map, .inset__map { position: relative; align-self: stretch; min-height: 380px; }
.hero__map li, .inset__map li { position: absolute; left: var(--x); top: var(--y); }

.marker {
  position: relative; display: block; width: 44px; height: 44px; margin: -27px 0 0 -22px;
  text-decoration: none; color: var(--ink);
}
.marker__pt {
  position: absolute; left: 10px; top: 10px; width: 24px; height: 24px;
  fill: var(--blue); stroke: var(--blue); stroke-width: 1.6; stroke-linejoin: round;
  transition: transform 260ms var(--ease);
}
.marker__pt circle { fill: var(--paper); stroke: none; }
.marker__label {
  /* A solid paper box masks the contours behind a label, as on a printed map */
  position: absolute; left: 40px; top: 10px; display: grid;
  padding: 2px 5px 3px; background: var(--paper); white-space: nowrap;
}
.marker__name { font-size: 0.9375rem; }
a.marker:hover .marker__pt, a.marker:focus-visible .marker__pt, .marker.is-active .marker__pt { transform: translateY(-3px) scale(1.12); }
a.marker:hover .marker__name, a.marker:focus-visible .marker__name { color: var(--blue); }
/* Focus ring hugs the trig point so it never cuts through the label */
a.marker:focus-visible { outline: none; }
a.marker:focus-visible::before { content: ""; position: absolute; inset: 1px; border: 2px solid var(--blue); border-radius: 50%; }

/* Neatline along the foot of the sheet, with tick marks */
.hero__note {
  position: absolute; left: 0; right: 0; bottom: 0; margin-inline: auto;
  color: var(--ink-2); font-weight: 500;
}
.hero__note b {
  font-weight: inherit;
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper), 2px 0 2px var(--paper), -2px 0 2px var(--paper), 0 2px 2px var(--paper), 0 -2px 2px var(--paper);
}
.hero__note span {
  display: block; padding: 14px 0 16px;
  background:
    repeating-linear-gradient(90deg, var(--contour-index) 0 1px, transparent 1px 80px) 0 0 / 100% 7px no-repeat,
    linear-gradient(var(--contour-index), var(--contour-index)) 0 0 / 100% 1px no-repeat;
}

/* Systems: the night sheet */
.systems { position: relative; background: var(--charcoal); color: var(--on-dark); }
.systems ::selection { background: var(--blue-on-dark); color: var(--charcoal); }
.systems :focus-visible { outline-color: var(--blue-on-dark); }
.systems__in {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px);
  padding-block: clamp(72px, 10vw, 136px);
}
.systems__side { position: sticky; top: 32px; align-self: start; }
.systems__intro { margin-top: 20px; max-width: 26rem; color: var(--on-dark-2); }

.inset {
  position: relative; margin-top: 36px; aspect-ratio: 5 / 4; overflow: hidden;
  border: 1px solid var(--rule-dark);
}
.inset .field { --contour: #4c4a45; --contour-index: #6f6c66; --contour-hot: #a9bbf4; }
.inset__map { position: absolute; inset: 0; min-height: 0; }
.systems .marker { color: var(--on-dark); }
.systems .marker__pt { fill: var(--blue-on-dark); stroke: var(--blue-on-dark); }
.systems .marker__pt circle { fill: var(--charcoal); }
.systems .marker__label { background: var(--charcoal); }
.systems .marker__name { font-size: 0.8125rem; color: var(--on-dark-2); transition: color 200ms var(--ease); }
.systems .marker.is-active .marker__name { color: var(--on-dark); }
/* On the inset the rings centre on the glyph, so it grows in place and does not lift */
.inset .marker.is-active .marker__pt { transform: scale(1.12); }

.entry { padding-block: 34px 38px; border-top: 1px solid var(--rule-dark); }
.entry:last-child { border-bottom: 1px solid var(--rule-dark); }
.entry h3 { transition: color 240ms var(--ease); }
.entry__job { margin-top: 10px; font-size: 1.1875rem; line-height: 1.4; color: var(--on-dark); }
.entry p:not([class]) { margin-top: 12px; max-width: 38rem; color: var(--on-dark-2); }
.entry__more { margin-top: 6px; }
.entry__more .link { color: var(--blue-on-dark); text-underline-offset: 0.2em; }
.entry__more .link:hover { color: var(--on-dark); }
.entry .todo { display: block; margin-top: 14px; max-width: 38rem; font-size: 0.9375rem; }
/* With the inset map pinned beside the list, the entry in the middle of the screen is the bright one */
@media (min-width: 901px) {
  .js .entry h3, .js .entry .entry__job { color: var(--on-dark-2); transition: color 240ms var(--ease); }
  .js .entry.is-current h3, .js .entry.is-current .entry__job { color: var(--on-dark); }
}

/* Training: a ruled schedule of sessions */
.training { padding-block: clamp(56px, 8vw, 104px); border-top: 1px solid var(--rule); }
.training__in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 6vw, 96px); }
.training__head .lead { margin-top: 24px; max-width: 26rem; }
.training__note { margin-top: 16px; max-width: 26rem; color: var(--ink-2); }
.training__head .actions { margin-top: 20px; }
.courses { border-top: 1px solid var(--contour-index); }
.course {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 24px; align-items: baseline;
  padding-block: 22px 26px; border-bottom: 1px solid var(--rule);
}
.course__terms { white-space: nowrap; color: var(--ink); }
.course p:not([class]) { grid-column: 1 / -1; max-width: 36rem; color: var(--ink-2); }

/* Not-found page */
.lost { padding-block: clamp(96px, 16vw, 200px); }
.lost .lead { margin-top: 24px; max-width: 34rem; color: var(--ink-2); }
.lost .actions { margin-top: 36px; }

/* Route: three waypoints on a footpath */
.route { padding-block: clamp(72px, 10vw, 136px) clamp(56px, 8vw, 104px); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: clamp(40px, 6vw, 72px); counter-reset: step; }
.step { position: relative; padding: 88px 40px 0 0; counter-increment: step; }
.step__path { position: absolute; left: 0; top: 0; width: 100%; height: 56px; overflow: visible; }
.step__path path { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 7 6; vector-effect: non-scaling-stroke; }
.step::before {
  content: counter(step);
  position: absolute; left: -1px; top: 12px; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 50%; z-index: 1;
  background: var(--paper); border: 1.5px solid var(--ink);
  font-weight: 600; font-size: 0.875rem; font-variant-numeric: tabular-nums;
}
.step h3 { max-width: 16ch; }
.step p { margin-top: 12px; max-width: 30rem; color: var(--ink-2); }
.step .step__terms { margin-top: 18px; color: var(--ink); }

/* About */
.about { padding-block: clamp(56px, 8vw, 104px); border-top: 1px solid var(--rule); }
.about__in { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(24px, 6vw, 96px); }
.about__body { max-width: 40rem; }
.about__head .lead { margin-top: 24px; max-width: 26rem; }
.about__body > p { color: var(--ink-2); }
/* The sheet's title block */
.facts { margin-top: 32px; max-width: 30rem; border: 1px solid var(--contour-index); }
.facts div { display: grid; grid-template-columns: 11.5rem 1fr; gap: 12px; padding: 11px 14px; align-items: baseline; }
.facts div + div { border-top: 1px solid var(--rule); }
.facts dt { color: var(--ink-2); font-weight: 500; }

/* Contact */
.contact { position: relative; background: var(--paper-hi); padding-block: clamp(80px, 11vw, 152px); }
/* The neatline returns to close the sheet */
.contact::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 7px;
  background:
    repeating-linear-gradient(90deg, var(--contour-index) 0 1px, transparent 1px 80px) 0 0 / 100% 7px no-repeat,
    linear-gradient(var(--contour-index), var(--contour-index)) 0 0 / 100% 1px no-repeat;
}
.contact__in { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(32px, 6vw, 96px); align-items: end; }
.contact__in > :not(.brief) { grid-column: 1; }
.brief { grid-column: 2; grid-row: 1 / span 3; align-self: end; }
.brief h3 { font-family: var(--sans); font-size: 0.8125rem; font-stretch: 78%; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-2); }
.brief ol { margin-top: 14px; counter-reset: brief; border-top: 1px solid var(--rule); }
.brief li { counter-increment: brief; display: grid; grid-template-columns: 2rem 1fr; padding-block: 14px; border-bottom: 1px solid var(--rule); color: var(--ink); }
.brief li::before { content: counter(brief); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.contact h2 { max-width: 16ch; font-size: clamp(2.25rem, 1.4rem + 3.4vw, 4.25rem); }
.contact .lead { margin-top: 24px; max-width: 36rem; color: var(--ink-2); }
.contact .actions { margin-top: 36px; }

/* Colophon */
.colophon { border-top: 1px solid var(--rule); color: var(--ink-2); font-weight: 500; }
.colophon__in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 36px; padding-block: 26px 34px; }
.colophon .brand { color: var(--ink); }
.colophon .brand__name { text-transform: none; letter-spacing: -0.01em; font-stretch: 100%; }
.colophon p:last-child { margin-left: auto; }
.colophon a { display: inline-flex; align-items: center; min-height: 44px; }
.colophon .plain { text-transform: none; letter-spacing: 0; font-stretch: 100%; font-size: 0.9375rem; font-weight: 400; color: var(--ink); }

/* Narrower screens */
@media (max-width: 900px) {
  .hero__in { grid-template-columns: 1fr; align-items: start; min-height: 0; padding-block: 44px 76px; gap: 12px; }
  .hero__map { min-height: 330px; }
  .systems__in, .about__in, .training__in, .contact__in { grid-template-columns: 1fr; }
  .brief { grid-column: 1; grid-row: auto; margin-top: 56px; }
  .systems__side { position: static; }
  .inset { aspect-ratio: 16 / 10; max-width: 560px; }
  .steps { grid-template-columns: 1fr; gap: 0; }
  .step { padding: 4px 0 44px 56px; }
  .step:last-child { padding-bottom: 0; }
  .step__path { display: none; }
  .step::before { left: 0; top: 0; }
  .step:not(:last-child)::after {
    content: ""; position: absolute; left: 15px; top: 40px; bottom: 8px;
    border-left: 1.5px dashed var(--ink);
  }
}
@media (max-width: 560px) {
  .top__in { min-height: 60px; }
  .nav { gap: 6px; }
  .nav a { font-size: 0.875rem; }
  .course { grid-template-columns: 1fr; gap: 6px; }
  .course p:not([class]) { margin-top: 4px; }
  .btn { width: 100%; justify-content: center; }
  .hero__map { min-height: 340px; margin-inline: -4px; }
  .marker__name { font-size: 0.8125rem; }
  /* The marker nearest the right edge carries its label on the left */
  .hero__map li:nth-child(4) .marker__label, .inset__map li:nth-child(4) .marker__label, .inset__map li:nth-child(2) .marker__label { left: auto; right: 40px; justify-items: end; }
  /* Re-space the hills so no two labels meet on a narrow sheet */
  .inset__map li:nth-child(1) { top: 14%; }
  .inset__map li:nth-child(2) { top: 32%; }
  .inset__map li:nth-child(3) { left: 22%; top: 66%; }
  .inset__map li:nth-child(4) { left: 78%; top: 86%; }
  .hero__map li:nth-child(1) { left: 16%; top: 34%; }
  .hero__map li:nth-child(2) { left: 66%; top: 24%; }
  .hero__map li:nth-child(3) { left: 24%; top: 80%; }
  .hero__map li:nth-child(4) { left: 86%; top: 60%; }
  .facts div { grid-template-columns: 1fr; gap: 2px; }
  .facts { max-width: none; }
  .colophon p:last-child { margin-left: 0; }
}

@media (max-width: 385px) {
  .top .brand__name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
