/* ==========================================================================
   Systems Atlas Project
   Paper, graph grid, ink. No accent colour — the tools carry the colour,
   the atlas doesn't.
   ========================================================================== */

:root {
  /* Sampled from the logo */
  --paper:  #F8EFE2;
  --grid:   #ECE3D4;
  --ink:    #161613;
  --ink-2:  #6B6355;
  --ink-3:  #9A9382;
  --rule:   #DFD4C0;

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype",
           Palatino, "Book Antiqua", Georgia, serif;
  --mono:  ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas,
           "Liberation Mono", monospace;

  --measure: 35rem;
  --wide: 68rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

/* Reset ------------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;

  /* The graph paper the atlas is drawn on. */
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: center top;
}

h1, h2, h3, p, ul, ol, figure, dl { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

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

/* Layout ----------------------------------------------------------------- */

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

.measure { max-width: var(--measure); }
.band { padding-block: clamp(3rem, 7vw, 5rem); }

/* Type ------------------------------------------------------------------- */

.label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1.2rem;
}

.display {
  font-size: clamp(2.3rem, 1.4rem + 4vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.022em;
  font-weight: 400;
  text-wrap: balance;
}

.h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.05rem);
  line-height: 1.18;
  letter-spacing: -0.014em;
  font-weight: 400;
  margin: 0 0 1rem;
  text-wrap: balance;
}

.h3 { font-size: 1.1rem; font-weight: 600; margin: 0 0 0.35rem; }

.lede {
  font-size: clamp(1.08rem, 1rem + 0.5vw, 1.28rem);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 33rem;
}

.prose { color: var(--ink-2); }
.prose p + p { margin-top: 0.95rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.jp { letter-spacing: 0.05em; }

/* Masthead --------------------------------------------------------------- */

.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.4rem;
}

.masthead__mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-size: 1.1rem;
}

.masthead__icon {
  width: 30px;
  height: 30px;
  border: 1px solid var(--rule);
}

.masthead__contact {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
}

.masthead__contact:hover { color: var(--ink); }

/* Hero ------------------------------------------------------------------- */

.hero { padding-block: clamp(2rem, 5vw, 3.5rem) clamp(1.5rem, 3vw, 2rem); }
.hero__display { margin-bottom: 1.3rem; max-width: 17ch; }

/* Signature: the map ------------------------------------------------------ */

.map { margin-top: clamp(2rem, 5vw, 3rem); }

.map__scroll {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
}

.map__scroll::-webkit-scrollbar { display: none; }

.map__svg {
  width: 100%;
  min-width: 52rem;
  height: auto;
  border: 1px solid var(--rule);
  background: var(--paper);
}

@media (min-width: 60rem) {
  .map__scroll { overflow: visible; margin-inline: 0; padding-inline: 0; }
  .map__svg { min-width: 0; }
}

/* Terrain */
.ct {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  opacity: 0.42;
}

.ct--index { stroke-width: 2.8; opacity: 0.9; }

/* The route: where you are, to wherever you're going */
.map__route {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 16 17;
}

.map__origin { fill: var(--ink); }
.map__x { stroke: var(--ink); stroke-width: 7; stroke-linecap: round; }

/* Stations: a triangulation point per tool */
.station { cursor: pointer; }
.station__knock { fill: var(--paper); }
.station__ring { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.station__dot { fill: var(--ink); }

.station__name {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 5;
  paint-order: stroke fill;
}

.station__domain {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: var(--ink-2);
  stroke: var(--paper);
  stroke-width: 4;
  paint-order: stroke fill;
}

.station:hover .station__ring { stroke-width: 3.4; }
.station:hover .station__dot { r: 7; }
.station:focus-visible .station__ring { stroke-width: 3.4; }

.map__caption {
  color: var(--ink-2);
  font-size: 0.94rem;
  margin-top: 1.1rem;
  max-width: 42rem;
}

/* Tools ------------------------------------------------------------------ */

.tools { margin-top: 2rem; border-top: 1px solid var(--rule); }

.tool {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem 2rem;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
  align-items: baseline;
}

.tool__name { font-size: 1.15rem; }
.tool__name .jp { color: var(--ink-3); margin-left: 0.45rem; font-size: 0.88em; }

.tool__domain {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.tool__what { color: var(--ink-2); font-size: 0.98rem; }

.tool__link {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}

a.tool:hover .tool__name,
a.tool:hover .tool__link { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

@media (min-width: 50rem) {
  .tool { grid-template-columns: 12rem 1fr auto; }
  .tool__domain { grid-column: 1; }
  .tool__link { justify-self: end; }
}

/* Principles ------------------------------------------------------------- */

.principles { margin-top: 2rem; display: grid; gap: 1.75rem; grid-template-columns: 1fr; }
.principles p { color: var(--ink-2); font-size: 0.97rem; }

@media (min-width: 46rem) {
  .principles { grid-template-columns: 1fr 1fr; gap: 2rem 2.5rem; }
}

/* Glyphs ----------------------------------------------------------------- */

.glyphs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.75rem;
}

.glyph {
  border: 1px solid var(--rule);
  background: var(--paper);
  padding: 0.85rem 0.95rem 0.75rem;
  min-width: 6.5rem;
}

.glyph__char { font-size: 2rem; line-height: 1; display: block; margin-bottom: 0.45rem; }

.glyph__gloss {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  line-height: 1.5;
}

/* Footer ----------------------------------------------------------------- */

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 2rem 3rem;
  margin-top: 1rem;
}

.footer__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2.5rem;
  justify-content: space-between;
  align-items: baseline;
}

.footer__nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }

.footer__nav a,
.footer__colophon {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-decoration: none;
}

.footer__nav a:hover { color: var(--ink); }
.footer__colophon a { color: inherit; }

/* Document pages --------------------------------------------------------- */

.doc { padding-block: clamp(1.5rem, 4vw, 3rem) 4rem; }
.doc .measure { max-width: 38rem; }
.doc h2 { font-size: 1.25rem; font-weight: 600; margin: 2.4rem 0 0.6rem; }
.doc h2:first-of-type { margin-top: 1.8rem; }
.doc p { color: var(--ink-2); margin-bottom: 0.85rem; }
.doc a { color: var(--ink); text-underline-offset: 3px; }

/* Motion ----------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  /* The dashed route can't be drawn by animating its own dash offset — that
     would just slide the dashes along. Instead a solid stroke inside the mask
     is drawn, progressively revealing the dashes underneath. 1421 is the
     measured path length. */
  .map__reveal {
    stroke-dasharray: 1421;
    stroke-dashoffset: 1421;
    animation: trace 2.8s cubic-bezier(0.33, 0, 0.25, 1) 0.2s forwards;
  }
  .map__fade { opacity: 0; animation: fade 0.5s ease forwards; }
  .s1 { animation-delay: 0.9s; }
  .s2 { animation-delay: 1.3s; }
  .s3 { animation-delay: 1.7s; }
  .s4 { animation-delay: 2.1s; }
  .sx { animation-delay: 2.7s; }
}

@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

@media print {
  body { background: #fff; }
}