/* Palette: near-black with a violet cast, one violet accent, one red used once.
   Dark is the identity here, not a trend: the reference is a voice client at midnight. */
:root {
  --ink: #07060a;
  --surface: #0e0b14;
  --line: #211b2c;
  --text: #ece8f2;
  --muted: #a49cb4;
  --accent: #b06cff;
  --danger: #ff4d6a;

  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --body: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --pad: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--line) var(--ink);
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 17px/1.6 var(--body);
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

button { font: inherit; cursor: pointer; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 20;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
}
.skip:focus { left: 12px; top: 12px; }

/* Header stays out of the way: three real anchors and the motion switch. */
.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px var(--pad);
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  border-bottom: 1px solid var(--line);
}

.mark {
  font: 800 italic 17px/1 var(--display);
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.top nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.top nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  color: var(--muted);
  text-decoration: none;
  font: 500 14px/1 var(--body);
}
.top nav a:hover { color: var(--text); }

.motion {
  min-height: 44px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font: 500 13px/1 var(--mono);
}
.motion:hover { color: var(--text); border-color: var(--accent); }
.motion[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* Hero: the name is the loudest thing on the page, and the only element with glow. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: min(88vh, 820px);
  padding: clamp(64px, 12vh, 140px) var(--pad) 56px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto auto;
  width: 60vw;
  height: 60vw;
  max-width: 760px;
  max-height: 760px;
  background: radial-gradient(circle, rgba(176, 108, 255, 0.22), transparent 62%);
  filter: blur(20px);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 40%),
    rgba(176, 108, 255, 0.16),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 600ms var(--ease);
  pointer-events: none;
}
.hero.lit::after { opacity: 1; }

.hero-inner { position: relative; max-width: 900px; }

h1 {
  margin: 0;
  font: 800 italic clamp(58px, 15vw, 172px) / 0.86 var(--display);
  letter-spacing: -0.045em;
  text-transform: lowercase;
  color: var(--text);
}

/* The glitch fires on hover and focus only, never on a loop. */
.glitch { position: relative; display: inline-block; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.glitch::before { color: var(--accent); }
.glitch::after { color: var(--danger); }
.glitch:hover::before,
.glitch:focus-visible::before {
  opacity: 0.9;
  animation: slice-a 320ms steps(2, end) 1;
}
.glitch:hover::after,
.glitch:focus-visible::after {
  opacity: 0.9;
  animation: slice-b 380ms steps(2, end) 1;
}

@keyframes slice-a {
  0% { clip-path: inset(12% 0 66% 0); transform: translate(-6px, -2px); }
  50% { clip-path: inset(58% 0 18% 0); transform: translate(4px, 1px); }
  100% { clip-path: inset(100% 0 0 0); transform: none; }
}
@keyframes slice-b {
  0% { clip-path: inset(70% 0 8% 0); transform: translate(6px, 2px); }
  60% { clip-path: inset(22% 0 52% 0); transform: translate(-3px, -1px); }
  100% { clip-path: inset(100% 0 0 0); transform: none; }
}

.kicker {
  margin: 22px 0 0;
  font: 500 13px/1.4 var(--mono);
  letter-spacing: 0.08em;
  color: var(--accent);
  text-transform: lowercase;
}

.lead {
  max-width: 46ch;
  margin: 18px 0 0;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.5;
  color: var(--text);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  font: 500 14px/1.4 var(--mono);
}

.hero-note {
  position: absolute;
  right: var(--pad);
  bottom: 26px;
  margin: 0;
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.18em;
  color: var(--muted);
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

/* Section 2: a list, not a card grid. Each row earns its space. */
.langs { padding: clamp(72px, 11vh, 130px) var(--pad); }

.section-head { max-width: 62ch; }

h2 {
  margin: 0;
  font: 800 italic clamp(30px, 5vw, 52px) / 1 var(--display);
  letter-spacing: -0.03em;
  text-transform: lowercase;
}

.section-head p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.lang-list {
  margin: clamp(40px, 6vh, 72px) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
  counter-reset: none;
}

.lang {
  display: grid;
  grid-template-columns: 56px minmax(160px, 1.1fr) minmax(150px, 0.8fr) minmax(0, 1.8fr) minmax(120px, 0.8fr);
  gap: 6px 24px;
  align-items: baseline;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 220ms var(--ease);
}

.lang:hover { background: var(--surface); }

.lang-index {
  font: 500 12px/1.4 var(--mono);
  color: var(--muted);
}

.lang-name {
  margin: 0;
  font: 700 21px/1.2 var(--display);
  letter-spacing: -0.01em;
}

.lang-band {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.bar {
  position: relative;
  display: block;
  width: 84px;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--fill);
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 700ms var(--ease);
}
.lang.in .bar::after { transform: scaleX(1); }

.band-label {
  font: 500 12px/1.4 var(--mono);
  color: var(--muted);
  white-space: nowrap;
}

.lang-note {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  max-width: 42ch;
}

.lang-used {
  margin: 0;
  font: 500 12px/1.5 var(--mono);
  color: var(--muted);
}
.lang-used b { color: var(--text); font-weight: 500; }

/* Section 3: two columns of uneven weight, so the page does not repeat itself. */
.bench {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  padding: clamp(72px, 11vh, 130px) var(--pad);
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.bench-copy p {
  max-width: 54ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 17px;
}
.bench-copy p + p { margin-top: 14px; }

code {
  font: 500 0.92em/1 var(--mono);
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--accent);
}

.bench-facts { margin: 0; }
.bench-facts div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.bench-facts div:first-child { padding-top: 0; }
.bench-facts dt {
  font: 500 12px/1.4 var(--mono);
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: lowercase;
}
.bench-facts dd {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

/* Section 4: a short ledger. Three rows is the real content, so no column layout. */
.find { padding: clamp(72px, 11vh, 130px) var(--pad); }

.find-list {
  margin: clamp(32px, 5vh, 56px) 0 0;
  padding: 0;
  list-style: none;
  max-width: 720px;
  border-top: 1px solid var(--line);
}

.find-list li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 4px 20px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.find-label {
  font: 500 12px/1.5 var(--mono);
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: lowercase;
}

.find-value, .find-list a { font-size: 17px; }
.find-value { color: var(--text); }

.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px var(--pad) 40px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 500 12px/1.5 var(--mono);
}

.foot p { margin: 0; }

.foot-mark {
  color: var(--accent);
  font: 800 italic 13px/1 var(--display);
}

/* Reveal: 14px and a fade, staggered by row. No scale, no bounce.
   Guarded by html.js so the page never hides its own content. */
html.js [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}
html.js [data-reveal].in { opacity: 1; transform: none; }

/* The name arrives once, on load. Keyframes rather than a class, so it ends
   visible even if the script never runs. */
.hero-inner { animation: rise 760ms var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  .lang {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas:
      "index name band"
      ".     note note"
      ".     used used";
    gap: 10px 16px;
    align-items: start;
  }
  .lang-index { grid-area: index; padding-top: 4px; }
  .lang-name { grid-area: name; }
  .lang-band { grid-area: band; }
  .lang-note { grid-area: note; }
  .lang-used { grid-area: used; }
  .bar { width: 64px; }
  .bench { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  /* Two rows in the header: identity and switch on top, the three links under it.
     Wrapping labels mid-word is what a phone gets if the nav keeps one row. */
  .top {
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 10px var(--pad) 4px;
  }
  .top nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    gap: 2px;
  }
  .top nav a { padding: 0 10px 0 0; font-size: 13px; white-space: nowrap; }
  .motion { margin-left: auto; }
  .hero { min-height: auto; padding: 56px var(--pad) 48px; }
  .hero-note { display: none; }
  .langs, .bench, .find { padding-block: 72px; }
  .lang {
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas:
      "index name"
      ".     band"
      ".     note"
      ".     used";
    gap: 8px 12px;
    padding: 22px 0;
  }
  .lang-band { align-self: start; }
  .find-list li { grid-template-columns: 1fr; }
  .foot { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  html.js [data-reveal] { opacity: 1; transform: none; }
  .glitch::before, .glitch::after { display: none; }
}

/* The switch in the header, and the OS setting, both land here. */
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
html[data-motion="off"] [data-reveal] { opacity: 1; transform: none; }
html[data-motion="off"] { scroll-behavior: auto; }
html[data-motion="off"] .hero::after { opacity: 0 !important; }
