/* Palettes. Black and white (data-mono) keeps each sepia colour's luminance at zero saturation, its
   day paper a touch lighter still. The night sepia keeps only its paper warm: its light ink is the
   neutral grey of the same luminance. */
:root {
  --day-paper: #f4eae2; --day-paper-mono: #f1f1f1; --day-ink: #666;
  --night-paper: #1e1a17; --night-paper-mono: #1b1b1b; --night-ink: #a7a7a7;

  --gutter: 16px;
  --stage-max: 900px;
  --caption-gap: 6.4cqw;

  --bg: var(--day-paper); --ink: var(--day-ink);
  font-size: clamp(13px, 3.2cqw, 18px);
  letter-spacing: .02em;
}
:root[data-mono] { --bg: var(--day-paper-mono); }
:root[data-theme="dark"] { --bg: var(--night-paper); --ink: var(--night-ink); color-scheme: dark; }
:root[data-theme="dark"][data-mono] { --bg: var(--night-paper-mono); }
/* Until the script picks a theme the system's decides, so a dark page never flashes light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { --bg: var(--night-paper-mono); --ink: var(--night-ink); color-scheme: dark; }
}

* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; padding: var(--gutter);
  display: grid; place-items: center;
  background: var(--bg); color: var(--ink);
}

/* The logo and its caption are sized against the stage, so they keep their proportions at any width. */
.stage {
  container-type: inline-size;
  width: min(100%, var(--stage-max), calc(100dvh - 3 * var(--gutter)));
  display: flex; flex-direction: column; align-items: center;
  margin-top: 20vh;
}

.caption {
  margin-top: var(--caption-gap); text-align: center; line-height: 1.1;
  font-family: 'Urbanist', system-ui, sans-serif;
}
.caption-title { font-weight: 800; font-size: 2.2rem; letter-spacing: .01em; }
.caption-slogan { font-weight: 400; margin-top: .35em; }
.description {
    h2 {
        font-size: 1.25rem;
    }
    margin: 15vh var(--gutter) 0;
}

.theme-toggle {
  position: fixed; top: var(--gutter); right: var(--gutter);
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer;
  opacity: .45; transition: opacity .2s;
}
.theme-toggle:hover, .theme-toggle:focus-visible { opacity: 1; }
.theme-toggle:focus-visible { outline: 1.5px solid currentColor; outline-offset: 2px; }
.theme-toggle svg {
  grid-area: 1 / 1; width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
/* The icon shows the theme on screen; it stays hidden until the script has picked one. */
:root:not([data-theme]) .theme-toggle { visibility: hidden; }
:root[data-theme="light"] .theme-toggle .moon, :root[data-theme="dark"] .theme-toggle .sun { display: none; }

/* --line-width is the width on screen, whatever the logo's size; the script keeps --weight, the
   same width in viewBox units, in step with it. */
.logo {
  --logo-size: 0.5; --line-width: 1.5px; --hollow: 0; --node-hollow-fill: var(--bg);
  display: block; width: calc(50% * var(--logo-size)); color: var(--ink);
}
.logo path, .logo line {
  fill: none; stroke: currentColor; stroke-width: var(--weight);
  stroke-linecap: round; stroke-linejoin: round;
}
/* Legs and arms meet at right angles in the canonical elbows; square caps close those into
   the logo's sharp corner and cut the gap ends square. */
.logo path.gapped { stroke-linecap: square; stroke-linejoin: miter; }
.logo path.plates { stroke-linecap: butt; }
.logo .node { stroke: currentColor; stroke-width: var(--weight); stroke-linejoin: miter; }
/* Each node reads its own --hollow, so the groups can be filled differently. */
.logo .node polygon, .logo .node circle {
  fill: color-mix(in srgb, var(--node-hollow-fill) calc(var(--hollow) * 100%), currentColor);
}
.logo .pulses path {
  stroke: var(--pulse-colour, currentColor);
  stroke-width: calc(var(--weight) * var(--pulse-peak, 2) * var(--layer-width, 1));
}
/* On light paper the pulse is a light core running inside the line instead of a dark bead. */
.logo .pulses.inside { --pulse-colour: var(--bg); }

/* Twice the viewport and hopping between offsets, so a small noise tile never shows its edges or repeats in place. */
.film-grain {
  position: fixed; inset: -50%; z-index: 10; pointer-events: none; background-repeat: repeat;
  mix-blend-mode: overlay; animation: grain-hop .5s steps(1) infinite;
}
.film-grain[hidden] { display: none; }
@keyframes grain-hop {
  0% { transform: translate(0, 0); } 17% { transform: translate(-7%, 3%); } 33% { transform: translate(4%, -9%); }
  50% { transform: translate(-11%, 6%); } 67% { transform: translate(9%, 10%); } 83% { transform: translate(-3%, -5%); }
}
