/* Brewric — tokens */
:root {
  --canvas: #0b0a09;
  --ink: #d6d0c4;
  --ink-strong: #efe9de;
  --muted: #918b80;
  --faint: #625e57;
  --rule: rgba(214, 208, 196, 0.11);
  --rule-strong: rgba(214, 208, 196, 0.24);
  --panel: #0f0e0c;
  --accent: #eda23c;
  --accent-soft: rgba(237, 162, 60, 0.17);
  --on-accent: #140e05;
  --grid: rgba(214, 208, 196, 0.04);
  --glow: rgba(237, 162, 60, 0.04);

  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --hand: "Caveat", "Bradley Hand", "Segoe Print", cursive;

  --measure: 740px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --canvas: #ece9e2;
  --ink: #2b2923;
  --ink-strong: #13120f;
  --muted: #6a665d;
  --faint: #9d988e;
  --rule: rgba(43, 41, 35, 0.13);
  --rule-strong: rgba(43, 41, 35, 0.28);
  --panel: #e4e1d9;
  --accent: #b5610a;
  --accent-soft: rgba(181, 97, 10, 0.15);
  --on-accent: #ffffff;
  --grid: rgba(43, 41, 35, 0.06);
  --glow: rgba(255, 255, 255, 0.5);
  color-scheme: light;
}

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--canvas); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .4s ease, color .4s ease;
}
::selection { background: var(--accent-soft); color: var(--ink-strong); }
a { color: inherit; }
button { font: inherit; }
:focus-visible { outline: 1px dashed var(--accent); outline-offset: 4px; border-radius: 2px; }

/* Header */
.chrome {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: 60px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(to bottom, var(--canvas) 55%, transparent);
  pointer-events: none;
}
.chrome > * { pointer-events: auto; }
.brand {
  color: var(--ink-strong);
  text-decoration: none;
  font-family: var(--display);
  font-size: 23px;
  letter-spacing: 0.01em;
}
.chrome-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--ink-strong); background: var(--rule); }
.icon-btn svg { width: 16px; height: 16px; }

.model-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  margin-right: 6px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s;
}
.model-toggle:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.mt-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rule-strong); transition: background-color .2s, box-shadow .2s; }
.mt-short { display: none; }
.model-toggle[aria-pressed="true"] { color: var(--ink-strong); border-color: var(--accent); background: var(--accent-soft); }
.model-toggle[aria-pressed="true"] .mt-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Hero */
.hero {
  --hero-h: clamp(460px, 70vh, 680px);
  position: relative;
  width: min(1200px, calc(100% - 32px));
  height: var(--hero-h);
  margin: 64px auto 8px;
  user-select: none;
  -webkit-user-select: none;
  transition: margin-top 1.8s cubic-bezier(.65, 0, .25, 1);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 55% at 40% 50%, var(--glow), transparent 75%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, 32px 32px, 32px 32px;
  background-position: center, center, center;
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 50% 50%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 72% 70% at 50% 50%, #000 35%, transparent 100%);
}
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: default;
  touch-action: pan-y;
}

.hud {
  position: absolute;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  pointer-events: none;
}
.hud-tip {
  top: 20px;
  left: 20px;
  color: var(--ink);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity .2s;
}
.hud-tip.is-on { opacity: 1; }
.hud-bl { bottom: 18px; left: 20px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.hud-legend {
  right: 20px;
  bottom: 18px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--faint);
}
.hud-legend li { display: flex; align-items: center; gap: 10px; }
.hud-legend .lg-shared { display: none; color: var(--accent); }
.hero[data-lens="shared"] .hud-legend .lg-shared { display: flex; }
.lg { flex: none; display: inline-grid; place-items: center; width: 14px; height: 10px; }
.lg::before { content: ""; display: block; }
.lg-agent::before { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); }
.lg-file::before { width: 9px; height: 9px; border: 1px solid var(--rule-strong); background: var(--accent); }
.lg-store::before { width: 14px; height: 1px; background: var(--muted); }
.lg-layer::before { width: 14px; height: 1.5px; background: var(--accent); }

.lens {
  position: absolute;
  top: 12px;
  right: 14px;
  display: flex;
  padding: 3px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--canvas) 75%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.lens button {
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  transition: color .25s, background-color .25s;
}
.lens button:hover { color: var(--ink-strong); }
.lens button[aria-pressed="true"] { background: var(--ink-strong); color: var(--canvas); }

.hand-note {
  position: absolute;
  top: 31%;
  right: 30px;
  width: max-content;
  max-width: min(300px, 27%);
  margin: 0;
  font-family: var(--hand);
  font-weight: 600;
  font-size: clamp(28px, 2.8vw, 38px);
  line-height: 1.05;
  color: var(--accent);
  white-space: pre-line;
  pointer-events: none;
  transform: rotate(-3deg);
  transform-origin: right center;
  clip-path: inset(-20% 100% -20% 0);
  transition: clip-path 1s cubic-bezier(.55, .05, .3, 1);
}
.hand-note.is-in { clip-path: inset(-20% -6% -20% 0); }
.hand-note:not(.is-in) { transition-duration: .25s; }
.hero-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.hero-ink path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Article */
.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 24px;
  counter-reset: sec;
}
.sheet h1 {
  position: relative;
  margin: 40px 0 34px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(42px, 5.6vw, 66px);
  line-height: 1.02;
  letter-spacing: -0.008em;
  color: var(--ink-strong);
  text-wrap: balance;
}
.sheet h1 em { color: var(--ink); }
.sheet p {
  margin: 0 0 1.05em;
  font-size: clamp(18.5px, 0.5vw + 15.5px, 22px);
  line-height: 1.66;
  hyphens: auto;
  -webkit-hyphens: auto;
  text-wrap: pretty;
}
.sheet > p, .pull p { position: relative; }
.sheet h2 {
  position: relative;
  counter-increment: sec;
  margin: 2.1em 0 0.55em;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(31px, 1.6vw + 22px, 41px);
  line-height: 1.08;
  letter-spacing: -0.005em;
  color: var(--ink-strong);
  scroll-margin-top: 84px;
}

@media (min-width: 700px) {
  /* Chrome mis-justifies the last line when `pretty` rebalances it. */
  .sheet > p { text-align: justify; text-wrap: wrap; }
}
@media (min-width: 1080px) {
  .sheet h2::before {
    content: counter(sec, decimal-leading-zero);
    position: absolute;
    right: calc(100% + 30px);
    top: 0.72em;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.06em;
    color: var(--faint);
  }
}

/* Figures */
.fig {
  margin: 2.1em 0 2.3em;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  transition: background-color .4s ease;
}
@media (min-width: 880px) {
  .fig { margin-left: -32px; margin-right: -32px; }
}
.fig-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.fig-head > span { white-space: nowrap; }
.fig-meta { margin-left: auto; color: var(--faint); }

/* Fig 02: one table, four roofs */
.roofs { padding: 8px 0 10px; }
.roof-row {
  display: grid;
  grid-template-columns: 168px 1fr auto;
  gap: 0 16px;
  align-items: baseline;
  padding: 8px 16px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .5s ease, transform .5s ease, background-color .15s;
}
.fig.in-view .roof-row { opacity: 1; transform: none; }
.fig.in-view .roof-row:nth-child(3) { transition-delay: .15s, .15s, 0s; }
.fig.in-view .roof-row:nth-child(4) { transition-delay: .3s, .3s, 0s; }
.fig.in-view .roof-row:nth-child(5) { transition-delay: .6s, .6s, 0s; }
.roof-th {
  margin-bottom: 4px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--rule);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.roof-row:not(.roof-th):hover { background: var(--rule); }
.roof-row .k { color: var(--ink); }
.roof-row .v b { font-weight: 400; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.roof-row .lag { color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.roof-row.is-live .lag { color: var(--ink); }
.roof-row.is-live .lag::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  vertical-align: 1px;
}
.roof-row.is-unknown .v b, .roof-row.is-unknown .lag { color: var(--accent); }
.snap.is-new { animation: snapflash 1.3s ease; }
@keyframes snapflash { from { color: var(--accent); } to { color: var(--ink-strong); } }

/* Fig 03: a column, and what it means */
.tree { margin: 0; padding: 14px 0 12px; list-style: none; counter-reset: step; }
.tree li {
  display: grid;
  grid-template-columns: 30px 96px 1fr;
  gap: 0 12px;
  align-items: baseline;
  padding: 6px 16px;
  transition: background-color .15s;
}
.tree li::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-size: 11px;
  color: var(--faint);
}
.tree li:hover { background: var(--rule); }
.tree .k { color: var(--ink); }
.tree li:hover .k { color: var(--ink-strong); }
.tree .meaning { margin-top: 8px; padding-top: 14px; border-top: 1px dashed var(--rule-strong); }
.tree .meaning .k { color: var(--accent); }
.missing { position: relative; color: var(--faint); }
.missing::after {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 55%;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .45s ease;
}
.fig-col.is-struck .missing::after { transform: scaleX(1); }
.typed { display: block; margin-top: 6px; color: var(--ink-strong); }
.typed:empty { display: none; }
.typed.is-typing::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}

/* Fig 04: routing */
.states { display: flex; border-bottom: 1px solid var(--rule); }
.states span {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
  transition: color .25s;
}
.states span + span { border-left: 1px solid var(--rule); }
.states span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rule-strong);
  transition: background-color .25s, box-shadow .25s;
}
.states span.on { color: var(--ink-strong); }
.states span.on::before { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.log { min-height: 236px; padding: 14px 16px 16px; line-height: 1.8; font-variant-numeric: tabular-nums; }
.log .line { display: grid; grid-template-columns: 84px 1fr; gap: 0 10px; animation: rise .35s ease both; }
.log .line .t { color: var(--faint); }
.log .line.task { color: var(--ink-strong); margin-bottom: 6px; }
.log .line .who { color: var(--muted); margin-right: 10px; }
.log .line .good { color: var(--ink-strong); }
.log .line.answer { margin-top: 6px; color: var(--accent); }
.log .line.answer .t { color: var(--accent); }
.log .pending { color: var(--faint); }

/* Pull quote */
.pull { margin: 1.9em 0 1.6em; padding: 0; }
.pull::before { content: ""; display: block; width: 44px; height: 2px; margin-bottom: 24px; background: var(--accent); }
.sheet .pull p {
  margin: 0;
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(31px, 2.2vw + 19px, 46px);
  line-height: 1.12;
  color: var(--ink-strong);
  text-align: left;
  hyphens: manual;
  -webkit-hyphens: manual;
  text-wrap: balance;
}

/* Fig 05: the polygon */
.poly-wrap { container-type: inline-size; padding: 14px 8px 0; }
.poly-svg { display: block; width: 100%; height: auto; overflow: visible; }
.pg-guide { fill: none; stroke: var(--rule); stroke-width: 1; }
.pg-guide.is-outer { stroke: var(--rule-strong); }
.pg-spoke { stroke: var(--rule); stroke-width: 1; transition: stroke .2s; }
.pg-spoke.is-on { stroke: var(--accent); }
.pg-shape {
  fill: var(--accent-soft);
  stroke: var(--ink-strong);
  stroke-width: 1.3;
  stroke-linejoin: round;
  transform: scale(0);
  transition: transform 1.4s cubic-bezier(.2, .75, .1, 1);
}
.fig-poly.in-view .pg-shape { transform: scale(1); }
.pg-vector, .pg-vhead { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pg-vector { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s cubic-bezier(.5, 0, .3, 1) 1.1s; }
.fig-poly.in-view .pg-vector { stroke-dashoffset: 0; }
.pg-vhead, .pg-vlabel { opacity: 0; transition: opacity .3s ease 1.95s; }
.fig-poly.in-view .pg-vhead, .fig-poly.in-view .pg-vlabel { opacity: 1; }
.pg-vlabel { font-family: var(--hand); font-weight: 600; font-size: 25px; fill: var(--accent); }
.pg-vtarget { cursor: pointer; outline: none; }
.pg-vtarget .pg-hit { fill: transparent; }
.pg-node { cursor: pointer; outline: none; }
.pg-hit { fill: transparent; }
.pg-dot {
  fill: var(--panel);
  stroke: var(--ink-strong);
  stroke-width: 1.4;
  opacity: 0;
  transition: fill .2s, stroke .2s, opacity .4s ease 1.2s;
}
.fig-poly.in-view .pg-dot { opacity: 1; }
.pg-text { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em; fill: var(--muted); transition: fill .2s; }
.pg-text .pg-n { fill: var(--faint); }
.pg-node:hover .pg-dot, .pg-node.is-on .pg-dot { fill: var(--accent); stroke: var(--accent); }
.pg-node:hover .pg-text, .pg-node.is-on .pg-text { fill: var(--ink-strong); }
.pg-node.is-on .pg-n { fill: var(--accent); }
.pg-node:focus-visible .pg-dot, .pg-vtarget:focus-visible .pg-vhead { stroke-width: 3; }
@container (max-width: 520px) {
  .pg-l { display: none; }
  .pg-text { font-size: 15px; }
  .pg-vlabel { font-size: 23px; }
}
.poly-detail { margin: 4px 16px 0; padding: 16px 0 18px; border-top: 1px dashed var(--rule-strong); min-height: 168px; }
.pd-head { display: flex; align-items: baseline; gap: 12px; }
.pd-no { font-size: 11px; letter-spacing: 0.06em; color: var(--accent); }
.pd-title { font-family: var(--display); font-size: 27px; line-height: 1.12; color: var(--ink-strong); }
.pd-nav { margin-left: auto; display: flex; gap: 6px; flex: none; }
.pd-nav button {
  width: 30px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.pd-nav button:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.pd-body { margin-top: 8px; font-family: var(--serif); font-size: 18px; line-height: 1.55; color: var(--ink); }
.pd-hold { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--muted); }
.pd-k { margin-right: 10px; font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); }

/* Call to action */
.cta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-top: 1.4em;
  padding-top: 40px;
}
.cta-mail {
  padding-bottom: 6px;
  font-family: var(--display);
  font-size: clamp(36px, 5.8vw, 64px);
  line-height: 1.05;
  color: var(--ink-strong);
  text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 2px no-repeat;
  transition: color .2s ease;
}
.cta-mail:hover { color: var(--accent); }
.copy {
  padding: 7px 13px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.copy:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.copy.is-done { color: var(--accent); border-color: var(--accent); }
.sheet .cta-note {
  position: absolute;
  top: -14px;
  right: 0;
  margin: 0;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 30px;
  line-height: 1;
  color: var(--accent);
  text-align: left;
  transform: rotate(-4deg);
}
.cta-arrow {
  position: absolute;
  top: 10px;
  right: 148px;
  width: 64px;
  height: 44px;
  overflow: visible;
}
.cta-arrow path { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Footer */
.foot {
  width: min(692px, calc(100% - 48px));
  margin: 104px auto 0;
  padding: 22px 0 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

/* The veil: for the first thirty seconds only the drawing and its switch are on the page, centered, and nothing scrolls.
   Then the rest fades in and the essay materializes, block by block. */
.is-veiled, .is-veiled body { overflow: hidden; }
.is-veiled .hero {
  margin-top: max(24px, calc((100vh - var(--hero-h)) / 2));
  margin-top: max(24px, calc((100svh - var(--hero-h)) / 2));
}
.is-veiled :is(.chrome, .foot, .workload) { opacity: 0; visibility: hidden; }
.is-veiled .sheet { visibility: hidden; }
.chrome, .foot, .workload { transition: opacity 1.4s ease .6s; }
.is-revealed .sheet > * { animation: materialize 1.6s cubic-bezier(.2, .7, .2, 1) var(--d, 0ms) both; }
@keyframes materialize {
  from { opacity: 0; filter: blur(12px); transform: translateY(18px); }
  to { opacity: 1; filter: none; transform: none; }
}
.veil-note {
  position: fixed;
  left: 50%;
  bottom: 6vh;
  z-index: 30;
  margin: 0;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 32px;
  line-height: 1;
  color: var(--accent);
  white-space: nowrap;
  pointer-events: none;
  transform: translateX(-50%) rotate(-3deg);
  clip-path: inset(-30% 100% -30% 0);
  transition: clip-path .9s cubic-bezier(.55, .05, .3, 1);
}
.veil-note.is-in { clip-path: inset(-30% -8% -30% 0); }
.veil-note:not(.is-in) { transition-duration: .25s; }
:root:not(.is-veiled) .veil-note { display: none; }

/* Margin notes */
.has-note { position: relative; }
.mnote {
  position: absolute;
  top: 0;
  left: calc(100% + 28px);
  width: 200px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-family: var(--hand);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.02;
  color: var(--accent);
  text-align: left;
  hyphens: manual;
  -webkit-hyphens: manual;
  transform: rotate(-2.5deg);
  transform-origin: left top;
  clip-path: inset(-30% 100% -30% 0);
  transition: clip-path 1.1s cubic-bezier(.55, .05, .3, 1) .25s;
}
.mnote.mid { top: 38%; }
.mnote.at-end { top: auto; bottom: 0.3em; }
.mnote.in-view { clip-path: inset(-30% -10% -30% 0); }
.mnote svg { flex: none; width: 36px; height: 18px; margin-top: 5px; overflow: visible; }
.mnote path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Workload: a run that advances as you read */
.workload {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 12;
  width: 210px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.wl-row { display: flex; justify-content: space-between; gap: 10px; }
.wl-row + .wl-row { margin-top: 3px; }
.wl-head { margin-bottom: 8px; color: var(--faint); text-transform: uppercase; }
.workload b { font-weight: 400; color: var(--ink-strong); }
.wl-chart { display: block; width: 184px; height: 46px; margin-bottom: 8px; overflow: visible; }
.wl-axis { fill: none; stroke: var(--rule-strong); stroke-width: 1; }
.wl-asked { fill: none; stroke: var(--muted); stroke-width: 1.1; stroke-dasharray: 3 2; }
.wl-read { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; }
.wl-dot { fill: var(--accent); }
.workload.is-done .wl-head span:first-child, .workload.is-done #wl-pct { color: var(--accent); }

/* Query console */
.console {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 25;
  width: min(640px, calc(100% - 24px));
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
}
.console.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: 0s; }
.cs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 8px 7px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}
.cs-head b { font-weight: 400; color: var(--ink); }
.cs-close {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.cs-close:hover { color: var(--ink-strong); background: var(--rule); }
.cs-out {
  min-height: 70px;
  max-height: min(190px, 30vh);
  overflow-y: auto;
  padding: 10px 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  font-variant-numeric: tabular-nums;
}
.cs-out .q { color: var(--ink-strong); }
.cs-out .row { color: var(--ink); }
.cs-out .meta { color: var(--faint); }
.cs-out .hot { color: var(--accent); }
.cs-chips { display: flex; gap: 6px; padding: 0 12px 10px 14px; overflow-x: auto; scrollbar-width: none; }
.cs-chips::-webkit-scrollbar { display: none; }
.cs-chips button, .cs-in button {
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}
.cs-chips button:hover, .cs-in button:hover { color: var(--ink-strong); border-color: var(--ink-strong); }
.cs-in { display: flex; align-items: center; gap: 10px; padding: 9px 10px 9px 14px; border-top: 1px solid var(--rule); }
.cs-in > span { color: var(--accent); }
.cs-in input {
  flex: 1;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--ink-strong);
  font-family: var(--mono);
  font-size: 12.5px;
}
.cs-in input::placeholder { color: var(--faint); }

/* Query hits, and row ids in the margin while querying */
mark.q-mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--ink-strong);
  box-shadow: inset 0 -2px 0 var(--accent);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@media (min-width: 1080px) {
  .is-querying .sheet [data-row]::before {
    content: attr(data-row);
    position: absolute;
    right: calc(100% + 30px);
    top: 0.7em;
    font-family: var(--mono);
    font-size: 11px;
    font-style: normal;
    letter-spacing: 0.04em;
    line-height: 1;
    color: var(--faint);
    text-align: right;
    white-space: nowrap;
  }
  .is-querying .sheet h1[data-row]::before { top: 1.1em; }
  .is-querying .sheet .q-hit[data-row]::before { color: var(--accent); }
}

@media (max-width: 1239px) {
  .workload { display: none; }
  .mnote { position: static; width: auto; justify-content: flex-end; margin-top: 6px; font-size: 24px; transform: rotate(-1.5deg); transform-origin: right center; }
  .mnote svg { display: none; }
  .mnote br { display: none; }
}

/* Small screens */
@media (max-width: 760px) {
  .hud-bl, .hud-legend, .hud-tip { display: none; }
  .lens { top: auto; bottom: 14px; right: 50%; transform: translateX(50%); }
  .hand-note { top: auto; bottom: 64px; right: 50%; max-width: 86%; text-align: center; transform: translateX(50%) rotate(-3deg); transform-origin: center; font-size: 28px; }
  .roof-row { grid-template-columns: 1fr auto; }
  .roof-row .v { grid-column: 1 / -1; grid-row: 2; }
  .roof-th span:nth-child(2) { display: none; }
}
@media (max-width: 600px) {
  .chrome { padding: 0 12px 0 16px; }
  .mt-long { display: none !important; }
  .mt-short { display: inline; }
  .model-toggle { margin-right: 2px; }
  .tree li { grid-template-columns: 26px 80px 1fr; }
  .log .line { grid-template-columns: 58px 1fr; }
  .states span { padding: 10px 12px; }
  .cta-arrow { display: none; }
  .sheet .cta-note { position: static; flex-basis: 100%; transform: rotate(-3deg); font-size: 28px; }
  .pd-title { font-size: 24px; }
}

@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

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