:root {
  color-scheme: dark;
  --bg: #080a0f;
  --band: #0e1219;
  --hub: #131822;
  --line: #2a303c;
  --line-strong: #444c5c;
  --text: #f3f5fa;
  --muted: #aab3c5;
  --blue: #58c4dd;
  --blue-fill: rgba(88, 196, 221, 0.16);
  --yellow: #f4d35e;
  --ink: #05141a;
  --ic1: #58c4dd;
  --ic2: #5cd0b3;
  --ic3: #83c167;
  --ic4: #f4d35e;
  --ic5: #ff862f;
  --ic6: #fc6255;
  --key-white: #e3e7ef;
  --key-black: #141821;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.7, 0.5, 1);
  --gutter: clamp(20px, 5vw, 48px);
  --edge: max(var(--gutter), calc((100vw - 1200px) / 2 + var(--gutter)));
  --head-h: 68px;

  --font: 'Manrope', system-ui, sans-serif;
  --w-body: 330;
  --w-label: 420;
  --w-head: 520;
  --w-display: 300;
  --track: -0.03em;
  --forte: clamp(3.4rem, 8.5vw, 7rem);
  --prime: clamp(1.8rem, 3.6vw, 3rem);
  --title: clamp(2.4rem, 5vw, 3.9rem);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; font-size: 97%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--w-body) 1rem/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button, input, select, svg text { font-family: var(--font); }
button { font-size: inherit; color: inherit; touch-action: manipulation; }
/* Controls are pressed, not read: a tap or a long press must not select them or open a menu. */
button, summary, .site nav a, .clock, .kb, .ic-box, .track, .seg, .sc-table tbody tr {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
a { color: inherit; }

h1, h2, h3 { margin: 0; font-weight: var(--w-head); color: var(--text); letter-spacing: var(--track); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.8rem); line-height: 1.15; }
h3 { font-size: 1.0625rem; line-height: 1.3; letter-spacing: -0.01em; }
p { margin: 0; }
sub { font-size: 0.7em; line-height: 0; vertical-align: baseline; position: relative; top: 0.35em; }

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

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

/* ---------- site header ---------- */

.site { height: var(--head-h); }
.bar {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 32px;
}
.logo { font-weight: var(--w-head); font-size: 1.0625rem; letter-spacing: var(--track); text-decoration: none; }
.site nav { display: flex; gap: 28px; }
.site nav a {
  position: relative;
  padding: 6px 0;
  color: var(--muted);
  font-weight: var(--w-label);
  text-decoration: none;
  transition: color 0.25s;
}
.site nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}
@media (hover: hover) {
  .site nav a:hover { color: var(--text); }
  .site nav a:hover::after { transform: scaleX(1); }
}
.site nav a[aria-current] { color: var(--text); }
.site nav a[aria-current]::after { transform: scaleX(1); }

/* On a small screen the links are a side bar that slides in from the right, behind a three-line button. */
.menu-btn, .menu-close, .scrim { display: none; }
@media (max-width: 900px) {
  .menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0 10px;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .menu-btn span { display: block; height: 2px; background: var(--text); }

  .site nav {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    width: min(80vw, 300px);
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 76px 28px 28px;
    overflow-y: auto;
    background: var(--band);
    box-shadow: -24px 0 48px rgba(0, 0, 0, 0.5);
    visibility: hidden;
    transform: translateX(100%);
    transition: transform 0.5s var(--ease), visibility 0s 0.5s;
  }
  .site nav.open { visibility: visible; transform: none; transition: transform 0.5s var(--ease); }
  .site nav a { padding: 12px 0; font-size: 1.25rem; }

  .menu-close {
    position: absolute;
    top: 12px;
    right: 14px;
    display: block;
    width: 44px;
    height: 44px;
    padding: 0;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .menu-close span { position: absolute; left: 12px; right: 12px; top: 21px; height: 2px; background: var(--text); transform: rotate(45deg); }
  .menu-close span + span { transform: rotate(-45deg); }

  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s, visibility 0s 0.4s;
  }
  .scrim.open { opacity: 1; visibility: visible; transition: opacity 0.4s; }
  html.menu-open { overflow: hidden; }
}

/* ---------- notice for phones and tablets ---------- */

.notice {
  width: min(86vw, 340px);
  margin: auto;
  padding: 28px 24px 24px;
  color: var(--text);
  text-align: center;
  background: var(--hub);
  border: 0;
  border-radius: 12px;
  outline: none;
}
.notice .btn:focus-visible { outline: none; }
.notice::backdrop { background: rgba(0, 0, 0, 0.65); }
.notice p { margin-bottom: 22px; font-size: 1.25rem; font-weight: var(--w-head); line-height: 1.35; letter-spacing: -0.01em; }
.notice .btn { justify-content: center; width: 100%; padding: 12px 15px; }

/* ---------- motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: none; } }
@keyframes tick { from { opacity: 0; transform: translateY(0.25em); } to { opacity: 1; transform: none; } }
@keyframes cell { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes flash { from { fill: var(--yellow); } }
@keyframes flash-hit { from { fill: #fff; } }
@keyframes pulse { 35% { transform: scale(1.5); } }
@keyframes press { from { background: var(--yellow); color: var(--ink); } }

.rise { animation: rise 1s var(--ease) both; }

[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
[data-reveal].in { opacity: 1; transform: none; }

.tick { display: inline-block; animation: tick 0.5s var(--ease) both; }
p.tick { display: block; }

/* ---------- layout ---------- */

.section { padding: clamp(36px, 6vh, 64px) 0; }
.band { background: var(--band); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px 20px; }
@media (min-width: 901px) {
  .cols { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

.key { color: var(--text); font-weight: var(--w-label); font-size: 1rem; }
.display {
  margin: 0 0 12px;
  font: var(--w-display) var(--forte)/1 var(--font);
  letter-spacing: var(--track);
  min-height: 1em;
  overflow-wrap: anywhere;
}
.display.accent { margin: 0; color: var(--blue); font-size: var(--prime); line-height: 1.15; letter-spacing: 0.01em; }
.title { font-size: var(--title); font-weight: var(--w-display); line-height: 1.1; letter-spacing: var(--track); }
.note { color: var(--muted); }

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

.field { position: relative; }
.field::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s var(--ease);
}
.field:focus-within::after { transform: scaleX(1); }
.field input {
  display: block;
  width: 100%;
  padding: 4px 0 10px;
  color: var(--text);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  border-radius: 0;
  outline: none;
  font: var(--w-display) var(--title)/1.2 var(--font);
  letter-spacing: 0.01em;
}
.field input::placeholder { color: #7f889a; }
.field.small input { font-size: 1.375rem; font-weight: var(--w-body); padding-bottom: 8px; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 0;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: var(--w-label);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, transform 0.3s var(--spring);
}
.btn svg { width: 9px; height: 9px; flex: none; }
.btn:active { transform: scale(0.96); }
.btn.press { animation: press 0.4s var(--ease); }
.btn.primary { color: var(--ink); background: var(--blue); }
@media (hover: hover) {
  .btn:hover { background: rgba(255, 255, 255, 0.13); transform: scale(1.04); }
  .btn.primary:hover { background: #7bd3e8; }
}

/* A row of choices where each one is on or off. */
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button {
  min-width: 2.5rem;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.07);
  border: 0;
  border-radius: 6px;
  font-weight: var(--w-label);
  cursor: pointer;
  transition: background 0.25s, color 0.25s, transform 0.3s var(--spring);
}
@media (hover: hover) { .seg button:hover { background: rgba(255, 255, 255, 0.14); } }
.seg button:active { transform: scale(0.94); }
.seg button[aria-pressed='true'] { color: var(--ink); background: var(--blue); }

/* The gliding track: a row of choices of which one is on, and one thumb that slides to it.
   --cols is how many choices there are, --n which one is chosen. */
.track { position: relative; display: grid; grid-template-columns: repeat(var(--cols, 12), minmax(0, 1fr)); --n: 0; padding: 4px; background: rgba(255, 255, 255, 0.05); border-radius: 8px; }
.track .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--cols, 12)); border-radius: 6px; background: var(--blue); transform: translateX(calc(var(--n) * 100%)); transition: transform 0.6s var(--ease); }
.track button { position: relative; z-index: 1; min-width: 0; height: 40px; padding: 0; background: none; border: 0; border-radius: 6px; color: var(--text); font-weight: var(--w-label); cursor: pointer; transition: color 0.3s, background 0.25s; }
@media (hover: hover) { .track button:hover { background: rgba(255, 255, 255, 0.1); } }
.track button[aria-pressed='true'] { color: var(--ink); background: none; }
.track button:active { transform: scale(0.94); }

/* ---------- clock ---------- */

.clock svg { display: block; width: 100%; height: auto; }
.clock .ring {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 1.8s var(--ease) 0.2s forwards;
}
.shape {
  fill: var(--blue-fill);
  stroke: var(--blue);
  stroke-width: 3;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.5s;
}
.shape.show { opacity: 1; }
.axis {
  stroke: var(--yellow);
  stroke-width: 1.25;
  stroke-opacity: 0.75;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.45s var(--ease) forwards;
}

.node {
  cursor: pointer;
  outline: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: pop 0.8s var(--ease) both;
  animation-delay: calc(var(--i) * 55ms + 500ms);
}
.node .bubble { transform-box: fill-box; transform-origin: center; transition: transform 0.5s var(--spring); }
.node circle { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; transition: fill 0.35s, stroke 0.35s; }
.node text { fill: var(--text); font-size: 21px; font-weight: var(--w-head); pointer-events: none; transition: fill 0.35s; }
.node.on .bubble { transform: scale(1.12); }
@media (hover: hover) {
  .node:hover .bubble { transform: scale(1.1); }
  .node:hover circle { stroke: var(--text); }
  .node.on:hover .bubble { transform: scale(1.2); }
}
.node.on circle { fill: var(--blue); stroke: var(--blue); }
.node.on text { fill: var(--ink); }
.node.ping .bubble { animation: pulse 0.6s var(--ease); }
.node:focus-visible circle { stroke: var(--yellow); stroke-width: 3; }
.clock.static .node { cursor: default; }
@media (hover: hover) {
  .clock.static .node:hover .bubble { transform: none; }
  .clock.static .node:hover circle { stroke: var(--line-strong); }
  .clock.static .node.on:hover .bubble { transform: scale(1.12); }
  .clock.static .node.on:hover circle { stroke: var(--blue); }
}

/* ---------- keyboard ---------- */

.keys-scroll { overflow-x: auto; padding: 2px 0 6px; }
.kb { display: block; margin: 0 auto; touch-action: manipulation; }
.kb:focus-visible { outline: none; }
.kb .key { cursor: pointer; }
.kb rect { transition: fill 0.35s, stroke 0.2s; }
.kb .white rect { fill: var(--key-white); stroke: #5a6272; stroke-width: 1; }
.kb .black rect { fill: var(--key-black); stroke: #000; stroke-width: 1; }
/* A key in the set; a hit is one the page points out. */
.kb .white.on rect { fill: var(--blue); }
.kb .black.on rect { fill: #1d8aa6; }
.kb .white.hit rect { fill: var(--yellow); }
.kb .black.hit rect { fill: #c9a62f; }
@media (hover: hover) { .kb .key:hover rect { stroke: var(--yellow); stroke-width: 2; } }
.kb:focus-visible .key.cursor rect { stroke: var(--yellow); stroke-width: 3; }
.kb .key.ping rect { animation: flash 0.6s; }
.kb .key.hit.ping rect { animation-name: flash-hit; }
.kb .klab { fill: var(--ink); font-size: 13px; font-weight: var(--w-label); text-anchor: middle; pointer-events: none; }
.kb .black .klab { fill: #fff; }
.kb .black.hit .klab { fill: var(--ink); }

.link {
  padding: 0;
  background: none;
  border: 0;
  font-weight: var(--w-label);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color 0.25s, text-decoration-color 0.25s;
}
@media (hover: hover) { .link:hover { color: var(--blue); text-decoration-color: var(--blue); } }

/* ---------- small clocks drawn by lattice.js ---------- */

svg.mc { display: block; width: 100%; height: auto; }
.mc-ring { fill: none; stroke: var(--line-strong); stroke-width: 1; }
.mc-shape { fill: var(--blue-fill); stroke: var(--blue); stroke-width: 1.6; stroke-linejoin: round; }
.mc-dot.off { fill: var(--line-strong); }
.mc-dot.on { fill: var(--blue); }
.mc-dot.hot { fill: var(--yellow); }
.mc-dot.ghost { fill: none; stroke: var(--yellow); stroke-width: 1.4; stroke-dasharray: 2.2 2; }

/* ---------- property rows ---------- */

.ptable { max-width: 600px; }
.prow {
  display: grid;
  grid-template-columns: minmax(9rem, 16rem) minmax(0, 1fr);
  gap: 0 16px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.phead { padding-top: 0; padding-bottom: 8px; border-bottom-color: var(--line-strong); font-weight: var(--w-label); }
.pname { font-weight: var(--w-label); }
.pval { overflow-wrap: anywhere; }
.pval .note { margin-left: 10px; }
[data-reveal].in .prow { animation: cell 0.7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 55ms + 150ms); }

@media (max-width: 900px) {
  .prow { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .phead { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-delay: 0s !important; transition-duration: 0.001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- phone and tablet: flat and square, no outlines ---------- */

@media (max-width: 900px) {
  .btn, .seg button, .track, .track .thumb, .track button, .notice { border-radius: 0; }
  .kb rect { rx: 0; }
}
