/*! © 2026 Parameter Space Pty Ltd. Melbourne, Australia. */
:root {
  --paper: #f2eee4;
  --white: #fbf9f4;   /* the tablet's screen in the drawing (WHITE in town.js) */
  --ink: #171613;
  --ink-2: #55524a;
  --rule: rgba(23, 22, 19, .28);
  --sans: "Jost", "Futura", "Century Gothic", "Avenir Next", sans-serif;
  --serif: "EB Garamond", "Hoefler Text", "Baskerville", Garamond, Georgia, serif;
  --gutter: clamp(20px, 5.5vw, 84px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
p, h1, h2, dl, dd { margin: 0; }
a { color: inherit; }

/* ---------- the drawing and its sheet ---------- */
#plate { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(90deg, var(--paper) 0, var(--paper) 31%, rgba(242, 238, 228, 0) 45%);
}
.sheet {
  position: fixed; inset: 10px; z-index: 3; pointer-events: none;
  border: 1px solid var(--ink);
}

/* ---------- title strip ---------- */
.bar {
  position: fixed; z-index: 4; top: 10px; left: 10px; right: 10px; height: 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px;
  background: var(--white);
  border: 1px solid var(--ink);
  font-family: var(--sans); font-size: 11px; letter-spacing: .2em; text-transform: uppercase;
  white-space: nowrap;
}
.mark { font-weight: 600; letter-spacing: .3em; text-decoration: none; }
.bar-mid { color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* gives way before the controls do */
.bar-ref { display: flex; gap: 14px; align-items: center; font-variant-numeric: tabular-nums; }
.bar-ref b { font-weight: 600; }
#scale { min-width: 9.5em; text-align: right; color: var(--ink-2); font-weight: 600; }
#scale::before { font-weight: 400; }
.units {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 5px 0 5px 14px;
  border: 0; border-left: 1px solid var(--rule); border-radius: 0; background: none; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: #8a867c;
}
.units i { font-style: normal; }
.rev { display: flex; align-items: center; gap: 8px; padding: 5px 0 5px 14px; border-left: 1px solid var(--rule); color: var(--ink-2); }
.rev b { display: inline-block; min-width: 1.9em; padding: 2px 0 2px .2em; border: 1px solid var(--ink); text-align: center; color: var(--ink); }
.units[data-units="metric"] [data-u="metric"], .units[data-units="imperial"] [data-u="imperial"] { color: var(--ink); font-weight: 600; }
.units:hover span { color: var(--ink); }
.units:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* ---------- scenes ---------- */
main { position: relative; z-index: 2; }
.scene { min-height: 240vh; padding: 52vh var(--gutter) 0; }
.code {
  font-family: var(--sans); font-size: 11px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--ink-2);
}

.hero { min-height: 100vh; padding-top: 0; display: flex; align-items: center; }
.hero-in { max-width: 30rem; padding-top: 40px; }
h1 {
  font-family: var(--sans); font-weight: 500; text-transform: uppercase;
  font-size: clamp(44px, 6.4vw, 96px); line-height: .94; letter-spacing: .05em;
  margin: 18px 0 22px -.04em;
}
.lede { font-style: italic; font-size: clamp(21px, 2vw, 27px); line-height: 1.25; }
.hero .body { margin-top: 18px; max-width: 25rem; color: var(--ink-2); }
.cue {
  margin-top: 44px; display: flex; align-items: center; gap: 12px;
  font-family: var(--sans); font-size: 11px; letter-spacing: .22em; text-transform: uppercase;
}
.cue span { width: 1px; height: 38px; background: var(--ink); transform-origin: top; animation: drop 2.2s ease-in-out infinite; }
@keyframes drop { 0% { transform: scaleY(0); } 55% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

.entry {
  position: sticky; top: 24vh;
  /* inset text; the box reaches out into the gutter by the same amount, so the text keeps its column */
  width: calc(min(24rem, 100%) + 36px); margin-left: -18px;
  padding: 14px 18px 18px;
  box-shadow: 6px 8px 10px -6px rgba(23, 22, 19, .22);   /* lifts it off the drawing as it slides up: bottom and right only */
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid rgba(23, 22, 19, .18);   /* a shade lighter than --rule */
  border-right: 1px solid rgba(23, 22, 19, .18);
  background: var(--white);
}
.entry .code { display: flex; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
h2 {
  font-family: var(--sans); font-weight: 600; text-transform: uppercase;
  font-size: 27px; line-height: 1.1; letter-spacing: .16em;
  margin: 18px 0 8px;
}
.def { font-size: 20px; line-height: 1.3; margin-bottom: 14px; text-wrap: pretty; }
.entry p:last-child { color: var(--ink-2); text-wrap: pretty; }

/* the last section's text box lets go early, leaving a clear space before the colophon follows it up
   (the section keeps its height, so the drawing's timing is unchanged) */
.scene:has(+ .last) { padding-bottom: 22vh; }

/* ---------- colophon ---------- */
.last { min-height: 100vh; padding-top: 0; padding-bottom: 40px; display: flex; align-items: center; }
/* the width of the section text boxes, reaching into the gutter so the text keeps its column and its rule spans the same */
.colophon {
  width: calc(min(24rem, 100%) + 36px); margin: 50px 0 0 -18px; padding: 0 18px;
  border-top: 3px solid var(--ink);
}
.colophon .code { display: flex; justify-content: space-between; margin: 0 -18px; padding: 14px 18px 12px; border-bottom: 1px solid var(--rule); }   /* its line runs to the edges of the box, under the full-width rule above */
.colophon h2 { font-size: clamp(34px, 3.6vw, 50px); letter-spacing: .06em; font-weight: 500; margin: 22px 0 12px; }
.table { margin: 24px 0 26px; border-top: 1px solid var(--ink); }
.table div { display: grid; grid-template-columns: 8.2em 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.table dt { font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.table dd { font-size: 17px; line-height: 1.3; }
.button {
  display: inline-block; padding: 13px 20px 12px;
  background: var(--ink); color: var(--paper); border: 1px solid var(--ink);
  font-family: var(--sans); font-size: 12px; font-weight: 500; letter-spacing: .2em; text-transform: uppercase; text-decoration: none;
  transition: background .2s, color .2s;
}
.button:hover, .button:focus-visible { background: var(--paper); color: var(--ink); }
.colophon .button { display: block; width: fit-content; margin-inline: auto; }   /* centred in the colophon */
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.fine { margin-top: 26px; font-size: 14px; color: var(--ink-2); text-align: center; }   /* centred under the button */

/* ---------- narrow screens: drawing above, text below ---------- */
/* iPad mini in landscape and narrower: the units read M / FT, and the tagline leaves the title strip */
@media (max-width: 1133px) {
  .bar-mid { display: none; }
  .units span { font-size: 0; }
  .units span::after { content: attr(data-s); font-size: 11px; }
}

@media (max-width: 860px) {
  body { font-size: 16px; }
  /* the drawing fades to paper by --clear; in portrait town.js sets it a gap above the section text */
  .veil { background: linear-gradient(180deg, rgba(242, 238, 228, 0) calc(var(--clear, 60%) - var(--fade, 12%)), var(--paper) var(--clear, 60%)); }
  .bar-mid, #refname { display: none; }
  .bar { padding: 0 12px; font-size: 10px; }
  .bar-ref { gap: 10px; }
  #scale { min-width: 0; }
  .units { padding-left: 10px; gap: 4px; }
  .rev { padding-left: 10px; gap: 5px; }
  .rev span { display: none; }
  .units span::after { font-size: 10px; }
  .scene { padding-top: 70vh; }
  .scene:has(+ .last) { padding-bottom: 0; }   /* the colophon sits at the foot of its screen here, well clear already */
  .hero, .last { padding-top: 0; align-items: flex-end; padding-bottom: 34px; }
  .hero-in { padding-top: 0; }
  h1 { font-size: clamp(38px, 11.5vw, 60px); margin: 10px 0 12px; }
  .hero .body { margin-top: 10px; }
  .cue { margin-top: 20px; }
  .cue span { height: 24px; }
  .entry { top: 55vh; width: 100%; margin-left: 0; padding: 12px 14px 14px; }
  .entry .code { padding-bottom: 8px; }
  h2 { font-size: 21px; margin: 10px 0 4px; }
  .def { font-size: 17px; margin-bottom: 8px; }
  /* at the foot of the page a paper panel runs the full width, hiding the drawing behind it.
     The rule goes back onto the heading line, which drops it from 768px down */
  .colophon { width: auto; flex: 1; margin: 0 calc(-1 * var(--gutter)) -34px; padding: 0 calc(var(--gutter) + 14px) 34px; border-top: 0; background: var(--paper); }
  .colophon .code { margin: 0; padding-inline: 0; border-top: 3px solid var(--ink); }
  .colophon h2 { margin: 14px 0 8px; }
  .colophon .lede { font-size: 19px; }
  .table { margin: 14px 0 16px; }
  .table div { padding: 5px 0; }
  .table dd { font-size: 15px; }
  .fine { margin-top: 14px; font-size: 13px; }
}

/* iPad mini (portrait) and smaller: the section text sits on the paper without its ruled border */
@media (max-width: 768px) {
  .entry { border-top: 0; border-bottom: 0; border-right: 0; }
  .colophon .code { border-top: 0; }
}
/* narrower than the iPad mini in portrait (744px): the colophon's paper panel fades in over the drawing above it
   instead of cutting it off, the fade running up from the panel's top so its first line still sits on paper */
@media (max-width: 743px) {
  .colophon { position: relative; }
  .colophon::before {
    content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 64px; pointer-events: none;
    background: linear-gradient(180deg, rgba(242, 238, 228, 0), var(--paper));
  }
}
/* phones: tighten the title strip so the revision box stays inside it */
@media (max-width: 440px) {
  .bar { gap: 10px; }
  .mark { letter-spacing: .2em; }
  .bar-ref { gap: 8px; }
  .units, .rev { padding-left: 8px; }
}

/* iPad mini (744px portrait) and wider: the scale is labelled */
@media (min-width: 744px) {
  #scale::before { content: "Scale: "; }
}

@media (prefers-reduced-motion: reduce) {
  .cue span { animation: none; }
}
