/* Workplace Survival Guide, styled as Royal Velvet.
 *
 * Source of truth: .obsidian/themes/Royal Velvet/theme.css v0.11.8, the theme
 * this vault runs in dark mode, with the noctalia snippet NOT applied. Values
 * copied from the .theme-dark block and from the h1 to h6 gradient rules.
 *
 *   --layer-hue-sat   235, 15%
 *   layer-0 to layer-4  9%, 13%, 15%, 19%, 30% lightness
 *   --on-layer        hsl(60 30% 96%)       warm off-white body text
 *   --on-layer-600    the same at 60% alpha
 *   hues              red 10, orange 35, yellow 60, green 115, blue 170,
 *                     purple 250, purple-pink 285, pink 330
 *                     all at 100% saturation and 75.1% lightness
 *   --gradientDegree  135deg
 *   text-accent       pink, internal links orange
 *
 * The heading gradients are the theme's, one pair per level: pink to orange,
 * orange to yellow, yellow to green, green to blue, blue to purple, purple to
 * pink. Anything that needs a colour not listed above is a mistake, not a
 * design decision.
 *
 * Fira Sans and Fira Code are self-hosted from fonts/ (latin subset, 97 KB
 * total). The theme embeds the same faces at 1.6 MB, which is too much for a
 * page served over a tunnel.
 */

@font-face {
  font-family: "Fira Sans";
  src: url("fonts/fira-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Fira Sans";
  src: url("fonts/fira-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Fira Sans";
  src: url("fonts/fira-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Fira Code";
  src: url("fonts/fira-code-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

:root {
  --layer-0: hsl(235 15% 9%);
  --layer-1: hsl(235 15% 13%);
  --layer-2: hsl(235 15% 15%);
  --layer-3: hsl(235 15% 19%);
  --layer-4: hsl(235 15% 30%);

  --on-layer: hsl(60 30% 96%);
  --on-layer-600: hsla(60 30% 96% / 0.6);
  --on-layer-400: hsla(60 30% 96% / 0.4);

  --red: hsl(10 100% 75.1%);
  --orange: hsl(35 100% 75.1%);
  --yellow: hsl(60 100% 75.1%);
  --green: hsl(115 100% 75.1%);
  --blue: hsl(170 100% 75.1%);
  --purple: hsl(250 100% 75.1%);
  --purple-pink: hsl(285 100% 75.1%);
  --pink: hsl(330 100% 75.1%);

  --paper: var(--layer-2);
  --paper-deep: var(--layer-1);
  --panel: var(--layer-3);
  --panel-sink: var(--layer-4);
  --ink: var(--on-layer);
  --ink-soft: var(--on-layer-600);
  --ink-faint: var(--on-layer-400);
  --rule: hsla(60 30% 96% / 0.1);
  --rule-soft: hsla(60 30% 96% / 0.18);
  --accent: var(--pink);
  --accent-ink: var(--layer-1);
  --link: var(--orange);
  --link-hover: var(--yellow);
  --code: var(--purple-pink);
  --code-bg: var(--layer-0);
  --selection: hsla(250 100% 75.1% / 0.2);

  --deg: 135deg;
  --grad-h1: linear-gradient(var(--deg), var(--pink), var(--orange));
  --grad-h2: linear-gradient(var(--deg), var(--orange), var(--yellow));
  --grad-h3: linear-gradient(var(--deg), var(--yellow), var(--green));
  --grad-h4: linear-gradient(var(--deg), var(--green), var(--blue));
  --grad-h5: linear-gradient(var(--deg), var(--blue), var(--purple));
  --grad-h6: linear-gradient(var(--deg), var(--purple), var(--pink));

  --sans: "Fira Sans", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Fira Code", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 0.4rem;
  --wrap: 46rem;
}

/* ============================================================
   Base
   ============================================================ */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  /* Full bleed rules below use 100vw, which includes the scrollbar width. Clip
     the horizontal overflow on the root instead of hiding it: `clip` is not a
     scroll container, so the sticky nav and rail keep working, whereas
     `overflow-x: hidden` here would silently break them. */
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--layer-2);
  color: var(--on-layer);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background-color: var(--selection); }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.skip {
  position: absolute; left: -9999px; top: 0; padding: .6rem 1rem;
  background: var(--pink); color: var(--layer-1); z-index: 50;
}
.skip:focus { left: .5rem; top: .5rem; }

a { color: var(--link); text-decoration: none; border-bottom: 1px solid hsla(35 100% 75.1% / 0.4); }
a:hover { color: var(--link-hover); border-bottom-color: currentColor; }

strong { color: var(--on-layer); font-weight: 700; }

code {
  font: .92em/1.5 var(--mono);
  color: var(--code);
  background: var(--code-bg);
  padding: .1em .35em;
  border-radius: 3px;
}

/* ============================================================
   Header, with the QR code first
   ============================================================ */

.top {
  position: relative;
  padding: 3rem 0 3rem;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--layer-1) 0%, var(--layer-2) 100%);
}

.scan {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding-bottom: 2.4rem;
  margin-bottom: 2.4rem;
  border-bottom: 1px solid var(--rule);
}

/* White card on purpose: a QR code in dark mode reads badly on a projector
   and some scanners refuse inverted codes outright. It is a button because
   clicking it enlarges the code for a room. */
.scan-qr {
  flex: 0 0 auto;
  width: 148px;
  height: 148px;
  padding: 10px;
  background: #ffffff;
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 2px 18px hsl(235 30% 4% / 0.55);
  cursor: zoom-in;
  transition: transform .15s ease, box-shadow .15s ease;
}
.scan-qr:hover, .scan-qr:focus-visible {
  transform: scale(1.03);
  box-shadow: 0 4px 26px hsl(330 100% 75.1% / 0.35), 0 2px 18px hsl(235 30% 4% / 0.55);
}
.scan-qr svg, .scan-qr img { display: block; width: 100%; height: 100%; }

.scan-text p { margin: 0; }
.scan-kicker {
  font: 700 .72rem/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: .5rem;
}
.scan-lead {
  font: 500 1.15rem/1.4 var(--sans);
  color: var(--on-layer);
  margin-bottom: .35rem;
}
.scan-url {
  font: 400 .8rem/1.5 var(--mono);
  color: var(--on-layer-600);
  overflow-wrap: anywhere;
}

@media (max-width: 34rem) {
  .scan { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .scan-qr { width: 132px; height: 132px; }
}

.kicker {
  margin: 0 0 1rem;
  font: 700 .72rem/1 var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pink);
}

.top h1 {
  margin: 0 0 1.4rem;
  font: 700 clamp(2.1rem, 6vw, 2.75rem)/1.15 var(--sans);
  letter-spacing: -.005em;
  background-image: var(--grad-h1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: block;
  width: fit-content;
  max-width: 100%;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.lede { margin: 0; max-width: 34rem; color: var(--on-layer-600); font-size: 1.12rem; }

/* ============================================================
   Full screen QR, for a projector
   ============================================================ */

.qr-modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  color: #14161c;
}
.qr-modal::backdrop {
  background: hsl(235 30% 4% / 0.94);
}
.qr-modal-inner {
  display: grid;
  justify-items: center;
  gap: .9rem;
  padding: 2rem 2rem 1.6rem;
  background: #ffffff;
  border-radius: .7rem;
  text-align: center;
}
/* Big enough for the back row, but it must not push the title, URL and Close
   button off a short laptop screen. The 100vh term is the one that keeps the
   whole card visible when the window is wide and short, which is what a
   projector laptop usually is. */
.qr-modal-img {
  display: block;
  width: min(78vmin, calc(100vh - 220px), 900px);
  height: min(78vmin, calc(100vh - 220px), 900px);
  background: #fff;
}
.qr-modal-title {
  margin: 0;
  font: 700 1.05rem/1.3 var(--sans);
  color: #14161c;
}
.qr-modal-url {
  margin: 0;
  font: 400 .78rem/1.5 var(--mono);
  color: #4a5568;
  overflow-wrap: anywhere;
  max-width: 44ch;
}
.qr-modal .btn { margin-top: .2rem; }

/* Stop the page scrolling behind the modal. */
body:has(dialog[open]) { overflow: hidden; }

/* ============================================================
   Chapter nav
   ============================================================ */

.chapters {
  position: sticky; top: 0; z-index: 20;
  background: var(--layer-1);
  border-bottom: 1px solid var(--rule);
}

.chapters .navrow {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: .85rem;
}

.chapters .navlinks {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.chapters .navlinks::-webkit-scrollbar { display: none; }

.chapters a {
  flex: 0 0 auto;
  font: 700 .73rem/1 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--on-layer-600);
  padding-bottom: .25rem;
  border: none;
  border-bottom: 2px solid transparent;
}
.chapters a:hover { color: var(--pink); }
.chapters a.active { color: var(--pink); border-bottom-color: var(--pink); }

/* The contents button only exists once the outline is hidden. */
.outline-toggle {
  display: none;
  flex: 0 0 auto;
  margin-left: auto;
  font: 700 .73rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .55rem .8rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  background: var(--layer-3);
  color: var(--on-layer);
  cursor: pointer;
}
.outline-toggle:hover { color: var(--pink); border-color: var(--pink); }

.progress { height: 3px; background: var(--layer-3); }
.progress span {
  display: block; height: 100%; width: 0;
  background: var(--pink);
  transition: width .3s ease;
}

/* ============================================================
   Layout: outline rail on the left, text column on the right
   ============================================================ */

/* Three tracks, so the text column stays exactly where it was before the
   outline existed and the rail hangs in the left margin. Centring the pair
   instead would push the prose off centre and out of line with the header. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 46rem) minmax(0, 1fr);
  align-items: start;
}

.content { grid-column: 2; min-width: 0; }

/* Sticky the way the Obsidian outline is: it scrolls with you, and stops
   itself from growing past the window. */
.outline {
  grid-column: 1;
  justify-self: end;
  /* 13rem plus a 2rem gap is 240px of margin, which fits beside a 736px
     column at 1216px and up. Wider than that and the rail would overflow its
     grid track on a 1280 laptop, which is the most common size here. */
  width: 13rem;
  margin-right: 2rem;
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 6rem);
  overflow-y: auto;
  padding: 4rem 0 2rem;
  scrollbar-width: thin;
}

.outline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .7rem;
}

.outline-close {
  display: none;
  font: 700 .68rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .4rem .55rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-layer-600);
  cursor: pointer;
}
.outline-close:hover { color: var(--pink); border-color: var(--pink); }

.outline-title {
  margin: 0;
  font: 700 .68rem/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--on-layer-400);
}

.outline-list { display: grid; gap: .1rem; }

.outline-list a {
  display: block;
  padding: .3rem .55rem .3rem .6rem;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  font: 500 .82rem/1.35 var(--sans);
  color: var(--on-layer-600);
}
.outline-list a:hover {
  color: var(--on-layer);
  background: var(--layer-3);
}
.outline-list a.is-current {
  color: var(--pink);
  border-left-color: var(--pink);
  background: hsla(330 100% 75.1% / 0.08);
}

/* Sub-headings sit one level in, and quieter, like a file tree. */
.outline-list a.level-3 {
  padding-left: 1.5rem;
  font-size: .78rem;
}

.outline-scrim { display: none; }

@media (max-width: 76rem) {
  .layout { display: block; }
  .content { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
  .chapters .navlinks { display: none; }
  .outline-toggle { display: inline-block; }

  /* The outline becomes a drawer off the left edge. Height comes from dvh, not
     from stretching between top and bottom: on a phone the layout viewport is
     taller than the visible area while the browser bars are out, so a drawer
     pinned to both edges ends up taller than the screen with nothing to scroll,
     and the last entries are simply cut off. */
  .outline {
    position: fixed;
    top: 0;
    left: 0;
    width: min(82vw, 19rem);
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    z-index: 40;
    background: var(--layer-1);
    border-right: 1px solid var(--rule);
    padding: 1.4rem 1rem 4rem;
    transform: translateX(-100%);
    transition: transform .22s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .outline.open { transform: none; }
  .outline-close { display: inline-block; }

  .outline-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: hsl(235 30% 4% / 0.65);
  }
  .outline-scrim[hidden] { display: none; }

  body.outline-open { overflow: hidden; }
}

/* ============================================================
   Chapters and headings
   ============================================================ */

.chapter { padding: 5rem 0 1.5rem; }

/* One subject ends, the next begins. The old rule was a 10% hairline, which at
   this length of page read as nothing, so the chapters ran together. */
.chapter {
  position: relative;
}

.chapter + .chapter { padding-top: 5.5rem; }

/* Each chapter carries its own full-bleed wash, in the hue of its own heading
   gradient: pink, orange, red, blue, green, purple, then neutral for the close.
   The band is its own element so it can run past the text column to the window
   edges, and because neighbouring bands differ the change between chapters is a
   hard cut rather than a fade. Colour only; no line, so nothing crosses the
   outline rail. */
.chapter::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  transform: translateX(-50%);
  width: 100vw;
  z-index: -1;
  pointer-events: none;
  /* Solid, not a gradient, and opaque on purpose. An alpha tint composites with
     the layer-2 page colour, which is a cool blue-grey, and pulling a hue
     through it at five percent desaturates whatever you started with. That is
     where the grey came from. These are painted colours instead.

     Hue is the theme's own per-level set and the lightness sits in the theme's
     layer range, so body text keeps the contrast it had on layer-2: 13.7 to
     15.7 to 1 against hsl(60 30% 96%). Saturation is raised, which the layer
     ladder does not do, because a 15% saturated wash at this darkness reads as
     grey at every hue. */
  background-color: var(--band);
  background-image: none;
}

/* The order is the story, not the heading ladder. Violet to open, teal for the
   cool head that sorts a queue, red where the friction is, amber for the flare
   of the hijack, green for the body cooling down, plum for the outward-facing
   chapter, and neutral for the close. Read top to bottom it is cool, cool, hot,
   hotter, cooled, outward, rest. */
#start      { --band: hsl(250 26% 16%); }
#time       { --band: hsl(170 24% 14%); }
#conflict   { --band: hsl(10  30% 13%); }
#triggers   { --band: hsl(35  32% 17%); }
#stress     { --band: hsl(115 22% 13%); }
#reputation { --band: hsl(285 24% 16%); }
/* The close has no id of its own until the outline script names it, so it is
   matched by its class instead of by a generated id. */
.chapter.close { --band: hsl(235 15% 13%); }

.num {
  margin: 0 0 .75rem;
  font: 700 .72rem/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--on-layer-400);
}

.chapter > h2 {
  margin: 0 0 1.5rem;
  font: 700 clamp(1.55rem, 4.6vw, 2.05rem)/1.25 var(--sans);
  letter-spacing: -.005em;
  background-image: var(--grad-h2);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: block;
  width: fit-content;
  max-width: 32ch;
  overflow-wrap: anywhere;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

h3 {
  margin: 2.5rem 0 .75rem;
  font: 700 1.15rem/1.4 var(--sans);
  background-image: var(--grad-h3);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: block;
  width: fit-content;
  max-width: 100%;
}

h4 { margin: 0 0 .4rem; font: 700 1rem/1.35 var(--sans); color: var(--on-layer); }

/* Phones get solid headings rather than clipped gradient text.
   The clipped fill is the one thing that has failed repeatedly on mobile
   engines: the heading stays in the layout and paints nothing, and no amount of
   reloading brings it back. At this size the gradient spans about two
   letterforms anyway, and the solid theme colour is what the eye reads. From
   48rem up the gradients stay. */
@media (max-width: 48rem) {
  .top h1,
  .chapter > h2,
  h3 {
    background-image: none;
    -webkit-text-fill-color: currentColor;
  }
  .top h1 { color: var(--pink); }
  .chapter > h2 { color: var(--orange); }
  h3 { color: var(--yellow); }
}

p { margin: 0 0 1.1rem; }

/* The author's own voice, once, at the top. It carries the brief's "your
   personal insights" line, so it is set apart from the instruction voice with a
   rule in the hero's own hue rather than with italics, which read as a quote
   from someone else. */
.first-person {
  margin: 1.5rem 0 1.9rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--purple);
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--on-layer);
}

.plain { list-style: none; padding: 0; margin: 0 0 1.2rem; }
.plain li {
  margin-bottom: .8rem;
  padding-left: 1rem;
  border-left: 2px solid var(--rule-soft);
}

.source {
  margin-top: 2.5rem;
  padding-top: .9rem;
  border-top: 1px solid var(--rule);
  font-size: .85rem;
  color: var(--on-layer-400);
}

/* ============================================================
   Cards
   ============================================================ */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

/* Four cards sit as a 2 by 2 block rather than three plus an orphan. */
.cards.four { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }

.card {
  background: var(--layer-3);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
}
.card h4 { color: var(--pink); }
.card p { margin: 0; font-size: .95rem; color: var(--on-layer-600); }

/* ============================================================
   Triage
   ============================================================ */

.triage { display: flex; flex-wrap: wrap; gap: .55rem; margin: .5rem 0 1rem; }

.pill {
  font: 500 .9rem/1.25 var(--sans);
  padding: .7rem 1rem;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  background: var(--layer-3);
  color: var(--on-layer);
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.pill:hover { border-color: var(--pink); color: var(--pink); }
.pill[aria-pressed="true"] {
  background: var(--pink);
  border-color: var(--pink);
  color: var(--layer-1);
}

.triage-out {
  border-left: 3px solid var(--pink);
  background: var(--layer-3);
  padding: 1.2rem 1.3rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.5rem;
}
.triage-out h4 { margin-bottom: .6rem; color: var(--pink); }
.triage-out ol { margin: 0; padding-left: 1.2rem; color: var(--on-layer-600); }
.triage-out li { margin-bottom: .5rem; }

/* ============================================================
   Table
   ============================================================ */

/* The table pans inside its own box on a narrow screen. Left to itself it
   compresses every cell to its minimum and reads as a wall of broken lines, and
   in some browsers it refuses to compress and pushes the whole page sideways
   instead. A scroller settles both. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0 1.6rem;
  padding: 1rem 1.15rem 1.15rem;
  border: 1px solid var(--rule-soft);
  border-radius: var(--radius);
  background: hsla(235 15% 9% / 0.28);
}

.quad {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  margin: 0;
  font-size: .95rem;
}
.quad caption {
  text-align: left;
  font: 700 .72rem/1 var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--on-layer-400);
  padding-bottom: .6rem;
}
.quad th, .quad td {
  padding: .75rem .85rem;
  vertical-align: top;
  text-align: left;
}
.quad thead th {
  font: 700 .78rem/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--orange);
  border: none;
}
.quad tbody th {
  width: 6.5rem;
  font: 700 .85rem/1.35 var(--sans);
  border: none;
  color: var(--on-layer);
}
.quad td {
  border: 1px solid var(--rule-soft);
  color: var(--on-layer-600);
}
.quad tbody tr:nth-child(even) td { background-color: var(--layer-1); }
.quad td strong { display: block; margin-bottom: .3rem; color: var(--orange); }

/* Under 48rem the table stops being a table. Two dimensions do not fit in one
   phone column, so each row becomes a block and each cell carries its column
   heading, which beats panning a grid sideways to read half of it. */
@media (max-width: 48rem) {
  .table-scroll { overflow: visible; padding: 1rem 1rem 0.4rem; }
  .quad { min-width: 0; display: block; }
  .quad caption { display: block; margin-bottom: .8rem; }
  .quad thead { display: none; }
  .quad tbody, .quad tr, .quad th, .quad td { display: block; width: auto; }
  .quad tr { margin-bottom: 1.5rem; }
  .quad tbody th {
    /* The desktop rule pins this column at 6.5rem, which wraps "Not important"
       onto two lines on a phone. */
    width: auto;
    font: 700 .78rem/1.3 var(--mono);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--pink);
    padding: 0 0 .5rem;
    margin-bottom: .6rem;
    border-bottom: 1px solid var(--rule-soft);
  }
  .quad td {
    border: none;
    padding: 0 0 1rem;
  }
  .quad td::before {
    content: attr(data-col);
    display: block;
    font: 700 .68rem/1 var(--mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--orange);
    margin-bottom: .35rem;
  }
}

/* ============================================================
   Scripts
   ============================================================ */

.script {
  position: relative;
  background: var(--layer-3);
  border-left: 3px solid var(--pink);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.3rem 4.6rem 1.1rem 1.4rem;
  margin: 1.4rem 0 1.8rem;
}
.script p { margin: 0 0 .8rem; }
.script p:last-child { margin-bottom: 0; }
.script-label {
  font: 700 .72rem/1.5 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pink);
}
.script .note { font-size: .9rem; color: var(--on-layer-600); font-style: italic; }
.script ol { margin: 0; padding-left: 1.2rem; color: var(--on-layer-600); }
.script li { margin-bottom: .6rem; }

.copy {
  position: absolute; top: .7rem; right: .7rem;
  font: 700 .7rem/1 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .45rem .6rem;
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  background: var(--layer-4);
  color: var(--on-layer);
  cursor: pointer;
}
.copy:hover { color: var(--pink); border-color: var(--pink); }

/* ============================================================
   Steps and styles
   ============================================================ */

.steps { padding-left: 1.3rem; margin: 0 0 1.4rem; }
.steps li { margin-bottom: .9rem; }
.steps li::marker { font: 700 .85rem/1 var(--mono); color: var(--orange); }

.styles dt {
  font: 700 .98rem/1.45 var(--sans);
  margin-top: 1rem;
  color: var(--orange);
}
.styles dt::after { content: ":"; }
.styles dd { margin: .2rem 0 0; color: var(--on-layer-600); font-size: .98rem; }

/* ============================================================
   Checklists
   ============================================================ */

.check { list-style: none; padding: 0; margin: 0 0 1rem; }

.check li {
  position: relative;
  padding: .7rem .5rem .7rem 2.4rem;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: color .15s;
}
.check li:first-child { border-top: 1px solid var(--rule); }
.check li::before {
  content: "";
  position: absolute; left: .35rem; top: .95rem;
  width: 1.05rem; height: 1.05rem;
  border: 1.5px solid var(--on-layer-400);
  border-radius: 4px;
  transition: background .15s, border-color .15s;
}
.check li:hover::before { border-color: var(--pink); }
.check li.done { color: var(--on-layer-400); text-decoration: line-through; text-decoration-thickness: 1px; }
.check li a { text-decoration: none; }
.check li.done a { color: var(--on-layer-400); }

/* Links inside running prose stay visible in both themes without shouting. */
p a, li a, dd a { border-bottom: 1px solid hsla(35 100% 75.1% / 0.45); }
p a:hover, li a:hover, dd a:hover { border-bottom-color: currentColor; }
.check li.done::before {
  background-color: var(--pink);
  border-color: var(--pink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23202228' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-6'/%3E%3C/svg%3E");
  background-size: 78%;
  background-position: center;
  background-repeat: no-repeat;
}

/* ============================================================
   Quiz
   ============================================================ */

.quiz {
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  background: var(--layer-3);
  margin: 1rem 0 1.8rem;
}
.quiz .q { margin-bottom: 1.3rem; }
.quiz .q p { font-weight: 700; margin-bottom: .5rem; }
.quiz label {
  display: block;
  padding: .45rem .6rem;
  border-radius: 4px;
  font-size: .95rem;
  color: var(--on-layer-600);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.quiz label:hover { background: var(--layer-4); color: var(--on-layer); }
.quiz input { margin-right: .5rem; accent-color: var(--pink); }

.btn {
  font: 700 .85rem/1 var(--sans);
  padding: .7rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--pink);
  background: var(--pink);
  color: var(--layer-1);
  cursor: pointer;
}
.btn:hover { border-color: var(--orange); background: var(--orange); }
.btn:disabled { opacity: .5; cursor: default; }

.quiz-out {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}
.quiz-out h4 { color: var(--pink); }
.quiz-out p { margin: 0 0 .6rem; font-size: .97rem; color: var(--on-layer-600); }
.quiz-out .note { color: var(--on-layer); }

/* ============================================================
   Breathing
   ============================================================ */

.breathe {
  display: grid;
  justify-items: center;
  gap: 1.2rem;
  border-radius: var(--radius);
  background: var(--layer-3);
  padding: 2rem 1.5rem 1.6rem;
  margin: 1rem auto 1.8rem;
  text-align: center;
}

/* The circle scales; the label does not. Scaling type re-rasterises it on every
   frame, which is where the jitter came from, and it fuzzed the letters. */
.orb-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 12rem;
  height: 12rem;
}

.orb {
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  /* A flat fill and a border, not a radial gradient. A gradient on a scaled
     element gets rasterised per tile in Firefox and shows a hairline cross
     through the middle while the circle changes size. */
  background: hsla(330 100% 75.1% / 0.16);
  border: 2px solid var(--pink);
  box-shadow: 0 0 28px hsla(330 100% 75.1% / 0.22);
  transform: scale(.72);
  will-change: transform, opacity;
}

.orb-label {
  position: absolute;
  pointer-events: none;
  color: var(--pink);
  font: 700 .72rem/1.4 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.breathe-controls {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  align-items: center;
}
.count { font: 500 .85rem/1 var(--mono); color: var(--on-layer-600); }

/* ============================================================
   Close and footer
   ============================================================ */

.close { padding-bottom: 3rem; }
.sig {
  margin-top: 2rem;
  font: 700 .75rem/1.7 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--on-layer-400);
}

/* The background lives on the element that spans the window; the text keeps its
   own 46rem column inside. Putting `wrap` on the footer itself painted a
   736px rectangle of darker colour with the page showing either side of it. */
footer {
  background: hsl(235 15% 13%);
  padding: 2.25rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  font-size: .85rem;
  color: var(--on-layer-400);
}
footer p { margin: 0; }

.foot-head {
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--on-layer-600);
}

.foot-intro {
  margin: .9rem 0 2.2rem;
  max-width: 64ch;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--on-layer-600);
}

.foot-grid {
  display: grid;
  gap: 1.7rem 2.2rem;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  margin-bottom: 2.4rem;
}

.foot-item {
  border-left: 2px solid var(--rule);
  padding-left: 1rem;
}

.foot-item[data-accent="time"] { border-left-color: var(--blue); }
.foot-item[data-accent="conflict"] { border-left-color: var(--red); }
.foot-item[data-accent="triggers"] { border-left-color: var(--orange); }
.foot-item[data-accent="stress"] { border-left-color: var(--green); }
.foot-item[data-accent="reputation"] { border-left-color: var(--purple-pink); }

.foot-label {
  margin-bottom: .7rem;
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--on-layer);
}

.foot-item ul {
  display: grid;
  gap: .8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.foot-item li { line-height: 1.5; }

.foot-path {
  display: block;
  margin-bottom: .15rem;
  font-family: "Fira Code", ui-monospace, monospace;
  font-size: .74rem;
  line-height: 1.45;
  color: var(--on-layer);
  overflow-wrap: anywhere;
}

.foot-what { color: var(--on-layer-600); }

.foot-path + .foot-what { display: block; }

.foot-note {
  padding-top: 1.3rem;
  border-top: 1px solid var(--rule);
  color: var(--on-layer-400);
}

/* ============================================================
   Jump target flash
   ------------------------------------------------------------
   The ring and the brightness pulse are two channels on purpose: brightness
   works on the gradient-clipped headings where a background colour cannot
   show, and the outline is what carries on a projector where a 1.2x lift in
   brightness is invisible. Three beats so it reads as a flash rather than a
   blink, and it is retriggered from app.js because clicking the same link
   twice does not restart a CSS animation on its own.
   ============================================================ */

/* No filter here. A `filter: brightness()` on an element whose text is painted
   with `background-clip: text` makes the browser re-rasterise those glyphs, and
   in Firefox the clipped fill can come back blank afterwards, which reads as the
   heading flashing and then vanishing. The ring and a glow do the same job
   without touching how the text is painted. */
@keyframes target-flash {
  0% {
    outline-color: hsla(330 100% 75.1% / 0.95);
    box-shadow: 0 0 0 4px hsla(330 100% 75.1% / 0.3), 0 0 30px hsla(330 100% 75.1% / 0.4);
  }
  35% {
    outline-color: hsla(330 100% 75.1% / 0.3);
    box-shadow: 0 0 0 2px hsla(330 100% 75.1% / 0.12), 0 0 12px hsla(330 100% 75.1% / 0.16);
  }
  62% {
    outline-color: hsla(330 100% 75.1% / 0.8);
    box-shadow: 0 0 0 3px hsla(330 100% 75.1% / 0.22), 0 0 22px hsla(330 100% 75.1% / 0.3);
  }
  100% {
    outline-color: transparent;
    box-shadow: none;
  }
}

/* No fill mode. Firefox has a documented bug where `background-clip: text`
   plus `animation-fill-mode: both` makes the background paint as a full box
   instead of through the glyphs, and the keyframes already end on the
   element's resting state, so there is nothing to hold. */
.flash {
  outline: 3px solid transparent;
  outline-offset: 6px;
  border-radius: var(--radius);
  animation: target-flash 1.5s ease-out 1;
}

/* A pilot light, not a strobe. */
@media (prefers-reduced-motion: reduce) {
  .flash { animation: none; outline: 3px solid var(--pink); outline-offset: 6px; }
}

/* ============================================================
   Motion and print
   ============================================================ */

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

/* Paper gets black on white. The QR code stays, because a printed cover is
   exactly where someone would want to scan it.

   The gradient headings are clipped text, so printing needs two moves: kill
   every background image, and put the text fill back to currentColor. Without
   the second one the headings print as nothing at all. */
@media print {
  :root {
    --layer-0: #fff; --layer-1: #fff; --layer-2: #fff;
    --layer-3: #f6f6f6; --layer-4: #ededed;
    --on-layer: #111; --on-layer-600: #333; --on-layer-400: #555;
    --rule: #ccc; --rule-soft: #bbb;
    --pink: #111; --orange: #111; --yellow: #111; --green: #111;
    --blue: #111; --purple: #111; --purple-pink: #111; --red: #111;
    --code-bg: #f0f0f0; --selection: transparent;
  }

  * {
    background-image: none !important;
    -webkit-text-fill-color: currentColor !important;
    text-shadow: none !important;
  }

  /* currentColor above resolves against these rules, so the headings need a
     real colour, not the transparent one they clip their gradient through. */
  .top h1, .chapter > h2, h3, h4, .scan-kicker, .scan-lead, .card h4,
  .script-label, .num, .quad thead th, .quad td strong, .styles dt,
  .quiz-out h4, .triage-out h4, .orb {
    color: #111 !important;
  }

  body { background: #fff; color: #111; font-size: 10.5pt; }
  .top { padding-top: 1rem; }
  .chapters, .triage, .copy, .breathe-controls, .quiz .btn,
  .outline, .outline-toggle, .outline-scrim { display: none; }
  .flash { animation: none; outline: none; }
  .qr-modal { display: none; }
  .scan-qr { width: 120px; height: 120px; box-shadow: none; border: 1px solid #ccc; }
  .card, .script, .quiz, .breathe, .triage-out { border: 1px solid #ddd; }
  .chapter { page-break-inside: avoid; }
  /* A CSS background may be dropped by the print dialog, so draw the break as
     a border on paper instead of relying on the tinted bands. */
  .chapter::before { display: none; }
  .chapter + .chapter { padding-top: 2rem; border-top: 1px solid #ccc; }
  .card, .script, .quiz, .breathe { break-inside: avoid; }
  a { color: #111; border: none; }

  /* The pages print, so the source list prints with them: on paper the footer is
     the bibliography, and a handout that names its notes is worth more than one
     that hides them because the screen version was dark. */
  footer {
    background: none;
    padding-top: 1.5rem;
    border-top: 1px solid #ccc;
    page-break-before: always;
    font-size: 8.5pt;
  }
  .foot-grid { gap: 1.2rem 1.6rem; }
  .foot-intro { margin-bottom: 1.2rem; font-size: 8.5pt; color: #333; }
  .foot-path { font-size: 7.5pt; }
  .foot-note { color: #555; }
}
