/* ============================================================
   UbiFit legal & support pages.

   The token block below is lifted from the ubifit.net landing
   stylesheet (ring-web/public/css/styles.css) so the two
   properties read as one brand: obsidian stage, Hanken Grotesk,
   one cool accent, hairline borders, light theme as an opt-in.

   What is NOT lifted is the landing page's type scale. A policy
   is read, not scanned past: the display sizes come down, the
   measure is capped, and the vertical rhythm is looser.
   ============================================================ */

/* -- Tokens ------------------------------------------------- */

:root {
  color-scheme: dark;

  /* Obsidian stage — near-black with the faintest cool cast. */
  --bg: oklch(0.135 0.010 260);
  --surface: oklch(0.180 0.012 260);
  --surface-2: oklch(0.220 0.014 260);
  --ink: oklch(0.965 0.004 250);
  --ink-2: oklch(0.760 0.010 252);
  --ink-3: oklch(0.600 0.012 252);
  --border: oklch(1 0 0 / 0.09);
  --border-strong: oklch(1 0 0 / 0.17);

  --accent: oklch(0.74 0.145 252);
  --accent-press: oklch(0.80 0.115 252);
  --accent-soft: oklch(0.74 0.145 252 / 0.13);
  --accent-line: oklch(0.74 0.145 252 / 0.32);
  --accent-ink: oklch(0.12 0.02 252);

  /* The footer stage stays dark in BOTH themes, so its foreground
     tokens are declared once and re-declared in the light block. */
  --stage: oklch(0.190 0.018 262);
  --stage-fg: oklch(0.97 0.006 264);
  --stage-mute: oklch(0.72 0.018 264);
  --stage-border: oklch(1 0 0 / 0.14);

  --font-display: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --t-xs: 0.7rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-md: 1.0625rem;
  --t-lg: 1.375rem;
  --t-xl: 1.75rem;
  --t-2xl: clamp(2.1rem, 5vw, 3.1rem);

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 22px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;
  --s-9: 96px;

  --r-sm: 6px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-pill: 9999px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --d-fast: 200ms;
  --d-base: 380ms;

  --measure: 68ch;
  --container: 1100px;
  --rail: 232px;

  --shadow-1: 0 1px 0 oklch(0 0 0 / 0.25), 0 14px 40px -10px oklch(0 0 0 / 0.55);

  --bloom-1: oklch(0.45 0.11 252 / 0.20);
  --bloom-2: oklch(0.52 0.09 170 / 0.09);
}

[data-theme="light"] {
  color-scheme: light;

  --bg: oklch(0.965 0.006 250);
  --surface: oklch(0.995 0.002 250);
  --surface-2: oklch(0.925 0.010 250);
  --ink: oklch(0.18 0.030 252);
  --ink-2: oklch(0.42 0.020 252);
  --ink-3: oklch(0.50 0.018 252);
  --border: oklch(0 0 0 / 0.10);
  --border-strong: oklch(0 0 0 / 0.20);

  --accent: oklch(0.55 0.20 252);
  --accent-press: oklch(0.46 0.22 252);
  --accent-soft: oklch(0.55 0.20 252 / 0.09);
  --accent-line: oklch(0.55 0.20 252 / 0.28);
  --accent-ink: oklch(0.99 0.005 252);

  --stage: oklch(0.235 0.030 262);
  --stage-fg: oklch(0.97 0.006 264);
  --stage-mute: oklch(0.72 0.018 264);
  --stage-border: oklch(1 0 0 / 0.14);

  --shadow-1: 0 1px 0 oklch(0.18 0.045 252 / 0.04),
    0 10px 30px -10px oklch(0.18 0.045 252 / 0.12);

  --bloom-1: oklch(0.64 0.14 252 / 0.13);
  --bloom-2: oklch(0.72 0.09 205 / 0.08);
}

/* A policy has to stay legible on a browser that cannot parse
   oklch, where an unparsed colour falls back to inherit and the
   page can go ink-on-ink. These approximations only ever apply
   there. */
@supports not (color: oklch(0.5 0.1 250)) {
  :root {
    --bg: #0d0f13;
    --surface: #15181d;
    --surface-2: #1c2027;
    --ink: #f2f4f6;
    --ink-2: #b0b6bd;
    --ink-3: #7f858d;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.17);
    --accent: #5aa6f2;
    --accent-press: #8cc0f7;
    --accent-soft: rgba(90, 166, 242, 0.13);
    --accent-line: rgba(90, 166, 242, 0.32);
    --accent-ink: #0b1620;
    --stage: #15191f;
    --stage-fg: #f5f7f9;
    --stage-mute: #a8b0ba;
  }
  [data-theme="light"] {
    --bg: #f3f4f6;
    --surface: #ffffff;
    --surface-2: #e7e9ed;
    --ink: #161c27;
    --ink-2: #566070;
    --ink-3: #6a7382;
    --border: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.2);
    --accent: #1366d6;
    --accent-press: #0b4fae;
    --accent-soft: rgba(19, 102, 214, 0.09);
    --accent-line: rgba(19, 102, 214, 0.28);
    --accent-ink: #ffffff;
  }
}

/* -- Base --------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Clears the fixed header when an anchor is jumped to. */
  scroll-padding-top: 92px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: var(--t-md);
  line-height: 1.72;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0 0 var(--s-4);
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--d-fast) var(--ease);
}

a:hover {
  color: var(--accent-press);
}

strong {
  color: var(--ink);
  font-weight: 600;
}

em {
  font-style: normal;
  color: var(--ink);
  font-weight: 500;
}

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

.wrap {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-5);
}

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

.skip-link {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translate(-50%, -200%);
  z-index: 200;
  padding: 10px 18px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--t-sm);
  font-weight: 600;
  text-decoration: none;
  transition: transform var(--d-fast) var(--ease);
}

.skip-link:focus-visible {
  transform: translate(-50%, 0);
  color: var(--accent-ink);
}

/* -- Ambient layers ---------------------------------------- */

/* One cool bloom plus a whisper of the ring's biosensor green,
   fixed behind everything. Carries the landing page's depth
   without costing a single request. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 36rem at 76% -8%, var(--bloom-1), transparent 62%),
    radial-gradient(44rem 30rem at 6% 14%, var(--bloom-2), transparent 60%);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 105;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 60%, var(--bg)));
  z-index: 100;
  pointer-events: none;
  transition: transform 80ms linear;
}

/* -- Header ------------------------------------------------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 90;
  padding-block: var(--s-3);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--d-base) var(--ease),
    padding-block var(--d-base) var(--ease);
}

.site-header.is-scrolled {
  padding-block: var(--s-2);
  border-bottom-color: var(--border);
}

.site-header__row {
  display: flex;
  align-items: center;
  gap: var(--s-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -0.03em;
}

.brand img {
  width: 30px;
  height: 30px;
  display: block;
}

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

.site-nav a {
  padding: 7px 13px;
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: var(--t-sm);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--d-fast) var(--ease),
    background-color var(--d-fast) var(--ease);
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--surface);
}

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

.theme-toggle {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--r-pill);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background-color var(--d-fast) var(--ease),
    border-color var(--d-fast) var(--ease),
    color var(--d-fast) var(--ease),
    transform var(--d-fast) var(--ease);
}

.theme-toggle:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.theme-toggle:active {
  transform: scale(0.92);
}

.theme-toggle__icon {
  position: relative;
  width: 17px;
  height: 17px;
}

.theme-toggle__sun,
.theme-toggle__moon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transition: transform var(--d-base) var(--ease), opacity var(--d-base) var(--ease);
}

.theme-toggle__sun {
  opacity: 0;
  transform: rotate(-70deg) scale(0.5);
}

[data-theme="light"] .theme-toggle__sun {
  opacity: 1;
  transform: none;
}

[data-theme="light"] .theme-toggle__moon {
  opacity: 0;
  transform: rotate(70deg) scale(0.5);
}

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

.doc-hero {
  padding-top: calc(var(--s-9) + var(--s-5));
  padding-bottom: var(--s-7);
}

.doc-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 15px;
  margin-bottom: var(--s-5);
  border-radius: var(--r-pill);
  border: 1px solid color-mix(in oklab, var(--accent) 32%, var(--border));
  color: var(--accent);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.doc-hero__badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.doc-hero__title {
  font-size: var(--t-2xl);
  letter-spacing: -0.035em;
  font-weight: 800;
  max-width: 18ch;
}

.doc-hero__lede {
  margin-top: var(--s-4);
  max-width: 58ch;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--ink-2);
}

/* Effective date and publisher, as discrete facts rather than a
   run-on line — they are looked up individually. */
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-6);
  padding: 0;
  list-style: none;
}

.doc-meta li {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--t-sm);
  color: var(--ink);
  font-weight: 500;
}

.doc-meta b {
  font-weight: 500;
  color: var(--ink-3);
}

/* -- At a glance -------------------------------------------- */

/* The one loud element on the page. Someone opening a privacy
   policy usually wants four facts; this gives them those four
   before the prose starts, and the prose then backs each up. */
.glance {
  position: relative;
  margin-bottom: var(--s-8);
  padding: var(--s-6);
  border-radius: var(--r-lg);
  border: 1px solid var(--accent-line);
  background:
    linear-gradient(180deg, var(--accent-soft), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-1);
}

.glance__title {
  font-size: var(--t-lg);
  margin-bottom: var(--s-2);
}

.glance__lede {
  margin: 0;
  max-width: 62ch;
  color: var(--ink-2);
}

.glance__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--s-2);
  margin: var(--s-5) 0 0;
  padding: var(--s-5) 0 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.glance__item {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
}

.glance__ic {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.glance__ic svg {
  width: 17px;
  height: 17px;
}

.glance__k {
  display: block;
  color: var(--ink);
  font-weight: 600;
  font-size: var(--t-base);
  line-height: 1.35;
}

.glance__v {
  display: block;
  color: var(--ink-3);
  font-size: var(--t-sm);
  line-height: 1.5;
}

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

.doc {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: var(--s-8);
  align-items: start;
  padding-bottom: var(--s-9);
}

.doc__body > :first-child {
  margin-top: 0;
}

/* -- Contents rail ------------------------------------------ */

.toc {
  position: sticky;
  top: 104px;
  max-height: calc(100vh - 132px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.toc__title {
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: var(--s-3);
}

.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}

.toc__list a {
  display: block;
  padding: 6px 0 6px var(--s-4);
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-3);
  font-size: var(--t-sm);
  line-height: 1.4;
  text-decoration: none;
  transition: color var(--d-fast) var(--ease),
    border-color var(--d-fast) var(--ease);
}

.toc__list a:hover {
  color: var(--ink);
}

.toc__list a.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* Mobile: the rail becomes a disclosure directly under the hero. */
.toc--mobile {
  display: none;
  margin-bottom: var(--s-6);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.toc--mobile > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-5);
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  font-size: var(--t-sm);
  list-style: none;
}

.toc--mobile > summary::-webkit-details-marker {
  display: none;
}

.toc--mobile > summary::after {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--d-fast) var(--ease);
}

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

.toc--mobile .toc__list {
  padding: 0 var(--s-5) var(--s-4);
  border-left: 0;
}

.toc--mobile .toc__list a {
  border-left: 0;
  padding-left: 0;
  margin-left: 0;
}

/* -- Sections ----------------------------------------------- */

.sec {
  padding-top: var(--s-7);
  margin-top: var(--s-7);
  border-top: 1px solid var(--border);
}

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

.sec__head {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

/* Legal sections get cited by number, so the marker is a
   reference, not an ornament. */
.sec__num {
  flex: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  padding-top: 2px;
}

.sec__title {
  font-size: var(--t-xl);
  font-weight: 700;
  scroll-margin-top: 100px;
}

/* Anchor handle: invisible until the heading is hovered or it is
   focused, so a reader can lift a link to one clause. */
.sec__anchor {
  margin-left: 10px;
  color: var(--ink-3);
  text-decoration: none;
  opacity: 0;
  transition: opacity var(--d-fast) var(--ease), color var(--d-fast) var(--ease);
}

.sec__head:hover .sec__anchor,
.sec__anchor:focus-visible {
  opacity: 1;
}

.sec__anchor:hover {
  color: var(--accent);
}

.sec h3 {
  font-size: var(--t-base);
  font-weight: 600;
  margin: var(--s-6) 0 var(--s-2);
}

.sec ul {
  margin: 0 0 var(--s-4);
  padding: 0;
  max-width: var(--measure);
  list-style: none;
}

.sec ul li {
  position: relative;
  padding-left: var(--s-5);
  margin-bottom: var(--s-3);
}

.sec ul li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.sec ul li:last-child {
  margin-bottom: 0;
}

/* -- Definition rows (replaces the data tables) -------------- */

/* The old markup was a borderless <table> with a <th>/<td> pair
   per row, which collapses badly under 480px. These are the same
   pairs as a grid that stacks instead of squeezing. */
.defs {
  margin: var(--s-5) 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.defs__row {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr);
  gap: var(--s-5);
  padding: var(--s-5);
  border-top: 1px solid var(--border);
}

.defs__row:first-child {
  border-top: 0;
}

.defs__k {
  color: var(--ink);
  font-weight: 600;
  font-size: var(--t-base);
  line-height: 1.45;
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
}

.defs__k svg {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 4px;
  color: var(--accent);
}

.defs__v {
  margin: 0;
  max-width: none;
  color: var(--ink-2);
  font-size: var(--t-base);
  line-height: 1.62;
}

/* -- Callout ------------------------------------------------ */

.callout {
  display: flex;
  gap: var(--s-4);
  margin: var(--s-5) 0;
  padding: var(--s-5);
  border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
}

.callout svg {
  flex: none;
  width: 19px;
  height: 19px;
  margin-top: 4px;
  color: var(--ink);
}

.callout p {
  margin: 0;
  max-width: none;
  color: var(--ink-2);
}

.callout p + p {
  margin-top: var(--s-3);
}

/* -- Contact block ------------------------------------------ */

.contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4) var(--s-6);
  margin-top: var(--s-5);
  padding: var(--s-5) var(--s-6);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.contact__who {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-base);
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 11px 20px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-sm);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--d-fast) var(--ease),
    transform var(--d-fast) var(--ease);
}

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

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--ink);
}

.btn--ghost:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--ink);
}

/* -- Home: document cards ----------------------------------- */

.home {
  padding-bottom: var(--s-9);
}

.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-3);
  margin: var(--s-7) 0 0;
  padding: 0;
  list-style: none;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  height: 100%;
  padding: var(--s-6);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--d-fast) var(--ease),
    background-color var(--d-fast) var(--ease),
    transform var(--d-fast) var(--ease);
}

.doc-card:hover {
  border-color: var(--accent);
  background: var(--surface-2);
  color: var(--ink);
  transform: translateY(-2px);
}

.doc-card__ic {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--accent-soft);
  color: var(--accent);
}

.doc-card__ic svg {
  width: 19px;
  height: 19px;
}

.doc-card__t {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--t-base);
  letter-spacing: -0.02em;
}

.doc-card__d {
  color: var(--ink-3);
  font-size: var(--t-sm);
  line-height: 1.55;
  margin-top: auto;
}

/* -- Support: question accordions --------------------------- */

.faq {
  margin: var(--s-5) 0 0;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}

.faq__item {
  border-top: 1px solid var(--border);
}

.faq__item:first-child {
  border-top: 0;
}

.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5);
  cursor: pointer;
  list-style: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--t-base);
  color: var(--ink);
  transition: background-color var(--d-fast) var(--ease);
}

.faq__q::-webkit-details-marker {
  display: none;
}

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

.faq__q::after {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--d-fast) var(--ease);
}

.faq__item[open] > .faq__q::after {
  transform: rotate(-135deg) translate(-2px, -2px);
  border-color: var(--accent);
}

.faq__a {
  padding: 0 var(--s-5) var(--s-5);
}

.faq__a > :last-child {
  margin-bottom: 0;
}

/* -- Footer ------------------------------------------------- */

/* The landing page's oversized wordmark, kept at the same weight
   and tracking. It is the second and last loud moment. */
.site-footer {
  padding-block: var(--s-8) var(--s-6);
  background: var(--stage);
  color: var(--stage-mute);
  overflow: hidden;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
}

.site-footer__wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.25rem, 13vw, 8rem);
  letter-spacing: -0.055em;
  line-height: 0.9;
  color: oklch(1 0 0 / 0.94);
}

.site-footer__cols {
  margin-top: var(--s-7);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--stage-border);
}

.site-footer__col h2 {
  font-family: var(--font-body);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: oklch(1 0 0 / 0.56);
  margin-bottom: var(--s-4);
}

.site-footer__col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.site-footer__col li {
  font-size: var(--t-sm);
}

.site-footer__bottom {
  margin-top: var(--s-7);
  padding-top: var(--s-4);
  border-top: 1px solid var(--stage-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-3);
  font-size: var(--t-xs);
  font-weight: 500;
}

/* The 404 footer has no wordmark or columns above it, so the
   bottom row is the whole footer and needs no rule of its own. */
.site-footer__bottom--bare {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

/* -- Back to top -------------------------------------------- */

.to-top {
  position: fixed;
  right: var(--s-5);
  bottom: var(--s-5);
  z-index: 95;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--d-base) var(--ease),
    transform var(--d-base) var(--ease),
    visibility var(--d-base) var(--ease),
    border-color var(--d-fast) var(--ease);
}

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

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

.to-top svg {
  width: 17px;
  height: 17px;
}

/* -- Not found ---------------------------------------------- */

.notfound {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: var(--s-9);
}

.notfound__code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(4rem, 16vw, 9rem);
  line-height: 0.85;
  letter-spacing: -0.06em;
  color: var(--accent);
}

.notfound__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin-top: var(--s-6);
}

/* -- Page-load settle --------------------------------------- */

/* One orchestrated entrance on load, nothing on scroll. The
   no-JS render is already visible; the `js` class opts in. */
/* The element's RESTING state is its natural one — visible. The
   animation only supplies a `from`, with `backwards` fill so the
   offset also applies during the stagger delay.

   Written this way round on purpose: an `opacity: 0` base that
   relies on an animation finishing leaves the document blank if
   that animation never runs, and animations are throttled in
   background tabs. A policy must never be hidden behind motion. */
.js .settle {
  animation: settle 0.7s var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 80ms);
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* -- Responsive --------------------------------------------- */

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

  .toc--desktop {
    display: none;
  }

  /* The element carries both .toc and .toc--mobile so the print
     rule still catches it, which means it also inherits the
     rail's sticky positioning and scroll box. A disclosure sheet
     in the flow wants none of that. */
  .toc--mobile {
    display: block;
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 620px) {
  :root {
    --s-9: 72px;
  }

  .wrap {
    padding-inline: var(--s-4);
  }

  .site-nav a {
    padding: 7px 9px;
  }

  .brand span {
    display: none;
  }

  .doc-hero__title {
    max-width: none;
  }

  .glance {
    padding: var(--s-5);
  }

  .defs__row {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-2);
  }

  .sec__head {
    gap: var(--s-3);
  }

  /* The anchor handle has no hover on touch, so it stays hidden. */
  .sec__anchor {
    display: none;
  }

  .contact {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* -- Motion & print ----------------------------------------- */

@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;
  }

  .js .settle {
    animation: none;
  }
}

/* People print policies. This one prints as a document: no
   chrome, no stage, black on white, links spelled out. */
@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #fff;
    --ink: #000;
    --ink-2: #1a1a1a;
    --ink-3: #444;
    --border: #cfcfcf;
    --border-strong: #9a9a9a;
    --accent: #000;
    --accent-soft: transparent;
    --accent-line: #9a9a9a;
  }

  .site-header,
  .grain,
  .ambient,
  .scroll-progress,
  .to-top,
  .toc,
  .site-footer__wordmark,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
    line-height: 1.5;
  }

  .doc-hero {
    padding-top: 0;
  }

  .doc {
    display: block;
  }

  .glance,
  .defs,
  .callout,
  .contact,
  .faq {
    box-shadow: none;
    break-inside: avoid;
  }

  .sec {
    break-inside: avoid-page;
  }

  /* A printed policy must carry every answer, including the
     questions the reader left collapsed. The first rule beats
     Chrome and Safari's UA rule for a closed <details>; the
     second handles engines that hide it with content-visibility
     instead. */
  .faq__a {
    display: block !important;
  }

  details {
    content-visibility: visible !important;
  }

  a[href^="http"]::after,
  a[href^="mailto"]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    color: #444;
  }

  .site-footer {
    background: #fff;
    color: #000;
    border-top: 1px solid #cfcfcf;
  }
}
