:root {
  --bg: #f7f7f5;
  --fg: #121212;
  --muted: #6b6b68;
  --hover: rgb(0 0 0 / 0.05);
  --ring: rgb(0 0 0 / 0.35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0b;
    --fg: #ececea;
    --muted: #8a8a87;
    --hover: rgb(255 255 255 / 0.07);
    --ring: rgb(255 255 255 / 0.4);
    color-scheme: dark;
  }
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--fg); color: var(--bg); }

main {
  min-height: 100vh;
  min-height: 100svh;
  max-width: 32rem;
  margin-inline: auto;
  padding:
    clamp(4.5rem, 20vh, 11rem)
    max(1.5rem, env(safe-area-inset-right))
    calc(2.25rem + env(safe-area-inset-bottom))
    max(1.5rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}

/* ---------- mark ---------- */

.brand {
  margin: 0 0 1.5rem;
  line-height: 0;
  font-size: inherit;
  display: grid;
  justify-items: start;
}

.brand > * { grid-area: 1 / 1; }

.home { display: inline-grid; justify-items: start; border-radius: 4px; }
.home > * { grid-area: 1 / 1; }

.mark,
.mark-canvas {
  width: 5.75rem;
  -webkit-tap-highlight-color: transparent;
}

.mark {
  height: auto;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 0.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/*
  On the home page the mark is painted by site.js into a CPU canvas. Chrome's
  GPU rasteriser draws SVG curves with 4x MSAA in some setups, which leaves
  only five grey levels on every edge — visibly stepped once zoomed in. A
  canvas created with willReadFrequently is rasterised on the CPU with
  analytic antialiasing, at the exact device-pixel size, at any zoom.

  The SVG stays as the fallback: hidden while the canvas takes over, shown
  (and drawn by the CSS below) when there is no script, and shown anyway
  after 2.5 s if the script never arrives.
*/
.mark-canvas {
  display: block;
  aspect-ratio: 10.25 / 6.25;
  height: auto;
  color: var(--fg);
}

.mark-fallback {
  visibility: hidden;
  animation: failsafe 0s linear 2.5s forwards;
}

.canvas-mark .mark-fallback { display: none; }
.no-canvas-mark .mark-canvas { display: none; }

@keyframes failsafe { to { visibility: visible; } }

/*
  The wordmark writes itself once, in three strokes that all set off
  together: nul (one wave), the floating l, and p+o as a single ∞.
  Durations grow with the square root of each stroke's length, so the
  longer strokes travel faster but still land last. site.js reads these
  same custom properties, so the canvas and the fallback stay in step.

  The dash is only scaffolding for the draw. Chrome renders a dashed stroke
  differently from a plain one (the tail of each path comes up short and the
  edges get rougher), so the moment a stroke is complete the dash is removed
  and the mark is a plain stroke again.
*/
.mark.play path {
  stroke-dasharray: 1.05 3; /* pathLength units: each path is 1 long; 5% spare so no tail is clipped */
  animation:
    draw var(--dur) var(--ease) var(--at) both,
    undash 1ms linear calc(var(--at) + var(--dur)) forwards;
}

.mark path { --at: 120ms; --ease: cubic-bezier(.65, 0, .3, 1); }
.mark .s1 { --dur: 740ms; }   /* nul, 10.3 units */
.mark .s6 { --dur: 500ms; }   /* l,    4.7 units */
.mark .s2 { --dur: 910ms; }   /* p∞o, 15.6 units */

@keyframes draw {
  from { stroke-dashoffset: 1.06; }
  to   { stroke-dashoffset: 0; }
}

@keyframes undash {
  from, to { stroke-dasharray: none; }
}

/* ---------- text ---------- */

/*
  The line under the mark spells NULLPO down its initials. The initials
  start as muted as the rest and light up one by one as the mark finishes
  writing, which is how anyone notices the acrostic at all.
*/
.motto {
  margin: 0 0 2.25rem;
  color: var(--muted);
}

.motto .i { animation: lit 600ms ease forwards; }
.motto .i:nth-child(1) { animation-delay: 940ms; }
.motto .i:nth-child(2) { animation-delay: 1010ms; }
.motto .i:nth-child(3) { animation-delay: 1080ms; }
.motto .i:nth-child(4) { animation-delay: 1150ms; }
.motto .i:nth-child(5) { animation-delay: 1220ms; }
.motto .i:nth-child(6) { animation-delay: 1290ms; }

@keyframes lit { to { color: var(--fg); } }

.info {
  margin: 0;
  display: grid;
  gap: 0.25rem;
}

.row {
  display: grid;
  grid-template-columns: 5.75rem minmax(0, 1fr);
  align-items: baseline;
  column-gap: 1rem;
}

dt { color: var(--muted); }

dd {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.24em;
  text-decoration-color: transparent;
  transition: text-decoration-color 180ms ease;
  border-radius: 3px;
}

a:hover { text-decoration-color: var(--muted); }

a:focus-visible,
.copy:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.foot {
  margin-top: auto;
  padding-top: 4rem;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- copy ---------- */

.copy {
  appearance: none;
  border: 0;
  margin: -0.375rem 0;
  padding: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 0.5rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 200ms ease,
    color 150ms ease,
    background-color 150ms ease,
    transform 120ms ease;
  -webkit-tap-highlight-color: transparent;
}

.row:hover .copy,
.copy:focus-visible,
.copy.done { opacity: 1; }

.copy:hover { color: var(--fg); background: var(--hover); }
.copy:active { transform: scale(0.92); }
.copy.done { color: var(--fg); }

@media (hover: none) {
  .copy { opacity: 0.75; }
}

.copy svg {
  width: 1rem;
  height: 1rem;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy .i-copy,
.copy .i-check {
  transform-box: view-box;
  transform-origin: 50% 50%;
  transition:
    opacity 180ms ease,
    transform 260ms cubic-bezier(.2, .8, .2, 1),
    filter 180ms ease;
}

.copy .i-check { opacity: 0; transform: scale(0.5); filter: blur(2px); }
.copy.done .i-copy { opacity: 0; transform: scale(0.5); filter: blur(2px); }
.copy.done .i-check { opacity: 1; transform: none; filter: none; }

/* ---------- entrance ---------- */

.reveal { animation: rise 700ms cubic-bezier(.2, .7, .2, 1) both; }
.motto { animation-delay: 260ms; }
.info .row:nth-child(1) { animation-delay: 330ms; }
.info .row:nth-child(2) { animation-delay: 400ms; }
.info .row:nth-child(3) { animation-delay: 470ms; }
.foot { animation-delay: 620ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); filter: blur(3px); }
}

@media (prefers-reduced-motion: reduce) {
  .mark.play path,
  .reveal { animation: none; }
  .mark.play path { stroke-dasharray: none; }
  .motto .i { animation: none; color: var(--fg); }
  .copy .i-copy,
  .copy .i-check { transition: opacity 120ms ease; transform: none; filter: none; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
