@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --bg: #f2f4f5;
  --ink: #11171c;
  --faint: #8d9ea8;
  --contour: #b3c0c7;
  --contour-major: #8d9ea8;
  --river: #c3ccd1;
  --stream: #1d6fa5;
  --glint: #e9f7ff;
  --iron: #9a3a1c;
  --molten: #e0620f;
  --white-hot: #fff3d1;
  --font: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1114;
    --ink: #e6ecef;
    --faint: #4f606b;
    --contour: #26323a;
    --contour-major: #3a4a55;
    --river: #2c3840;
    --stream: #62b4e4;
    --glint: #f2fbff;
    --iron: #a8402a;
    --molten: #ff8a24;
    --white-hot: #fffbea;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

/* One screen. The map is 16:9 and right-aligned: it covers wide screens and
   shrinks smoothly to about 2.4 screen widths on tall ones, with no breakpoint. */
main {
  --w: max(100vw, min(177.78dvh, 240vw));
  --h: calc(var(--w) * 9 / 16);
  position: relative;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
}

.map {
  position: absolute;
  right: 0;
  top: 50%;
  width: var(--w);
  height: var(--h);
  transform: translateY(-50%);
  mask-image: linear-gradient(transparent, #000 64px, #000 calc(100% - 64px), transparent);
}

.map canvas,
.map svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Hairline glints inside the stream, at unrelated periods so they never visibly repeat. */
.flow path {
  fill: none;
  stroke: var(--glint);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  animation: var(--run) linear infinite;
}
.flow .g1 { stroke-dasharray: 12 47 6 71 18 53; opacity: .32; --run: run207 3.6s; }
.flow .g2 { stroke-dasharray: 4 29 9 61 3 41; opacity: .26; --run: run147 2.9s; }
.flow .g3 { stroke-dasharray: 90 243.333; opacity: .14; --run: run333 6.28318s; }
@keyframes run207 { to { stroke-dashoffset: -207; } }
@keyframes run147 { to { stroke-dashoffset: -147; } }
@keyframes run333 { to { stroke-dashoffset: -333.333; } }

/* The forge, where the stream meets the river: struck every π seconds, timed
   so the long glint arrives as it strikes. White-hot in about 100 ms, then it cools. */
.forge {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  translate: -50% -50%;
  background: var(--iron);
  animation: strike 3.14159s 2.42s infinite;
}
.forge::before {
  content: "";
  position: absolute;
  inset: -11px;
  border-radius: 50%;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--molten) 55%, transparent),
    color-mix(in srgb, var(--molten) 15%, transparent) 35%,
    transparent);
  opacity: 0;
  animation: glow 3.14159s 2.42s infinite;
}
@keyframes strike {
  3% { background: var(--white-hot); animation-timing-function: cubic-bezier(.1, .7, .3, 1); }
  18% { background: var(--molten); animation-timing-function: cubic-bezier(.3, 0, .4, 1); }
  70%, 100% { background: var(--iron); }
}
@keyframes glow {
  3% { opacity: 1; animation-timing-function: cubic-bezier(.1, .7, .3, 1); }
  40%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .flow { display: none; }
  .forge, .forge::before { animation: none; }
}

/* The name sits low on the map, above its fading bottom edge on tall screens. */
main h1 {
  position: absolute;
  left: max(16px, env(safe-area-inset-left), 3vw);
  bottom: max(clamp(20px, 5vw, 48px), (100dvh - var(--h)) / 2 + 72px);
  margin: 0;
  font-size: clamp(3rem, 2rem + 7vw, 8.5rem);
  font-weight: 650;
  font-stretch: 78%;
  letter-spacing: -0.035em;
  line-height: .9;
}

.credit {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  margin: 0;
  color: var(--faint);
  font-size: 11px;
  text-align: right;
}
.credit a {
  color: inherit;
}

/* Text pages: one narrow column in the same type. */
header,
article,
footer {
  max-width: 36rem;
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}
header {
  padding-top: 32px;
}
header a {
  color: inherit;
  font-size: 1.5rem;
  font-weight: 650;
  font-stretch: 78%;
  letter-spacing: -0.02em;
  text-decoration: none;
}
article {
  padding-block: 32px 48px;
  font-size: 1.0625rem;
  line-height: 1.55;
}
article h1 {
  margin: 0 0 1.5rem;
  font-size: 2.25rem;
  font-weight: 650;
  font-stretch: 78%;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
article h2 {
  margin: 2rem 0 .5rem;
  font-size: 1.125rem;
  font-weight: 650;
}
article ul {
  padding-left: 1.25rem;
}
article li + li {
  margin-top: .5rem;
}
article a,
footer a {
  color: inherit;
}
article pre {
  overflow-x: auto;
  font-size: .75rem;
  line-height: 1.4;
}
footer {
  padding-bottom: 48px;
  color: var(--faint);
  font-size: .8125rem;
  line-height: 1.5;
}
footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
}
