/* Colours come from the :root block in the repo-root index.html, which is
   the source of truth for the whole product. See design-system/glider/MASTER.md.
   These were within a few points of the landing values already; the small
   drift was visible when moving between the landing page and a docs page,
   so they are now exact. */
:root {
  --ink: #12100e;
  --ink-soft: #55524a;
  --paper: #f5f1e8;
  --paper-deep: #e6e4dc;
  --line: #cfccc2;
  --accent: #0a7c8c;
  --accent-strong: #086672;
  --surface: rgba(251, 250, 247, 0.72);

  --code-bg: #12100e;
  --code-text: #f5f1e8;
  --code-border: #2f2b25;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --space: clamp(1.15rem, 4.5vw, 1.5rem);
  /* --measure is the reading measure for hero/intro copy. --doc is the
     content column for reference pages, which carry route and config
     tables that need more room than prose does. */
  --measure: 42rem;
  --doc: 52rem;
  --wide: 72rem;
}

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

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(10, 124, 140, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(18, 21, 26, 0.04), transparent 50%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 23px,
      rgba(18, 21, 26, 0.025) 24px
    );
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 0.6rem;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 3.75rem);
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

h3 {
  font-size: 1.35rem;
}

p {
  margin: 0 0 1.1em;
  color: var(--ink-soft);
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

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

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

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2rem 0;
}

blockquote {
  margin: 1.25rem 0;
  padding: 0 0 0 1rem;
  border-left: 3px solid var(--accent);
  background: none;
  font-size: 1.08em;
  color: var(--ink);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.12em 0.35em;
  background: var(--paper-deep);
  border-radius: 3px;
  color: var(--ink);
}

pre {
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 0 0 1.5rem;
  -webkit-overflow-scrolling: touch;
}

pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  border-radius: 0;
  white-space: pre;
  tab-size: 2;
}

.meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.15rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 0;
  text-decoration: none;
}

.btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--paper);
  text-decoration: none;
}

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

.btn-ghost:hover {
  background: var(--paper-deep);
  color: var(--ink);
  border-color: var(--ink-soft);
}

.wrap {
  width: min(100% - 2 * var(--space), var(--wide));
  margin-inline: auto;
  padding: 0 0 4rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
  position: sticky;
  top: 0;
  background: transparent;
  /* No paper tint, but the nav is sticky — keep the backdrop blur so
     content scrolling underneath it doesn't collide with the links. */
  backdrop-filter: blur(10px);
  z-index: 5;
}

/* The mark. Every docs page is a light ground, so the pair is fixed: an ink
   body and a teal wing. Citron never appears on a light ground, and the wing
   would be invisible there. The two paths are declared once per page, in the
   <symbol> at the top of <body>, and the brand link pulls that symbol in with
   <use>. Custom properties inherit into the shadow tree that <use> makes, so
   the pair is carried on variables. See design-system/glider/MASTER.md. */
:root {
  --mark-body: var(--ink);
  --mark-wing: var(--accent);
}

.mk {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

/* The nav brand is the only place the mark appears on a docs page. */
.nav .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-right: auto;
  text-decoration: none;
}

.nav .brand .mk {
  width: 20px;
  height: 20px;
}

.nav .brand:hover {
  color: var(--accent-strong);
}

.nav a {
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-decoration: none;
}

.nav a:hover,
.nav a.active {
  color: var(--ink);
}

.nav-section {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  pointer-events: none;
}

.hero {
  padding: 2rem 0 2.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
}

.hero p {
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 0.85rem;
  font-size: 1.05rem;
}

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

/* The one action of the hero. It is a link, not a button, because it goes
   to a page. The border makes it the first thing that a reader sees. */
.herolink {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  text-decoration: none;
  padding: 0.5rem 0.85rem;
  color: var(--accent-strong);
  background: var(--paper-deep);
  border: 1px solid var(--line);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.herolink:hover,
.herolink:focus-visible {
  background: var(--surface);
  border-color: var(--accent);
}

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 0;
  background: var(--paper-deep);
  color: var(--accent-strong);
  border: 1px solid var(--line);
  margin-bottom: 0.75rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1.1rem 1.2rem;
  display: block;
  color: inherit;
  text-decoration: none;
}

.card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}

.card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.card code {
  font-size: 0.85em;
}

main.prose,
.prose {
  max-width: var(--doc);
}

.prose.deep {
  max-width: min(var(--wide), 64rem);
}

.prose h1 {
  margin-top: 0;
}

.prose h2 {
  margin-top: 2.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.prose h3 {
  margin-top: 1.5rem;
}

.prose p,
.prose li {
  color: var(--ink-soft);
}

.prose strong {
  color: var(--ink);
}

.prose code,
.prose pre {
  font-family: var(--font-mono);
}

.prose code {
  background: var(--paper-deep);
  padding: 0.12rem 0.35rem;
  border-radius: 3px;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  color: var(--code-text);
}

.prose pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* One table box for the header and every body row, so columns line up
   down the whole grid. The previous rule gave each <tr> its own
   display:table box, which sized columns per-row independently and left
   the borders visibly ragged from row to row. */
.prose table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 0.9rem;
  margin: 1rem 0;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 0.7rem 0.85rem;
  text-align: left;
  vertical-align: top;
  color: var(--ink-soft);
  overflow-wrap: break-word;
}

/* Narrow viewports: scroll the table sideways rather than letting it
   overflow into the clipped body. thead + tbody stay inside one
   anonymous table box here, so columns remain aligned while scrolling. */
@media (max-width: 720px) {
  .prose table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

.prose th {
  background: var(--paper-deep);
  color: var(--ink);
  font-weight: 600;
}

.prose .note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0;
  padding: 0.85rem 1rem;
  margin: 1.25rem 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.prose .note strong {
  color: var(--ink);
}

.prose h2 + .note {
  margin-top: 0.75rem;
}

.prose .seq {
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre;
}

.prose .hint {
  color: var(--ink-soft);
  font-size: 0.88em;
}

.foot {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.foot a {
  color: var(--ink-soft);
}

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

.foot .lic {
  margin: 0.8rem 0 0;
  line-height: 1.7;
}

/* ── context-flow figure ─────────────────────────────────────────────
   One inline SVG, no script and no external file. It scrolls inside its
   own box on a narrow screen rather than making the page scroll. */
.ctxfig {
  margin: 1.6rem 0;
  overflow-x: auto;
}

.ctxfig svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
  color: var(--accent); /* currentColor drives the arrowheads */
}

.ctxfig figcaption {
  margin-top: 0.7rem;
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.55;
}

.ctx-lane {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--ink-soft);
}

.ctx-turn text {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  fill: var(--ink-soft);
  text-anchor: middle;
}

.ctx-box rect {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1;
}

.ctx-txt text {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--ink);
  text-anchor: middle;
}

.ctx-store {
  fill: var(--paper-deep);
  stroke: var(--accent);
  stroke-width: 1;
}

.ctx-store-lbl {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  fill: var(--ink);
}

.ctx-store-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-soft);
}

.ctx-tick circle { fill: var(--accent); }

.ctx-line path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.ctx-back path { stroke-dasharray: 4 3; }

.ctx-note,
.ctx-note text {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--ink-soft);
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.5rem;
}

.steps li {
  position: relative;
  padding: 0.85rem 1rem 0.85rem 3.25rem;
  margin: 0.5rem 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink-soft);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0.85rem;
  top: 0.85rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--paper-deep);
  color: var(--accent-strong);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps li strong {
  color: var(--ink);
}

.steps .tech {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  a {
    transition: color 160ms ease, text-decoration-color 160ms ease;
  }

  .btn {
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
  }

  .btn:hover {
    transform: translateY(-1px);
  }

  .card {
    transition: border-color 0.15s ease;
  }

  .rise {
    animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .rise-delay-1 {
    animation-delay: 80ms;
  }

  .rise-delay-2 {
    animation-delay: 160ms;
  }

  .rise-delay-3 {
    animation-delay: 240ms;
  }
}

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

  .rise,
  .rise-delay-1,
  .rise-delay-2,
  .rise-delay-3 {
    animation: none;
  }

  .btn:hover {
    transform: none;
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
  }

  body::before {
    opacity: 0.18;
  }
}

@media (max-width: 640px) {
  .nav .brand {
    width: 100%;
    margin-bottom: 0.25rem;
  }
}
