/* The Shutter Manual
   ---------------------------------------------------------------------------
   Two themes, both built from the same idea: a filmstrip. The chassis is the
   dark base of the stock, the reading column is the exposed frame. `paper`
   keeps that literal contrast; `night` dims the frame for reading in the dark.

   Colour is a tungsten/daylight pair - 3200K against 5600K - which is the
   contrast a cinematographer balances every day. Tungsten marks where you are;
   daylight marks what you can act on. Nothing else is coloured.
   --------------------------------------------------------------------------- */

:root {
  /* Chassis - identical in both themes. */
  --ink:     #0E1116;
  --ink-2:   #141920;
  --ink-3:   #1C232C;
  --ink-4:   #2A333F;
  --on-ink:  #C6CDD6;
  --on-ink-2:#7C8895;

  /* Instruments */
  --tungsten:  #E0561F;
  --tungsten-d:#B4400F;
  --daylight:  #4FA3C7;
  --daylight-d:#2E7E9F;

  /* Reading surface */
  --paper:   #FCFBF8;
  --paper-2: #F2F0EA;
  --paper-3: #E6E3DA;
  --text:    #16191E;
  --text-2:  #565C66;
  --text-3:  #8A9098;
  --rule:    #DFDCD3;
  --mark:    #FFE9A8;

  --fs-body: 1.0625rem;

  --f-display: Archivo, "Helvetica Neue", Arial, sans-serif;
  --f-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --nav-w: 17.5rem;
  --rail-w: 14rem;
  --bar-h: 3.75rem;
  --measure: 40rem;

  --ease: cubic-bezier(.2, .7, .3, 1);
}

[data-theme="night"] {
  --paper:   #12161C;
  --paper-2: #171C24;
  --paper-3: #1F262F;
  --text:    #DCE2E9;
  --text-2:  #98A2AE;
  --text-3:  #6E7885;
  --rule:    #262E38;
  --mark:    #4A3C12;
}

[data-size="m"] { --fs-body: 1.1875rem; --measure: 42rem; }
[data-size="l"] { --fs-body: 1.3125rem; --measure: 44rem; }

* { box-sizing: border-box; }

/* The `hidden` attribute is a UA rule (`[hidden] { display: none }`), so any
   class that sets `display` outranks it on specificity. .overlay, .shell and
   .topbar all do. Without this the search panel is open on first paint. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: 1.7;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

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

.skip {
  position: fixed; left: .75rem; top: .75rem; z-index: 200;
  transform: translateY(-150%);
  background: var(--tungsten); color: #fff;
  padding: .55rem .9rem; border-radius: .25rem;
  font: 600 .8125rem/1 var(--f-display); text-decoration: none;
}
.skip:focus { transform: none; }

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

/* --------------------------------------------------------------- shutter disc
   The wedge path is written by JS; these are just the fills. A shutter reads
   from 12 o'clock clockwise, so 180 degrees is the right half.

   A closed disc still has to look like an instrument, so the ring carries the
   shape and the body only gives it weight. The two colours are variables
   because a disc sits on the dark chassis in the sidebar and on white paper in
   the contents list, and one fill cannot serve both. */
:root { --disc-bg: #232B36; --disc-ring: #3C4653; }
.main { --disc-bg: #E4E0D6; --disc-ring: #C4BFB2; }
[data-theme="night"] .main { --disc-bg: #232B36; --disc-ring: #3C4653; }
.resume { --disc-bg: #2B3441; --disc-ring: #46515F; }

.disc-body { fill: var(--disc-bg); }
.disc-wedge { fill: var(--tungsten); transition: d .5s var(--ease); }
.disc-ring { fill: none; stroke: var(--disc-ring); stroke-width: 5; }

/* ------------------------------------------------------------------- booting */
.boot {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-content: center; justify-items: center; gap: 1.25rem;
  background: var(--ink);
  transition: opacity .4s var(--ease);
}
.boot.gone { opacity: 0; pointer-events: none; }
.boot-disc { width: 3.5rem; height: 3.5rem; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-label {
  margin: 0; font: 500 .75rem/1 var(--f-display);
  letter-spacing: .16em; text-transform: uppercase; color: var(--on-ink-2);
}

/* -------------------------------------------------------------------- topbar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 60;
  height: var(--bar-h);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1rem 0 1.125rem;
  background: color-mix(in srgb, var(--ink) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--ink-3);
}

.brand {
  display: flex; align-items: center; gap: .75rem;
  text-decoration: none; color: var(--on-ink);
  flex: 0 0 auto; width: calc(var(--nav-w) - 1.125rem);
  min-width: 0;
}
.brand-disc { width: 1.75rem; height: 1.75rem; flex: 0 0 auto; }
.brand-text { display: grid; min-width: 0; }
.brand-name {
  font: 700 .9375rem/1.2 var(--f-display);
  font-stretch: 108%; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub {
  font: 400 .6875rem/1.3 var(--f-mono);
  color: var(--on-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand:hover .brand-name { color: #fff; }

.searchbtn {
  flex: 1 1 auto; max-width: 30rem;
  display: flex; align-items: center; gap: .625rem;
  height: 2.25rem; padding: 0 .5rem 0 .75rem;
  background: var(--ink-2); color: var(--on-ink-2);
  border: 1px solid var(--ink-3); border-radius: .375rem;
  font: 400 .8125rem/1 var(--f-display);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.searchbtn:hover { border-color: var(--daylight-d); color: var(--on-ink); }
.searchbtn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; flex: 0 0 auto; }
.searchbtn span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

kbd {
  font: 500 .6875rem/1 var(--f-mono);
  padding: .25rem .375rem; border-radius: .1875rem;
  background: var(--ink-3); color: var(--on-ink-2);
  border: 1px solid var(--ink-4);
}

.topright { display: flex; align-items: center; gap: .5rem; margin-left: auto; }

.gauge { position: relative; display: grid; place-items: center; width: 2.625rem; height: 2.625rem; }
.gauge .disc-hole { fill: var(--ink); }
.gauge-disc { width: 100%; height: 100%; }
.gauge-num {
  position: absolute; font: 600 .625rem/1 var(--f-mono);
  color: #fff; letter-spacing: -.04em;
}
.gauge-num i { font-style: normal; opacity: .55; font-size: .8em; }

.iconbtn {
  width: 2.125rem; height: 2.125rem; display: grid; place-items: center;
  background: transparent; color: var(--on-ink-2);
  border: 1px solid var(--ink-3); border-radius: .375rem;
  cursor: pointer; font: 600 .75rem/1 var(--f-display);
  transition: color .15s, border-color .15s;
}
.iconbtn:hover { color: var(--on-ink); border-color: var(--ink-4); }
.iconbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.iconbtn .ic-sun { display: none; }
[data-theme="night"] .iconbtn .ic-sun { display: block; }
[data-theme="night"] .iconbtn .ic-moon { display: none; }
.iconbtn.menu { display: none; }

/* --------------------------------------------------------------------- shell */
.shell {
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--rail-w);
  padding-top: var(--bar-h);
  min-height: 100vh;
}
/* The contents page has no sections to list, so the rail would be a dead
   column of chassis. Drop it and let the reading measure centre itself. */
.shell.contents { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.shell.contents .rail { display: none; }

/* ----------------------------------------------------------------------- nav */
.nav {
  position: sticky; top: var(--bar-h); align-self: start;
  height: calc(100vh - var(--bar-h));
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--ink);
  border-right: 1px solid var(--ink-3);
  scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent;
}
.nav-inner { padding: 1.25rem 0 4rem; }

.nav-part {
  display: flex; align-items: baseline; gap: .5rem;
  padding: 1.5rem 1.125rem .5rem;
  font: 600 .6875rem/1 var(--f-display);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-ink-2);
}
.nav-part:first-child { padding-top: .25rem; }
.nav-part b { color: var(--tungsten); font-weight: 600; }

.nav-item {
  display: grid; grid-template-columns: 1.375rem 1fr; align-items: center;
  gap: .625rem; padding: .4375rem 1.125rem;
  text-decoration: none; color: var(--on-ink-2);
  border-left: 2px solid transparent;
  transition: color .15s, background .15s;
}
.nav-item:hover { color: var(--on-ink); background: var(--ink-2); }
.nav-item[aria-current="page"] {
  color: #fff; background: var(--ink-2); border-left-color: var(--tungsten);
}
.nav-disc { width: 1.375rem; height: 1.375rem; }
.nav-label { display: grid; min-width: 0; }
.nav-t {
  font: 500 .8125rem/1.35 var(--f-display);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nav-n {
  font: 400 .625rem/1.2 var(--f-mono);
  color: var(--on-ink-2); opacity: .8;
}
.nav-item[aria-current="page"] .nav-n { color: var(--tungsten); opacity: 1; }
.nav-item.done .nav-t { color: var(--on-ink); }

/* ---------------------------------------------------------------------- main */
.main {
  background: var(--paper);
  min-width: 0; position: relative;
}

/* Exposure strip: position within the chapter, drawn as film perforations. */
.exposure {
  position: sticky; top: var(--bar-h); z-index: 20;
  height: 2px; background: var(--paper-3);
}
.exposure i {
  display: block; height: 100%; width: 0;
  background: var(--tungsten);
  transition: width .12s linear;
}

.chapter {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 2rem 8rem;
  outline: none;
}
@media (min-width: 60rem) { .chapter { padding-left: 3.5rem; padding-right: 3.5rem; } }

/* ------------------------------------------------------------- chapter head */
.ch-head { margin-bottom: 3rem; }
.ch-eyebrow {
  display: flex; align-items: center; gap: .625rem;
  font: 600 .6875rem/1 var(--f-display);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 1.75rem;
}
.ch-eyebrow b { color: var(--tungsten); font-weight: 600; }
.ch-eyebrow s { flex: 1; height: 1px; background: var(--rule); text-decoration: none; }

.ch-num {
  display: block;
  font-family: var(--f-display); font-weight: 800; font-stretch: 125%;
  font-size: clamp(3.5rem, 11vw, 6rem); line-height: .8;
  letter-spacing: -.045em;
  color: var(--text); margin-bottom: .5rem;
  font-variant-numeric: tabular-nums;
}
.ch-h1, .ch-title {
  font-family: var(--f-display); font-weight: 700; font-stretch: 105%;
  font-size: clamp(1.75rem, 4.6vw, 2.625rem); line-height: 1.08;
  letter-spacing: -.025em; margin: 0 0 1.25rem;
  color: var(--text); text-wrap: balance;
}
.ch-h1 { display: none; } /* the built head supplies the title */

.ch-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .875rem;
  font: 400 .75rem/1 var(--f-mono); color: var(--text-3);
  padding-bottom: 1.5rem; border-bottom: 1px solid var(--rule);
}
.ch-meta em { font-style: normal; color: var(--tungsten); }
.ch-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--rule); }

/* -------------------------------------------------------------------- prose */
.chapter h2 {
  font-family: var(--f-display); font-weight: 700; font-stretch: 103%;
  font-size: 1.4375rem; line-height: 1.25; letter-spacing: -.017em;
  margin: 3.25rem 0 1rem; color: var(--text); text-wrap: balance;
}
.chapter h3 {
  font-family: var(--f-display); font-weight: 600;
  font-size: 1.0625rem; line-height: 1.35; letter-spacing: -.008em;
  margin: 2.25rem 0 .75rem; color: var(--text); text-wrap: balance;
}
.chapter h4 {
  font: 600 .8125rem/1.4 var(--f-display);
  letter-spacing: .06em; text-transform: uppercase;
  margin: 2rem 0 .625rem; color: var(--text-2);
}
.anchored { position: relative; }
.anchor {
  position: absolute; left: -1.25rem; top: 50%; transform: translateY(-50%);
  color: var(--text-3); text-decoration: none; opacity: 0;
  font: 400 1em/1 var(--f-mono); transition: opacity .15s;
}
.anchored:hover .anchor, .anchor:focus { opacity: 1; }
@media (max-width: 60rem) { .anchor { display: none; } }

.chapter p { margin: 0 0 1.25rem; }
.chapter > p:first-of-type { font-size: 1.06em; }

.chapter strong { font-weight: 700; color: var(--text); }
.chapter em { font-style: italic; }

.chapter a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--daylight);
  text-decoration-thickness: 1.5px;
  text-underline-offset: .17em;
  transition: color .15s;
}
.chapter a:hover { color: var(--daylight-d); }
[data-theme="night"] .chapter a:hover { color: var(--daylight); }

/* Chrome rendered inside the article is not prose. Match the prose selector's
   specificity so it does not inherit underlines and link colour. */
.chapter a.toc-item, .chapter a.resume-go, .chapter a.anchor,
.chapter .pagenav a, .chapter a.xref-plain {
  text-decoration: none;
}
.chapter a.toc-item:hover, .chapter a.resume-go:hover,
.chapter .pagenav a:hover { color: inherit; }
.chapter a.resume-go, .chapter a.resume-go:hover { color: #fff; }

.chapter ul, .chapter ol { margin: 0 0 1.25rem; padding-left: 1.375rem; }
.chapter li { margin-bottom: .4375rem; }
.chapter li::marker { color: var(--text-3); }

.chapter hr {
  border: 0; height: 1px; background: var(--rule);
  margin: 3rem 0;
}

.chapter blockquote {
  margin: 1.75rem 0; padding: .125rem 0 .125rem 1.25rem;
  border-left: 2px solid var(--tungsten);
  color: var(--text-2); font-style: italic;
}
.chapter blockquote p:last-child { margin-bottom: 0; }

/* Inline code, and the file:line citation that runs through the whole manual. */
.chapter :not(pre) > code {
  font: 500 .855em/1.4 var(--f-mono);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: .1875rem;
  padding: .0625rem .3125rem;
  word-break: break-word;
}
.chapter code.cite {
  background: transparent; border: 0; padding: 0;
  white-space: nowrap;
  border-bottom: 1px dashed var(--rule);
}
.cite-f { color: var(--text-2); }
.cite-l { color: var(--tungsten); font-weight: 600; }

/* ---------------------------------------------------------------- code block */
.code {
  position: relative;
  margin: 1.75rem 0;
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: .375rem;
  overflow: hidden;
}
.code::before {
  content: attr(data-lang);
  position: absolute; top: 0; right: 0;
  padding: .3125rem .625rem;
  font: 500 .625rem/1 var(--f-mono);
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--on-ink-2);
  pointer-events: none;
}
.code[data-lang=""]::before { content: none; }
.code pre {
  margin: 0; padding: 1.0625rem 1.125rem;
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent;
}
.code code {
  font: 400 .8125rem/1.65 var(--f-mono);
  color: var(--on-ink);
  white-space: pre; -webkit-font-smoothing: antialiased;
}
.copy {
  position: absolute; top: .375rem; right: .375rem; z-index: 2;
  padding: .25rem .5rem; border-radius: .1875rem;
  background: var(--ink-3); color: var(--on-ink-2);
  border: 1px solid var(--ink-4);
  font: 500 .6875rem/1 var(--f-display);
  cursor: pointer; opacity: 0; transition: opacity .15s, color .15s;
}
.code:hover .copy, .copy:focus { opacity: 1; }
.copy:hover { color: #fff; }
.copy.ok { color: var(--daylight); opacity: 1; }
.code:hover::before { opacity: 0; }

.t-c  { color: #6E7C8C; font-style: italic; }
.t-s  { color: #C9A26D; }
.t-k  { color: #E0561F; }
.t-ty { color: #7FB6D1; }
.t-n  { color: #B8CE7E; }
.t-f  { color: #E4E9EF; }
.t-p  { color: #C08BC0; }

/* -------------------------------------------------------------------- tables */
.table-wrap {
  margin: 1.75rem 0; overflow-x: auto; overscroll-behavior-x: contain;
  border: 1px solid var(--rule); border-radius: .375rem;
  scrollbar-width: thin;
}
.chapter table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.chapter th {
  text-align: left; padding: .625rem .875rem;
  font: 600 .6875rem/1.3 var(--f-display);
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-2); background: var(--paper-2);
  border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.chapter td {
  padding: .625rem .875rem; vertical-align: top;
  border-bottom: 1px solid var(--rule); line-height: 1.55;
}
.chapter tbody tr:last-child td { border-bottom: 0; }
.chapter td code { font-size: .8em; }

/* ------------------------------------------------------------------- pagenav */
.pagenav {
  display: grid; gap: .75rem; grid-template-columns: 1fr 1fr;
  margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--rule);
}
.pagenav a {
  display: grid; gap: .25rem; padding: 1rem 1.125rem;
  border: 1px solid var(--rule); border-radius: .375rem;
  text-decoration: none; color: var(--text);
  transition: border-color .15s, background .15s;
}
.pagenav a:hover { border-color: var(--tungsten); background: var(--paper-2); }
.pagenav a.next { text-align: right; }
.pagenav .lbl {
  font: 600 .625rem/1 var(--f-display);
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
}
.pagenav .ttl { font: 600 .9375rem/1.3 var(--f-display); letter-spacing: -.012em; }
.pagenav a:only-child { grid-column: 2; }

/* --------------------------------------------------------------- done button */
.donebar {
  display: flex; align-items: center; gap: .875rem; flex-wrap: wrap;
  margin-top: 2.5rem; padding: 1.125rem 1.25rem;
  background: var(--paper-2); border: 1px solid var(--rule);
  border-radius: .375rem;
}
.donebar p { margin: 0; font: 400 .875rem/1.5 var(--f-display); color: var(--text-2); flex: 1; min-width: 12rem; }
.donebtn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .875rem; border-radius: .25rem;
  background: var(--tungsten); color: #fff; border: 1px solid var(--tungsten);
  font: 600 .8125rem/1 var(--f-display); cursor: pointer;
  transition: background .15s;
}
.donebtn:hover { background: var(--tungsten-d); border-color: var(--tungsten-d); }
.donebtn[data-done="1"] { background: transparent; color: var(--text-2); border-color: var(--rule); }
.donebtn[data-done="1"]:hover { border-color: var(--text-3); }
.donebtn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------------- rail */
.rail {
  position: sticky; top: var(--bar-h); align-self: start;
  height: calc(100vh - var(--bar-h));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 2rem 1.25rem 4rem 1rem;
  background: var(--ink);
  border-left: 1px solid var(--ink-3);
  scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent;
}
.rail-h {
  font: 600 .625rem/1 var(--f-display);
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-ink-2); margin: 0 0 .875rem;
}
.rail a {
  display: block; padding: .3125rem 0 .3125rem .75rem;
  border-left: 2px solid var(--ink-3);
  font: 400 .75rem/1.45 var(--f-display);
  color: var(--on-ink-2); text-decoration: none;
  transition: color .15s, border-color .15s;
}
.rail a.sub { padding-left: 1.5rem; font-size: .71875rem; }
.rail a:hover { color: var(--on-ink); }
.rail a.here { color: #fff; border-left-color: var(--tungsten); }

.rail-stat {
  margin-top: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--ink-3);
  display: grid; gap: .5rem;
}
.rail-stat div { display: flex; justify-content: space-between; gap: .5rem; font: 400 .6875rem/1.4 var(--f-mono); color: var(--on-ink-2); }
.rail-stat b { color: var(--on-ink); font-weight: 500; }

/* ------------------------------------------------------------------ contents */
.toc-hero { padding: .5rem 0 1.75rem; }
.toc-kicker {
  font: 600 .6875rem/1 var(--f-display);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--tungsten); margin: 0 0 1.25rem;
}
.toc-title {
  font-family: var(--f-display); font-weight: 800; font-stretch: 118%;
  font-size: clamp(2.5rem, 8vw, 4.25rem); line-height: .95;
  letter-spacing: -.04em; margin: 0 0 1.25rem; color: var(--text);
  text-wrap: balance;
}
.toc-lede {
  font-size: 1.1875rem; line-height: 1.6; color: var(--text-2);
  margin: 0 0 2rem; max-width: 34rem;
}
.toc-stats {
  display: flex; flex-wrap: wrap; gap: 0 2rem;
  padding: 1.25rem 0; margin-bottom: 1.75rem;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
}
.toc-stat { display: grid; gap: .1875rem; }
.toc-stat b {
  font: 700 1.375rem/1 var(--f-display); font-stretch: 112%;
  letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums;
}
.toc-stat span {
  font: 400 .6875rem/1 var(--f-mono);
  letter-spacing: .04em; color: var(--text-3);
}

.resume {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.25rem; margin-bottom: 2.5rem;
  background: var(--ink); border-radius: .5rem;
  color: var(--on-ink);
}
.resume .rd { width: 2.75rem; height: 2.75rem; flex: 0 0 auto; }
.resume-txt { flex: 1; min-width: 11rem; display: grid; gap: .1875rem; }
.resume-lbl { font: 600 .625rem/1 var(--f-display); letter-spacing: .14em; text-transform: uppercase; color: var(--on-ink-2); }
.resume-ch { font: 600 1rem/1.3 var(--f-display); letter-spacing: -.015em; color: #fff; }
.resume-go {
  padding: .5625rem 1rem; border-radius: .25rem;
  background: var(--tungsten); color: #fff; border: 0;
  font: 600 .8125rem/1 var(--f-display); text-decoration: none;
  transition: background .15s;
}
.resume-go:hover { background: var(--tungsten-d); }

.part-block { margin-bottom: 2.75rem; }
.part-head {
  display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap;
  margin-bottom: .375rem;
}
.part-lbl {
  font: 700 .6875rem/1 var(--f-display);
  letter-spacing: .14em; text-transform: uppercase; color: var(--tungsten);
}
.part-name {
  font: 700 1.125rem/1.2 var(--f-display); font-stretch: 106%;
  letter-spacing: -.018em; color: var(--text);
}
.part-blurb { font-size: .875rem; color: var(--text-3); margin: 0 0 1rem; }

.toc-item {
  display: grid; grid-template-columns: 2rem 1fr auto; align-items: center;
  gap: .875rem; padding: .8125rem .5rem .8125rem 0;
  border-top: 1px solid var(--rule);
  text-decoration: none; color: var(--text);
  transition: background .15s, padding-left .15s;
}
.toc-item:hover { background: var(--paper-2); padding-left: .5rem; }
.toc-item:last-child { border-bottom: 1px solid var(--rule); }
.toc-d { width: 1.75rem; height: 1.75rem; }
.toc-body { min-width: 0; display: grid; gap: .1875rem; }
.toc-n { font: 400 .6875rem/1 var(--f-mono); color: var(--text-3); }
.toc-t { font: 600 1rem/1.3 var(--f-display); letter-spacing: -.015em; text-wrap: balance; }
.toc-time { font: 400 .6875rem/1 var(--f-mono); color: var(--text-3); white-space: nowrap; }

/* -------------------------------------------------------------------- search */
.overlay {
  position: fixed; inset: 0; z-index: 100;
  background: color-mix(in srgb, var(--ink) 72%, transparent);
  backdrop-filter: blur(6px);
  display: grid; align-items: start; justify-items: center;
  padding: max(3rem, 8vh) 1rem 1rem;
  animation: fade .16s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.search {
  width: min(44rem, 100%);
  max-height: min(38rem, 80vh);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: .625rem;
  box-shadow: 0 24px 64px -12px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.search-head {
  display: flex; align-items: center; gap: .75rem;
  padding: .875rem 1rem; border-bottom: 1px solid var(--rule);
}
.search-ic { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-linecap: round; flex: 0 0 auto; }
#q {
  flex: 1; min-width: 0; border: 0; background: transparent;
  font: 400 1rem/1.4 var(--f-display); color: var(--text);
  outline: none; -webkit-appearance: none;
}
#q::placeholder { color: var(--text-3); }
#q::-webkit-search-cancel-button { display: none; }
.esc {
  border: 1px solid var(--rule); background: transparent; color: var(--text-3);
  border-radius: .1875rem; padding: .25rem .4375rem;
  font: 500 .6875rem/1 var(--f-mono); cursor: pointer;
}
.esc:hover { color: var(--text); }

.search-body { overflow-y: auto; overscroll-behavior: contain; padding: .5rem; scrollbar-width: thin; }

.s-group {
  font: 600 .625rem/1 var(--f-display);
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-3);
  padding: .875rem .75rem .5rem;
}
.s-hit {
  display: block; width: 100%; text-align: left;
  padding: .625rem .75rem; border-radius: .3125rem;
  border: 0; background: transparent; cursor: pointer;
  text-decoration: none; color: inherit; font: inherit;
}
.s-hit:hover, .s-hit.sel { background: var(--paper-2); }
.s-hit.sel { box-shadow: inset 2px 0 0 var(--tungsten); }
.s-top { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .1875rem; }
.s-ch { font: 400 .6875rem/1 var(--f-mono); color: var(--tungsten); flex: 0 0 auto; }
.s-h { font: 600 .875rem/1.3 var(--f-display); letter-spacing: -.01em; color: var(--text); min-width: 0; }
.s-snip { font-size: .8125rem; line-height: 1.5; color: var(--text-2); }
.s-snip mark, .s-h mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

.s-term { border-left: 2px solid var(--daylight); padding-left: .625rem; margin: .25rem .75rem .5rem; }
.s-term .tw { font: 700 .9375rem/1.3 var(--f-display); color: var(--text); }
.s-term .td { font-size: .875rem; line-height: 1.55; color: var(--text-2); }
.s-term .tr { font: 400 .6875rem/1 var(--f-mono); color: var(--text-3); margin-top: .25rem; }

.s-empty { padding: 2.5rem 1rem; text-align: center; color: var(--text-3); font-size: .875rem; }
.s-empty b { display: block; color: var(--text-2); font: 600 .9375rem/1.4 var(--f-display); margin-bottom: .25rem; }

.search-foot {
  display: flex; gap: 1rem; padding: .625rem 1rem;
  border-top: 1px solid var(--rule); background: var(--paper-2);
  font: 400 .6875rem/1.6 var(--f-display); color: var(--text-3);
}
.search-foot span { display: flex; align-items: center; gap: .3125rem; }
.search-foot kbd { background: var(--paper); border-color: var(--rule); color: var(--text-3); }

/* Landing highlight after jumping to a search hit. */
@keyframes flash { 0%, 100% { background: transparent; } 12%, 55% { background: var(--mark); } }
.flash { animation: flash 1.9s var(--ease); border-radius: 3px; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 78rem) {
  .shell { grid-template-columns: var(--nav-w) minmax(0, 1fr); }
  .rail { display: none; }
}
@media (max-width: 58rem) {
  :root { --bar-h: 3.25rem; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .brand { width: auto; flex: 0 1 auto; }
  .brand-sub { display: none; }
  .searchbtn span { display: none; }
  .searchbtn kbd { display: none; }
  .searchbtn { flex: 0 0 auto; width: 2.25rem; justify-content: center; padding: 0; }
  .iconbtn.menu { display: grid; }
  #typeBtn { display: none; }

  .nav {
    position: fixed; inset: var(--bar-h) auto 0 0; z-index: 55;
    width: min(20rem, 86vw); height: auto;
    transform: translateX(-101%);
    transition: transform .26s var(--ease);
    box-shadow: 0 0 40px rgba(0, 0, 0, .5);
  }
  .nav.open { transform: none; }
  .chapter { padding: 2.25rem 1.25rem 5rem; }
  .pagenav { grid-template-columns: 1fr; }
  .pagenav a.next { text-align: left; }
  .pagenav a:only-child { grid-column: 1; }
  .toc-stats { gap: 0 1.25rem; }
}

.scrim {
  position: fixed; inset: var(--bar-h) 0 0 0; z-index: 54;
  background: rgba(0, 0, 0, .45); border: 0; padding: 0;
  animation: fade .2s var(--ease);
}
@media (min-width: 58.0625rem) { .scrim { display: none; } }

@media print {
  .topbar, .nav, .rail, .overlay, .pagenav, .donebar, .exposure, .copy { display: none !important; }
  .shell { display: block; padding: 0; }
  .main { background: #fff; }
  .chapter { max-width: none; padding: 0; }
  .code { background: #f6f6f4; border-color: #ddd; }
  .code code, .t-c, .t-s, .t-k, .t-ty, .t-n, .t-f, .t-p { color: #111 !important; }
}
