@font-face {
  font-family: "Fraunces Desk";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("type/fraunces.woff2") format("woff2");
}
@font-face {
  font-family: "Public Civic";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("type/publicsans.woff2") format("woff2");
}
@font-face {
  font-family: "Public Civic";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("type/publicsans-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Plot Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("type/inconsolata.woff2") format("woff2");
}

:root {
  --paper: #e7dcc8;
  --paper-deep: #d4c6ae;
  --ink: #1c1914;
  --mute: #3f392f;
  --copper: #8c5a3c;
  --oxide: #5e7464;
  --rule: #b11f14;
  --hair: rgba(28, 25, 20, 0.22);
  --focus: #8c5a3c;
  --mast-h: 7.5rem;
  --ledger-h: 11.5rem;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
}

body.desk {
  min-height: 100svh;
  font-family: "Public Civic", "Source Sans 3", sans-serif;
  font-size: 1.05rem;
  line-height: 1.55;
  cursor: none;
}

body.desk.touching { cursor: auto; }
body.desk.touching .reticle { display: none !important; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 40;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}
.skip:focus { top: 1rem; }

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

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  opacity: 0.18;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.reticle {
  pointer-events: none;
  position: fixed;
  z-index: 35;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 1px solid var(--copper);
  border-radius: 0;
  transform: translate3d(-100px, -100px, 0);
}
.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: var(--rule);
}
.reticle::before { left: 10px; top: 3px; width: 1px; height: 16px; }
.reticle::after { left: 3px; top: 10px; width: 16px; height: 1px; }

.mast {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.15rem 1.25rem;
  align-items: end;
  padding: 0.85rem clamp(1rem, 3vw, 2.4rem) 0.75rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--hair);
  backdrop-filter: blur(6px);
}

.sheet-id {
  grid-column: 1 / -1;
  margin: 0;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
}

.mast h1 {
  margin: 0;
  font-family: "Fraunces Desk", "Source Serif 4", serif;
  font-weight: 650;
  font-size: clamp(2.4rem, 6vw, 4.6rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
}

.sym {
  margin: 0 0 0.35rem;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: var(--copper);
}

.hook {
  grid-column: 1 / -1;
  margin: 0.15rem 0 0;
  max-width: 62ch;
  color: var(--mute);
  font-size: 0.98rem;
}

.viewport {
  position: sticky;
  top: var(--mast-h);
  z-index: 1;
  height: calc(100svh - var(--mast-h) - var(--ledger-h));
  min-height: 22rem;
  background: #1c1914;
}

#wardfield {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  inset: auto 1rem 1.35rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  pointer-events: none;
}

.coord, .theodolite {
  margin: 0;
  color: #efe6d4;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  background: rgba(20, 17, 14, 0.78);
  padding: 0.4rem 0.65rem 0.35rem;
  white-space: nowrap;
}

.coord span, .theodolite span {
  display: inline;
  opacity: 0.65;
  letter-spacing: 0.16em;
  margin-right: 0.55rem;
}

.theodolite { pointer-events: auto; min-width: min(18rem, 46vw); }

#delay-dial {
  width: 100%;
  height: 2.6rem;
  margin: 0;
  accent-color: var(--rule);
}

.travel { height: 380vh; }

.azimuth {
  position: fixed;
  right: 0.8rem;
  top: 50%;
  z-index: 14;
  display: grid;
  gap: 0.35rem;
  transform: translateY(-50%);
}

.azimuth a {
  display: grid;
  grid-template-columns: 1.4rem auto;
  gap: 0.4rem;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.2rem 0.45rem;
  color: #efe6d4;
  text-decoration: none;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0,0,0,.55);
}

.azimuth a span {
  color: var(--rule);
}

.ledger {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(34rem, 86vw);
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  background: var(--paper);
  border-top: 1px solid var(--ink);
  height: var(--ledger-h);
}

.plate {
  scroll-snap-align: start;
  margin: 0;
  padding: 0.85rem 1.1rem 0.7rem;
  border-right: 1px solid var(--hair);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "cap draw" "copy draw";
  gap: 0.35rem 1rem;
}

.plate figcaption { grid-area: cap; }
.plate p { grid-area: copy; margin: 0; font-size: 0.92rem; max-width: 42ch; }
.plate .trace { grid-area: draw; width: 13rem; height: 4.6rem; color: var(--ink); align-self: center; }

.plate-no {
  margin: 0;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  color: var(--copper);
}

.plate h2 {
  margin: 0.1rem 0 0;
  font-family: "Fraunces Desk", serif;
  font-size: 1.35rem;
  font-weight: 650;
  line-height: 1.05;
}

.plate.is-live { background: color-mix(in srgb, var(--paper-deep) 55%, var(--paper)); }

.reading, .franchise, .drawings, .cadastre, .colophon {
  position: relative;
  z-index: 8;
  background: var(--paper);
  padding: clamp(2.4rem, 6vw, 5.2rem) clamp(1rem, 4vw, 3.4rem);
}

.kicker {
  margin: 0 0 0.4rem;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--copper);
}

.reading blockquote {
  margin: 0;
  max-width: 68ch;
  font-size: 1.08rem;
  text-wrap: pretty;
}

.reading blockquote p { margin: 0; }

.franchise h2, .drawings h2, .cadastre h2 {
  margin: 0 0 1.4rem;
  font-family: "Fraunces Desk", serif;
  font-weight: 650;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 0.96;
  letter-spacing: -0.02em;
}

.franchise ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 1.1rem;
  max-width: 74ch;
  counter-reset: hold;
}

.franchise li {
  position: relative;
  padding-left: 3.2rem;
  counter-increment: hold;
}

.franchise li::before {
  content: counter(hold, upper-roman);
  position: absolute;
  left: 0;
  top: 0.15rem;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  color: var(--rule);
}

.drawing-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--ink);
}

.drawing-row figure {
  margin: 0;
  padding: 1rem 0.4rem;
  border-bottom: 1px solid var(--hair);
  color: var(--ink);
}

.drawing-row svg { width: min(100%, 36rem); height: auto; display: block; }

.cadastre table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

.cadastre th, .cadastre td {
  text-align: left;
  vertical-align: top;
  padding: 0.85rem 0.9rem 0.85rem 0;
  border-bottom: 1px solid var(--hair);
}

.cadastre thead th {
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 500;
}

.cadastre tbody th {
  width: 8.5rem;
  font-weight: 500;
  color: var(--copper);
}

.unpublished {
  display: inline-block;
  padding: 0.15rem 0;
  border-bottom: 1px dashed var(--mute);
  color: var(--mute);
}

.identities {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stamp {
  padding: 1.1rem 1rem 1rem;
  max-width: 28rem;
}

.guardian-stamp {
  border: 1px solid var(--copper);
  transform: rotate(-0.4deg);
}

.launch-stamp {
  border: 1px solid var(--ink);
  margin-left: auto;
  transform: rotate(0.6deg);
}

.stamp-label {
  margin: 0 0 0.4rem;
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stamp p:last-child { margin: 0; color: var(--mute); }

.foot-rule {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--ink);
  font-family: "Plot Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.foot-rule a {
  color: var(--ink);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

.foot-rule a[aria-disabled="true"] {
  color: var(--mute);
  text-decoration: none;
  pointer-events: none;
}

.miss-body {
  padding: 4rem clamp(1rem, 4vw, 3rem);
  max-width: 40rem;
}

.home-rule { color: var(--rule); }

@media (min-width: 860px) {
  .drawing-row { grid-template-columns: 1fr 1fr 1fr; }
  .drawing-row figure { border-right: 1px solid var(--hair); padding: 1.2rem; }
  .drawing-row figure:last-child { border-right: 0; }
  .identities { grid-template-columns: 1fr 1fr; align-items: start; }
}

@media (max-width: 720px) {
  body.desk { cursor: auto; }
  .reticle { display: none !important; }
  .mast {
    grid-template-columns: 1fr auto;
    --local: 1;
  }
  .viewport { top: 8.6rem; height: calc(100svh - 8.6rem - 14.5rem); min-height: 16rem; }
  .ledger {
    height: 14.5rem;
    grid-auto-columns: 92vw;
  }
  .plate {
    grid-template-columns: 1fr;
    grid-template-areas: "cap" "copy" "draw";
  }
  .plate .trace { width: 100%; height: 3.4rem; }
  .azimuth { display: none; }
  .hud { flex-direction: column; align-items: stretch; }
  .coord, .theodolite { white-space: normal; }
  .cadastre tbody th, .cadastre td { display: block; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .travel { height: 0; }
  .viewport { position: relative; top: 0; height: min(70svh, 38rem); }
  .ledger { position: relative; height: auto; grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; }
  .plate { border-right: 0; border-bottom: 1px solid var(--hair); }
}

@media print {
  .grain, .reticle, .azimuth, .travel, .viewport { display: none; }
  body.desk { cursor: auto; background: white; }
}
