/* ─────────────────────────────────────────────────────────────────
   CHAP microsite — site styles
   Ported from the Claude Design prototype's <style> block. The design
   tokens (fonts, colours, gradients, shadows, easing) live in
   assets/ds/colors_and_type.css and are referenced via var(--bb-*).
   ───────────────────────────────────────────────────────────────── */

html { scroll-behavior: smooth; }
body { margin: 0; }

/* The design-system stylesheet underlines links by default; the site
   design wants clean links everywhere. */
a { border-bottom: none !important; text-decoration: none; }

/* ── Keyframes ───────────────────────────────────────────────────── */
@keyframes bb-lp {
  0%   { box-shadow: 0 0 0 0 rgba(31,91,57,0.5); }
  70%  { box-shadow: 0 0 0 10px rgba(31,91,57,0); }
  100% { box-shadow: 0 0 0 0 rgba(31,91,57,0); }
}
@keyframes bb-slideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes bb-reveal {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}

/* ── Motion ──────────────────────────────────────────────────────────
   Scroll-driven reveals. initReveal() sets html.anim, then an
   IntersectionObserver adds .in to each .reveal wrapper as it enters
   the viewport. Everything is gated on .anim: without JS the page
   renders fully visible, and prefers-reduced-motion turns it all off. */

/* Content blocks rise in, staggered top to bottom. */
.anim .reveal > * {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .65s var(--bb-ease-out), transform .65s var(--bb-ease-out);
}
.anim .reveal.in > * { opacity: 1; transform: none; }
.anim .reveal.in > *:nth-child(2) { transition-delay: 0.07s; }
.anim .reveal.in > *:nth-child(3) { transition-delay: 0.14s; }
.anim .reveal.in > *:nth-child(4) { transition-delay: 0.21s; }
.anim .reveal.in > *:nth-child(5) { transition-delay: 0.28s; }
.anim .reveal.in > *:nth-child(6) { transition-delay: 0.35s; }
.anim .reveal.in > *:nth-child(7) { transition-delay: 0.42s; }
.anim .reveal.in > *:nth-child(n+8) { transition-delay: .45s; }

/* Section-header accent ticks draw themselves under the title. */
.anim .reveal div[style*="height:3px"] { width: 0 !important; transition: width .55s var(--bb-ease-out) .5s; }
.anim .reveal.in div[style*="height:3px"] { width: 56px !important; }

/* Hero enters on load: copy rises line by line over a slow photo drift. */
@keyframes bb-rise {
  from { opacity: 0; transform: translateY(26px); }
  to   { opacity: 1; transform: none; }
}
.anim #top .gx > div > * { animation: bb-rise .8s var(--bb-ease-out) backwards; }
.anim #top .gx > div > *:nth-child(1) { animation-delay: 0.08s; }
.anim #top .gx > div > *:nth-child(2) { animation-delay: 0.20s; }
.anim #top .gx > div > *:nth-child(3) { animation-delay: 0.32s; }
.anim #top .gx > div > *:nth-child(4) { animation-delay: 0.44s; }
.anim #top .gx > div > *:nth-child(5) { animation-delay: 0.56s; }
.anim #top .gx > div > *:nth-child(6) { animation-delay: 0.68s; }
.anim #top .gx > div > *:nth-child(7) { animation-delay: 0.80s; }
.anim #top .gx > div > *:nth-child(8) { animation-delay: 0.92s; }
@keyframes bb-kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.055); }
}
.anim #top > div:first-child img { animation: bb-kenburns 20s ease-in-out forwards; transform-origin: 62% 38%; }

/* Cold loads: the photo fades in when it arrives instead of popping
   over the charcoal. Cached loads never get .hero-fade (no hiding). */
.anim #top img.hero-fade { opacity: 0; }
.anim #top img.hero-fade.loaded { opacity: 1; transition: opacity .7s ease; }

/* Evidence-loop chips pop in reading order. */
.anim .reveal #evidence-flow > span {
  opacity: 0;
  transform: translateY(10px) scale(.92);
  transition: opacity .5s var(--bb-ease-out), transform .5s var(--bb-ease-out);
}
.anim .reveal.in #evidence-flow > span { opacity: 1; transform: none; }
.anim .reveal.in #evidence-flow > span:nth-child(1) { transition-delay: 0.25s; }
.anim .reveal.in #evidence-flow > span:nth-child(2) { transition-delay: 0.34s; }
.anim .reveal.in #evidence-flow > span:nth-child(3) { transition-delay: 0.43s; }
.anim .reveal.in #evidence-flow > span:nth-child(4) { transition-delay: 0.52s; }
.anim .reveal.in #evidence-flow > span:nth-child(5) { transition-delay: 0.61s; }
.anim .reveal.in #evidence-flow > span:nth-child(6) { transition-delay: 0.70s; }
.anim .reveal.in #evidence-flow > span:nth-child(7) { transition-delay: 0.79s; }

/* Protocol-stack layers drop into place, CHAP first. Keyframes with
   fill backwards so the cards' own inline hover transitions win after. */
@keyframes bb-layer-in {
  from { opacity: 0; transform: translateY(-18px); }
  to   { opacity: 1; transform: none; }
}
.anim .reveal:not(.in) #stack-diagram > div { opacity: 0; }
.anim .reveal.in #stack-diagram > div { animation: bb-layer-in .6s var(--bb-ease-out) backwards; }
.anim .reveal.in #stack-diagram > div:nth-child(1) { animation-delay: .30s; }
.anim .reveal.in #stack-diagram > div:nth-child(2) { animation-delay: .48s; }
.anim .reveal.in #stack-diagram > div:nth-child(3) { animation-delay: .66s; }

/* Evidence-chain rows cascade like the log being written. */
@keyframes bb-row-in {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: none; }
}
.anim .reveal:not(.in) #trace-rows > div { opacity: 0; }
.anim .reveal.in #trace-rows > div { animation: bb-row-in .45s var(--bb-ease-out) backwards; }
.anim .reveal.in #trace-rows > div:nth-child(1) { animation-delay: 0.35s; }
.anim .reveal.in #trace-rows > div:nth-child(2) { animation-delay: 0.41s; }
.anim .reveal.in #trace-rows > div:nth-child(3) { animation-delay: 0.47s; }
.anim .reveal.in #trace-rows > div:nth-child(4) { animation-delay: 0.53s; }
.anim .reveal.in #trace-rows > div:nth-child(5) { animation-delay: 0.59s; }
.anim .reveal.in #trace-rows > div:nth-child(6) { animation-delay: 0.65s; }
.anim .reveal.in #trace-rows > div:nth-child(7) { animation-delay: 0.71s; }
.anim .reveal.in #trace-rows > div:nth-child(8) { animation-delay: 0.77s; }
.anim .reveal.in #trace-rows > div:nth-child(9) { animation-delay: 0.83s; }
.anim .reveal.in #trace-rows > div:nth-child(10) { animation-delay: 0.89s; }
.anim .reveal.in #trace-rows > div:nth-child(11) { animation-delay: 0.95s; }
.anim .reveal.in #trace-rows > div:nth-child(12) { animation-delay: 1.01s; }
.anim .reveal.in #trace-rows > div:nth-child(13) { animation-delay: 1.07s; }
.anim .reveal.in #trace-rows > div:nth-child(14) { animation-delay: 1.13s; }
.anim .reveal.in #trace-rows > div:nth-child(15) { animation-delay: 1.19s; }

/* One-time attention pulse on the walkthrough's Start button, fired
   when the controls actually reach the viewport (see initReveal). */
@keyframes bb-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,153,0,0.45); }
  70%  { box-shadow: 0 0 0 14px rgba(255,153,0,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,153,0,0); }
}
#demo-next.cue { animation: bb-pulse 1.6s cubic-bezier(0.22,0.61,0.36,1) .4s 2; }

/* Reading-progress hairline under the nav. */
#scroll-progress {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, #ff9900, #FF9900);
  z-index: 60; pointer-events: none; transition: width .1s linear;
}

@media (prefers-reduced-motion: reduce) {
  .anim .reveal > *, .anim #top .gx > div > *, .anim .reveal #evidence-flow > span,
  .anim .reveal:not(.in) #stack-diagram > div, .anim .reveal.in #stack-diagram > div,
  .anim .reveal:not(.in) #trace-rows > div, .anim .reveal.in #trace-rows > div,
  .anim #top > div:first-child img, .anim #top img.hero-fade, #demo-next.cue {
    animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important;
  }
  .anim .reveal div[style*="height:3px"] { width: 56px !important; transition: none !important; }
  #scroll-progress { display: none; }
}

/* Readable measure for body copy inside the content columns. */
.wrap > p, .wrap > h2, .wrap > ol { max-width: 760px; }

/* Full-film unit: the second page segment, directly below the hero. */
.watch-section {
  scroll-margin-top: 78px;
  overflow: hidden;
  color: #282829;
  background:
    radial-gradient(circle at 92% 8%, rgba(255,153,0,.16), transparent 30%),
    #f7f7f2;
  border-top: 4px solid #FF9900;
}
.watch-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(64px,7vw,92px) 40px;
}
.watch-intro {
  display: grid;
  grid-template-columns: minmax(250px,.72fr) minmax(360px,1.28fr);
  gap: clamp(34px,7vw,96px);
  align-items: end;
  margin-bottom: 34px;
}
.watch-kicker {
  margin: 0 0 14px;
  color:var(--chap-ink, #282829);
  font: 700 11px/1.2 var(--bb-font-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.watch-intro h2 {
  margin: 0;
  color: #282829;
  font: 500 clamp(42px,5vw,68px)/.98 var(--bb-font-sans);
  letter-spacing: -.035em;
}
.watch-lead {
  max-width: 44ch;
  margin: 0;
  color: #4d4d4e;
  font: 300 clamp(20px,2.1vw,27px)/1.45 var(--bb-font-sans);
}
.watch-player {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #161617;
  border: 1px solid rgba(40,40,41,.16);
  border-radius: 18px;
  box-shadow: 0 30px 70px -42px rgba(40,40,41,.72);
}
.watch-player iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.watch-footer { margin-top: 24px; }
.watch-chapters {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.watch-chapters a {
  display: flex;
  min-height: 84px;
  box-sizing: border-box;
  flex-direction: column;
  gap: 9px;
  padding: 16px 18px;
  color: #282829;
  background: rgba(255,255,255,.72);
  border: 1px solid #E4E2DD !important;
  border-radius: 10px;
  font: 600 14px/1.35 var(--bb-font-sans);
  transition: border-color .2s var(--bb-ease-out), transform .2s var(--bb-ease-out), background .2s var(--bb-ease-out);
}
.watch-chapters a:hover,
.watch-chapters a:focus-visible {
  background: #fff;
  border-color: #ff9900 !important;
  transform: translateY(-2px);
}
.watch-chapters a:focus-visible { outline: 3px solid rgba(255,153,0,.28); outline-offset: 3px; }
.watch-chapters span {
  color:var(--chap-ink, #282829);
  font: 700 12px/1 var(--bb-font-mono);
  letter-spacing: .04em;
}
.watch-notes {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
}
.watch-notes p {
  max-width: 68ch;
  margin: 0;
  color: #646468;
  font: 400 12px/1.55 var(--bb-font-sans);
}
.watch-notes > a {
  flex-shrink: 0;
  color:var(--chap-ink, #282829);
  font: 700 13px/1.4 var(--bb-font-sans);
}
.watch-notes > a:hover,
.watch-notes > a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 720px) {
  .watch-intro { grid-template-columns: 1fr; gap: 20px; }
  .watch-lead { max-width: 34ch; }
  .watch-player { border-radius: 11px; }
  .watch-notes { flex-direction: column; gap: 12px; }
}

/* Webinar registration: a focused live-event panel between the hero and
   protocol content. The form remains native HTML; JavaScript only enhances
   validation and submission feedback. */
[hidden] { display: none !important; }

.webinar-section {
  position: relative;
  overflow: hidden;
  scroll-margin-top: 78px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 12%, rgba(255,153,0,.18), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(255,153,0,.16), transparent 33%),
    #1f1f20;
  border-top: 4px solid #ff9900;
}
.webinar-section::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image: linear-gradient(rgba(255,255,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.12) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(90deg, #000, transparent 62%);
}
.webinar-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0,.9fr) minmax(480px,1.1fr);
  gap: clamp(46px,7vw,96px);
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 86px 40px 92px;
}
.webinar-kicker, .registration-heading > p, .result-kicker {
  margin: 0 0 15px;
  color: #FF9900;
  font: 700 11px/1.2 var(--bb-font-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.webinar-intro h2 {
  max-width: 10ch;
  margin: 0;
  color: #fff;
  font: 500 clamp(42px,5vw,68px)/.98 var(--bb-font-sans);
  letter-spacing: -.035em;
}
.webinar-lead {
  max-width: 48ch;
  margin: 27px 0 30px;
  color: rgba(255,255,255,.82);
  font: 300 20px/1.55 var(--bb-font-sans);
}
.webinar-date {
  padding: 21px 23px;
  border: 1px solid rgba(255,255,255,.18);
  border-left: 4px solid #ff9900;
  border-radius: 0 12px 12px 0;
  background: rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.webinar-date p { margin: 0 0 7px; color: #fff; font: 700 18px/1.3 var(--bb-font-sans); }
.webinar-date strong { color: #FFB538; font: 500 18px/1.4 var(--bb-font-sans); }
.webinar-zones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.webinar-zones span {
  padding: 8px 10px;
  border-radius: 5px;
  color: rgba(255,255,255,.74);
  background: rgba(255,255,255,.07);
  font: 400 12px/1 var(--bb-font-mono);
}
.webinar-leads {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.webinar-leads p {
  margin: 0;
  padding: 12px 13px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(0,0,0,.12);
}
.webinar-leads span,
.webinar-leads strong { display: block; }
.webinar-leads span {
  margin-bottom: 5px;
  color: rgba(255,255,255,.52);
  font: 600 10px/1.2 var(--bb-font-sans);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.webinar-leads strong {
  color: #fff;
  font: 650 14px/1.35 var(--bb-font-sans);
}
.webinar-delivery-note { max-width: 48ch; margin: 22px 0 0; color: rgba(255,255,255,.58); font-size: 14px; line-height: 1.6; }

.registration-card {
  position: relative;
  min-height: 560px;
  box-sizing: border-box;
  padding: clamp(26px,4vw,42px);
  color: #282829;
  background: #fff;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 18px;
  box-shadow: 0 30px 70px -32px rgba(0,0,0,.78);
}
.registration-heading h3, .registration-result h3 { margin: 0; color: #282829; font: 700 29px/1.12 var(--bb-font-sans); letter-spacing: -.015em; }
.registration-heading { margin-bottom: 28px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-field { margin-bottom: 16px; }
.form-field label {
  display: block;
  margin: 0 0 7px;
  color: #353536;
  font: 650 13px/1.25 var(--bb-font-sans);
}
.form-field label span { color: #646468; font-weight: 400; }
.form-field input {
  display: block;
  width: 100%;
  min-height: 46px;
  box-sizing: border-box;
  padding: 10px 12px;
  color: #282829;
  background: #fff;
  border: 1.5px solid #c9c8c4;
  border-radius: 8px;
  font: 400 16px/1.3 var(--bb-font-sans);
  transition: border-color .18s, box-shadow .18s;
}
.form-field input:hover { border-color: #8c8b88; }
.form-field input:focus { outline: none; border-color: #ff9900; box-shadow: 0 0 0 3px rgba(255,153,0,.13); }
.form-field input[aria-invalid="true"] { border-color: #b42318; box-shadow: 0 0 0 3px rgba(180,35,24,.09); }
.form-honeypot { position: absolute !important; width: 1px !important; height: 1px !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.field-error { display: block; min-height: 16px; margin-top: 5px; color: #a4261d; font: 600 12px/1.35 var(--bb-font-sans); }
.check-error { margin: -4px 0 9px 30px; }
.form-check { display: grid; grid-template-columns: 18px 1fr; gap: 11px; align-items: start; margin: 5px 0 12px; color: #535356; font-size: 13px; line-height: 1.5; cursor: pointer; }
.form-check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: #ff9900; }
.form-check a { color:var(--chap-ink, #282829); font-weight: 650; }
.form-check a:hover { text-decoration: underline; text-underline-offset: 2px; }
.turnstile-wrap { min-height: 76px; margin: 18px 0 8px; }
.registration-submit {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 20px;
  color: #fff;
  background: #ff9900;
  border: 0;
  border-radius: 999px;
  font: 700 15px/1 var(--bb-font-sans);
  cursor: pointer;
  transition: opacity .18s, transform .18s;
}
.registration-submit:hover { opacity: .88; transform: translateY(-1px); }
.registration-submit:focus-visible { outline: 3px solid #FF9900; outline-offset: 3px; }
.registration-submit:disabled { opacity: .55; cursor: wait; transform: none; }
.registration-status { min-height: 20px; margin: 11px 0 0; color: #535356; text-align: center; font-size: 13px; }
.form-error-summary { margin: 0 0 22px; padding: 14px 16px; color: #7a1f17; background: #fff1ef; border-left: 4px solid #b42318; border-radius: 0 7px 7px 0; font-size: 13px; }
.form-error-summary:focus { outline: 2px solid #b42318; outline-offset: 2px; }
.form-error-summary ul { margin: 7px 0 0; padding-left: 18px; }
.form-noscript { padding: 10px 12px; color: #7a1f17; background: #fff1ef; border-radius: 6px; font-size: 13px; }
.registration-result { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: clamp(30px,6vw,60px); box-sizing: border-box; }
.registration-result[hidden] { display: none; }
.registration-result .result-mark { display: grid; width: 58px; height: 58px; place-items: center; margin-bottom: 24px; color: #fff; background: #1f5b39; border-radius: 50%; font: 700 25px/1 var(--bb-font-sans); }
.registration-result > p:not(.result-kicker) { max-width: 38ch; margin: 18px 0 0; color: #535356; font-size: 17px; line-height: 1.6; }
.registration-result > p.result-contact { margin-top: 24px; color: #66666a; font-size: 14px; }
.result-contact a { color:var(--chap-ink, #282829); font-weight: 700; }
.result-contact a:hover { text-decoration: underline; text-underline-offset: 2px; }
.registration-result > a { display: inline-block; align-self: flex-start; margin-top: 24px; color:var(--chap-ink, #282829); font-weight: 700; }

/* LinkedIn measurement is optional. The fixed panel adds page breathing room
   while visible so it never hides the final form controls on small screens. */
.footer-meta-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-meta-actions a, .footer-meta-actions button {
  padding: 0;
  color: rgba(255,255,255,.66);
  background: transparent;
  border: 0;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.footer-meta-actions a:hover, .footer-meta-actions button:hover { color: #FFB538; }
.footer-meta-actions a:focus-visible, .footer-meta-actions button:focus-visible { outline: 2px solid #FFB538; outline-offset: 4px; }
body.linkedin-consent-visible { padding-bottom: 176px; }
.linkedin-consent {
  position: fixed;
  z-index: 120;
  right: 20px;
  bottom: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 28px;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px;
  box-sizing: border-box;
  color: #fff;
  background: #282829;
  border: 1px solid rgba(255,255,255,.18);
  border-top: 3px solid #ff9900;
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.32);
}
.linkedin-consent[hidden] { display: none; }
.linkedin-consent-kicker { margin: 0 0 5px; color: #FFB538; font: 700 10px/1 var(--bb-font-sans); letter-spacing: .14em; text-transform: uppercase; }
.linkedin-consent h2 { margin: 0 0 7px; color: #fff; font: 650 20px/1.15 var(--bb-font-sans); letter-spacing: -.01em; }
.linkedin-consent-copy > p:not(.linkedin-consent-kicker) { max-width: 76ch; margin: 0; color: rgba(255,255,255,.76); font: 400 14px/1.5 var(--bb-font-sans); }
.linkedin-consent-copy a { color: #fff; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.linkedin-consent-current { margin-top: 6px !important; color: #FFB538 !important; }
.linkedin-consent-status { min-height: 1px; }
.linkedin-consent-actions { display: grid; grid-template-columns: repeat(2,minmax(112px,1fr)); gap: 9px; }
.linkedin-consent-actions button {
  min-height: 44px;
  padding: 0 18px;
  color: #fff;
  background: transparent;
  border: 1.5px solid rgba(255,255,255,.62);
  border-radius: 999px;
  font: 700 13px/1 var(--bb-font-sans);
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
}
.linkedin-consent-actions button:hover { color: #282829; background: #fff; border-color: #fff; }
.linkedin-consent-actions button:focus-visible { outline: 3px solid #FF9900; outline-offset: 3px; }
.linkedin-consent-actions .linkedin-consent-close { grid-column: 1 / -1; min-height: 34px; border-color: transparent; color: rgba(255,255,255,.66); font-size: 12px; }

@media (max-width: 1420px) { .nav-btn[href*="arxiv"] { display: none !important; } }
@media (max-width: 960px) {
  .webinar-wrap { grid-template-columns: 1fr; gap: 42px; }
  .webinar-intro h2 { max-width: none; }
  .webinar-lead { max-width: 58ch; }
  .registration-card { min-height: 0; }
  .registration-result { position: static; min-height: 440px; }
}
@media (max-width: 640px) {
  .webinar-wrap { padding: 58px 20px 64px; }
  .webinar-intro h2 { font-size: clamp(40px,13vw,58px); }
  .webinar-lead { font-size: 18px; }
  .registration-card { padding: 25px 20px; border-radius: 13px; }
  .webinar-leads { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .nav-btn-github { display: none !important; }
  body.linkedin-consent-visible { padding-bottom: 218px; }
  .linkedin-consent { right: 10px; bottom: 10px; left: 10px; grid-template-columns: 1fr; gap: 10px; padding: 14px 15px; }
  .linkedin-consent-kicker { display: none; }
  .linkedin-consent h2 { margin-bottom: 4px; font-size: 17px; }
  .linkedin-consent-copy > p:not(.linkedin-consent-kicker) { font-size: 12.5px; line-height: 1.4; }
  .linkedin-consent-actions { width: 100%; gap: 8px; }
  .linkedin-consent-actions button { min-height: 40px; }
}
@media (max-width: 390px) {
  .nav-btn-register { padding: 8px 9px !important; font-size: 11px !important; }
  .turnstile-wrap { transform: scale(.91); transform-origin: left top; margin-bottom: -3px; }
}

/* ── Responsive ──────────────────────────────────────────────────── */
/* Nine nav items: tighten item padding on laptop widths so the full set
   fits beside the GitHub button without scrolling. */
@media (max-width: 1300px) {
  .nav-links a { padding: 8px 7px !important; }
}
/* Even tightened, seven items + lockup + buttons need ~1115px — below
   that the links get cut off, so the burger takes over early. */
@media (max-width: 1140px) {
  .nav-links { display: none !important; }
}
@media (max-width: 1024px) {
  .gx { padding-left: 32px !important; padding-right: 32px !important; }
}
@media (max-width: 768px) {
  .gx { padding-left: 24px !important; padding-right: 24px !important; }
  .wrap { padding-top: 60px !important; padding-bottom: 60px !important; }
  .sec-h1 { font-size: clamp(26px, 6vw, 34px) !important; }
  .aud-entry { display: flex !important; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
  .aud-entry > span:nth-child(4) { display: none; }
}
@media (max-width: 480px) {
  .gx { padding-left: 16px !important; padding-right: 16px !important; }
  .agg-bar { grid-template-columns: 78px 1fr 30px !important; gap: 10px !important; }
  .agg-bar > div:first-child { font-size: 12px !important; }
  /* Tighten nav spacing so the logo lockup + GitHub button fit down to 320px. */
  nav.gx { gap: 12px !important; }
  nav.gx > div:first-child { gap: 12px !important; }
}

/* Hero: extra darkening on small screens, where the copy spans the full width
   and would otherwise sit over the brighter (right) part of the photo. */
@media (max-width: 900px) { .hero-scrim-m { display: block !important; } }

/* Fixed-size demo windows (03 · See it work): the frame stays put; the demo
   plays and scrolls inside it. Taller on narrow screens, where the embedded
   demo stacks its chat and ledger panes vertically. */
.demo-frame { height: 760px; }
/* The replay frame carries its Play/Pause + Replay controls above the window. */
iframe.demo-frame[data-demo-view="replay"] { height: 815px; }
@media (max-width: 940px) {
  .demo-frame { height: 1280px; }
  iframe.demo-frame[data-demo-view="replay"] { height: 1340px; }
}

/* Typography pass (round-6): headings never orphan a single word — balance
   distributes the break; body copy relies on per-element text-wrap:pretty. */
h1, h2, h3, h4 { text-wrap: balance; }
p { text-wrap: pretty; }

/* Hero headline: hold the two-line break on desktop – the copy column is
   narrower than the headline, so let it overhang rather than wrap to three. */
@media (min-width: 768px) { .hero-h1 { white-space: nowrap; } }

/* Scenario cards (04 · At every scale): the grid is authored as three
   across; step down to two on tablet and one on phones. */
@media (max-width: 1024px) { #vignettes { grid-template-columns: repeat(2, 1fr) !important; } }
@media (max-width: 640px)  { #vignettes { grid-template-columns: 1fr !important; } }

/* Nav on small screens: the lockup wraps to two lines and the header
   buttons compact so logo + lockup + arXiv + GitHub fit at 375px. */
@media (max-width: 640px) {
  /* Support-triage demo: the stage grows as the log fills, so the control
     bar pins to the bottom of the screen while the card is in view. The
     card swaps overflow:hidden for clip (hidden breaks position:sticky);
     participants compress to a chip row; narration caps with inner scroll. */
  .demo-card { overflow: clip !important; }
  .demo-controls { position: sticky; bottom: 0; z-index: 5; padding: 12px 16px 14px !important; box-shadow: 0 -8px 18px -14px rgba(0,0,0,0.35); }
  #demo-explainer { max-height: 76px; overflow-y: auto; margin-top: 10px !important; font-size: 14px !important; }
  #demo-participants { grid-template-columns: repeat(3, 1fr) !important; gap: 8px !important; margin-bottom: 14px !important; }
  #demo-participants .pcard { flex-direction: column; text-align: center; padding: 10px 6px !important; gap: 6px !important; }
  #demo-participants .pavatar { width: 34px !important; height: 34px !important; font-size: 15px !important; }
  #demo-participants .pcard > div:last-child > div:first-child { font-size: 13px !important; }
  #demo-participants .pcard > div:last-child > div:last-child { display: none; }
  /* Section headers stack: small number above kicker + full-width title,
     so the divider lines up with the text instead of floating left. */
  .sec-head { display: block !important; }
  .sec-head > div { padding-top: 0 !important; }
  .sec-num { font-size: 30px !important; line-height: 1.1 !important; margin: 0 0 8px; }
  .nav-lockup { white-space: nowrap; }
  .nav-lockup .lockup-br { display: block; }
  .nav-btn { padding: 9px 12px !important; }
  nav.gx { gap: 14px !important; }
  nav.gx > div:first-child { gap: 12px !important; }
}
@media (max-width: 480px) {
  nav.gx a[aria-label="Back to top"] img { height: 34px !important; }
  nav.gx > div:first-child > div:nth-child(2) { display: none; }  /* divider */
  nav.gx { gap: 10px !important; }
  nav.gx > div:first-child { gap: 10px !important; }
  .nav-lockup { letter-spacing: 0.08em !important; }
  .nav-btn { padding: 8px 10px !important; }
}

/* Burger menu: below 768px the section links leave the bar, so a burger
   reveals them in a dropdown under the nav. The arXiv button folds into
   the menu below 640px so the bar still fits at 375. */
.nav-burger { display: none; }
#nav-menu { display: none; }
@media (max-width: 1140px) {
  .nav-burger { display: inline-flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; width: 40px; height: 40px; background: transparent; border: 1px solid rgba(255,255,255,0.3); border-radius: 10px; cursor: pointer; flex-shrink: 0; padding: 0; }
  .nav-burger span { display: block; width: 16px; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s var(--bb-ease-out), opacity .2s; }
  .nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  #nav-menu { position: absolute; top: 100%; left: 0; right: 0; background: #282829; border-top: 1px solid rgba(255,255,255,0.12); box-shadow: 0 22px 34px -20px rgba(0,0,0,0.6); padding: 6px 0 10px; max-height: calc(100vh - 78px); overflow-y: auto; }
  #nav-menu.open { display: block; }
  #nav-menu a { display: flex; align-items: baseline; gap: 14px; padding: 13px 24px; text-decoration: none; }
  #nav-menu .m-num { font: 400 11px/1 var(--bb-font-mono); color:var(--chap-ink, #282829); min-width: 18px; }
  #nav-menu .m-label { font: 600 14px/1.2 var(--bb-font-sans); color: rgba(255,255,255,0.88); }
  #nav-menu a.nav-menu-cta { border-top: 1px solid rgba(255,255,255,0.10); margin-top: 6px; padding-top: 15px; }
  #nav-menu a.nav-menu-cta .m-label { color: #FF9900; text-transform: uppercase; letter-spacing: 0.08em; font-size: 12px; }
}
@media (max-width: 640px) {
  .nav-btn[href*="arxiv"] { display: none !important; }
  /* Stack-diagram layer cards: name above description, both left-aligned,
     instead of the desktop name-left / description-right split. */
  #stack-diagram > div { flex-direction: column !important; align-items: flex-start !important; gap: 10px !important; }
  #stack-diagram > div > div:last-child { text-align: left !important; max-width: none !important; }
}
