/* ============================================================================
   Krawlify.com — one stylesheet, no framework, no external requests.

   The palette is not invented here: it is lifted from the product itself
   (crawer_app/src/lib/brand.ts and src/app/globals.css) so the marketing site
   and the app you land in are visibly the same thing.
   ========================================================================= */

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

:root {
  /* brand constants — identical in both themes */
  --violet: #8b5cf6;
  --purple: #a855f7;
  --ink: #15141f;
  --ok: #3ddc84;
  --warn: #ffbd2e;
  --err: #e0576b;

  /* light theme (the default) */
  --bg: #ffffff;
  --bg-alt: #faf9fe;
  --card: #ffffff;
  --card-alt: #f5f1ff;
  --border: rgba(21, 20, 31, 0.10);
  --border-soft: rgba(21, 20, 31, 0.06);
  --text: #1a1826;
  --text-2: #46445a;
  --muted: #6b6980;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #ede4ff;
  --code-bg: #15141f;
  --code-text: #ececf1;
  --shadow: 0 1px 2px rgba(21, 20, 31, .05), 0 8px 24px -12px rgba(21, 20, 31, .16);
  --shadow-lg: 0 2px 4px rgba(21, 20, 31, .05), 0 24px 56px -20px rgba(21, 20, 31, .22);
  --header-bg: rgba(255, 255, 255, .78);

  --radius: 14px;
  --radius-sm: 9px;
  --wrap: 1120px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

/* Dark by OS preference, so the page is already correct before any JS runs.
   The explicit [data-theme] attributes below override it in both directions. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101019;
    --bg-alt: #0b0a12;
    --card: #15141f;
    --card-alt: #1d1b2b;
    --border: rgba(255, 255, 255, .09);
    --border-soft: rgba(255, 255, 255, .06);
    --text: #ececf1;
    --text-2: #c9c9d3;
    --muted: #8a8a97;
    --accent: #a855f7;
    --accent-hover: #b975f9;
    --accent-soft: #1d1b2b;
    --code-bg: #0b0a12;
    --code-text: #ececf1;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 56px -20px rgba(0, 0, 0, .7);
    --header-bg: rgba(16, 16, 25, .78);
  }
}

:root[data-theme="dark"] {
  --bg: #101019;
  --bg-alt: #0b0a12;
  --card: #15141f;
  --card-alt: #1d1b2b;
  --border: rgba(255, 255, 255, .09);
  --border-soft: rgba(255, 255, 255, .06);
  --text: #ececf1;
  --text-2: #c9c9d3;
  --muted: #8a8a97;
  --accent: #a855f7;
  --accent-hover: #b975f9;
  --accent-soft: #1d1b2b;
  --code-bg: #0b0a12;
  --code-text: #ececf1;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 24px 56px -20px rgba(0, 0, 0, .7);
  --header-bg: rgba(16, 16, 25, .78);
}

/* --- reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .6em; font-weight: 650; }
h1 { font-size: clamp(2.1rem, 1.35rem + 3.1vw, 3.9rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.55rem, 1.2rem + 1.5vw, 2.35rem); letter-spacing: -.028em; }
h3 { font-size: clamp(1.15rem, 1.05rem + .45vw, 1.4rem); }
h4 { font-size: 1.02rem; }
p  { margin: 0 0 1.1em; }

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

::selection { background: var(--violet); color: #fff; }

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

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 22px; }

.section { padding-block: clamp(3.5rem, 2rem + 6vw, 6.5rem); }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border-soft); }

.section__head { max-width: 62ch; margin-bottom: 2.6rem; }
.section__head p { color: var(--text-2); font-size: 1.06rem; margin-bottom: 0; }

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .7rem;
}

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip:focus { left: 0; color: #fff; }

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

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

.header__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 660;
  letter-spacing: -.02em;
  flex: 0 0 auto;
}
.brand:hover { color: var(--text); }
.brand svg { width: 28px; height: 28px; flex: 0 0 auto; }
.brand__tag {
  display: block;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--muted);
  line-height: 1.1;
}
.brand__name { display: block; line-height: 1.15; }

.nav { display: flex; align-items: center; gap: .3rem; margin-left: auto; }
.nav a {
  color: var(--text-2);
  text-decoration: none;
  font-size: .93rem;
  font-weight: 500;
  padding: .45rem .68rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--card-alt); }
.nav a[aria-current="true"] { color: var(--accent); }

.header__actions { display: flex; align-items: center; gap: .5rem; flex: 0 0 auto; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  padding: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun, .theme-toggle .i-moon, .theme-toggle .i-auto { display: none; }
:root[data-theme-mode="light"]  .theme-toggle .i-sun  { display: block; }
:root[data-theme-mode="dark"]   .theme-toggle .i-moon { display: block; }
:root[data-theme-mode="system"] .theme-toggle .i-auto { display: block; }

.nav-toggle { display: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .68rem 1.15rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: linear-gradient(120deg, var(--violet), var(--purple));
  color: #fff;
  box-shadow: 0 8px 22px -12px var(--purple);
}
.btn--primary:hover { color: #fff; filter: brightness(1.07); }

.btn--ghost {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { color: var(--text); border-color: var(--accent); background: var(--card-alt); }

.btn--sm { padding: .45rem .85rem; font-size: .88rem; }

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

.hero {
  position: relative;
  padding-block: clamp(3rem, 1.5rem + 6vw, 5.5rem) clamp(2.5rem, 1.5rem + 4vw, 4rem);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -30% -10% auto -10%;
  height: 620px;
  background:
    radial-gradient(46% 52% at 78% 12%, rgba(168, 85, 247, .20), transparent 68%),
    radial-gradient(40% 46% at 14% 0%, rgba(139, 92, 246, .16), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.hero__inner { max-width: 46rem; }
.hero h1 { margin-bottom: .45em; }
.hero h1 .grad {
  background: linear-gradient(100deg, var(--violet), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lede {
  font-size: clamp(1.05rem, .98rem + .4vw, 1.28rem);
  color: var(--text-2);
  max-width: 40rem;
}
.hero__cta { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.8rem 0 1.4rem; }

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-size: .9rem;
}
.hero__meta li { display: flex; align-items: center; gap: .4rem; }
.hero__meta li::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}

.figure { margin: 2.6rem 0 0; }
.figure img { width: 100%; border-radius: var(--radius); }
.figure figcaption {
  margin-top: .85rem;
  font-size: .89rem;
  color: var(--muted);
  max-width: 68ch;
}

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

.grid { display: grid; gap: 1.1rem; }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .45rem; }
.card p:last-child { margin-bottom: 0; }
.card p { color: var(--text-2); font-size: .96rem; }

.card__icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: .9rem;
}
.card__icon svg { width: 20px; height: 20px; }

/* --- steps ---------------------------------------------------------------- */

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; counter-reset: step; }
.steps--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.steps li {
  counter-increment: step;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
}
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(120deg, var(--violet), var(--purple));
  color: #fff;
  font-size: .85rem;
  font-weight: 700;
  margin-bottom: .7rem;
}
.steps li strong { display: block; margin-bottom: .25rem; }
.steps li span { color: var(--text-2); font-size: .93rem; }

/* --- components ----------------------------------------------------------- */

.component {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: clamp(1.4rem, 1rem + 1.4vw, 2.2rem);
  box-shadow: var(--shadow);
  scroll-margin-top: 88px;
}
.component + .component { margin-top: 1.3rem; }
.component__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem 1rem; margin-bottom: .3rem; }
.component__head h3 { margin: 0; }
.component__lede { color: var(--text-2); font-size: 1.02rem; max-width: 66ch; }
.component__body { display: grid; gap: 1.6rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .component__body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}

.tag {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--border-soft);
}
.tag--alpha { background: transparent; color: var(--warn); border-color: var(--warn); }

.ticks { list-style: none; margin: 0 0 1.2rem; padding: 0; display: grid; gap: .55rem; }
.ticks li { position: relative; padding-left: 1.6rem; color: var(--text-2); font-size: .96rem; }
.ticks li::before {
  content: "";
  position: absolute;
  left: 0; top: .55em;
  width: 9px; height: 9px;
  border-radius: 2px;
  background: linear-gradient(120deg, var(--violet), var(--purple));
}
.ticks strong { color: var(--text); font-weight: 600; }

/* --- demo credentials ----------------------------------------------------- */

.demo { display: grid; gap: 1.6rem; align-items: start; }
@media (min-width: 900px) { .demo { grid-template-columns: 1.05fr .95fr; gap: 2.4rem; } }

.creds {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
}
.creds h3 { font-size: 1.02rem; margin-bottom: 1rem; }

.cred {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  padding: .7rem .9rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--card-alt);
}
.cred + .cred { margin-top: .55rem; }
.cred__label {
  font-size: .7rem; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
  display: block; margin-bottom: .15rem;
}
.cred__value {
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--text);
  word-break: break-all;
}
.cred button {
  flex: 0 0 auto;
  padding: .34rem .7rem;
  font: 600 .78rem/1.4 var(--sans);
  color: var(--text-2);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.cred button:hover { color: var(--accent); border-color: var(--accent); }
.cred button[data-copied="true"] { color: var(--ok); border-color: var(--ok); }

/* --- resource links (source, registries) ---------------------------------- */

.btns { display: flex; flex-wrap: wrap; gap: .6rem; }

.reslinks {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 1.2rem 0 0;
  padding: 0;
}
.reslinks a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .42rem .8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: .87rem;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
}
.reslinks a:hover { color: var(--accent); border-color: var(--accent); background: var(--card-alt); }
.reslinks svg { width: 15px; height: 15px; flex: 0 0 auto; }
.reslinks code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: .93em;
}

/* Registry grid on the source section */
.registry { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); }
.registry .card { display: flex; flex-direction: column; }
.registry .card pre { margin-top: auto; margin-bottom: 0; }
.registry h3 { display: flex; align-items: center; gap: .5rem; font-size: 1.08rem; }
.registry h3 svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--accent); }
.registry dl { margin: 0 0 1.1rem; display: grid; gap: .55rem; }
.registry dt {
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.registry dd { margin: -.4rem 0 0; font-size: .93rem; }
.registry dd a { word-break: break-word; }

/* --- code ----------------------------------------------------------------- */

code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: .12em .38em;
  border-radius: 5px;
  word-break: break-word;
}

pre {
  position: relative;
  margin: 0 0 1rem;
  padding: 1rem 1.1rem;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .855rem;
  line-height: 1.65;
  tab-size: 2;
}
pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
  white-space: pre;
  word-break: normal;
}
pre .c { color: #8a8a97; }        /* comment */
pre .k { color: #a855f7; }        /* keyword / command */
pre .s { color: #3ddc84; }        /* string */

.copy {
  position: absolute;
  top: .5rem;
  right: .5rem;
  padding: .28rem .6rem;
  font: 600 .74rem/1.4 var(--sans);
  color: #c9c9d3;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease;
}
pre:hover .copy, .copy:focus-visible { opacity: 1; }
.copy:hover { background: rgba(255, 255, 255, .13); color: #fff; }
.copy[data-copied="true"] { color: var(--ok); border-color: var(--ok); }
@media (hover: none) { .copy { opacity: 1; } }

.term {
  display: flex;
  align-items: center;
  gap: .8rem;
  max-width: 26rem;
  padding: .7rem .9rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: .86rem;
  color: var(--code-text);
}
.term__prompt { color: var(--purple); flex: 0 0 auto; }

/* --- tabs ----------------------------------------------------------------- */

.tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: 1.4rem;
  padding: .3rem;
  background: var(--card-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  width: fit-content;
  max-width: 100%;
}
.tabs__tab {
  appearance: none;
  border: 0;
  background: transparent;
  font: 600 .92rem/1 var(--sans);
  color: var(--text-2);
  padding: .6rem .95rem;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}
.tabs__tab:hover { color: var(--text); }
.tabs__tab[aria-selected="true"] {
  background: var(--card);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.tabs__panel[hidden] { display: none; }
.tabs__panel > h3:first-child { margin-top: 0; }

.numbered { counter-reset: n; list-style: none; margin: 0; padding: 0; display: grid; gap: 1.3rem; }
.numbered > li { counter-increment: n; position: relative; padding-left: 2.4rem; }
.numbered > li::before {
  content: counter(n);
  position: absolute;
  left: 0; top: 0;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--accent);
  font-size: .8rem;
  font-weight: 700;
}
.numbered > li > strong { display: block; margin-bottom: .5rem; }
.numbered p { font-size: .95rem; color: var(--text-2); }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; min-width: 480px; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--border-soft); }
th { font-weight: 650; color: var(--text); background: var(--card-alt); white-space: nowrap; }
td { color: var(--text-2); vertical-align: top; }
tr:last-child td { border-bottom: 0; }

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

.faq { display: grid; gap: .7rem; }

details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
}
details[open] { border-color: var(--accent); }
summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 3rem 1rem 1.2rem;
  font-weight: 600;
  position: relative;
  border-radius: var(--radius-sm);
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "";
  position: absolute;
  right: 1.2rem;
  top: 50%;
  width: 9px; height: 9px;
  margin-top: -6px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s ease;
}
details[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
summary:hover { color: var(--accent); }
.details__body { padding: 0 1.2rem 1.1rem; color: var(--text-2); font-size: .97rem; }
.details__body > :last-child { margin-bottom: 0; }

/* --- callout -------------------------------------------------------------- */

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--card-alt);
  padding: 1.05rem 1.25rem;
  font-size: .95rem;
  color: var(--text-2);
  margin: 0 0 1.2rem;
}
.callout--warn { border-left-color: var(--warn); }
.callout strong { color: var(--text); }
.callout > :last-child { margin-bottom: 0; }

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

.footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding-block: 3rem 2rem;
  font-size: .92rem;
}
.footer__grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 2.2rem;
}
.footer__grid > div:first-child { grid-column: 1 / -1; }
@media (min-width: 780px) {
  .footer__grid { grid-template-columns: 1.5fr repeat(4, minmax(0, 1fr)); }
  .footer__grid > div:first-child { grid-column: auto; }
}
/* Footer column labels are <h2>, not <h4>: they follow the last section's <h2>,
   and dropping two levels there breaks the heading outline for a screen reader.
   They are styled down to look like the small labels they are. */
.footer__grid h2 {
  font-size: .76rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .8rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.footer a { color: var(--text-2); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }
.footer__note { color: var(--muted); max-width: 34ch; margin-top: .8rem; }
.footer__bottom {
  border-top: 1px solid var(--border-soft);
  padding-top: 1.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 1.4rem;
  justify-content: space-between;
  color: var(--muted);
}

/* --- legal / prose pages -------------------------------------------------- */

.prose { max-width: 74ch; }
.prose h2 { margin-top: 2.6rem; font-size: clamp(1.3rem, 1.15rem + .7vw, 1.65rem); }
.prose h3 { margin-top: 1.9rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.1em; }
.prose li { margin-bottom: .5em; color: var(--text-2); }
.prose li::marker { color: var(--accent); }
.prose p { color: var(--text-2); }
.prose strong { color: var(--text); }
.prose > p:first-of-type { font-size: 1.06rem; }

.page-head {
  padding-block: clamp(2.5rem, 1.6rem + 3vw, 4rem) 1.5rem;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-alt);
}
.page-head h1 { font-size: clamp(1.9rem, 1.5rem + 1.8vw, 2.9rem); margin-bottom: .3rem; }
.page-head p { color: var(--muted); margin: 0; }

.crumbs { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: 0 0 1rem;
          font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs li + li::before { content: "/"; margin-right: .4rem; color: var(--border); }

.toc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 1.1rem 1.3rem;
  margin-bottom: 2.4rem;
}
.toc h2 { margin: 0 0 .6rem; font-size: .78rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.2rem; display: grid; gap: .3rem; }
.toc li { margin: 0; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* --- 404 ------------------------------------------------------------------ */

.notfound { text-align: center; padding-block: clamp(4rem, 3rem + 8vw, 8rem); }
.notfound .code {
  font: 800 clamp(4rem, 3rem + 8vw, 8rem)/1 var(--sans);
  background: linear-gradient(120deg, var(--violet), var(--purple));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -.05em;
}
.notfound .btn-row { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin-top: 1.6rem; }

/* --- reveal --------------------------------------------------------------- */

/* Gated on .js, which the inline head script adds. Without it these rules never
   apply, so with JavaScript disabled the diagrams and cards are simply visible
   rather than stuck at opacity 0 forever. */
:root.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
:root.js .reveal.is-in { opacity: 1; transform: none; }

/* --- responsive ----------------------------------------------------------- */

@media (max-width: 880px) {
  .nav-toggle {
    display: inline-grid;
    place-items: center;
    width: 38px; height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--text-2);
    cursor: pointer;
    padding: 0;
  }
  .nav-toggle svg { width: 18px; height: 18px; }
  .nav-toggle:hover { color: var(--text); border-color: var(--accent); }

  /* The open menu stays in the flow rather than overlaying the page: with JS
     disabled the toggle does nothing, and an always-open overlay would sit on
     top of the content forever. In flow it simply reads as a taller header. */
  .header__bar { flex-wrap: wrap; }
  .header__actions { margin-left: auto; }
  .nav {
    order: 3;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: .1rem;
    margin: 0 0 .5rem;
    padding-top: .5rem;
    border-top: 1px solid var(--border-soft);
  }
  .nav[hidden] { display: none; }
  .nav a { padding: .68rem .6rem; font-size: 1rem; }

  /* While the menu is open the header overlays the page, and a 78%-opaque bar
     lets the content underneath show through the links. Go opaque. */
  .header:has(#primary-nav:not([hidden])) {
    background: var(--bg);
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 560px) {
  .brand__tag { display: none; }
  .header__cta { display: none; }
  .hero__cta .btn { flex: 1 1 100%; }
  .tabs__list { width: 100%; }
  .tabs__tab { flex: 1 1 auto; text-align: center; }
}

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

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

@media print {
  .header, .footer__grid, .skip, .copy, .hero::before, .nav, .theme-toggle { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section, .page-head { padding-block: .6rem; background: none; }
  a { color: #000; text-decoration: underline; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
  pre { background: #f4f4f4; color: #000; border-color: #ccc; white-space: pre-wrap; }
  details { border: 0; break-inside: avoid; }
  details > summary::after { display: none; }
  .details__body { display: block !important; }
}
