/* SID-32 — page styles. No external fonts, images, or imports. */

:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --header-bg: rgba(255, 255, 255, 0.78);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --subtle: #86868b;
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.18);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --blue-soft: rgba(0, 113, 227, 0.09);
  --orange: #bf4800;
  --orange-soft: rgba(191, 72, 0, 0.10);
  --green: #008a3e;
  --green-soft: rgba(0, 138, 62, 0.10);
  --red: #d70015;
  --red-soft: rgba(215, 0, 21, 0.08);
  --card: #ffffff;
  --input: #f5f5f7;
  --button-text: #ffffff;
  --stage: #000000;
  --stage-text: #f5f5f7;
  --stage-border: transparent;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.12);
  --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.06);
  --radius: 32px;
  --radius-sm: 18px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #000000;
    --bg-alt: #0a0a0a;
    --header-bg: rgba(0, 0, 0, 0.76);
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --subtle: #86868b;
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.24);
    --blue: #2997ff;
    --blue-hover: #47a6ff;
    --blue-soft: rgba(41, 151, 255, 0.14);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.13);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.13);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.12);
    --card: #111111;
    --input: #1c1c1e;
    --button-text: #000000;
    --stage: #111111;
    --stage-text: #f5f5f7;
    --stage-border: rgba(255, 255, 255, 0.10);
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
    --shadow-soft: 0 18px 50px rgba(0, 0, 0, 0.35);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
figure {
  margin-top: 0;
}

a {
  color: var(--blue);
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: rgba(0, 113, 227, 0.22);
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

[hidden] {
  display: none !important;
}

.container {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.container.narrow {
  width: min(900px, calc(100% - 48px));
}

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

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-size: 13px;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 32px;
  width: min(1120px, calc(100% - 48px));
  height: 52px;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue), #5ac8fa);
  box-shadow: 0 0 12px rgba(0, 113, 227, 0.45);
}

.nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nav a {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: -0.005em;
  transition: color 160ms ease;
}

.nav a:hover {
  color: var(--text);
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 980px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 120ms ease;
}

.button:hover {
  background: var(--line);
}

.button:active {
  transform: scale(0.985);
}

.button.primary {
  background: var(--blue);
  color: var(--button-text);
}

.button.primary:hover {
  background: var(--blue-hover);
}

.button.quiet {
  padding-inline: 8px;
  background: transparent;
  color: var(--blue);
}

.button.quiet:hover {
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.button:disabled {
  opacity: 0.36;
  cursor: not-allowed;
  transform: none;
}

.copy-button {
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 980px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.copy-button:hover {
  border-color: var(--line-strong);
}

.copy-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Hero */

.hero {
  position: relative;
  padding: clamp(72px, 10vw, 128px) 0 clamp(72px, 9vw, 112px);
  overflow: hidden;
  text-align: center;
}

.hero::before {
  content: "";
  position: absolute;
  top: -30%;
  left: 50%;
  width: min(1000px, 110vw);
  height: 700px;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.10), transparent 66%);
  transform: translateX(-50%);
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  .hero::before {
    background: radial-gradient(circle, rgba(41, 151, 255, 0.16), transparent 66%);
  }
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero .eyebrow {
  animation: fade-up 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero h1 {
  max-width: 1000px;
  margin: 0 auto 24px;
  font-size: clamp(52px, 8.2vw, 108px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.98;
  text-wrap: balance;
  animation: fade-up 800ms 50ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero h1 span {
  color: var(--subtle);
  background: linear-gradient(110deg, var(--blue) 10%, #5ac8fa 62%, var(--green) 130%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 680px;
  margin: 0 auto 32px;
  color: var(--muted);
  font-size: clamp(18px, 2.1vw, 23px);
  letter-spacing: -0.012em;
  line-height: 1.45;
  text-wrap: balance;
  animation: fade-up 800ms 120ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 24px;
  animation: fade-up 800ms 180ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-facts {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 0;
  margin: 30px 0 0;
  color: var(--subtle);
  font-size: 12px;
  letter-spacing: 0.01em;
  animation: fade-up 800ms 240ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero-facts span + span::before {
  content: "·";
  margin: 0 10px;
  color: var(--line-strong);
}

/* Dark showcase */

.stage {
  position: relative;
  max-width: 980px;
  margin: clamp(48px, 7vw, 80px) auto 0;
  padding: clamp(36px, 7vw, 72px) clamp(20px, 5vw, 56px);
  overflow: hidden;
  border: 1px solid var(--stage-border);
  border-radius: clamp(24px, 3vw, 40px);
  background: var(--stage);
  color: var(--stage-text);
  box-shadow: var(--shadow);
  animation: fade-up 900ms 300ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.stage::before {
  content: "";
  position: absolute;
  top: -55%;
  left: 50%;
  width: 760px;
  height: 560px;
  background: radial-gradient(circle, rgba(41, 151, 255, 0.26), transparent 65%);
  transform: translateX(-50%);
  pointer-events: none;
}

.stage-label {
  position: relative;
  margin: 0 0 20px;
  color: #86868b;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.stage-code {
  position: relative;
  margin: 0;
  color: #f5f5f7;
  font-family: var(--mono);
  font-size: clamp(36px, 11vw, 124px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0 70px rgba(41, 151, 255, 0.35);
  white-space: nowrap;
}

.stage-caption {
  position: relative;
  margin: 14px 0 0;
  color: #a1a1a6;
  font-size: 13px;
}

.stage-meta {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 22px 0 0;
  color: #86868b;
  font-family: var(--mono);
  font-size: 13px;
}

.stage-meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #48484a;
}

.stage .bits {
  max-width: 760px;
  margin: 30px auto 0;
}

/* Bit diagrams */

.bits {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.bit-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-alt);
}

.bit-group.time {
  flex: 25 1 0;
  background: var(--blue-soft);
}

.bit-group.node {
  flex: 4 1 0;
  background: var(--orange-soft);
}

.bit-group.seq {
  flex: 3 1 0;
  background: var(--green-soft);
}

.bit-group-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

.bit-cells {
  display: flex;
  gap: 2px;
  min-width: 0;
}

.bit-cell {
  display: grid;
  flex: 1 1 0;
  place-items: center;
  min-width: 0;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
}

.stage .bit-group {
  background: rgba(255, 255, 255, 0.06);
}

.stage .bit-group.time {
  background: rgba(41, 151, 255, 0.18);
}

.stage .bit-group.node {
  background: rgba(255, 159, 10, 0.16);
}

.stage .bit-group.seq {
  background: rgba(48, 209, 88, 0.15);
}

.stage .bit-group-head {
  color: #a1a1a6;
}

.stage .bit-cell {
  border-color: rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.07);
  color: #e8e8ed;
}

/* Sections */

.section {
  padding: clamp(88px, 12vw, 150px) 0;
  scroll-margin-top: 52px;
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  max-width: 780px;
  margin: 0 auto clamp(48px, 6vw, 72px);
  text-align: center;
}

.section-head h2,
.section h2 {
  margin: 0 0 18px;
  font-size: clamp(36px, 5.2vw, 64px);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-wrap: balance;
}

.section-lead {
  max-width: 660px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  letter-spacing: -0.008em;
  line-height: 1.5;
  text-wrap: balance;
}

/* Format */

#format .bits {
  margin-top: 8px;
}

.field-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 56px;
  border-top: 1px solid var(--line);
}

.field {
  --field-color: var(--blue);
  padding: 32px 28px 0;
  border-left: 1px solid var(--line);
}

.field:first-child {
  padding-left: 0;
  border-left: 0;
}

.field:last-child {
  padding-right: 0;
}

.field.node {
  --field-color: var(--orange);
}

.field.seq {
  --field-color: var(--green);
}

.field h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.field h3::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--field-color);
}

.field-meta {
  margin: 0 0 12px;
  color: var(--field-color);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.01em;
}

.field p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.formula {
  width: fit-content;
  max-width: 100%;
  margin: 52px auto 0;
  padding: 16px 22px;
  overflow-x: auto;
  border-radius: 14px;
  background: var(--bg-alt);
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(13px, 1.8vw, 16px);
  white-space: nowrap;
}

.formula strong {
  color: var(--text);
  font-weight: 500;
}

/* Worked example */

.example-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: center;
}

.steps {
  display: flex;
  flex-direction: column;
}

.step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 16px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.step:first-child {
  padding-top: 0;
  border-top: 0;
}

.step:last-child {
  padding-bottom: 0;
}

.step-number {
  padding-top: 3px;
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 11px;
}

.step h3 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.step p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.55;
}

.step code {
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9em;
}

.code-stage {
  position: relative;
  padding: clamp(32px, 5vw, 52px);
  overflow: hidden;
  border: 1px solid var(--stage-border);
  border-radius: var(--radius);
  background: var(--stage);
  color: var(--stage-text);
  box-shadow: var(--shadow);
}

.code-stage::before {
  content: "";
  position: absolute;
  top: -45%;
  right: -20%;
  width: 480px;
  height: 420px;
  background: radial-gradient(circle, rgba(41, 151, 255, 0.24), transparent 65%);
  pointer-events: none;
}

.code-stage-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.code-stage-label {
  margin: 0;
  color: #86868b;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.code-stage .copy-button {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.10);
  color: #f5f5f7;
}

.code-stage .copy-button:hover {
  border-color: rgba(255, 255, 255, 0.30);
}

.code-stage-value {
  position: relative;
  margin: 0;
  color: #f5f5f7;
  font-family: var(--mono);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  text-shadow: 0 0 60px rgba(41, 151, 255, 0.32);
  white-space: nowrap;
}

.code-stage-caption {
  position: relative;
  margin: 12px 0 0;
  color: #a1a1a6;
  font-size: 12px;
}

.code-stage-rows {
  position: relative;
  margin-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.13);
}

.code-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 12px;
}

.code-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.code-row span {
  flex: 0 0 auto;
  color: #86868b;
}

.code-row code {
  overflow-wrap: anywhere;
  color: #d2d2d7;
  font-family: var(--mono);
  text-align: right;
}

.example-note {
  max-width: 730px;
  margin: 52px auto 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
  text-align: center;
  text-wrap: balance;
}

.example-note strong {
  color: var(--text);
  font-weight: 600;
}

/* Principles */

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 48px);
  margin-top: 48px;
}

.principle {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.principle-number {
  display: block;
  margin-bottom: 18px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
}

.principle h3 {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.principle p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}

/* Playground */

.playground {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px;
  align-items: start;
}

.panel {
  padding: clamp(24px, 3.5vw, 36px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow-soft);
}

@media (prefers-color-scheme: dark) {
  .panel {
    box-shadow: none;
  }
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.panel h3 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

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

.select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  white-space: nowrap;
}

select {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
}

.clock-row {
  display: grid;
  grid-template-columns: 1.25fr 0.9fr 0.6fr;
  gap: 1px;
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.clock-row > div {
  min-width: 0;
  padding: 12px 14px;
  background: var(--input);
}

.clock-row span {
  display: block;
  margin-bottom: 3px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.clock-row strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.controls .button {
  min-height: 36px;
  padding: 0 16px;
  font-size: 12.5px;
}

.output {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.output-label {
  margin: 0 0 6px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.output-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.output-value {
  min-width: 0;
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(38px, 5.6vw, 56px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.05;
  white-space: nowrap;
}

.output-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 11.5px;
}

.output-meta code {
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.95em;
}

.output .bits {
  margin-bottom: 22px;
}

.slots-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.slots {
  display: flex;
  gap: 6px;
}

.slot {
  display: grid;
  flex: 1 1 0;
  place-items: center;
  max-width: 40px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--input);
  color: var(--subtle);
  font-family: var(--mono);
  font-size: 11px;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.slot.used {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 600;
}

.output-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.output-fields div {
  min-width: 0;
}

.output-fields span {
  display: block;
  margin-bottom: 2px;
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.output-fields strong {
  display: block;
  overflow-wrap: anywhere;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
}

.note {
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--input);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.note.warn {
  background: var(--orange-soft);
  color: var(--orange);
}

.warn-text {
  color: var(--orange) !important;
}

.decode-form {
  display: flex;
  gap: 8px;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--input);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
}

input[type="text"]::placeholder {
  color: var(--subtle);
}

.decode-form .button {
  min-height: 44px;
  padding: 0 18px;
  font-size: 13px;
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.quick-picks button {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 980px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}

.quick-picks button:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
}

.decode-output {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.decode-output .output-value {
  font-size: clamp(34px, 4.6vw, 48px);
}

.decode-time {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.decode-time strong {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.playground-note {
  max-width: 640px;
  margin: 40px auto 0;
  color: var(--subtle);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  text-wrap: balance;
}

/* Profiles */

.table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

td {
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td:first-child {
  color: var(--text);
  font-weight: 600;
}

tr.active td {
  background: var(--blue-soft);
  color: var(--text);
}

td.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--blue);
  color: var(--button-text);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.table-note {
  max-width: 640px;
  margin: 24px auto 0;
  color: var(--subtle);
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
  text-wrap: balance;
}

.table-note a {
  color: var(--blue);
}

.table-note a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Footer */

.site-footer {
  padding: 48px 0 64px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.footer-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.footer-note {
  max-width: 40ch;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.footer-links a {
  color: var(--muted);
  font-size: 12px;
  transition: color 160ms ease;
}

.footer-links a:hover {
  color: var(--text);
}

/* Motion */

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero .eyebrow,
  .hero h1,
  .hero-sub,
  .hero-actions,
  .hero-facts,
  .stage {
    opacity: 1;
    transform: none;
  }
}

/* Responsive */

@media (max-width: 960px) {
  .example-layout,
  .playground {
    grid-template-columns: 1fr;
  }

  .example-layout {
    gap: 48px;
  }

  .code-stage {
    max-width: 620px;
    margin-inline: auto;
  }

  .stage .bit-cell {
    font-size: 8px;
  }
}

@media (max-width: 760px) {
  .container,
  .container.narrow,
  .header-inner {
    width: min(1120px, calc(100% - 32px));
  }

  .nav {
    display: none;
  }

  .hero {
    padding-top: 64px;
  }

  .hero h1 {
    font-size: clamp(46px, 12.5vw, 76px);
  }

  .stage {
    margin-top: 48px;
    border-radius: 26px;
  }

  .stage-code {
    letter-spacing: 0.04em;
  }

  .section {
    scroll-margin-top: 52px;
  }

  .field-list,
  .principles {
    grid-template-columns: 1fr;
  }

  .field {
    padding: 24px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .field:first-child {
    padding-top: 0;
    border-top: 0;
  }

  .field:last-child {
    padding-right: 0;
  }

  .principle {
    padding-top: 20px;
  }

  .bit-group {
    gap: 4px;
    padding: 6px;
  }

  .bit-cells {
    gap: 1px;
  }

  .bit-cell {
    height: 20px;
    border-radius: 2px;
    font-size: 0;
  }

  .bit-group-head {
    font-size: 8px;
  }

  .bit-group-head span:last-child {
    display: none;
  }

  .output .bits .bit-cell,
  .stage .bit-cell {
    font-size: 0;
  }

  .clock-row {
    grid-template-columns: 1fr 1fr;
  }

  .clock-row > div:last-child {
    grid-column: 1 / -1;
  }

  .footer-inner {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .hero-actions .button {
    width: 100%;
  }

  .hero-facts {
    font-size: 11px;
  }

  .stage {
    padding: 30px 16px;
  }

  .stage-meta {
    font-size: 11px;
  }

  .panel-head {
    flex-direction: column;
    gap: 14px;
  }

  .output-row {
    align-items: flex-start;
  }

  .output-value {
    font-size: 34px;
  }

  .decode-form {
    flex-direction: column;
  }

  .decode-form .button {
    width: 100%;
  }

  .step {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 10px;
  }

  .formula {
    width: 100%;
    text-align: center;
  }

  .code-stage {
    padding: 28px 20px;
  }
}
