/*
 * cpux website — design system.
 *
 * The app is a dark instrument panel (src/theme.ts) so the site is dark too,
 * but restrained: one accent, hairline borders, and a strict spacing scale.
 * Colour is reserved for meaning — links, active state, live meters, and the
 * per-tab dots that match the app's section colours. Everything else is
 * greyscale, which is what keeps a dark page from looking like a toy.
 */

/* ------------------------------------------------------------------ tokens */

:root {
  /* Surfaces, from the page up. */
  --bg: #08090d;
  --surface-1: #0d0f15;
  --surface-2: #12151d;
  --surface-3: #171b25;

  /* Hairlines. Borders are alpha so they sit correctly on any surface. */
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #e9edf5;
  --text-2: #9aa4b8;
  --text-3: #626c82;

  --accent: #38e0d0;
  --accent-hover: #5eeade;
  --accent-ink: #04191c; /* text on an accent fill */
  --accent-soft: rgba(56, 224, 208, 0.1);
  --accent-line: rgba(56, 224, 208, 0.28);

  /* App section colours (src/theme.ts), used only as identity dots. */
  --violet: #a78bfa;
  --blue: #60a5fa;
  --green: #4ade80;
  --amber: #fbbf24;
  --orange: #fb923c;
  --pink: #f472b6;

  /* Spacing scale — every gap in the page comes from here. */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --s9: 96px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
  /*
   * System stack on purpose: a privacy-first site should not hand every
   * visitor's IP address to a font CDN.
   */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter,
    "Helvetica Neue", Arial, sans-serif;

  --shell: 1120px;
  --measure: 68ch;
  --header-h: 64px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

/* ------------------------------------------------------------------- base */

*,
*::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(--sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.12em 0.4em;
  border-radius: 5px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}

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

a:hover {
  text-decoration: underline;
}

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

::selection {
  background: rgba(56, 224, 208, 0.26);
}

.shell {
  width: min(100% - var(--s6), var(--shell));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 18px;
  font-weight: 650;
  border-radius: 0 0 var(--r-sm) 0;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------------------------------------------- type */

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 640;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
}

h1 {
  font-size: clamp(2.15rem, 1.4rem + 3.2vw, 3.5rem);
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.05rem);
  letter-spacing: -0.03em;
}

h3 {
  font-size: 1.0625rem;
  font-weight: 620;
  letter-spacing: -0.015em;
}

p {
  margin: 0;
}

.eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s4);
}

.lede {
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 58ch;
}

/* ---------------------------------------------------------------- section */

section {
  padding-block: clamp(var(--s7), 6vw, var(--s9));
}

.section-head {
  max-width: var(--measure);
  margin-bottom: var(--s7);
}

.section-head h2 + .lede {
  margin-top: var(--s4);
}

.rule {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 9, 13, 0.8);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

.site-header.is-stuck {
  border-bottom-color: var(--line);
  background: rgba(8, 9, 13, 0.94);
}

.site-header .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  height: var(--header-h);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: 0.9375rem;
  font-weight: 640;
  letter-spacing: -0.02em;
  color: var(--text);
}

.wordmark:hover {
  text-decoration: none;
}

.wordmark .glyph {
  width: 24px;
  height: 24px;
  flex: none;
}

.wordmark .x {
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--s1);
}

.nav a {
  position: relative;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--s2) var(--s3);
  border-radius: var(--r-sm);
  transition: color 0.16s var(--ease), background 0.16s var(--ease);
}

.nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  text-decoration: none;
}

.nav a[aria-current="page"] {
  color: var(--text);
}

/* Quiet underline for the current page — no coloured pill. */
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--s3);
  right: var(--s3);
  bottom: 2px;
  height: 1.5px;
  border-radius: 2px;
  background: var(--accent);
}

.nav-toggle {
  display: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 15px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.24s var(--ease), opacity 0.16s linear;
}

.nav-toggle span {
  position: relative;
  margin-inline: auto;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
}

.nav-toggle span::before {
  top: -5px;
}

.nav-toggle span::after {
  top: 5px;
}

.nav-toggle[aria-expanded="true"] span {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] span::before {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span::after {
  transform: translateY(-5px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: grid;
    place-items: center;
  }

  .nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: var(--s2) var(--s4) var(--s4);
    background: rgba(8, 9, 13, 0.98);
    border-bottom: 1px solid var(--line);
  }

  .nav.is-open {
    display: flex;
  }

  .nav a {
    padding: var(--s3);
    font-size: 0.9375rem;
    border-radius: var(--r-sm);
  }

  .nav a[aria-current="page"]::after {
    display: none;
  }

  .nav a[aria-current="page"] {
    color: var(--accent);
    background: var(--accent-soft);
  }
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 42px;
  padding-inline: var(--s5);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 560;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface-2);
  border-color: var(--line-strong);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--text-3);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  margin-top: var(--s6);
}

/* ------------------------------------------------------------------ cards */

.grid {
  display: grid;
  gap: var(--s4);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
}

.card {
  padding: var(--s5);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.card:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.card h3 {
  margin-bottom: var(--s2);
}

.card p {
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Monochrome by default — one accent, no confetti. */
.card-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: var(--s4);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--accent);
}

/* ------------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding-block: clamp(var(--s7), 6vw, var(--s9)) clamp(var(--s7), 6vw, var(--s8));
  overflow: hidden;
}

/* A single soft light source behind the headline. Nothing else glows. */
.hero::before {
  content: "";
  position: absolute;
  inset: -30% 30% auto -20%;
  height: 700px;
  background: radial-gradient(
    50% 50% at 40% 50%,
    rgba(56, 224, 208, 0.09),
    transparent 72%
  );
  pointer-events: none;
}

.hero .shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.78fr);
  gap: clamp(var(--s6), 5vw, var(--s9));
  align-items: center;
}

@media (max-width: 940px) {
  .hero .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-visual {
    order: -1;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  height: 28px;
  padding-inline: var(--s3) var(--s4);
  margin-bottom: var(--s5);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-2);
}

.pill .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.14);
}

.hero h1 {
  max-width: 15ch;
}

.hero .lede {
  margin-top: var(--s5);
}

.hero-note {
  margin-top: var(--s4);
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* ------------------------------------------------------- hero device panel */

.hero-visual {
  display: flex;
  justify-content: center;
}

.device {
  position: relative;
  width: min(100%, 292px);
  aspect-ratio: 9 / 18.6;
  padding: 9px;
  border-radius: 36px;
  background: linear-gradient(165deg, #2a3040, #12151d 45%, #20252f);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 32px 64px -28px rgba(0, 0, 0, 0.95);
}

.device-screen {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  width: 100%;
  height: 100%;
  padding: var(--s4) var(--s3);
  border-radius: 28px;
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

.device-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 0.5625rem;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.device-live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.device-live::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

.device-head h4 {
  font-size: 0.9375rem;
}

.device-head p {
  margin-top: 2px;
  font-size: 0.625rem;
  color: var(--text-3);
}

.rings {
  display: flex;
  justify-content: center;
  gap: var(--s5);
  padding-block: var(--s2);
}

.ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  text-align: center;
}

.ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.ring .track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 6;
}

.ring .bar {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s var(--ease), stroke 0.9s linear;
}

.ring-value {
  font-family: var(--mono);
  font-size: 1.0625rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ring-label {
  margin-top: 4px;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.cores {
  display: grid;
  gap: 6px;
}

.core {
  display: grid;
  grid-template-columns: 18px 1fr 44px;
  align-items: center;
  gap: var(--s2);
  font-family: var(--mono);
  font-size: 0.5625rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.core-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.core-fill {
  width: 20%;
  height: 100%;
  border-radius: 999px;
  transition: width 0.9s var(--ease), background 0.9s linear;
}

.core-hz {
  text-align: right;
  color: var(--text-2);
}

.device-rows {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.device-row {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  padding: 7px var(--s3);
  font-size: 0.625rem;
  border-bottom: 1px solid var(--line);
}

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

.device-row dt {
  color: var(--text-3);
}

.device-row dd {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ------------------------------------------------------------- facts strip */

.facts {
  border-block: 1px solid var(--line);
  background: var(--surface-1);
}

.facts .shell {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s5);
  padding-block: var(--s6);
}

@media (max-width: 700px) {
  .facts .shell {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s6) var(--s5);
  }
}

.fact-value {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  color: var(--text);
}

.fact-label {
  margin-top: var(--s1);
  font-size: 0.8125rem;
  color: var(--text-3);
}

/* --------------------------------------------------------------- feature list */

.claim {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: var(--s3);
  align-items: start;
}

.claim svg {
  margin-top: 3px;
  color: var(--accent);
}

.claim.no svg {
  color: var(--text-3);
}

.claim p {
  color: var(--text-2);
  font-size: 0.9375rem;
}

.claim strong {
  color: var(--text);
  font-weight: 560;
}

.claims {
  display: grid;
  gap: var(--s4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ------------------------------------------------------------------ panel */

.panel {
  padding: clamp(var(--s5), 4vw, var(--s7));
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.panel-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: clamp(var(--s6), 4vw, var(--s7));
  align-items: start;
}

/* ------------------------------------------------------------------ table */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
}

table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  text-align: left;
  padding: var(--s3) var(--s5);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

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

tbody tr {
  transition: background 0.16s var(--ease);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody td:first-child {
  width: 1%;
  white-space: nowrap;
  font-weight: 560;
}

tbody td:last-child {
  color: var(--text-2);
}

/* The one place per-tab colour appears, echoing sectionColors in the app. */
.tab-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: var(--s2);
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

/* -------------------------------------------------------------------- faq */

.faq {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  overflow: hidden;
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq details:last-child {
  border-bottom: 0;
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  padding: var(--s4) var(--s5);
  font-size: 0.9375rem;
  font-weight: 560;
  cursor: pointer;
  list-style: none;
  transition: background 0.16s var(--ease);
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary:hover {
  background: rgba(255, 255, 255, 0.02);
}

.faq summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--text-3);
  border-bottom: 1.5px solid var(--text-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.24s var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.faq details[open] summary {
  color: var(--text);
}

.faq-body {
  padding: 0 var(--s5) var(--s5);
  max-width: var(--measure);
  font-size: 0.9375rem;
  color: var(--text-2);
}

/* -------------------------------------------------------------------- cta */

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s5);
  padding: clamp(var(--s5), 4vw, var(--s7));
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
}

.cta h2 {
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
}

.cta p {
  margin-top: var(--s2);
  color: var(--text-2);
  max-width: 46ch;
}

.cta .btn-row {
  margin-top: 0;
}

/* -------------------------------------------------------------- page head */

.page-head {
  padding-block: clamp(var(--s7), 6vw, var(--s8)) var(--s6);
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  max-width: 18ch;
}

.page-head .lede {
  margin-top: var(--s5);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  margin-top: var(--s5);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-3);
}

.page-meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}

.page-meta span + span::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.6;
}

/* ------------------------------------------------------- legal doc layout */

.doc-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: clamp(var(--s6), 5vw, var(--s8));
  align-items: start;
  padding-block: var(--s7) var(--s9);
}

@media (max-width: 900px) {
  .doc-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s6);
  }
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + var(--s5));
}

.toc h2 {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s3);
}

.toc ol {
  counter-reset: toc;
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: block;
  padding: 6px var(--s3);
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text-3);
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  margin-right: var(--s2);
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--text-3);
  opacity: 0.7;
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
}

.toc a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.toc a.is-active::before {
  color: var(--accent);
  opacity: 1;
}

@media (max-width: 900px) {
  .toc {
    position: static;
    padding: var(--s4);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-1);
  }

  .toc ol {
    columns: 2;
    column-gap: var(--s5);
    border-left: 0;
  }

  .toc a {
    border-left: 0;
    padding-inline: 0;
  }

  .toc a.is-active {
    border-left: 0;
  }
}

@media (max-width: 520px) {
  .toc ol {
    columns: 1;
  }
}

/* ------------------------------------------------------------- legal body */

.doc {
  max-width: var(--measure);
  counter-reset: sec;
}

.doc-intro {
  padding: var(--s5);
  margin-bottom: var(--s7);
  border: 1px solid var(--accent-line);
  border-radius: var(--r-md);
  background: var(--accent-soft);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--text);
}

.doc h2 {
  position: relative;
  font-size: 1.1875rem;
  font-weight: 620;
  letter-spacing: -0.02em;
  margin-top: var(--s7);
  margin-bottom: var(--s4);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  scroll-margin-top: calc(var(--header-h) + var(--s5));
  counter-increment: sec;
}

.doc h2::before {
  content: counter(sec, decimal-leading-zero);
  display: block;
  margin-bottom: var(--s2);
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-3);
}

/* Anchor affordance, revealed on hover — quiet but discoverable. */
.doc h2 .anchor {
  position: absolute;
  left: -1.4em;
  top: auto;
  opacity: 0;
  color: var(--text-3);
  font-weight: 400;
  transition: opacity 0.16s var(--ease);
}

.doc h2:hover .anchor,
.doc h2 .anchor:focus-visible {
  opacity: 1;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .doc h2 .anchor {
    display: none;
  }
}

.doc p {
  margin-bottom: var(--s4);
  color: var(--text-2);
  line-height: 1.7;
}

.doc p:last-child {
  margin-bottom: 0;
}

.doc ul {
  margin: 0 0 var(--s4);
  padding: 0;
  list-style: none;
}

.doc ul li {
  position: relative;
  padding-left: var(--s5);
  margin-bottom: var(--s3);
  color: var(--text-2);
  line-height: 1.6;
}

.doc ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7em;
  width: 7px;
  height: 1px;
  background: var(--accent);
  opacity: 0.7;
}

.doc strong {
  color: var(--text);
  font-weight: 560;
}

.doc-foot {
  margin-top: var(--s7);
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--text-3);
}

.doc-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s5);
}

.chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding-inline: var(--s4);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease),
    background 0.16s var(--ease);
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
  text-decoration: none;
}

.chip[aria-current="page"] {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

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

.copy-field {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  max-width: 100%;
  padding: 5px 5px 5px var(--s4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-1);
  font-family: var(--mono);
  font-size: 0.875rem;
}

.copy-field > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-btn {
  flex: none;
  height: 30px;
  padding-inline: var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 560;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

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

.copy-btn.done {
  color: var(--accent);
  border-color: var(--accent-line);
}

/* ----------------------------------------------------------- back to top */

.to-top {
  position: fixed;
  right: var(--s5);
  bottom: var(--s5);
  z-index: 40;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.24s var(--ease), transform 0.24s var(--ease),
    visibility 0.24s, color 0.16s var(--ease);
}

.to-top.is-shown {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.to-top:hover {
  color: var(--text);
}

/* ----------------------------------------------------------------- footer */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr));
  gap: var(--s7) var(--s5);
  padding-block: var(--s7);
}

@media (max-width: 720px) {
  .footer-top {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s6) var(--s5);
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

.footer-brand p {
  margin-top: var(--s4);
  max-width: 44ch;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text-3);
}

.footer-col h3 {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: var(--s4);
}

.footer-col ul {
  display: grid;
  gap: var(--s3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-col a {
  font-size: 0.875rem;
  color: var(--text-2);
}

.footer-col a:hover {
  color: var(--text);
  text-decoration: none;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s3);
  padding-block: var(--s5);
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--text-3);
}

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

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

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

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------ print */

@media print {
  .site-header,
  .site-footer,
  .toc,
  .to-top,
  .doc-switch,
  .doc h2 .anchor {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .doc-layout {
    display: block;
    padding: 0;
  }

  .doc,
  .doc p,
  .doc li,
  .page-meta {
    max-width: none;
    color: #1a1a1a;
  }

  .doc-intro {
    background: none;
    border-color: #999;
    color: #000;
  }

  .doc h2 {
    page-break-after: avoid;
  }
}
