/* Voussoir site.
   The subject is masonry: an arch is a load-bearing arrangement of stones, and
   the joints between them are structure, not decoration. So the palette is the
   brand's slate and ember, the dividers are mortar lines rather than shadowed
   cards, and the one loud element is the keystone. */

:root {
  --slate-950: #0a0c10;
  --slate-900: #0e1116;
  --slate-850: #12151b;
  --slate-800: #161a21;
  --stone-700: #1f242d;
  --stone-600: #272c38;
  --stone-500: #343b49;
  --mortar: #05070a;
  --chalk: #e9e7e2;
  --dust: #a5a29b;
  --dust-dim: #78756e;
  --ember: #f98a28;
  --ember-bright: #ffc97a;
  --ember-deep: #c2500d;

  --display: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --measure: 68ch;
  --pad: clamp(1.25rem, 4vw, 3rem);
}

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

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

body {
  margin: 0;
  background: var(--slate-900);
  color: var(--chalk);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  /* A faint vertical grain, as if the page were a cut face of stone. */
  background-image:
    repeating-linear-gradient(90deg, rgb(255 255 255 / 0.012) 0 1px, transparent 1px 3px);
}

a { color: var(--ember-bright); text-decoration-color: rgb(249 138 40 / 0.4); text-underline-offset: 0.2em; }
a:hover { color: #fff3e2; text-decoration-color: currentColor; }

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

/* ---------- shell ---------- */

.wrap { max-width: 1180px; margin: 0 auto; padding-inline: var(--pad); }

.topbar {
  border-bottom: 1px solid var(--mortar);
  background: color-mix(in oklab, var(--slate-900) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--chalk);
  text-decoration: none;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  font-variant: small-caps;
  text-transform: lowercase;
}
.brand img { width: 1.6rem; height: 1.6rem; display: block; }
.brand:hover { color: var(--ember-bright); }

.topnav { margin-left: auto; display: flex; gap: 1.4rem; font-size: 0.9rem; }
.topnav a { color: var(--dust); text-decoration: none; }
.topnav a:hover { color: var(--chalk); }

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding-block: clamp(3rem, 8vw, 6rem);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dust-dim);
  margin: 0 0 1.1rem;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 1.2rem;
  text-wrap: balance;
}
.hero h1 em {
  font-style: normal;
  color: var(--ember-bright);
}
.hero p.lede {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--dust);
  max-width: 46ch;
  margin: 0 0 2rem;
  text-wrap: pretty;
}

.term {
  font-family: var(--mono);
  font-size: 0.86rem;
  background: var(--slate-950);
  border: 1px solid var(--stone-700);
  border-radius: 4px;
  padding: 0.9rem 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.9rem;
  align-items: baseline;
  max-width: 34rem;
  overflow-x: auto;
}
.term .pfx { color: var(--ember); user-select: none; }
.term code { color: var(--chalk); white-space: nowrap; }
.term .cmt { color: var(--dust-dim); }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.6rem; }
.btn {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border-radius: 3px;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid var(--stone-500);
  color: var(--chalk);
  background: transparent;
  transition: background-color 120ms, border-color 120ms;
}
.btn:hover { background: var(--stone-700); border-color: var(--stone-600); color: var(--chalk); }
.btn.primary {
  background: var(--ember-deep);
  border-color: var(--ember-deep);
  color: #fff6ea;
}
.btn.primary:hover { background: var(--ember); border-color: var(--ember); color: var(--slate-950); }

/* ---------- the arch: the page's signature ---------- */

.arch { position: relative; }
.arch svg { display: block; width: 100%; height: auto; overflow: visible; }
.arch .stone {
  fill: var(--stone-700);
  stroke: var(--slate-900);
  stroke-width: 3;
  stroke-linejoin: round;
  transition: fill 160ms ease, transform 160ms ease;
  transform-origin: 200px 300px;
}
.arch a:nth-child(odd) .stone { fill: var(--stone-600); }
.arch .keystone {
  fill: url(#keystoneGrad);
  stroke: var(--slate-900);
}
.arch a:hover .stone,
.arch a:focus-visible .stone { fill: var(--ember); }
.arch a:hover .keystone,
.arch a:focus-visible .keystone { fill: url(#keystoneHot); }
.arch a:focus-visible { outline: none; }
.arch .label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  fill: var(--dust-dim);
}
.arch .label.hot { fill: var(--ember-bright); }
.arch figcaption {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dust-dim);
  text-align: center;
  margin-top: 0.4rem;
  min-height: 1.2em;
}

@media (prefers-reduced-motion: no-preference) {
  .arch .stone { animation: set 520ms cubic-bezier(.2,.7,.3,1) backwards; }
  .arch a:nth-child(1) .stone { animation-delay: 40ms; }
  .arch a:nth-child(2) .stone { animation-delay: 90ms; }
  .arch a:nth-child(3) .stone { animation-delay: 140ms; }
  .arch a:nth-child(4) .stone { animation-delay: 190ms; }
  .arch a:nth-child(5) .stone { animation-delay: 240ms; }
  .arch a:nth-child(6) .stone { animation-delay: 290ms; }
  .arch a:nth-child(7) .stone { animation-delay: 340ms; }
  .arch a:nth-child(8) .stone { animation-delay: 390ms; }
  .arch a:nth-child(9) .stone { animation-delay: 440ms; }
  @keyframes set {
    from { opacity: 0; transform: translateY(-14px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ---------- bands ---------- */

.band { border-top: 1px solid var(--mortar); padding-block: clamp(2.5rem, 6vw, 4.5rem); }
.band h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}
.band > .wrap > p { color: var(--dust); max-width: var(--measure); margin-top: 0; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1px; background: var(--mortar); border: 1px solid var(--mortar); margin-top: 2rem; }
.cols > div { background: var(--slate-850); padding: 1.4rem; }
.cols h3 { margin: 0 0 0.4rem; font-size: 1rem; font-weight: 600; letter-spacing: 0.01em; }
.cols p { margin: 0; color: var(--dust); font-size: 0.94rem; }
.cols .n { font-family: var(--mono); font-size: 0.75rem; color: var(--ember); display: block; margin-bottom: 0.7rem; }

pre {
  background: var(--slate-950);
  border: 1px solid var(--stone-700);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
  margin: 1.2rem 0;
}
code { font-family: var(--mono); font-size: 0.9em; }
p code, li code, td code { background: var(--stone-700); padding: 0.12em 0.36em; border-radius: 2px; }
pre code { background: none; padding: 0; }

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

.docshell { display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3.5rem); padding-block: 2.5rem; align-items: start; }

.side { position: sticky; top: 4.5rem; font-size: 0.9rem; max-height: calc(100vh - 6rem); overflow-y: auto; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side > ul > li { border-top: 1px solid var(--mortar); }
.side > ul > li:last-child { border-bottom: 1px solid var(--mortar); }
.side a { display: block; padding: 0.5rem 0 0.5rem 0.85rem; color: var(--dust); text-decoration: none; border-left: 2px solid transparent; }
.side a:hover { color: var(--chalk); border-left-color: var(--stone-500); }
.side a[aria-current="page"] { color: var(--ember-bright); border-left-color: var(--ember); }
.side ul ul a { padding-left: 1.7rem; font-size: 0.86rem; }
/* Child chapters, marked by depth in SUMMARY.md rather than a nested list. */
.side a.sub { padding-left: 1.7rem; font-size: 0.86rem; }
.side .grp { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust-dim); padding: 1rem 0 0.3rem 0.85rem; }

.prose { max-width: var(--measure); }
.prose h1 { font-family: var(--display); font-weight: 400; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 1.2rem; letter-spacing: -0.015em; }
.prose h2 { font-family: var(--display); font-weight: 400; font-size: 1.55rem; margin: 2.4rem 0 0.7rem; padding-top: 1.4rem; border-top: 1px solid var(--mortar); }
.prose h3 { font-size: 1.05rem; margin: 1.8rem 0 0.5rem; color: var(--ember-bright); font-weight: 600; }
.prose p, .prose li { color: #d8d5cf; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin: 0.3rem 0; }
.prose blockquote { margin: 1.4rem 0; padding: 0.2rem 0 0.2rem 1rem; border-left: 2px solid var(--ember-deep); color: var(--dust); }
.prose table { border-collapse: collapse; width: 100%; margin: 1.3rem 0; font-size: 0.92rem; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--stone-700); vertical-align: top; }
.prose th { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dust-dim); font-weight: 500; }
.prose hr { border: 0; border-top: 1px solid var(--mortar); margin: 2rem 0; }
.prose img { max-width: 100%; height: auto; }
.prose > :first-child { margin-top: 0; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--mortar); border: 1px solid var(--mortar); margin-top: 3rem; }
.pager a { background: var(--slate-850); padding: 0.9rem 1.1rem; text-decoration: none; display: block; }
.pager a:hover { background: var(--stone-700); }
.pager .k { display: block; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust-dim); margin-bottom: 0.2rem; }
.pager .t { color: var(--chalk); font-size: 0.95rem; }
.pager .next { text-align: right; }
.pager .empty { background: var(--slate-850); }

.editline { margin-top: 2rem; font-size: 0.82rem; color: var(--dust-dim); }

footer.site { border-top: 1px solid var(--mortar); padding-block: 2.5rem; color: var(--dust-dim); font-size: 0.86rem; }
footer.site .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: baseline; }
footer.site .spacer { margin-left: auto; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .arch { order: -1; max-width: 26rem; margin-inline: auto; }
  .docshell { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; border-bottom: 1px solid var(--mortar); padding-bottom: 1rem; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { text-align: left; }
}

/* The two legs: the piers the arch stands on. They are not chapters, so they
   stay darker than any stone and get no hover, which keeps the arch reading as
   something carried by the stones above it. */
.arch .leg {
  fill: var(--slate-850);
  stroke: var(--slate-900);
  stroke-width: 3;
}
