/* JetBrains Mono for the technical labels, so they look the same on every device. */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/assets/jetbrains-mono.ttf') format('truetype');
  font-weight: 100 800;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url('/assets/manrope.ttf') format('truetype');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #ebe8e0;
  --ink: #161616;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: Manrope, system-ui, sans-serif;
  --pad: clamp(24px, 4vw, 64px);
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Manrope, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
a:focus-visible, button:focus-visible { outline: 1px solid currentColor; outline-offset: 4px; }

.wordmark {
  display: block;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 5.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 30;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
}
.skip:focus { top: 12px; }

/* Header: white + difference blending reads as black on paper and white on the ink sheet. */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 28px var(--pad) 0;
  color: #fff;
  mix-blend-mode: difference;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { width: 64px; }

.langs { display: flex; gap: 4px; margin-left: auto; font: 11px/1 var(--mono); }

/* Side scale: one tick per sheet, the current one drawn long; a quiet way to see where you are and jump. */
.scale {
  position: fixed;
  z-index: 20;
  right: max(14px, calc(var(--pad) * 0.45));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.scale a { display: flex; align-items: center; gap: 8px; padding: 7px 0; font: 9px/1 var(--mono); letter-spacing: 0.08em; }
.scale a::after {
  content: '';
  display: block;
  width: 12px;
  height: 1px;
  background: var(--ink);
  opacity: 0.35;
  transition: width 0.45s cubic-bezier(.2, .7, .2, 1), opacity 0.45s ease;
}
.scale a span { opacity: 0; transition: opacity 0.45s ease; }
.scale a.current::after { width: 26px; opacity: 1; }
.scale a.current span, .scale a:hover span { opacity: 0.7; }
.scale a:hover::after { opacity: 0.8; }
.langs button { background: none; border: 1px solid transparent; padding: 5px 7px; cursor: pointer; opacity: 0.55; }
.langs button:hover { opacity: 1; }
.langs button[aria-pressed="true"] { opacity: 1; border-color: currentColor; }

/* Sheets */

.sheet {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(300px, 34%) 1fr;
  grid-template-rows: 1fr;
  column-gap: 2vw;
  padding: 90px var(--pad) 48px;
  isolation: isolate;
}
.sheet canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.stage { grid-column: 2; grid-row: 1; min-height: 460px; }
.sheet > .sheet-text { grid-column: 1; grid-row: 1; align-self: center; }

.tag {
  margin: 0 0 22px;
  font: 12px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sheet h1, .sheet h2 {
  margin: 0 0 24px;
  font-family: var(--display);
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 1.06;
  text-wrap: balance;
}
.sheet h2 { font-size: clamp(32px, 3.3vw, 54px); }
.body { margin: 0 0 18px; max-width: 36ch; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.6; }

/* Hero */

.hero { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.hero .stage { grid-column: 1; grid-row: 1; min-height: 320px; }

/* The slogan appears in the wordmark's place once the wordmark has been erased. */
.hero .slogan {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  margin: 0;
  max-width: 14ch;
  font-size: clamp(36px, 5.4vw, 88px);
  text-align: center;
}

/* Closing sheet */

.closing {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 1fr auto;
}
.closing .stage { grid-column: 1; grid-row: 1; }
/* The manifesto sits above the horizon as one narrow column of text. Its first sentence is the
   heading, set as the opening of the text itself, a little heavier than the rest. */
.closing .sheet-text {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  width: 100%;
  max-width: 680px;
  margin: 0 0 120px;
  font-size: clamp(17px, 1.3vw, 20px);
  line-height: 1.6;
}
.sheet.closing h2 {
  max-width: none;
  margin: 0 0 0.8em;
  font-family: var(--display);
  font-size: inherit;
  font-weight: 600;
  letter-spacing: 0;
  line-height: inherit;
  text-wrap: pretty;
}
.manifesto { display: grid; gap: 0.8em; }
.manifesto .body { max-width: none; margin: 0; font-size: inherit; line-height: inherit; }
/* Authorship, signed the way a letter is: the names on the right. */
.byline {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  margin: 1.6em 0 0;
}
.byline-name { font-weight: 500; }

/* The way back to the start, inside the last frame's lower-right corner: the drafting symbol for
   an origin (datum) — a quartered circle — with a small satellite circling it. Under the pointer
   the datum turns a quarter and the orbit closes. */
.to-origin {
  position: absolute;
  z-index: 1;
  display: block;
  width: 44px;
  height: 44px;
  padding: 2px;
  border-radius: 50%;
  background: var(--paper);
  transform: translate(-100%, -100%);
  color: var(--ink);
}
.to-origin svg { display: block; width: 100%; height: 100%; overflow: visible; fill: none; stroke: currentColor; }
.to-origin .orbit { stroke-width: 0.8; stroke-dasharray: 2 3; opacity: 0.55; transition: stroke-dasharray 0.4s ease, opacity 0.4s ease; }
.to-origin .datum { stroke-width: 1.1; transform-box: view-box; transform-origin: 20px 20px; transition: transform 0.6s cubic-bezier(.2, .7, .2, 1); }
.to-origin .datum path:last-child { stroke-width: 0.7; }
.to-origin .fill { fill: currentColor; stroke: none; }
.to-origin .sat { fill: currentColor; stroke: none; transform-box: view-box; transform-origin: 20px 20px; animation: orbit 14s linear infinite; }
.to-origin:hover .datum, .to-origin:focus-visible .datum { transform: rotate(90deg); }
.to-origin:hover .orbit, .to-origin:focus-visible .orbit { stroke-dasharray: 101 0; opacity: 0.9; }
@keyframes orbit { to { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: reduce) { .to-origin .sat { animation: none; } }
@media (max-width: 600px) { .to-origin { width: 38px; height: 38px; } }
.copyright {
  grid-row: 2;
  justify-self: center;
  margin: 0;
  padding-top: 10px;
  font: 11px/1.4 var(--mono);
  letter-spacing: 0.08em;
  opacity: 0.7;
}

/* Page-to-page: on any screen tall enough, one sheet fills it. JS does the paging, the settling
   onto the nearest sheet and the dissolve (CSS scroll snapping would fight the glides). */

@media (min-height: 520px) {
  html { scroll-behavior: auto; }
  .sheet { height: 100vh; height: 100svh; min-height: 0; overflow: hidden; }
  .sheet canvas, .sheet > .sheet-text { will-change: transform, opacity; }
}
html.gliding { scroll-behavior: auto; }

/* Text reveal: each word rises from behind its own mask, line after line. */

.w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0.1em 0 0.16em; margin: -0.1em 0 -0.16em; }
.wi { display: inline-block; transform: translateY(108%); transition: transform 0.3s ease; }
.written .wi { transform: none; transition: transform 1.05s cubic-bezier(.16, .84, .24, 1) var(--d, 0ms); }
.unwritten .wi { transition: none; }
.measure { position: absolute; width: 0; height: 0; visibility: hidden; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Intro: the first screen starts empty; header and countdown arrive with the slogan. */

.topbar > * { transition: opacity 1.2s ease; }
.scale { transition: opacity 1.2s ease 0.25s; }
.langs { transition-delay: 0.5s; }
html.intro .topbar > *, html.intro .scale, html.intro [data-write]:not([data-len]) { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .wi { transform: none; transition: none; }
}


@media (max-width: 900px) {
  .topbar { padding-top: 22px; gap: 16px; }
  .langs { margin-left: auto; }
  .brand { width: 54px; }

  .sheet { display: block; padding: 78px 24px 36px; }
  .stage { min-height: 0; height: min(112vw, 620px); margin: 20px 0 0; }

  .hero { display: grid; min-height: 100vh; min-height: 100svh; }
  .hero .stage { height: auto; min-height: 280px; margin: 0; }

  .closing { display: grid; }
  .closing .stage { height: auto; margin: 0; }
}

/* Narrow screens with room for a sheet: text on top, the drawing takes the height that is left. */
@media (max-width: 900px) and (min-height: 520px) {
  .sheet { height: 100vh; height: 100svh; display: flex; flex-direction: column; padding-bottom: 28px; }
  /* In the column the text block spans the full width, so every sheet starts on the same left edge. */
  .sheet > .sheet-text { align-self: stretch; }
  .sheet .stage { flex: 1; height: auto; min-height: 150px; margin: 14px 0 0; }
  .hero, .closing { display: grid; }
  .hero .stage, .closing .stage { margin: 0; }
}
/* Tablets and phones: the manifesto reads as one column; headings are set a little less tight. */
@media (max-width: 900px) {
  .sheet h1, .sheet h2 { letter-spacing: -0.022em; line-height: 1.1; }
  .sheet h2 { max-width: 22ch; }
  .body { max-width: 58ch; }
  .sheet.closing > .sheet-text { align-self: center; margin-bottom: 120px; }
  .sheet.closing > .sheet-text { font-size: 17px; }
}
@media (max-width: 600px) {
  .sheet.closing > .sheet-text { margin-bottom: 84px; }
  .sheet.closing > .sheet-text { font-size: 15px; line-height: 1.55; }
  /* The side scale keeps to the very edge, clear of the drawings' frames. */
  .scale { right: 4px; }
  .scale a span { display: none; }
  .scale a::after { width: 8px; }
  .scale a.current::after { width: 14px; }
  .tag { margin-bottom: 14px; }
  .sheet h2 { font-size: clamp(26px, 7.4vw, 34px); margin-bottom: 14px; }
  .body { font-size: 15px; line-height: 1.55; margin-bottom: 0; }
}

/* Sections that receive focus from the skip link do not draw a focus box around the whole sheet. */
.sheet[tabindex="-1"]:focus { outline: none; }
