/* ==========================================================================
   SCIENTIFIC ML STUDIO — design system
   --------------------------------------------------------------------------
   Brand palette (from the logo sheet):

       coral   #FF674F   the flowing S; accents, fills, focus, progress
       teal    #063E3A   the wordmark; all text, dark surfaces
       ivory   #FBF8F0   the page
       butter  #F4EBCF   the symbol on dark; soft highlights

   Coral is 2.7:1 on ivory, so it is never used for small text on light
   surfaces: text uses --accent-text (a deeper coral, 4.9:1) and coral itself
   is reserved for fills, rules, focus rings and large display type.  Text on
   a coral fill is deep teal, never ivory.

   Type (all vendored; the site works with no network):
       Inter 500        navigation and small labels
       Inter 700 / 800  "Scientific" / "ML" in the wordmark
       Libre Baskerville 400 / 400 italic
                        "Studio", the tagline, editorial headings
       Inter 400        reading text
       IBM Plex Mono    code only
   ========================================================================== */

/* --- Fonts ---------------------------------------------------------------- */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-ext-500-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-ext-600-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-ext-700-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-800-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 800; font-display: swap;
  src: url('../vendor/fonts/inter/inter-latin-ext-800-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Libre Baskerville'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/libre-baskerville/libre-baskerville-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Libre Baskerville'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/libre-baskerville/libre-baskerville-latin-ext-400-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'Libre Baskerville'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/libre-baskerville/libre-baskerville-latin-400-italic.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: 'Libre Baskerville'; font-style: italic; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/libre-baskerville/libre-baskerville-latin-ext-400-italic.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('../vendor/fonts/ibm-plex-mono/ibm-plex-mono-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('../vendor/fonts/ibm-plex-mono/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
}

/* --- Tokens -------------------------------------------------------------- */
:root {
  /* brand */
  --coral:      #FF674F;
  --teal:       #063E3A;
  --ivory:      #FBF8F0;
  --butter:     #F4EBCF;

  /* ink and surfaces */
  --ink:        #063E3A;
  --ink-2:      #0C4E49;
  --ink-3:      #1B625B;
  --paper:      #FBF8F0;
  --paper-2:    #FFFDF8;
  --surface:    #FFFEFA;
  --line:       #E3DAC3;
  --line-soft:  #EEE7D6;
  --muted:      #476763;
  --muted-2:    #5F7772;

  /* text on dark (teal) surfaces */
  --on-dark:    #FBF8F0;
  --on-dark-2:  #D6D9C6;
  --on-dark-3:  #A5B4A6;

  /* accent (coral) */
  --accent:        #FF674F;
  --accent-bright: #FF7C66;
  --accent-text:   #C23E28;
  --accent-wash:   #FFEBE5;
  --on-accent:     #04211E;

  /* state */
  --ok:         #0F7A6C;
  --ok-wash:    #E1F0EA;
  --amber:      #94640F;
  --amber-wash: #FBF1D6;
  --rose:       #B0243A;
  --rose-wash:  #FBE7EA;

  --font-display: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-body:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-label: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.15vw, 1.02rem);
  --step-1:  clamp(1.08rem, 1.02rem + 0.3vw, 1.24rem);
  --step-2:  clamp(1.25rem, 1.12rem + 0.55vw, 1.55rem);
  --step-3:  clamp(1.5rem, 1.25rem + 1.05vw, 2.1rem);
  --step-4:  clamp(1.9rem, 1.4rem + 2.1vw, 3.1rem);

  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4.5rem;

  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(6, 62, 58, .05), 0 8px 24px -12px rgba(6, 62, 58, .18);
  --shadow-lift: 0 2px 4px rgba(6, 62, 58, .06), 0 18px 40px -18px rgba(6, 62, 58, .28);

  --measure: 68ch;
  --shell: 1240px;
  --rail: 300px;
  --header-h: 64px;
}

/* --- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 3rem); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4, h5 { margin: 0 0 var(--sp-3); line-height: 1.22; font-weight: 400; letter-spacing: -0.008em; }
h1 { font-family: var(--font-display); font-size: var(--step-4); }
h2 { font-family: var(--font-display); font-size: var(--step-3); }
h3 { font-family: var(--font-display); font-size: var(--step-2); }
h4 { font-family: var(--font-label); font-size: var(--step-1); font-weight: 600; letter-spacing: -.005em; }
p { margin: 0 0 var(--sp-4); }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
.hero :focus-visible, .footer :focus-visible, .notice :focus-visible { outline-color: var(--butter); }
::selection { background: var(--butter); color: var(--ink); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: #fff; padding: var(--sp-3) var(--sp-4); border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* --- Layout -------------------------------------------------------------- */
.shell { width: min(100% - 2.5rem, var(--shell)); margin-inline: auto; }
.shell--narrow { width: min(100% - 2.5rem, 760px); margin-inline: auto; }
.stack > * + * { margin-top: var(--sp-4); }
.section { padding-block: var(--sp-8); }
.section--tight { padding-block: var(--sp-7); }
.grid { display: grid; gap: var(--sp-5); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; }
.spread { display: flex; flex-wrap: wrap; gap: var(--sp-4); align-items: center; justify-content: space-between; }
.page { padding-block: var(--sp-7) var(--sp-8); }

/* --- Header -------------------------------------------------------------- */
.masthead {
  position: sticky; top: 0; z-index: 60;
  background: rgba(251, 248, 240, .9);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.masthead__inner { display: flex; align-items: center; gap: var(--sp-5); height: var(--header-h); }

/* The lockup: the coral S, then "Scientific ML" over "Studio".
   Scientific = Inter 700, ML = Inter 800, Studio = Libre Baskerville italic. */
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand__mark { display: block; width: auto; height: 42px; aspect-ratio: 85 / 100; color: var(--accent); flex: none; }
.brand__lockup { display: flex; flex-direction: column; line-height: 1; }
.brand__name { font-family: var(--font-label); font-weight: 700; font-size: 1.2rem; letter-spacing: -.025em; white-space: nowrap; }
.brand__name b { font-weight: 800; }
.brand__script { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 1.12rem; letter-spacing: -.015em; margin-top: .16rem; }

/* The app tile: a coral rounded square holding the ivory S. */
.glyph {
  display: inline-grid; place-items: center; flex: none;
  width: 36px; height: 36px; border-radius: 22%;
  background: var(--accent); color: var(--ivory);
}
.glyph svg { width: 56%; height: 56%; }
.glyph--accent { background: var(--accent); color: var(--ivory); }
.glyph--lg { width: 52px; height: 52px; }

.nav { display: flex; gap: var(--sp-1); margin-left: auto; align-items: center; }
.nav a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem; border-radius: var(--radius);
  color: var(--ink); text-decoration: none; font-size: var(--step--1);
  font-weight: 500; letter-spacing: .01em;
}
.nav a:hover { background: var(--line-soft); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper-2); }
.nav__count {
  font-family: var(--font-label); font-weight: 500; font-size: .7rem; min-width: 1.15rem; text-align: center;
  background: var(--accent); color: var(--on-accent); border-radius: 99px; padding: 0 .3rem; line-height: 1.35;
}
.nav__avatar {
  width: 28px; height: 28px; border-radius: 99px; background: var(--ink-2); color: var(--paper-2);
  display: grid; place-items: center; font-family: var(--font-label); font-weight: 500; font-size: .68rem; letter-spacing: .02em;
  overflow: hidden;
}
.nav__avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Context strip — the mono readout that says where you are. Structural: it
   prints the real coordinate of the page (section number, order reference). */
.contextbar {
  border-bottom: 1px solid var(--line-soft);
  background: var(--paper-2);
  font-family: var(--font-label); font-weight: 500; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted);
}
.contextbar__inner { display: flex; align-items: center; gap: var(--sp-3); min-height: 34px; flex-wrap: wrap; }
.contextbar a { color: var(--muted); text-decoration: none; }
.contextbar a:hover { color: var(--accent-text); }
.contextbar__sep { color: var(--line); }
.contextbar__right { margin-left: auto; display: flex; gap: var(--sp-3); align-items: center; }

/* --- Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: 500 var(--step--1)/1 var(--font-body); letter-spacing: .01em;
  padding: .68rem 1.05rem; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: var(--paper-2); }
.btn--primary:hover { background: var(--ink-3); color: #fff; }
.btn--accent { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn--accent:hover { background: var(--accent-bright); color: var(--on-accent); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); background: var(--surface); }
.btn--quiet { background: transparent; color: var(--muted); padding-inline: .5rem; }
.btn--quiet:hover { color: var(--ink); }
.btn--danger { background: transparent; border-color: var(--rose); color: var(--rose); }
.btn--danger:hover { background: var(--rose); color: #fff; }
.btn--block { width: 100%; }
.btn--lg { padding: .85rem 1.4rem; font-size: var(--step-0); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn--google { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--google:hover { border-color: var(--ink); }
.btn--google svg { width: 17px; height: 17px; }

/* --- Labels and badges --------------------------------------------------- */
.eyebrow {
  font-family: var(--font-label); font-weight: 500; font-size: .7rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 var(--sp-3);
  display: flex; align-items: center; gap: .55rem;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); flex: none; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-family: var(--font-label); font-weight: 500; font-size: .68rem; letter-spacing: .07em; text-transform: uppercase;
  padding: .2rem .5rem; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); background: var(--surface);
}
.badge--accent { border-color: var(--accent); color: var(--accent-text); background: var(--accent-wash); }
.badge--amber { border-color: var(--amber); color: var(--amber); background: var(--amber-wash); }
.badge--solid { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }
.badge--lock { border-style: dashed; }

.tag-link {
  font-family: var(--font-label); font-weight: 500; font-size: .7rem; color: var(--muted);
  text-decoration: none; border-bottom: 1px dotted var(--line);
}
.tag-link:hover { color: var(--accent-text); border-color: var(--accent); }

/* --- Cards --------------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: var(--sp-5); position: relative;
}
.card--flat { box-shadow: none; }
.card--pad-sm { padding: var(--sp-4); }

.tile {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.tile:hover { border-color: var(--ink-3); box-shadow: var(--shadow-lift); transform: translateY(-2px); color: inherit; }
.tile__media { aspect-ratio: 16 / 9; background: var(--ink-2); position: relative; overflow: hidden; }
.tile__media img { width: 100%; height: 100%; object-fit: cover; }
.tile__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.tile__title { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.2; margin: 0; }
.tile__meta {
  font-family: var(--font-label); font-weight: 500; font-size: .7rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted-2);
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
}
.tile__summary { color: var(--muted); font-size: var(--step--1); margin: 0; }
.tile__foot {
  margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
}
.price { font-family: var(--font-label); font-weight: 500; font-size: var(--step-1); font-weight: 500; letter-spacing: -.01em; }
.price small { font-size: .7em; color: var(--muted-2); text-decoration: line-through; margin-left: .4rem; font-weight: 400; }
.price--free { color: var(--ok); }

/* --- Notes / messages ---------------------------------------------------- */
.notes { position: fixed; top: calc(var(--header-h) + 44px); right: 1rem; z-index: 80; width: min(360px, calc(100vw - 2rem)); display: grid; gap: .5rem; }
.note {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--muted);
  border-radius: var(--radius); padding: .7rem .9rem; box-shadow: var(--shadow-lift);
  font-size: var(--step--1); display: flex; gap: .6rem; align-items: flex-start;
  animation: note-in .22s ease-out;
}
@keyframes note-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.note--success { border-left-color: var(--ok); }
.note--error { border-left-color: var(--rose); }
.note--warning { border-left-color: var(--amber); }
.note--info { border-left-color: var(--ink-3); }
.note__close { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--muted-2); font-size: 1.1rem; line-height: 1; padding: 0 .1rem; }

.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  background: var(--surface); border-radius: var(--radius);
  padding: var(--sp-4); font-size: var(--step--1);
}
.callout--amber { border-left-color: var(--amber); }
.callout__title { font-weight: 600; margin-bottom: .3rem; }

/* --- Forms --------------------------------------------------------------- */
.field { display: grid; gap: .35rem; margin-bottom: var(--sp-4); }
.field > label, .field__label {
  font-family: var(--font-label); font-weight: 500; font-size: .72rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
}
input[type="text"], input[type="email"], input[type="password"], input[type="url"],
input[type="search"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; font: 400 var(--step-0)/1.5 var(--font-body); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .6rem .75rem; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 103, 79, .38);
}
textarea { resize: vertical; min-height: 6rem; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
.helptext { font-size: .78rem; color: var(--muted-2); }
.errorlist { list-style: none; margin: .2rem 0 0; padding: 0; color: var(--rose); font-size: .78rem; }
.field__req { color: var(--rose); margin-left: .15rem; }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--rose); }
.field--invalid input:focus, .field--invalid select:focus, .field--invalid textarea:focus { box-shadow: 0 0 0 3px var(--rose-wash, rgba(190, 70, 70, .12)); }
.field--check { margin-top: calc(var(--sp-2) * -1); }
.check { display: flex; gap: .55rem; align-items: flex-start; font-size: var(--step--1); }
.check input { margin-top: .25rem; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0 0 var(--sp-5); }
legend { font-family: var(--font-display); font-size: var(--step-2); padding: 0; margin-bottom: var(--sp-3); }

.searchbar { display: flex; gap: .5rem; }
.searchbar input { flex: 1; }

/* --- Tables -------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.table th {
  text-align: left; font-family: var(--font-label); font-weight: 500; font-size: .7rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted); font-weight: 500;
  padding: .55rem .7rem; border-bottom: 1px solid var(--line);
}
.table td { padding: .7rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table__num { font-family: var(--font-label); font-weight: 500; text-align: right; white-space: nowrap; }

/* --- Prose (book sections, post bodies) ---------------------------------- */
.prose { max-width: var(--measure); font-size: 1.02rem; line-height: 1.72; }
.prose > * + * { margin-top: var(--sp-4); }
.prose h2 { font-size: var(--step-2); margin-top: var(--sp-7); scroll-margin-top: 6rem; }
.prose h3 { font-size: var(--step-1); font-family: var(--font-body); font-weight: 600; margin-top: var(--sp-6); scroll-margin-top: 6rem; }
.prose h4 { margin-top: var(--sp-5); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li + li { margin-top: .35rem; }
.prose blockquote {
  margin: var(--sp-5) 0; padding-left: var(--sp-4); border-left: 2px solid var(--accent);
  font-family: var(--font-display); font-size: var(--step-1); font-style: italic; color: var(--ink-3);
}
.prose code:not(pre code) {
  background: var(--line-soft); padding: .12em .35em; border-radius: 3px; font-size: .88em;
}
.prose pre, .codeblock {
  background: var(--ink); color: var(--on-dark); border-radius: var(--radius);
  padding: var(--sp-4); overflow-x: auto; font-family: var(--font-mono); font-size: .85rem; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92em; }
.prose th, .prose td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: left; }
.prose th { background: var(--line-soft); font-weight: 600; }
.prose img { border-radius: var(--radius); border: 1px solid var(--line); }
.prose figcaption { font-size: .82rem; color: var(--muted); font-family: var(--font-label); font-weight: 500; }
.prose .admonition { border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: var(--sp-4); background: var(--surface); }
.prose .admonition-title { font-weight: 600; margin-bottom: .3rem; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding-block: .35rem; }

/* --- Learn: two-column reader ------------------------------------------- */
.reader { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.reader__rail {
  position: sticky; top: calc(var(--header-h) + 34px);
  max-height: calc(100vh - var(--header-h) - 46px); overflow-y: auto;
  padding-right: var(--sp-3); border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.reader__main { min-width: 0; padding-block: var(--sp-5) var(--sp-8); }

.toc { list-style: none; margin: 0; padding: 0; font-size: var(--step--1); }
.toc__part {
  font-family: var(--font-label); font-weight: 500; font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted-2); margin: var(--sp-5) 0 var(--sp-2); padding-bottom: .3rem; border-bottom: 1px solid var(--line-soft);
}
.toc__chapter { margin-bottom: var(--sp-3); }
.toc__chapter-head {
  display: flex; align-items: baseline; gap: .5rem; width: 100%;
  background: none; border: 0; padding: .3rem 0; cursor: pointer; text-align: left;
  font: 500 var(--step--1)/1.35 var(--font-body); color: var(--ink);
}
.toc__num { font-family: var(--font-label); font-weight: 500; font-size: .72rem; color: var(--accent-text); flex: none; min-width: 1.4rem; }
.toc__count { margin-left: auto; font-family: var(--font-label); font-weight: 500; font-size: .65rem; color: var(--muted-2); }
.toc__sections { list-style: none; margin: .15rem 0 0; padding: 0 0 0 1.9rem; border-left: 1px solid var(--line-soft); }
.toc__sections li { margin: 0; }
.toc__link {
  display: flex; gap: .5rem; align-items: baseline; padding: .28rem .5rem .28rem .55rem;
  margin-left: -1px; border-left: 2px solid transparent;
  color: var(--muted); text-decoration: none; font-size: .86rem; line-height: 1.4;
}
.toc__link:hover { color: var(--ink); background: var(--line-soft); }
.toc__link[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); background: var(--accent-wash); font-weight: 500; }
.toc__link .toc__num { font-size: .68rem; }
.toc__done { color: var(--ok); flex: none; }
.toc__lock { color: var(--muted-2); flex: none; font-size: .7rem; }
.toc__search { margin-bottom: var(--sp-4); }
.toc__results { list-style: none; margin: .4rem 0 0; padding: 0; font-size: .82rem; }
.toc__results li a { display: block; padding: .3rem .4rem; border-radius: 3px; color: var(--ink); text-decoration: none; }
.toc__results li a:hover { background: var(--line-soft); }

.section-head { border-bottom: 1px solid var(--line); padding-bottom: var(--sp-4); margin-bottom: var(--sp-5); }
.section-head__num {
  font-family: var(--font-label); font-weight: 500; font-size: var(--step--1); color: var(--accent-text);
  letter-spacing: .1em; display: block; margin-bottom: .4rem;
}
.section-head__lead { color: var(--muted); font-size: var(--step-1); font-family: var(--font-display); margin: .4rem 0 0; }

.section-nav {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4);
  margin-top: var(--sp-8); padding-top: var(--sp-5); border-top: 1px solid var(--line);
}
.section-nav a {
  display: block; padding: var(--sp-4); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color .15s;
}
.section-nav a:hover { border-color: var(--ink-3); }
.section-nav__dir { font-family: var(--font-label); font-weight: 500; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); display: block; margin-bottom: .25rem; }
.section-nav__title { font-family: var(--font-display); font-size: var(--step-1); line-height: 1.2; }
.section-nav a:last-child { text-align: right; }

.outline {
  position: sticky; top: calc(var(--header-h) + 48px);
  font-size: .82rem; border-left: 1px solid var(--line); padding-left: var(--sp-4);
}
.outline ul { list-style: none; margin: 0; padding: 0; }
.outline a { display: block; padding: .2rem 0; color: var(--muted); text-decoration: none; }
.outline a:hover, .outline a.is-active { color: var(--accent-text); }
.outline .lvl-3 { padding-left: .8rem; }
.outline .lvl-4 { padding-left: 1.6rem; }

/* --- Gate ---------------------------------------------------------------- */
.gate {
  position: relative; margin-top: var(--sp-5);
  border: 1px dashed var(--line); border-radius: var(--radius-lg);
  padding: var(--sp-6); background: var(--surface); text-align: center;
}
.gate__mark { width: 34px; height: 34px; margin: 0 auto var(--sp-3); color: var(--accent); }
.gate h3 { font-size: var(--step-2); margin-bottom: .4rem; }
.gate p { color: var(--muted); max-width: 46ch; margin-inline: auto; }
.gate__fade {
  position: relative; max-height: 190px; overflow: hidden;
}
.gate__fade::after {
  content: ""; position: absolute; inset: auto 0 0; height: 120px;
  background: linear-gradient(to bottom, transparent, var(--paper));
}

/* --- Hero ---------------------------------------------------------------- */
.hero { position: relative; background: var(--ink); color: var(--on-dark); overflow: hidden; isolation: isolate; }
.hero__canvas { position: absolute; inset: 0; z-index: -1; opacity: .85; }
.hero__inner { padding-block: clamp(4rem, 11vh, 8rem); position: relative; }
.hero__eyebrow { color: var(--butter); }
.hero__eyebrow::before { background: var(--accent); }
.hero h1 { font-size: var(--step-4); font-weight: 400; letter-spacing: -.022em; max-width: 17ch; color: var(--on-dark); }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero__lead { max-width: 52ch; color: var(--on-dark-2); font-size: var(--step-1); margin-top: var(--sp-4); }
.hero__actions { margin-top: var(--sp-6); display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.hero .btn--ghost { border-color: rgba(244, 235, 207, .3); color: var(--on-dark); }
.hero .btn--ghost:hover { border-color: var(--accent-bright); background: rgba(255, 103, 79, .1); color: #fff; }
.hero__stats {
  margin-top: var(--sp-7); padding-top: var(--sp-5); border-top: 1px solid rgba(244, 235, 207, .16);
  display: flex; gap: var(--sp-7); flex-wrap: wrap;
  font-family: var(--font-label); font-weight: 500; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--on-dark-3);
}
.hero__stats b { display: block; font-size: 1.5rem; color: var(--on-dark); font-weight: 500; letter-spacing: -.01em; text-transform: none; margin-bottom: .1rem; }

/* --- Section index (the four ways in) ------------------------------------ */
.ways { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.way {
  padding: var(--sp-5); text-decoration: none; color: inherit;
  border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--sp-2);
  transition: background .16s;
}
.way:last-child { border-right: 0; }
.way:hover { background: var(--paper); color: inherit; }
.way__icon { width: 26px; height: 26px; color: var(--accent); }
.way__name { font-family: var(--font-display); font-size: var(--step-1); }
.way__desc { font-size: var(--step--1); color: var(--muted); margin: 0; }
.way__state { margin-top: auto; padding-top: var(--sp-3); }

/* --- Filters bar --------------------------------------------------------- */
.filters {
  display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: flex-end;
  padding: var(--sp-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  margin-bottom: var(--sp-5);
}
.filters .field { margin: 0; min-width: 150px; }
.filters .field--grow { flex: 1; min-width: 220px; }

/* --- Pagination ---------------------------------------------------------- */
.pager { display: flex; gap: .35rem; justify-content: center; align-items: center; margin-top: var(--sp-7); font-family: var(--font-label); font-weight: 500; font-size: .78rem; }
.pager a, .pager span {
  padding: .4rem .7rem; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); background: var(--surface);
}
.pager a:hover { border-color: var(--ink); }
.pager .is-current { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
.pager .is-disabled { opacity: .35; pointer-events: none; }

/* --- Forum --------------------------------------------------------------- */
.post-row {
  display: grid; grid-template-columns: 56px minmax(0,1fr); gap: var(--sp-4);
  padding: var(--sp-5) 0; border-bottom: 1px solid var(--line-soft);
}
.post-row__score { text-align: center; font-family: var(--font-label); font-weight: 500; }
.post-row__score b { display: block; font-size: var(--step-1); font-weight: 500; }
.post-row__score span { font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); }
.post-row__title { font-family: var(--font-display); font-size: var(--step-2); line-height: 1.18; margin: 0 0 .3rem; }
.post-row__title a { color: var(--ink); text-decoration: none; }
.post-row__title a:hover { color: var(--accent-text); }
.post-row__meta { font-family: var(--font-label); font-weight: 500; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); display: flex; gap: .55rem; flex-wrap: wrap; align-items: baseline; }
.post-row__meta > * + *::before { content: '\00B7'; margin-right: .55rem; color: var(--line); }

.comment { padding: var(--sp-4) 0; border-bottom: 1px solid var(--line-soft); }
.comment__head { display: flex; gap: .6rem; align-items: center; margin-bottom: .4rem; }
.comment__author { font-weight: 600; font-size: var(--step--1); }
.comment__time { font-family: var(--font-label); font-weight: 500; font-size: .68rem; color: var(--muted-2); }
.comment__replies { margin-left: var(--sp-5); padding-left: var(--sp-4); border-left: 2px solid var(--line-soft); }
.comment--answer { background: var(--accent-wash); border-radius: var(--radius); padding: var(--sp-4); border-bottom: 0; }

/* --- Lab ----------------------------------------------------------------- */
.lab-tile { position: relative; }
.lab-tile__stage { position: absolute; top: var(--sp-4); right: var(--sp-4); }
.lab-shell { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.lab-shell__bar {
  display: flex; align-items: center; gap: var(--sp-3); padding: .55rem var(--sp-4);
  border-bottom: 1px solid var(--line); background: var(--paper-2);
  font-family: var(--font-label); font-weight: 500; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.lab-shell__body { min-height: 480px; }
.lab-frame { width: 100%; height: 78vh; min-height: 520px; border: 0; display: block; }

/* --- Dashboard ----------------------------------------------------------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--sp-4); }
.stat__value { font-family: var(--font-label); font-weight: 500; font-size: var(--step-3); font-weight: 500; line-height: 1; letter-spacing: -.02em; }
.stat__label { font-family: var(--font-label); font-weight: 500; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin-top: .4rem; }

.ring__track { stroke: var(--line); }
.ring__value { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .4s ease; }

.progress { height: 4px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s ease; }

.side-tabs { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.side-tabs a {
  display: flex; align-items: center; gap: .5rem; padding: .55rem .75rem; border-radius: var(--radius);
  text-decoration: none; color: var(--ink); font-size: var(--step--1);
}
.side-tabs a:hover { background: var(--line-soft); }
.side-tabs a[aria-current="page"] { background: var(--ink); color: var(--paper-2); }

/* Sign out sits apart from the navigation items above it: it leaves the
   account area rather than moving within it. */
.side-tabs__end { margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line-soft); }
.side-tabs__end form { margin: 0; }
.side-tabs__signout {
  display: flex; align-items: center; gap: .5rem;
  width: 100%; padding: .55rem .75rem;
  background: none; border: 0; border-radius: var(--radius);
  font: inherit; font-size: var(--step--1); color: var(--muted);
  text-align: left; cursor: pointer;
}
.side-tabs__signout:hover { background: var(--rose-wash); color: var(--rose); }
.side-tabs__signout svg { flex: none; }

/* Header sign-out: an icon next to the avatar, unobtrusive until hovered. */
.nav__signout { display: inline-flex; margin: 0; }
.nav__signout button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .4rem; margin-left: -.2rem;
  background: none; border: 0; border-radius: var(--radius);
  color: var(--muted-2); cursor: pointer;
}
.nav__signout button:hover { background: var(--rose-wash); color: var(--rose); }
.nav__signout button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Entrance (sign in / sign up) ---------------------------------------- */
/* The page chrome would compete with a full-bleed split screen, so it goes. */
body.entrance-page .contextbar,
body.entrance-page .notice,
body.entrance-page .site-footer,
body.entrance-page footer { display: none; }
body.entrance-page .ambient { display: none; }

.entrance {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  min-height: calc(100vh - 62px);
}
@media (max-width: 900px) { .entrance { grid-template-columns: 1fr; min-height: 0; } }

/* --- Left: the claim --- */
.entrance__pitch {
  position: relative;
  background: var(--ink);
  color: var(--on-dark);
  padding: var(--sp-8) clamp(1.5rem, 4vw, 4.5rem);
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
/* Concentric rings: a radiating solution field, kept faint enough to read as
   texture rather than as a picture of anything. */
.entrance__pitch::before {
  content: "";
  position: absolute; right: -18%; bottom: -22%;
  width: 78%; aspect-ratio: 1; border-radius: 50%;
  background:
    repeating-radial-gradient(circle,
      rgba(255, 103, 79, .07) 0 1px, transparent 1px 42px);
  pointer-events: none;
}
.entrance__brand {
  display: inline-flex; align-items: center; gap: .7rem;
  text-decoration: none; color: #fff; margin-bottom: var(--sp-7);
  position: relative; width: max-content;
}
.entrance__word {
  font-family: var(--font-label); font-weight: 500; font-size: 1rem;
  letter-spacing: .22em; text-transform: uppercase;
}
.entrance__claim {
  position: relative;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(2rem, 3.4vw, 3.2rem); line-height: 1.08;
  letter-spacing: -.02em; color: #fff; margin-bottom: var(--sp-5);
  max-width: 16ch;
}
.entrance__claim em { font-style: italic; color: var(--accent-bright); }
.entrance__sub {
  position: relative; max-width: 46ch;
  font-size: var(--step-0); line-height: 1.6; color: var(--on-dark-2);
  margin-bottom: var(--sp-7);
}
.entrance__points { position: relative; list-style: none; margin: 0 0 var(--sp-8); padding: 0; }
.entrance__points li {
  display: flex; gap: .8rem; align-items: baseline;
  font-size: var(--step--1); color: var(--on-dark-2);
  padding: .55rem 0; border-top: 1px solid rgba(244, 235, 207, .12);
}
.entrance__points li:last-child { border-bottom: 1px solid rgba(244, 235, 207, .12); }
.entrance__points span {
  font-family: var(--font-label); font-weight: 500; font-size: .7rem;
  color: var(--accent-bright); flex: none;
}
.entrance__eq {
  position: relative; display: flex; flex-wrap: wrap; gap: .5rem 1.6rem;
  font-family: var(--font-label); font-weight: 500; font-size: .74rem; color: var(--muted-2); margin: 0;
}
.entrance__eqlist { color: var(--muted-2); }

@media (max-width: 900px) {
  .entrance__pitch { padding: var(--sp-6) var(--sp-5); }
  .entrance__points, .entrance__eq { display: none; }
  .entrance__claim { font-size: var(--step-3); max-width: none; }
  .entrance__sub { margin-bottom: 0; }
}

/* --- Right: the form --- */
.entrance__panel {
  background: var(--paper);
  padding: var(--sp-8) clamp(1.5rem, 4vw, 4rem);
  display: flex; flex-direction: column; justify-content: center;
}
.entrance__form { width: 100%; max-width: 27rem; margin-inline: auto; }

.entrance__tabs {
  display: flex; gap: var(--sp-5);
  width: 100%; max-width: 27rem; margin: 0 auto var(--sp-6);
  border-bottom: 1px solid var(--line);
}
.entrance__tabs a {
  padding: .5rem 0 .7rem; text-decoration: none;
  font-size: var(--step--1); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.entrance__tabs a:hover { color: var(--ink); }
.entrance__tabs a[aria-current="page"] { color: var(--accent-text); border-bottom-color: var(--accent); font-weight: 600; }

.entrance__form .eyebrow { margin-bottom: .2rem; }
.entrance__form h1 { margin-bottom: var(--sp-5); }
.entrance__form .btn--block { width: 100%; }

/* --- Lab: notebook list --------------------------------------------------- */
.nb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-5); }

.nb-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); display: flex; flex-direction: column;
  transition: border-color .2s ease, transform .2s ease;
}
.nb-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.nb-card__body { display: block; padding: var(--sp-5); color: inherit; text-decoration: none; flex: 1; }
.nb-card__title { font-family: var(--font-display); font-size: var(--step-1); margin-bottom: .3rem; }
.nb-card__summary { color: var(--muted); font-size: var(--step--1); margin-bottom: var(--sp-4); }
.nb-card__meta {
  display: flex; flex-wrap: wrap; gap: .5rem; font-family: var(--font-label); font-weight: 500;
  font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-2);
}
.nb-card__meta > * + *::before { content: '\00B7'; margin-right: .5rem; color: var(--line); }
.nb-card__delete {
  border: 0; border-top: 1px solid var(--line-soft); background: none;
  padding: .6rem var(--sp-5); text-align: left; width: 100%;
  font: inherit; font-size: var(--step--1); color: var(--muted-2); cursor: pointer;
}
.nb-card__delete:hover { background: var(--rose-wash); color: var(--rose); }

.nb-new {
  border: 1px dashed var(--line); border-radius: var(--radius);
  padding: var(--sp-5); background: var(--paper-2);
}
.nb-new--full { border-style: solid; }
.nb-new__title { font-family: var(--font-display); font-size: var(--step-1); margin-bottom: .3rem; }
.nb-new__note { color: var(--muted); font-size: var(--step--1); margin-bottom: var(--sp-4); }
.nb-new__form input, .nb-new__form select { width: 100%; margin-bottom: var(--sp-4); }

/* --- Lab: the studio ------------------------------------------------------ */
.studio { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5) var(--sp-5) var(--sp-8); }

.studio__bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--sp-4); flex-wrap: wrap;
  padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line);
}
.studio__id { display: flex; align-items: center; gap: var(--sp-4); }
.studio__back {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
}
.studio__back:hover { background: var(--paper-2); }
.studio__title { font-family: var(--font-display); font-size: var(--step-2); margin: 0; }
.studio__status { font-family: var(--font-label); font-weight: 500; font-size: .72rem; color: var(--muted-2); margin: 0; }
.studio__actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.studio__grid {
  display: grid; grid-template-columns: 216px 1fr 290px; gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 1180px) { .studio__grid { grid-template-columns: 1fr; } }

.studio__h {
  font-family: var(--font-label); font-weight: 500; font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 .3rem;
}
.studio__hint { font-size: var(--step--1); color: var(--muted-2); margin-bottom: var(--sp-4); }

.studio__library, .studio__inspector {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: var(--sp-4);
  max-height: 78vh; overflow-y: auto; position: sticky; top: var(--sp-4);
}

/* --- Palette --- */
.pal__group { margin-bottom: var(--sp-5); }
.pal__family {
  font-family: var(--font-label); font-weight: 500; font-size: .66rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--c); margin-bottom: .25rem;
  padding-left: .4rem; border-left: 2px solid var(--c);
}
.pal__blurb { font-size: .72rem; color: var(--muted-2); margin: 0 0 .4rem .4rem; line-height: 1.4; }
.pal__item {
  display: flex; align-items: center; gap: .5rem;
  padding: .38rem .5rem; margin-bottom: .25rem;
  border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--surface); font-size: var(--step--1);
  cursor: grab; user-select: none;
}
.pal__item:hover { border-color: var(--c); background: var(--paper-2); }
.pal__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pal__item.is-dragging { opacity: .4; }
.pal__chip {
  display: grid; place-items: center; width: 24px; height: 24px; flex: none;
  border-radius: 5px; background: var(--c); color: #fff; font-size: .7rem;
}

/* --- Canvas --- */
.studio__canvas-wrap {
  position: relative; height: 78vh; min-height: 560px; z-index: 1;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--paper-2);
  background-image: radial-gradient(circle, var(--line-soft) 1px, transparent 1px);
  background-size: 20px 20px;
  overflow: auto;
}
.studio__wires {
  position: absolute; inset: 0; width: 3000px; height: 2000px;
  pointer-events: none; z-index: 1;
}
.wire { fill: none; stroke: var(--accent); stroke-width: 1.8; opacity: .7; pointer-events: stroke; cursor: pointer; }
.wire:hover { stroke: var(--rose); opacity: 1; stroke-width: 2.6; }
.wire--ghost { stroke-dasharray: 5 4; opacity: .8; pointer-events: none; }

.studio__canvas { position: relative; width: 3000px; height: 2000px; z-index: 2; }
.studio__canvas.is-target { background: var(--accent-wash); }
.studio__empty {
  position: absolute; top: 40px; left: 0; right: 0; text-align: center;
  color: var(--muted-2); font-size: var(--step--1); pointer-events: none; z-index: 3;
}
.studio__empty[hidden] { display: none; }

/* --- Blocks --- */
.blk {
  position: absolute; z-index: 4;
  border: 1px solid var(--line); border-top: 3px solid var(--c);
  border-radius: var(--radius); background: var(--surface);
  box-shadow: 0 1px 4px rgba(6, 62, 58, .09);
  font-size: var(--step--1);
}
.blk.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-wash), 0 2px 8px rgba(6, 62, 58,.12); }
.blk__head {
  display: flex; align-items: center; gap: .4rem;
  padding: .4rem .5rem; cursor: grab; border-bottom: 1px solid var(--line-soft);
}
.blk__head:active { cursor: grabbing; }
.blk__chip {
  display: grid; place-items: center; width: 20px; height: 20px; flex: none;
  border-radius: 4px; background: var(--c); color: #fff; font-size: .64rem;
}
.blk__name { flex: 1; font-weight: 500; }
.blk__x { border: 0; background: none; color: var(--muted-2); cursor: pointer; line-height: 1; padding: 0 .1rem; }
.blk__x:hover { color: var(--rose); }

.blk__ports { display: flex; justify-content: space-between; padding: .3rem 0 .4rem; gap: .4rem; }
.blk__col { display: flex; flex-direction: column; gap: .1rem; }
.blk__col--out { align-items: flex-end; }

.port {
  display: flex; align-items: center; gap: .3rem;
  font-family: var(--font-label); font-weight: 500; font-size: .6rem; color: var(--muted-2);
  padding: .1rem .3rem; cursor: crosshair; height: 20px;
}
.port:hover { color: var(--accent); }
.port__dot {
  width: 9px; height: 9px; flex: none; border-radius: 50%;
  border: 1.5px solid var(--muted-2); background: var(--surface);
}
.port:hover .port__dot { border-color: var(--accent); background: var(--accent); }
.port--in .port__dot { margin-left: -7px; }
.port--out .port__dot { margin-right: -7px; }
/* While a wire is being dragged, only the ports it could legally land on
   light up — the rule is enforced anyway, but showing it saves a failed try. */
.port.is-compatible .port__dot { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 3px var(--accent-wash); }

/* --- Configuration panel --- */
.cfg__title { font-family: var(--font-display); font-size: var(--step-1); margin: 0 0 .2rem; }
.cfg__eq { font-size: var(--step--1); margin-bottom: var(--sp-4); overflow-x: auto; }
.cfg__row { display: block; margin-bottom: .7rem; }
.cfg__label {
  display: block; font-family: var(--font-label); font-weight: 500; font-size: .64rem;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem;
}
.cfg__label em { color: var(--muted-2); font-style: normal; }
.cfg__row input, .cfg__row select { width: 100%; font-size: var(--step--1); }
.cfg__help { display: block; font-size: .7rem; color: var(--muted-2); margin-top: .2rem; line-height: 1.4; }

.studio__problems {
  margin-top: var(--sp-4); padding: var(--sp-4);
  background: var(--amber-wash, var(--amber-wash)); border-left: 2px solid var(--amber);
  border-radius: var(--radius); font-size: var(--step--1);
}
.studio__problems ul { margin: 0; padding-left: 1.1rem; }
.studio__problems li { margin-bottom: .3rem; color: var(--ink); }

.studio__code { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: var(--sp-4); }
.studio__code-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.studio__code pre {
  max-height: 480px; overflow: auto; margin: 0;
  background: var(--code-bg, #F5F0E0); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: var(--sp-4);
  font-family: var(--font-mono); font-size: .78rem; line-height: 1.55;
}

/* --- Ambient field -------------------------------------------------------
   A fixed canvas behind everything. It sits above the page background but
   below all content, so it never intercepts a click and never sits over text.
   The script removes it under prefers-reduced-motion and on narrow screens. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* The field is decorative. Keeping it faint is the whole point: it should
     register as texture, never as something to look at. */
  opacity: .85;
}
.ambient[hidden] { display: none; }
/* The studio runs its own canvas at 60fps. Two animations competing for
   frames is exactly the kind of thing that reads as "the editor is laggy". */
body.no-ambient .ambient { display: none; }

/* Everything the reader actually reads is lifted above the canvas. Without
   this the fixed canvas would paint over the page. */
.masthead,
.contextbar,
.notice,
main,
.site-footer,
footer { position: relative; z-index: 1; }

/* Panels that must stay legible get an opaque backing, so the field never
   shows through a card and muddles the text on it. */
.card, .panel, .masthead, .site-footer, footer { background-color: var(--surface); }
.masthead { background-color: var(--paper-2); }

@media print { .ambient { display: none; } }

/* --- Lab holding page ----------------------------------------------------- */
.labsoon { padding: var(--sp-8) 0 var(--sp-9); }
.labsoon__inner { max-width: 62ch; }

.labsoon__eyebrow {
  display: inline-flex; align-items: center; gap: .55rem;
  font-family: var(--font-label); font-weight: 500; font-size: .72rem;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--sp-4);
}
.labsoon__pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); flex: none;
  animation: labpulse 2.4s ease-in-out infinite;
}
@keyframes labpulse {
  0%, 100% { opacity: 1;   box-shadow: 0 0 0 0 rgba(255, 103, 79, .45); }
  50%      { opacity: .55; box-shadow: 0 0 0 7px rgba(255, 103, 79, 0); }
}

.labsoon__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--step-4); line-height: 1.05;
  letter-spacing: -.02em; margin-bottom: var(--sp-5);
}
.labsoon__title em { font-style: italic; color: var(--accent); }

.labsoon__lede {
  font-size: var(--step-1); line-height: 1.55;
  color: var(--muted); margin-bottom: var(--sp-7);
}

.labsoon__list { list-style: none; margin: 0 0 var(--sp-7); padding: 0; }
.labsoon__list li {
  display: flex; gap: var(--sp-4); align-items: baseline;
  padding: var(--sp-4) 0;
  border-top: 1px solid var(--line-soft);
}
.labsoon__list li:last-child { border-bottom: 1px solid var(--line-soft); }
.labsoon__num {
  font-family: var(--font-label); font-weight: 500; font-size: .78rem;
  color: var(--accent); flex: none; padding-top: .15rem;
}
.labsoon__item strong { display: block; margin-bottom: .2rem; }
.labsoon__item { color: var(--muted); font-size: var(--step--1); line-height: 1.6; }

.labsoon__foot {
  font-size: var(--step--1); color: var(--muted-2);
  padding-left: var(--sp-4); border-left: 2px solid var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .labsoon__pulse { animation: none; }
}



/* --- Team (about page) --------------------------------------------------- */
.team { margin-top: var(--sp-8); }
.team__heading { font-size: var(--step-3); margin-bottom: .3rem; }
.team__intro { color: var(--muted); max-width: 52ch; margin-bottom: var(--sp-6); }

.team__grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-6) var(--sp-5);
}

.team__member { text-align: center; }

/* The circle. aspect-ratio keeps it perfectly round whatever the source
   image is, and object-fit crops rather than squashing a non-square photo. */
.team__photo {
  width: 100%;
  max-width: 190px;
  aspect-ratio: 1;
  margin: 0 auto var(--sp-4);
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-wash);
  border: 1px solid var(--line);
  transition: transform .25s ease, border-color .25s ease;
}
.team__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.team__member:hover .team__photo { transform: translateY(-4px); border-color: var(--accent); }

.team__name { font-family: var(--font-display); font-size: var(--step-1); margin-bottom: .15rem; }
.team__role {
  font-family: var(--font-label); font-weight: 500; font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin-bottom: .5rem;
}
.team__bio { color: var(--muted); font-size: var(--step--1); max-width: 30ch; margin-inline: auto; }

/* Staggered layout, as in the sketch — the middle portrait sits lower and
   slightly larger. Dropped on narrow screens, where a straight row reads
   better than a deliberate misalignment. */
@media (min-width: 760px) {
  .team__member:nth-child(2) { margin-top: var(--sp-7); }
  .team__member:nth-child(2) .team__photo { max-width: 215px; }
  .team__member:nth-child(3) { margin-top: calc(var(--sp-4) * -1); }
}

@media (prefers-reduced-motion: reduce) {
  .team__photo { transition: none; }
  .team__member:hover .team__photo { transform: none; }
}

/* --- Empty states -------------------------------------------------------- */
.empty { text-align: center; padding: var(--sp-8) var(--sp-4); border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.empty__mark { width: 40px; height: 40px; margin: 0 auto var(--sp-4); color: var(--line); }
.empty h3 { font-size: var(--step-2); margin-bottom: .3rem; }
.empty p { color: var(--muted); max-width: 44ch; margin-inline: auto; }

/* --- Footer -------------------------------------------------------------- */
.footer { background: var(--ink); color: var(--on-dark-2); margin-top: var(--sp-8); padding-block: var(--sp-7) var(--sp-5); }
.footer a { color: var(--on-dark-2); text-decoration: none; }
.footer a:hover { color: var(--butter); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.footer__grid { display: grid; grid-template-columns: 1.6fr repeat(3, minmax(140px, 1fr)); gap: var(--sp-6); }
.footer h4 { font-family: var(--font-label); font-weight: 500; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--on-dark-3); margin-bottom: var(--sp-3); font-weight: 500; }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: var(--step--1); }
.footer__note { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid rgba(244, 235, 207,.14); font-size: .78rem; color: var(--on-dark-3); display: flex; gap: var(--sp-4); flex-wrap: wrap; justify-content: space-between; }
.footer input[type="email"] { background: rgba(255,255,255,.06); border-color: rgba(244, 235, 207,.2); color: var(--on-dark); }
.footer input[type="email"]::placeholder { color: var(--on-dark-3); }

/* Footer only: larger text, logo, and controls */
.footer .small,
.footer ul { font-size: 1rem; }
.footer h4,
.footer .field__label { font-size: 0.85rem; }
.footer__note { font-size: 0.9rem; }
/* Dark version of the lockup: butter S, ivory lettering */
.footer .brand { color: var(--on-dark); }
.footer .brand__mark { color: var(--butter); height: 60px; }
.footer .brand__name { font-size: 1.55rem; }
.footer .brand__script { font-size: 1.45rem; }
/* Newsletter field and Join button */
.footer input[type="email"] {
  font-size: 1.5rem;
  padding: 0.8rem 0.9rem;
  min-width: 0;
}
.footer .btn {
  font-size: 1rem;
  padding: 0.8rem 1.2rem;
  flex-shrink: 0;
}
/* Slightly more space between links */
.footer ul {
  gap: 0.6rem;
}



/* --- Utilities ----------------------------------------------------------- */
.mono { font-family: var(--font-label); font-weight: 500; }
.muted { color: var(--muted); }
.small { font-size: var(--step--1); }
.tiny { font-size: .72rem; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); } .mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); } .mb-5 { margin-bottom: var(--sp-5); } .mb-6 { margin-bottom: var(--sp-6); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.divider-mark { display: flex; align-items: center; gap: var(--sp-4); color: var(--line); margin-block: var(--sp-6); }
.divider-mark::before, .divider-mark::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.divider-mark svg { width: 16px; height: 16px; color: var(--accent); }

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 1080px) {
  .reader { grid-template-columns: 1fr; }
  .reader__rail {
    position: static; max-height: none; border-right: 0; padding-right: 0;
    border-bottom: 1px solid var(--line); padding-bottom: var(--sp-4); margin-bottom: var(--sp-4);
  }
  .outline { display: none; }
}
@media (max-width: 820px) {
  :root { --header-h: 56px; }
  .ways { grid-template-columns: 1fr; }
  .way { border-right: 0; border-bottom: 1px solid var(--line); }
  .way:last-child { border-bottom: 0; }
  .section-nav { grid-template-columns: 1fr; }
  .section-nav a:last-child { text-align: left; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .notes { top: auto; bottom: 1rem; right: 1rem; left: 1rem; width: auto; }
}
@media (max-width: 560px) {
  .footer__grid { grid-template-columns: 1fr; }
  .hero__stats { gap: var(--sp-5); }
  .post-row { grid-template-columns: 1fr; }
  .post-row__score { display: flex; gap: .4rem; align-items: baseline; text-align: left; }
}

/* --- Print --------------------------------------------------------------- */
@media print {
  .masthead, .contextbar, .footer, .reader__rail, .outline, .section-nav, .notes { display: none !important; }
  body { background: #fff; }
  .reader { grid-template-columns: 1fr; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .8em; color: #555; }
}


/* Announcement banner */
.notice {
  position: relative;
  background: var(--butter);
  color: var(--ink);
  border-block: 1px solid #E3D6AE;
  font-size: 1rem;
  line-height: 1.6;
}

/* Override the normal .shell width for this banner */
.notice > .notice__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: none;
  min-height: 60px;
  margin: 0;
  padding: 14px 72px;
  box-sizing: border-box;
}

.notice__inner > span {
  display: block;
  text-align: center;
  overflow-wrap: anywhere;
}

/* Override the previous inline link color */
.notice .notice__inner a {
  color: var(--accent-text) !important;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.notice .notice__close {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid #E3D6AE;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.notice .notice__close:hover {
  background: #EADFB8;
  border-color: var(--accent-text);
}

.notice .notice__close:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 3px;
}

.notice[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .notice > .notice__inner {
    justify-content: flex-start;
    padding: 12px 64px 12px 16px;
  }

  .notice__inner > span {
    text-align: left;
  }

  .notice .notice__close {
    right: 12px;
  }
}


/* Larger desktop header */
:root {
  --header-h: 76px;
}

.masthead .nav a {
  font-size: 1rem;
}

.masthead .nav a > svg,
.masthead .nav__signout svg {
  width: 20px;
  height: 20px;
}

.masthead .nav__avatar {
  width: 34px;
  height: 34px;
  font-size: 0.8rem;
}

.masthead .nav__count {
  font-size: 0.8rem;
}

.contextbar {
  font-size: 0.85rem;
}

.contextbar__inner {
  min-height: 52px;
  padding-block: 8px;
}

@media (max-width: 820px) {
  :root {
    --header-h: 64px;
  }
}

/* Notebook deletion button */
.notebook-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.7rem 1rem;
  border: 1px solid #EBC0C8;
  border-radius: 8px;
  background: var(--rose-wash);
  color: var(--rose);
  font: 500 0.95rem/1.2 var(--font-body);
  cursor: pointer;
}

.notebook-delete:hover {
  background: #F6D3D9;
  border-color: var(--rose);
}

.notebook-delete svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Confirmation popup */
.delete-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 28px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(6, 62, 58, 0.25);
  font-family: var(--font-body);
  font-size: 1rem;
  letter-spacing: normal;
  text-transform: none;
}

.delete-dialog::backdrop {
  background: rgba(6, 62, 58, 0.55);
}

.delete-dialog h2 {
  margin-bottom: 12px;
  font-size: 1.6rem;
}

.delete-dialog p {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.delete-dialog__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.delete-dialog__actions form {
  margin: 0;
}

.delete-dialog .btn {
  min-height: 42px;
  font-size: 0.95rem;
}

.delete-dialog__confirm {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}

.delete-dialog__confirm:hover {
  background: #8E1D2F;
}



/* Larger block palette, matching the site's theme */
.studio.studio--v2 .st-palette {
  background: var(--paper-2);
}

.studio.studio--v2 .st-palette__label {
  padding-inline: 1rem;
  font-size: 0.85rem;
  color: var(--ink-2);
}

.studio.studio--v2 .st-family {
  padding: 8px 10px;
}

.studio.studio--v2 .st-family__name {
  font-size: 0.8rem;
  margin-bottom: 9px;
}

.studio.studio--v2 .st-family__chips {
  gap: 8px;
}

.studio.studio--v2 .st-chip {
  width: 108px;
  min-height: 82px;
  padding: 10px 8px;
  gap: 8px;
  justify-content: center;

  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent, var(--accent));
  border-radius: var(--radius-lg);
  font-family: var(--font-body);
  box-shadow: var(--shadow);

  transition: background 0.15s, box-shadow 0.15s;
}

.studio.studio--v2 .st-chip__tag {
  font-size: 0.75rem;
  padding: 3px 7px;
  border-radius: 5px;
}

.studio.studio--v2 .st-chip__name {
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.studio.studio--v2 .st-chip:hover {
  background: var(--accent-wash);
  border-color: var(--accent, var(--accent));
  box-shadow: var(--shadow-lift);
}

.studio.studio--v2 .st-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.studio.studio--v2 .st-chip:active {
  cursor: grabbing;
}
/* ==========================================================================
   Learn: video guides (learn/guide.html, learn/_guide_*.html)
   --------------------------------------------------------------------------
   Labelled buttons on top, one 16:9 player underneath. The frame is always
   dark, whatever it holds (thumbnail, player, "coming soon", sign-in gate),
   so swapping between them never flashes the page background.
   ========================================================================== */
.guide__head { max-width: 72ch; }
.guide__title { font-size: var(--step-4); }
.guide__intro { margin-top: var(--sp-4); color: var(--muted); }
.guide__intro p:last-child { margin-bottom: 0; }

.guide__index { display: grid; gap: var(--sp-6); margin-top: var(--sp-7); }
.gidx__head {
  display: flex; align-items: center; gap: .6rem;
  font-family: var(--font-label); font-weight: 500; font-size: .72rem; font-weight: 500; letter-spacing: .16em;
  text-transform: uppercase; color: var(--ink-3);
  padding-bottom: var(--sp-3); margin: 0 0 var(--sp-4); border-bottom: 1px solid var(--line);
}
.gidx__count {
  font-size: .64rem; letter-spacing: .04em; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 999px; padding: .05rem .45rem;
}
.gidx__list {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: var(--sp-3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 262px), 1fr));
}
.gidx__list > li { display: flex; }

.gtile {
  flex: 1; min-width: 0; min-height: 68px;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .85rem;
  padding: .75rem .85rem .75rem .75rem;
  background: var(--surface); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  transition: border-color .16s, box-shadow .16s, transform .16s, background-color .16s;
}
a.gtile:hover { border-color: var(--ink-3); box-shadow: var(--shadow); transform: translateY(-1px); color: var(--ink); }
a.gtile:focus-visible { outline-offset: 3px; }
.gtile__num {
  font-family: var(--font-label); font-weight: 500; font-size: .78rem; font-weight: 500; line-height: 1;
  color: var(--accent-text); background: var(--accent-wash);
  border-radius: 6px; padding: .5rem .45rem; min-width: 2.35rem; text-align: center;
}
.gtile__body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.gtile__title { font-weight: 500; font-size: .95rem; line-height: 1.28; overflow-wrap: anywhere; }
.gtile__meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem;
  font-family: var(--font-label); font-weight: 500; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted-2);
}
.gtile__label { color: var(--accent-text); }
.gtile__draft { color: var(--amber); }
.gtile__icon {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); color: var(--accent);
  transition: background-color .16s, border-color .16s, color .16s;
}
.gtile__icon svg { width: 15px; height: 15px; }
a.gtile:hover .gtile__icon { border-color: var(--accent); }

.gtile.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper-2); box-shadow: var(--shadow-lift); }
.gtile.is-active .gtile__num { background: var(--accent); color: var(--on-accent); }
.gtile.is-active .gtile__meta { color: rgba(255, 253, 248, .58); }
.gtile.is-active .gtile__label { color: var(--butter); }
.gtile.is-active .gtile__icon { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
a.gtile.is-active:hover { color: var(--paper-2); border-color: var(--ink); }

.gtile.is-locked .gtile__icon { color: var(--muted); }
.gtile.is-soon { background: transparent; border-style: dashed; color: var(--muted); cursor: default; }
.gtile.is-soon .gtile__num { background: var(--line-soft); color: var(--muted-2); }
.gtile.is-soon .gtile__icon { color: var(--muted-2); border-style: dashed; }

/* --- The stage: frame + what's playing ----------------------------------- */
.gstage { margin-top: var(--sp-7); }
/* The frame is capped so the whole player fits under the sticky header on a
   short laptop screen, instead of the controls sitting below the fold. */
.gstage__frame,
.gstage__info { max-width: min(1040px, calc((100vh - 13rem) * 16 / 9)); margin-inline: auto; }
@supports (height: 100svh) {
  .gstage__frame,
  .gstage__info { max-width: min(1040px, calc((100svh - 13rem) * 16 / 9)); }
}
.gstage__frame {
  position: relative; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lift);
  background:
    radial-gradient(120% 90% at 85% 0%, rgba(255, 103, 79, .16), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(255, 103, 79, .10), transparent 60%),
    var(--ink);
  color: var(--paper-2);
}
.gstage__iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.gfacade { position: absolute; inset: 0; display: block; color: #fff; text-decoration: none; cursor: pointer; }
.gfacade:hover { color: #fff; }
.gfacade__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gfacade__shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6, 62, 58, .05) 40%, rgba(6, 62, 58, .78));
}
.gfacade__play {
  position: absolute; left: 50%; top: 50%; width: 76px; height: 54px; transform: translate(-50%, -50%);
  transition: transform .18s;
}
.gfacade__play svg { width: 100%; height: 100%; }
.gfacade__play path { fill: rgba(6, 62, 58, .82); transition: fill .18s; }
.gfacade__play .gfacade__tri { fill: #fff; }
.gfacade:hover .gfacade__play path:not(.gfacade__tri),
.gfacade:focus-visible .gfacade__play path:not(.gfacade__tri) { fill: var(--accent); }
.gfacade:hover .gfacade__play { transform: translate(-50%, -50%) scale(1.06); }
.gfacade:focus-visible { outline: 3px solid var(--accent-bright); outline-offset: -3px; }
.gfacade__caption {
  position: absolute; left: var(--sp-5); right: var(--sp-5); bottom: var(--sp-4);
  display: flex; align-items: baseline; gap: .7rem;
  font-family: var(--font-display); font-size: var(--step-1); line-height: 1.2;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .45);
}
.gfacade__num { font-family: var(--font-label); font-weight: 500; font-size: .8rem; color: var(--butter); }

.gframe-msg {
  position: absolute; inset: 0; padding: var(--sp-5);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.gframe-msg__icon { width: 42px; height: 42px; color: var(--accent-bright); margin-bottom: var(--sp-3); }
.gframe-msg__glyph { margin-bottom: var(--sp-4); }
.gframe-msg__title { font-family: var(--font-display); font-size: var(--step-2); margin: 0 0 .25rem; }
.gframe-msg__sub { color: rgba(255, 253, 248, .66); max-width: 46ch; margin: 0; font-size: var(--step--1); }
.gframe-msg .btn--accent { max-width: 100%; white-space: normal; text-align: center; line-height: 1.3; }
.gframe-msg__ghost { color: var(--paper-2); border-color: rgba(255, 253, 248, .32); }
.gframe-msg__ghost:hover { color: var(--ink); background: var(--paper-2); border-color: var(--paper-2); }

.gstage__info { padding-top: var(--sp-5); }
.gstage__kicker {
  font-family: var(--font-label); font-weight: 500; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-text); margin: 0 0 var(--sp-2);
}
.gstage__title { font-size: var(--step-3); margin: 0; }
.gstage__notes { margin-top: var(--sp-4); max-width: var(--measure); }
.gstage__nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-5); }
.gstage__next { margin-left: auto; max-width: 100%; }
.gstage__next-title {
  display: inline-block; max-width: 34ch; min-width: 0; font-weight: 400; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  vertical-align: bottom;
}
.gstage [hidden] { display: none !important; }

@media (max-width: 560px) {
  .gstage { margin-top: var(--sp-6); }
  .gstage__frame { border-radius: var(--radius); margin-inline: calc(var(--sp-3) * -1); }
  .gframe-msg__sub { display: none; }
  .gfacade__caption { font-size: var(--step-0); left: var(--sp-4); bottom: var(--sp-3); }
  .gstage__next { margin-left: 0; flex: 1 1 100%; }
  .gstage__next-title { max-width: 20ch; }
}

/* --- Guide cards (Learn index, home, Lab) --------------------------------- */
.guide-card .tile__media { display: grid; place-items: center; }
.guide-card__shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(6, 62, 58, .7));
}
.guide-card__play {
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(6, 62, 58, .72); color: #fff;
  border: 1px solid rgba(255, 255, 255, .25); transition: background-color .18s, transform .18s;
}
.guide-card__play svg { width: 22px; height: 22px; margin-left: 3px; }
.guide-card:hover .guide-card__play { background: var(--accent); transform: scale(1.05); }
.guide-card__count {
  position: absolute; left: var(--sp-3); bottom: var(--sp-3);
  font-family: var(--font-label); font-weight: 500; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: #fff;
}

.lab-guide-callout {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4);
  margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5);
  background: var(--ink); color: var(--paper-2); border-radius: var(--radius-lg);
}
.lab-guide-callout__text { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.lab-guide-callout__icon {
  width: 42px; height: 42px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent);
}
.lab-guide-callout__icon svg { width: 18px; height: 18px; margin-left: 2px; }
.lab-guide-callout strong { display: block; font-family: var(--font-display); font-size: var(--step-1); font-weight: 500; }
.lab-guide-callout span.small { color: rgba(255, 253, 248, .66); }
.lab-guide-callout .btn--accent:hover { background: var(--accent-bright); color: var(--ink); }

/* --- Static site additions -------------------------------------------------- */
.toc__link.is-read .toc__num::after { content: ' \2713'; color: var(--ok); }
mark { background: var(--amber-wash, rgba(255, 200, 60, .25)); color: inherit; padding: 0 .1em; border-radius: 2px; }


/* --- Site menu ------------------------------------------------------------
   Learn and Lab stay in the bar at every width; the menu button beside them
   opens the full list. The button and panel are one native <details>. */
.masthead { z-index: 60; } /* above <main>, so the open menu is never clipped */
.nav { position: relative; }
.menu { position: relative; margin-left: .35rem; }
.menu__button {
  list-style: none; cursor: pointer; display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: var(--radius); color: var(--ink);
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.menu__button::-webkit-details-marker { display: none; }
.menu__button::marker { content: ""; }
.menu__button:hover { background: var(--line-soft); }
.menu__button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.menu[open] .menu__button { background: var(--line-soft); }
.menu__bars { position: relative; width: 22px; height: 16px; display: block; }
.menu__bars i {
  position: absolute; left: 0; right: 0; height: 2px; border-radius: 2px; background: currentColor;
  transition: transform .22s ease, opacity .18s ease, top .22s ease;
}
.menu__bars i:nth-child(1) { top: 0; }
.menu__bars i:nth-child(2) { top: 7px; }
.menu__bars i:nth-child(3) { top: 14px; }
.menu[open] .menu__bars i:nth-child(1) { top: 7px; transform: rotate(45deg); }
.menu[open] .menu__bars i:nth-child(2) { opacity: 0; }
.menu[open] .menu__bars i:nth-child(3) { top: 7px; transform: rotate(-45deg); }

.menu__panel {
  position: absolute; top: calc(100% + 10px); right: -6px; width: min(340px, calc(100vw - 2rem));
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 18px 44px -12px rgba(6, 62, 58, .28), 0 2px 6px rgba(6, 62, 58, .06);
  padding: .5rem; z-index: 60; transform-origin: top right;
  animation: menu-in .16s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.menu__panel ul { list-style: none; margin: 0; padding: 0; }
.menu__panel a { text-decoration: none; color: var(--ink); }

/* !important beats `.masthead .nav a`, which sizes the top-level links. */
.menu__primary a {
  display: grid; grid-template-columns: 1fr auto; column-gap: .75rem; align-items: center;
  padding: .8rem .9rem !important; border-radius: 10px;
}
.menu__primary a:hover { background: var(--accent-wash); }
.menu__label { font-family: var(--font-display); font-size: 1.28rem; line-height: 1.15; grid-column: 1; }
.menu__hint { grid-column: 1; font-size: .82rem; color: var(--muted); font-weight: 400; margin-top: .1rem; }
.menu__arrow { grid-column: 2; grid-row: 1 / span 2; color: var(--accent-text); transition: transform .18s ease; }
.menu__primary a:hover .menu__arrow { transform: translateX(3px); }

.menu__secondary { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; margin: .35rem 0 0; padding-top: .5rem; border-top: 1px solid var(--line); }
.menu__secondary a { display: block; padding: .65rem .9rem !important; border-radius: 10px; font-weight: 500; font-size: .95rem !important; }
.menu__secondary a:hover { background: var(--line-soft); }
.menu__panel a[aria-current="page"] { background: var(--ink); color: var(--on-dark); }
.menu__panel a[aria-current="page"] .menu__hint { color: var(--on-dark-2); }
.menu__panel a[aria-current="page"] .menu__arrow { color: var(--butter); }
.menu__tag {
  margin: .35rem .9rem .5rem; padding-top: .55rem; font-family: var(--font-display); font-style: italic;
  font-size: .85rem; color: var(--muted);
}
.menu__tag::before { content: ""; display: block; width: 22px; height: 2px; background: var(--accent); margin-bottom: .55rem; }

@media (max-width: 520px) {
  .masthead .nav a { padding: .4rem .5rem; font-size: .95rem; }
  .menu { margin-left: 0; }
  .menu__button { width: 40px; }
  .menu__panel { position: fixed; top: calc(var(--header-h) + 6px); left: 1rem; right: 1rem; width: auto; }
}
@media (max-width: 360px) {
  .brand__script { font-size: 1rem; }
  .brand__name { font-size: 1.05rem; }
}
@media (prefers-reduced-motion: reduce) {
  .menu__panel { animation: none; }
  .menu__bars i, .menu__arrow { transition: none; }
}

/* --- Copyright and usage terms (footer, terms page) ---------------------- */
.footer__terms { margin-top: var(--sp-6); padding-top: var(--sp-5); border-top: 1px solid rgba(244, 235, 207, .14); max-width: 78ch; }
.footer__terms h4 { margin-bottom: var(--sp-2); }
.footer__terms p { font-size: .82rem; line-height: 1.65; color: var(--on-dark-2); margin: 0 0 .55rem; }
.footer__terms a { color: var(--butter); text-decoration: underline; text-decoration-color: rgba(244, 235, 207, .4); text-underline-offset: 3px; }
.footer__terms a:hover { text-decoration-color: var(--accent); }
.footer__more { white-space: nowrap; margin-left: .35rem; font-weight: 500; }
.footer__links { display: inline-flex; gap: var(--sp-4); flex-wrap: wrap; align-items: center; }
.footer__links a { color: var(--on-dark-3); }
.terms-table { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.terms-table [role="row"] { display: grid; grid-template-columns: 1fr minmax(9.5rem, auto); gap: var(--sp-4); padding: .75rem 1rem; align-items: center; }
.terms-table [role="row"] + [role="row"] { border-top: 1px solid var(--line-soft); }
.terms-ok, .terms-ask { font-family: var(--font-label); font-weight: 600; font-size: .78rem; letter-spacing: .02em; padding: .25rem .6rem; border-radius: 99px; text-align: center; }
.terms-ok { color: var(--ok); background: var(--ok-wash); }
.terms-ask { color: var(--accent-text); background: var(--accent-wash); }
@media (max-width: 560px) { .terms-table [role="row"] { grid-template-columns: 1fr; gap: .4rem; } .terms-ok, .terms-ask { justify-self: start; } }


/* --- Compact footer: brand and links on one line, the licence under it ------------ */
.footer { padding-block: var(--sp-5) var(--sp-4); margin-top: var(--sp-7); }
.footer__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-4) var(--sp-6); }
.footer .brand__mark { height: 40px; }
.footer .brand__name { font-size: 1.2rem; }
.footer .brand__script { font-size: 1.15rem; }
.footer__nav { display: flex; flex-wrap: wrap; gap: .4rem 1.3rem; font-size: .92rem; }
.footer__legal { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid rgba(244, 235, 207, .14); }
.footer__legal p { margin: 0; font-size: .8rem; line-height: 1.6; color: var(--on-dark-3); max-width: 96ch; }
.footer__legal a { color: var(--on-dark-2); text-decoration: underline; text-decoration-color: rgba(244, 235, 207, .35); text-underline-offset: 3px; }
.footer__legal a:hover { color: var(--butter); text-decoration-color: var(--accent); }
.cc-badge { flex: none; display: inline-flex; flex-direction: column; align-items: center; gap: 2px; color: var(--on-dark-2); text-decoration: none !important; }
.cc-badge:hover { color: var(--butter); }
.cc-badge svg { width: 96px; height: auto; display: block; }
.cc-badge__text { font-family: var(--font-label); font-size: .62rem; letter-spacing: .14em; color: var(--on-dark-3); }
@media (max-width: 640px) { .footer__legal { flex-direction: column; align-items: flex-start; } }
.cc-badge--light .cc-badge { color: var(--ink); }
.cc-badge--light .cc-badge__text { color: var(--muted); }
