/* Notes: what goes inside the reading column of a note page (the layout
   around it is in reader.css). Built from notes/*.md by scripts/build.js.
   Only the tokens in styles.css. */

.g-note { min-width: 0; outline: none; }
@keyframes g-in { from { opacity: 0; transform: translateY(8px); } }

/* ```notes: the rest of the vault as a clickable list */
.g-notelist { margin: 0 0 32px; border: 1px solid var(--ink); background: var(--ivory); }
.g-body .g-notelist ul { margin: 0; padding: 0; list-style: none; }
.g-body .g-notelist li { margin: 0; padding: 0; font-size: 17px; }
.g-body .g-notelist li::before { content: none; }
.g-notelist li + li { border-top: 1px solid var(--rule); }
.g-notelist a {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 14px 18px;
  font: 500 18px/1.35 var(--sans);
  letter-spacing: -0.01em;
  color: var(--ink);
  transition: background .2s var(--ease), color .2s var(--ease), padding .25s var(--ease);
}
.g-out { display: grid; gap: 4px; }
.g-out .t { display: block; }
.g-out .s { display: block; padding-left: 32px; font: 400 14.5px/1.5 var(--sans); color: var(--ink-soft); letter-spacing: 0; }
.g-notelist a:hover .s { color: var(--ink-soft); }
.g-notelist .n { display: inline-block; width: 32px; font: 500 12px var(--mono); color: var(--terracotta); }
.g-notelist .go { font: 16px var(--sans); color: var(--terracotta); transition: transform .25s var(--ease); }
.g-notelist a:hover, .g-notelist a:focus-visible { background: color-mix(in srgb, var(--terracotta) 8%, var(--ivory)); color: var(--terracotta); padding-left: 24px; outline: none; }
.g-notelist a:hover .go, .g-notelist a:focus-visible .go { transform: translateX(4px); }

/* ```habs: the speech-bubble cat lives in styles.css (.g-wip) */
/* The docs' opening page: its title set like the case study's (frontmatter
   display: "first line / italic second line") */
.g-note h1.g-display { font-family: var(--serif); font-weight: 330; font-variation-settings: "opsz" 144; font-size: clamp(44px, 6vw, 84px); line-height: .86; letter-spacing: -0.04em; margin-bottom: clamp(80px, 9vw, 132px); }
/* A doc's title: set like the case study's section headings (light serif) */
.g-note h1 {
  width: auto;
  font-family: var(--serif);
  font-weight: 330;
  font-size: clamp(34px, 3.8vw, 50px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}

/* Type in a note has three voices and no others:
   - Geist (sans) for titles: the note h1, section h2s, step and card
     titles, semibold. (The serif is kept for the site's name, hero, project
     names and footer line only.)
   - Geist (sans) for reading: body copy at 17px, secondary copy (callouts,
     tables, widgets) at 15px, sub-headings (h3) at 18px semibold.
   - Geist Mono for labels and code: 12px caps for labels, 13.5px for code. */
.g-body { counter-reset: sec; }
.g-body > :first-child { margin-top: 0; }
.g-body p, .g-body li { font-size: 17px; line-height: 1.7; color: var(--ink-soft); }
.g-body p { margin: 0 0 18px; }
.g-body strong { font-weight: 600; color: var(--ink); }
.g-body mark { background: color-mix(in srgb, var(--terracotta) 22%, transparent); color: var(--ink); padding: 0 2px; }
.g-body h2, .g-body h3, .g-body h4 { scroll-margin-top: 24px; color: var(--ink); }
.g-body h2 {
  counter-increment: sec;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  column-gap: 16px;
  margin: 64px 0 20px;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
  font: 500 clamp(22px, 2.2vw, 28px)/1.2 var(--sans);
  letter-spacing: -0.025em;
}
.g-body h2::before {
  content: counter(sec, decimal-leading-zero);
  font: 500 12px var(--mono);
  letter-spacing: .08em;
  color: var(--terracotta);
  transform: translateY(-.35em);
}
.g-body h3 {
  margin: 36px 0 12px;
  font: 600 18px/1.35 var(--sans);
  letter-spacing: -0.005em;
}
.g-body h2 + h3 { margin-top: 0; }
.g-body h3 code, .g-body h2 code { font-size: .88em; }
.g-body ul, .g-body ol { margin: 0 0 20px; }
.g-body ul > li { position: relative; margin-bottom: 8px; padding-inline-start: 22px; }
.g-body ul > li::before { content: "—"; position: absolute; inset-inline-start: 0; color: var(--terracotta); }
.g-body ol { counter-reset: n; }
.g-body ol > li { position: relative; margin-bottom: 8px; padding-inline-start: 30px; counter-increment: n; }
.g-body ol > li::before {
  content: counter(n, decimal-leading-zero);
  position: absolute; inset-inline-start: 0; top: .3em;
  font: 12px var(--mono); color: var(--terracotta);
}
.g-body li.task::before { content: none; }
.g-body li.task .box {
  position: absolute; left: 0; top: .42em;
  width: 13px; height: 13px;
  border: 1.5px solid var(--muted); border-radius: 3px;
}
.g-body li.task.done { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--rule); }
.g-body li.task.done .box { background: var(--terracotta); border-color: var(--terracotta); }
.g-body li.task.done .box::after {
  content: ""; position: absolute; left: 3px; top: 0;
  width: 4px; height: 8px;
  border: solid var(--ivory); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.g-body blockquote { margin: 0 0 20px; padding-left: 20px; border-left: 2px solid var(--rule); font-style: italic; }

.g-code {
  position: relative;
  margin: 0 0 22px;
  padding: 18px 22px;
  overflow-x: auto;
  border-inline-start: 2px solid var(--terracotta);
  background: var(--ivory-deep);
  font: 13.5px/1.7 var(--mono);
  color: var(--ink);
}
.g-code[data-lang]:not([data-lang=""])::after {
  content: attr(data-lang);
  position: absolute; top: 8px; right: 12px;
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.g-code code { font-size: inherit; }
.tk-c { color: var(--muted); font-style: italic; }
.tk-s { color: var(--terracotta); }
.tk-k { color: var(--ink); font-weight: 500; }
.tk-p { color: var(--terracotta-deep); }

/* Wikilinks: dotted until hovered, terracotta when the note exists */
.wikilink {
  color: var(--terracotta);
  background-image: linear-gradient(90deg, currentColor 50%, transparent 0);
  background-size: 4px 1px;
  background-position: 0 100%;
  background-repeat: repeat-x;
  padding-bottom: 1px;
  transition: background-size .2s var(--ease);
}
.wikilink:hover { background-image: linear-gradient(currentColor, currentColor); background-size: 100% 1px; }
.wikilink.missing { color: var(--muted); }

/* Callouts: Obsidian's > [!type] blocks, retinted to the site palette */
.callout {
  --c: var(--terracotta);
  margin: 0 0 22px;
  padding: 14px 18px;
  border-left: 2px solid var(--c);
  background: color-mix(in srgb, var(--c) 7%, transparent);
}
.callout[data-callout="info"], .callout[data-callout="abstract"] { --c: #4f7a8a; }
.callout[data-callout="tip"] { --c: #5f7d4a; }
.callout[data-callout="question"] { --c: #8a6a3a; }
.callout[data-callout="bug"] { --c: #b03a3a; }
.callout[data-callout="note"] { --c: var(--muted); }
.callout-title {
  display: flex; align-items: center; gap: 10px;
  margin: 0 !important;
  font: 500 12px var(--mono) !important;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--c) !important;
}
.callout-icon {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  border: 1px solid var(--c); border-radius: 50%;
  font-size: 10px; text-transform: none;
}
.callout-body { margin-top: 10px; }
.callout-body > :last-child { margin-bottom: 0; }
.callout-body p, .callout-body li { font-size: 15px; line-height: 1.65; }

/* --- Rich blocks ----------------------------------------------------------- */

/* Figures: screenshots, sketches and diagrams share one frame */
.g-fig { margin: 36px 0; }
.g-fig figcaption { margin-top: 12px; }
.g-shot img {
  width: 100%;
  border: 1px solid var(--rule);
  box-shadow: 0 30px 60px -36px rgba(34, 29, 25, .45);
  cursor: zoom-in;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.g-shot img:hover { transform: translateY(-3px); box-shadow: 0 36px 70px -34px rgba(34, 29, 25, .55); }
.g-gallery { display: grid; grid-template-columns: 1.15fr 1fr; gap: var(--gap); align-items: start; margin: 36px 0; }
.g-gallery .g-fig { margin: 0; }
.g-gallery .g-fig:nth-child(2) { margin-top: 40px; } /* staggered, like prints on a desk */

/* Sketches: frame, colours and type are in styles.css (shared with the
   case-study page). Here they fade in once they have been fetched. */
.g-svg { min-height: 120px; opacity: 0; transform: scale(.985); transition: opacity .5s var(--ease), transform .6s var(--ease); }
.g-svg.ready { opacity: 1; transform: none; min-height: 0; }

/* Interactive sketches: the part under the pointer (and its partners)
   turn terracotta; nothing else changes */
.g-svg [data-tip] { cursor: pointer; outline: none; }
/* Clickable, not yet selected: thicker ink on hover so it reads as a button */
.g-svg [data-tip]:not(.hot):hover .ink { stroke-width: 2.6; }
.g-svg [data-tip]:not(.hot):hover .t-serif { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.g-svg .hit { fill: none; stroke: transparent; stroke-width: 22; pointer-events: stroke; }
.g-svg [data-part] .ink, .g-svg [data-part] text, .g-svg [data-part] .acc-soft { transition: stroke .2s, fill .2s; }
.g-svg .hot .ink { stroke: var(--terracotta); }
.g-svg .hot .paper { fill: color-mix(in srgb, var(--terracotta) 7%, var(--ivory)); }
.g-svg .hot .t-serif, .g-svg .hot .t-hand { fill: var(--terracotta); }
.g-svg .hot.acc-soft, .g-svg .hot .acc-soft { fill: color-mix(in srgb, var(--terracotta) 32%, var(--ivory)); }
.g-svg [data-tip]:focus-visible .ink { stroke-width: 2.4; }
.g-body .g-tip {
  min-height: 3.2em;
  margin: 14px 0 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
}
.g-body .g-tip.idle { color: var(--muted); font-style: italic; }
/* ```parts: every section shares one grid cell, so the panel is always as
   tall as the longest snippet and nothing below it moves */
.g-parts { display: grid; margin-top: 4px; }
.g-parts > section { grid-area: 1 / 1; min-width: 0; visibility: hidden; opacity: 0; transition: opacity .25s var(--ease); }
.g-parts > section.on { visibility: visible; opacity: 1; }
.g-parts .g-code { margin: 0 0 12px; font-size: 13px; }
.g-parts .g-code:last-child { margin-bottom: 0; }
.g-parts-idle { display: grid; place-items: center; border: 1px dashed var(--rule); }
.g-body .g-parts-idle p { margin: 0; font-size: 14px; font-style: italic; color: var(--muted); }

/* Mermaid output */
.g-mermaid { display: grid; place-items: center; min-height: 140px; opacity: 0; transition: opacity .5s var(--ease); }
.g-mermaid.ready { opacity: 1; min-height: 0; }
.g-mermaid svg { max-width: 100% !important; height: auto; }
.g-mermaid .g-code { width: 100%; margin: 0; }
/* Mermaid names its node labels "label", which would pick up the site's
   mono caps style, both while it measures them and once they're shown */
svg .label { font: inherit; letter-spacing: normal; text-transform: none; color: inherit; margin: 0; }
.g-body .g-mermaid p { margin: 0; font-size: 14px; line-height: 1.5; color: inherit; }

/* Tables */
.g-table { margin: 0 0 24px; overflow-x: auto; }
.g-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.g-table th, .g-table td { padding: 10px 14px 10px 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); color: var(--ink-soft); }
.g-table thead th { font: 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom-color: var(--ink); }
.g-table tbody tr { transition: background .2s var(--ease); }
.g-table tbody tr:hover { background: color-mix(in srgb, var(--terracotta) 6%, transparent); }
.g-table td:first-child { color: var(--ink); font-weight: 500; }
.callout .g-table { margin: 4px 0 0; }
.callout .g-table th, .callout .g-table td { border-bottom-color: color-mix(in srgb, var(--c) 25%, transparent); }

/* Transclusion: another note, quoted in place */
.g-embed {
  margin: 28px 0;
  border: 1px solid var(--rule);
  border-left: 2px solid var(--terracotta);
  background: color-mix(in srgb, var(--ivory-deep) 55%, var(--ivory));
}
.g-embed-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--rule);
  font-size: 14px; font-weight: 500;
  transition: color .2s var(--ease);
}
.g-embed-head > span:last-child { margin-left: auto; color: var(--muted); }
.g-embed-head:hover { color: var(--terracotta); }
.g-embed-head .sep { color: var(--muted); }
.g-embed > .g-body { padding: 18px 18px 2px; }
.g-embed .g-body h2 { margin-top: 0; padding-top: 0; border-top: 0; font-size: 24px; }
.g-embed .g-fig { margin: 0 0 18px; }

/* Token inspector (```jwt) */
.g-jwt { margin: 32px 0; border: 1px solid var(--ink); background: var(--ivory); }
.g-jwt-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink);
  background: var(--ink);
}
.g-jwt-bar .label { color: var(--ivory); opacity: .7; }
.g-jwt-bar [role="tablist"] { display: flex; gap: 4px; }
.g-jwt-bar button {
  padding: 4px 12px;
  border: 1px solid transparent; border-radius: 99px;
  background: none;
  font: 12px var(--mono); color: var(--ivory); opacity: .65;
  transition: opacity .2s, background .2s, color .2s;
}
.g-jwt-bar button:hover { opacity: 1; }
.g-jwt-bar button[aria-selected="true"] { opacity: 1; background: var(--ivory); color: var(--ink); }
.g-jwt-panel { padding: 18px; animation: g-in .35s var(--ease); }
.g-jwt-token {
  margin: 0 0 18px !important;
  padding: 12px 14px;
  background: var(--ivory-deep);
  font: 12.5px/1.6 var(--mono) !important;
  word-break: break-all;
  color: var(--muted) !important;
}
.g-jwt-token .jh { color: var(--terracotta); }
.g-jwt-token .jp { color: var(--ink); }
.g-jwt-token .js { color: var(--muted); opacity: .75; }
.g-jwt-claims { width: 100%; border-collapse: collapse; font-size: 15px; }
.g-jwt-claims th, .g-jwt-claims td { padding: 8px 0; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.g-jwt-claims th { width: 30%; font: 12.5px var(--mono); color: var(--muted); font-weight: 400; }
.g-jwt-claims td { color: var(--ink); word-break: break-all; }
.g-jwt-claims .mark { width: 28px; text-align: right; font-weight: 600; }
.g-jwt-claims .good .mark { color: #5f7d4a; }
.g-jwt-claims .bad { background: color-mix(in srgb, var(--terracotta) 9%, transparent); }
.g-jwt-claims .bad th { padding-left: 8px; color: var(--terracotta); }
.g-jwt-claims .hot { background: color-mix(in srgb, var(--terracotta) 9%, transparent); }
.g-jwt-claims .hot th { padding-left: 8px; color: var(--terracotta); font-weight: 500; }
.g-jwt-claims .hot td { font-weight: 500; }
.g-jwt-one { font: 12px var(--mono); color: var(--ivory); }
.g-jwt-claims .bad .mark { padding-right: 8px; color: var(--terracotta); }
.g-jwt-claims .want { display: block; margin-top: 4px; font-size: 12.5px; color: var(--terracotta); }
.g-jwt-verdict {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0 0 !important;
  font-size: 15px !important;
}
.g-jwt-verdict .code {
  padding: 2px 10px;
  border: 1.5px solid currentColor; border-radius: 3px;
  font: 600 14px var(--mono); letter-spacing: .06em;
}
.g-jwt-verdict.no .code { color: var(--terracotta); transform: rotate(-4deg); }
.g-jwt-verdict.ok .code { color: #5f7d4a; }

/* Walkthroughs (```steps / ```tabs) share the token inspector's frame: an ink bar on top, ivory below */
.g-walk { margin: 36px 0; border: 1px solid var(--ink); background: var(--ivory); outline: none; }
.g-walk:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--terracotta) 35%, transparent); }
.g-walk-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 14px;
  background: var(--ink);
}
.g-walk-bar .label { color: var(--ivory); opacity: .7; }
.g-walk-bar [role="tablist"] { display: flex; flex-wrap: wrap; gap: 4px; }
.g-walk-bar [role="tab"] {
  padding: 4px 12px;
  border: 1px solid transparent; border-radius: 99px;
  background: none;
  font: 12px var(--mono); color: var(--ivory); opacity: .65;
  cursor: pointer;
  transition: opacity .2s, background .2s, color .2s;
}
.g-walk-bar [role="tab"]:hover { opacity: 1; }
.g-walk-bar [role="tab"][aria-selected="true"] { opacity: 1; background: var(--ivory); color: var(--ink); }
.g-walk-count { font: 12px var(--mono); letter-spacing: .06em; color: var(--ivory); opacity: .7; }
.g-walk-count b { font-weight: 500; color: var(--ivory); opacity: 1; }

/* Only the current step takes space, so the box fits its content; setStep
   glides its height between steps like the case study's results box */
.g-walk-panels { padding: 14px clamp(14px, 1.8vw, 20px) 0; overflow: hidden; transition: height .35s ease; }
.g-step { min-width: 0; }
.g-step[hidden] { display: none; }
.g-body .g-step-title {
  margin: 0 0 8px;
  font: 500 17px/1.3 var(--sans);
  letter-spacing: -0.015em;
}
.g-step-body p, .g-step-body li { font-size: 14.5px; line-height: 1.55; }
.g-step-body p { margin-bottom: 10px; }
.g-step-body .g-code { margin-bottom: 10px; padding: 10px 14px; font-size: 12px; line-height: 1.5; }
.g-step-body .g-jwt, .g-step-body .g-fig { margin: 18px 0; }

/* Back, dots and Next on the top bar: they don't move when the box below
   changes height. Next is wide enough for "Start over" so nothing shifts */
.g-walk-nav { display: flex; align-items: center; gap: 12px; }
/* Phones: the Interactive tag needs the bar's left end, so the controls
   drop below it and spread across the full width */
@media (max-width: 560px) {
  .wu-live .g-walk-bar { padding-top: 22px; }
  .g-walk-nav { flex: 1; justify-content: space-between; }
}
.g-walk-btn {
  padding: 3px 12px;
  border: 1px solid var(--ink); border-radius: 99px;
  background: none;
  font: 500 12.5px var(--sans); color: var(--ink);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), opacity .2s;
}
.g-walk-btn:hover:not(:disabled) { background: var(--ink); color: var(--ivory); }
.g-walk-btn.next { min-width: 102px; background: var(--ink); color: var(--ivory); }
.g-walk-btn.next:hover { background: var(--terracotta); border-color: var(--terracotta); }
.g-walk-btn:disabled { opacity: .3; cursor: default; }
.g-walk-dots { display: flex; gap: 8px; }
.g-walk-dots button {
  width: 9px; height: 9px; padding: 0;
  border: 1.5px solid var(--muted); border-radius: 50%;
  background: none; cursor: pointer;
  transition: background .2s, border-color .2s, width .3s var(--ease);
}
.g-walk-dots button.seen { background: var(--muted); }
.g-walk-dots button[aria-current] { width: 24px; border-radius: 99px; border-color: var(--terracotta); background: var(--terracotta); }

/* Interactive blocks: the case study's teal system (.wu-live, in styles.css) */
.g-walk.wu-live, .g-jwt.wu-live { border: 2px solid var(--hot); }
.g-step-body .g-jwt.wu-live { border: 1px solid var(--rule); }
.g-step-body .g-jwt.wu-live::before { content: none; }
.wu-live .g-walk-bar, .wu-live .g-jwt-bar { min-height: 38px; justify-content: flex-end; border-bottom: 0; background: var(--hot-soft); }
/* The Interactive tag sits on this bar, so its own label would crowd it */
.wu-live .g-walk-bar .label, .wu-live .g-jwt-bar .label { display: none; }
.g-walk.wu-live:focus-visible { box-shadow: 0 0 0 1px var(--hot); }
.wu-live .g-walk-count, .wu-live .g-walk-count b { color: var(--hot-text); opacity: 1; }
.wu-live .g-walk-bar [role="tab"], .wu-live .g-jwt-bar button { border-color: var(--hot); color: var(--hot-text); opacity: 1; }
.wu-live .g-walk-bar [role="tab"]:hover, .wu-live .g-jwt-bar button:hover { background: var(--hot-mid); }
.wu-live .g-walk-bar [role="tab"][aria-selected="true"], .wu-live .g-jwt-bar button[aria-selected="true"] { background: var(--hot); color: var(--on-hot); }
.wu-live .g-walk-btn { border: 1.5px solid var(--hot); background: var(--hot-soft); color: var(--hot-text); }
.wu-live .g-walk-btn:hover:not(:disabled) { background: var(--hot-mid); color: var(--hot-text); }
.wu-live .g-walk-btn.next { background: var(--hot); color: var(--on-hot); }
.wu-live .g-walk-btn.next:hover:not(:disabled) { border-color: var(--hot-deep); background: var(--hot-deep); color: var(--on-hot); }

/* --- Phones ----------------------------------------------------------------- */
@media (max-width: 720px) {
  .g-gallery { grid-template-columns: 1fr; }
  .g-gallery .g-fig:nth-child(2) { margin-top: 0; }
}

/* Phones: long code lines wrap, so nothing scrolls sideways */
@media (max-width: 720px) {
  .g-code, .g-code code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .g-code { overflow-x: visible; }
  .g-table { overflow-x: visible; }
  .g-table table { font-size: 14px; }
  .g-table th, .g-table td { padding-right: 10px; overflow-wrap: anywhere; }
}

/* Phones (.is-plain): nothing to click. Every part of a clickable sketch and
   every walkthrough step is simply there, one after another */
.is-plain [data-part], .is-plain [data-tip] { pointer-events: none; cursor: default; }
.is-plain .g-parts { display: block; }
.is-plain .g-parts > section { visibility: visible; opacity: 1; margin-bottom: 18px; }
.is-plain .g-part-note { margin: 0 0 8px; }
.is-plain .g-parts > .g-parts-idle { display: none; }
.is-plain .g-walk.wu-live, .is-plain .g-jwt.wu-live { border: 1px solid var(--rule); --terracotta: #ad4f2b; }
.is-plain .g-walk.wu-live::before, .is-plain .g-jwt.wu-live::before, .is-plain .g-walk-bar, .is-plain .g-jwt-bar [role="tablist"] { display: none; }
.is-plain .g-walk-panels { height: auto !important; overflow: visible; }
.is-plain .g-step[hidden], .is-plain .g-jwt-panel[hidden] { display: block; }
.is-plain .g-step { margin-bottom: 18px; }
