
/* ===== demo3/demo.css ===== */
/* Demo 3 — Interactive "how we serve a model" diagram */
.how-lede {
  margin-top: 14px;
  max-width: 720px;
  font-size: 17px;
  color: var(--muted);
}
.flow { margin-top: 28px; }

.flow-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.flow-figure {
  position: relative;
  padding: 20px 20px 8px;
  background:
    radial-gradient(circle at 1px 1px, rgba(154, 167, 180, .09) 1px, transparent 1.5px) 0 0 / 22px 22px;
  outline: none;
}
.flow-figure:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.flow-figure svg { width: 100%; height: auto; display: block; overflow: visible; }

.flow-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
}
.flow-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.flow-btn { min-width: 84px; }
.flow-caption {
  flex: 1 1 320px;
  min-height: 3.2em;
  font-size: 15px;
  color: var(--muted);
}
.flow-caption strong { color: var(--text); font-weight: 600; margin-right: 6px; }

/* Steps: plain list without JS; a clickable stepper with JS */
.flow-steps {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
  counter-reset: step;
}
.flow-steps li { counter-increment: step; }
.flow:not(.is-live) .flow-steps li {
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--muted);
}
.flow:not(.is-live) .flow-steps li strong { display: block; color: var(--text); }
.flow:not(.is-live) .flow-steps li strong::before { content: counter(step) ". "; color: var(--accent); }

.flow.is-live .flow-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.flow.is-live .flow-steps li > span,
.flow.is-live .flow-steps li > strong { display: none; }
.flow-step-btn {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font: 500 14px/1.25 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.flow-step-btn:hover { border-color: var(--border-strong); color: var(--text); }
.flow-step-n {
  flex: none;
  width: 24px; height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #18212C;
  font-size: 12px;
  font-weight: 700;
}
.flow-step-btn.is-done { color: var(--text); }
.flow-step-btn.is-done .flow-step-n { background: var(--accent-soft); color: var(--accent); }
.flow-step-btn[aria-current="step"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--text);
}
.flow-step-btn[aria-current="step"] .flow-step-n { background: var(--accent); color: var(--on-accent); }

/* ---------- SVG ---------- */
.fl-edge { fill: none; stroke: #2C3A48; stroke-width: 2; transition: stroke .35s ease; }
.fl-edge.is-done { stroke: rgba(52, 211, 153, .35); }
.fl-edge.is-active { stroke: var(--accent); }

.fl-fabric { fill: rgba(52, 211, 153, .03); stroke: #2C3A48; stroke-width: 1.5; stroke-dasharray: 5 5; transition: fill .35s ease, stroke .35s ease; }
.fl-fabric.is-active { fill: rgba(52, 211, 153, .10); stroke: var(--accent); }
.fl-fabric-label { fill: var(--muted); font: 600 12px var(--font-body); letter-spacing: 1.2px; text-transform: uppercase; }
.fl-fabric-label.is-active { fill: var(--accent); }

.fl-box { fill: #0F151D; stroke: #2C3A48; stroke-width: 1.5; transition: stroke .35s ease, fill .35s ease; }
.fl-halo { fill: none; stroke: var(--accent); stroke-width: 8; opacity: 0; transition: opacity .35s ease; }
.fl-node.is-done .fl-box { stroke: rgba(52, 211, 153, .45); }
.fl-node.is-active .fl-box { stroke: var(--accent); fill: #10201A; }
.fl-node.is-active .fl-halo { opacity: .16; }
.fl-title { fill: var(--text); font: 600 15px var(--font-head); }
.fl-sub { fill: var(--muted); font: 400 12px var(--font-body); }
.fl-node.is-active .fl-sub { fill: #A7F3D0; }
.fl-tile { fill: #1A2531; }
.fl-tile-lit { fill: var(--accent); }

.fl-packet { fill: var(--accent); }
.fl-packet-halo { fill: var(--accent); opacity: .22; }
.fl-kv { fill: #6EE7B7; stroke: #052E1F; stroke-width: 1; }
.fl-token { fill: #A7F3D0; }
.fl-hidden { display: none; }

@media (max-width: 1100px) {
  .flow.is-live .flow-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .flow-figure { padding: 14px 10px 4px; }
  .flow-bar { padding: 14px 16px 16px; }
  .flow-controls { width: 100%; }
  .flow-btn { flex: 1 1 0; min-width: 0; }
  .flow-caption { flex-basis: 100%; min-height: 4.8em; }
  .flow.is-live .flow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fl-title { font-size: 15px; }
  .fl-sub { font-size: 12px; }
}

/* ===== demo2/demo.css ===== */
/* Demo 2 — Scroll motion: staggered fade/slide reveals + count-up numbers + scroll progress */

/* Reveal: only active when demo-early.js set html.js-reveal (motion allowed + IntersectionObserver) */
.js-reveal [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity .8s cubic-bezier(.2, .65, .2, 1),
    transform .8s cubic-bezier(.2, .65, .2, 1);
}
.js-reveal [data-reveal="card"] { transform: translate3d(0, 40px, 0) scale(.98); }
.js-reveal [data-reveal].is-in { opacity: 1; transform: none; }
.js-reveal [data-d="1"] { transition-delay: 90ms; }
.js-reveal [data-d="2"] { transition-delay: 180ms; }
.js-reveal [data-d="3"] { transition-delay: 270ms; }
/* cards stagger a little wider */
.js-reveal [data-reveal="card"][data-d="1"] { transition-delay: 110ms; }
.js-reveal [data-reveal="card"][data-d="2"] { transition-delay: 220ms; }
.js-reveal [data-reveal="card"][data-d="3"] { transition-delay: 330ms; }

/* Count-up numbers: fixed-width digits so the strip does not jitter */
.stats strong { font-variant-numeric: tabular-nums; }
.count-live { display: inline-block; }
/* the base sheet styles .stats span as the small caption; keep the number spans at number size */
.stats strong span { font-size: inherit; color: inherit; }

/* Emerald underline that draws in under each stat as it counts */
.stats li { position: relative; }
.js-reveal .stats li::after {
  content: "";
  position: absolute;
  left: 0; bottom: -10px;
  width: 32px; height: 2px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 1.2s cubic-bezier(.2, .65, .2, 1) .35s;
  opacity: .7;
}
.js-reveal .stats li.is-in::after { transform: scaleX(1); }
.stats { padding-bottom: 36px; }

/* Scroll progress line along the top edge */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
}
.scroll-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(52, 211, 153, .4), var(--accent));
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

@media (max-width: 600px) {
  .js-reveal [data-reveal] { transform: translate3d(0, 20px, 0); }
  .js-reveal [data-reveal="card"] { transform: translate3d(0, 24px, 0); }
  .stats { padding-bottom: 30px; }
}

/* ===== common/chapters.css ===== */
/* ---------- Chapter structure (demos 6 + 7) ---------- */

/* Header: chapter index in the nav */
.ch-nav { gap: 2px; }
.site-nav a.ch-link {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s ease, background-color .2s ease;
}
.ch-n {
  font: 600 11px/1 var(--font-head);
  letter-spacing: .04em;
  color: #66737F;
  transition: color .2s ease;
}
.site-nav a.ch-link:hover { color: var(--text); }
.site-nav a.ch-link.is-current { color: var(--text); background: rgba(52, 211, 153, .08); }
.ch-link.is-current .ch-n { color: var(--accent); }
.ch-nav .btn { margin-left: 12px; }

/* collapse the chapter nav into the menu button below 1240px (the toggle comes from main.js) */
@media (max-width: 1239px) {
  .js-nav .nav-toggle { display: inline-flex; }
  .js-nav .site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding-top: 8px;
  }
  .js-nav .site-nav.is-open { display: flex; }
  .js-nav .site-nav a.ch-link { padding: 12px 8px; border-radius: 8px; }
  .js-nav .site-nav .btn { margin: 12px 0 4px; }
  .site-nav { flex-wrap: wrap; }
}

/* Chapters */
.chapter {
  padding-top: clamp(72px, 10vw, 136px);
  padding-bottom: clamp(72px, 10vw, 136px);
  border-top: 1px solid var(--border);
}
.chapter.ch-hero { border-top: 0; }
.ch-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  font-size: 13px;
  letter-spacing: .14em;
  color: var(--muted);
}
.ch-eyebrow-n { color: var(--accent); }
.ch-eyebrow-sep { width: 20px; height: 1px; background: var(--border-strong); }

.ch-title {
  margin-top: 18px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(32px, 4.7vw, 60px);
  line-height: 1.05;
  letter-spacing: -.03em;
}
.hero h1.ch-title-xl {
  font-size: clamp(38px, 5.8vw, 76px);
  line-height: 1.02;
  letter-spacing: -.035em;
  max-width: none;
}
.hl-line { display: block; }
.ch-title em { font-style: normal; color: var(--accent); }
.ch-lede {
  margin-top: 22px;
  max-width: 640px;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.55;
  color: var(--muted);
}
.ch-hero { gap: 0; }
.ch-hero .hero-actions { margin-top: 32px; }
.ch-lede-long { max-width: 760px; }

/* Numbers chapter: bigger figures */
.ch-numbers .stats { margin-top: 48px; padding: 36px 40px; }
.ch-numbers .stats strong { font-size: clamp(32px, 4vw, 52px); letter-spacing: -.02em; }
.ch-numbers .stats li > span { font-size: 15px; }

/* Contact keeps its original block; only the eyebrow sits above it */
.ch-contact .ch-eyebrow { margin-bottom: 24px; }

@media (max-width: 600px) {
  /* forced two-line headlines only where there is room; on phones the words flow naturally */
  .hl-line { display: inline; }
  .ch-eyebrow { font-size: 12px; }
  .ch-title { margin-top: 14px; }
  .ch-lede { margin-top: 16px; }
  .ch-hero .hero-actions { margin-top: 24px; }
  .ch-numbers .stats { padding: 22px 20px; margin-top: 32px; }
}

/* ===== common/flow-tabs.css ===== */
/* ---------- Phase tabs with status badges (diagram from demo 3) — demos 7 + 8 ---------- */
.flow-tabs { margin-top: 48px; }
.flow-tabs .flow-steps { margin: 0 0 14px; }
.flow-tabs.is-live .flow-steps { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.flow-tabs .flow-step-btn { flex-wrap: wrap; min-height: 52px; padding: 10px 12px; }
.flow-badge {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font: 600 10.5px/1.2 var(--font-body);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.flow-badge.is-live { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.flow-badge.is-paused { border-color: var(--accent); color: var(--accent); }
.flow-badge.is-done { background: var(--accent-soft); border-color: rgba(52, 211, 153, .35); color: var(--accent); }

@media (max-width: 1100px) {
  .flow-tabs.is-live .flow-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .flow-tabs.is-live .flow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  /* name on the first row, status badge on its own row under it: every tab the same height */
  .flow-tabs .flow-step-btn { row-gap: 6px; }
  .flow-tabs .flow-step-btn > span:nth-child(2) { flex: 1 1 calc(100% - 34px); }
  .flow-tabs .flow-badge { margin-left: 34px; }
}

/* ===== common/profile.css ===== */
/* ---------- Profile card — demos 7 + 8 ---------- */
.profile {
  margin-top: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  padding: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  max-width: 980px;
}
.profile-mono {
  width: 96px; height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #4ADEAA, #22A878);
  color: var(--on-accent);
  font: 700 34px/1 var(--font-head);
  letter-spacing: -.02em;
  box-shadow: 0 0 0 6px var(--accent-soft), 0 0 0 7px rgba(52, 211, 153, .25);
}
.profile-name { font: 700 24px/1.2 var(--font-head); }
.profile-name span { font: 400 16px var(--font-body); color: var(--muted); }
.profile-role { margin-top: 6px; font-size: 14px; color: var(--accent); }
.profile-bio { margin-top: 18px; font-size: 16.5px; line-height: 1.7; color: var(--muted); }
.chips { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 13px;
  color: var(--text);
}

@media (max-width: 600px) {
  .profile { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 24px 20px; }
  .profile-mono { width: 72px; height: 72px; font-size: 26px; }
}

/* ===== demo6/demo.css ===== */
/* Demo 6 — Chapters, simplified: text-led, hairline structure, lots of whitespace */

/* 02 What we do: numbered rows instead of boxed cards */
.svc-list {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 64px;
}
.svc-list li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 6px 16px;
  padding: 28px 0 32px;
  border-top: 1px solid var(--border);
}
.svc-n {
  grid-row: span 2;
  padding-top: 5px;
  font: 600 14px/1 var(--font-head);
  color: var(--accent);
}
.svc-list h3 { font: 600 21px/1.3 var(--font-head); letter-spacing: -.01em; }
.svc-list p { font-size: 15.5px; line-height: 1.65; color: var(--muted); }

/* 03 How we serve: five numbered phases on a rule */
.steps5 {
  list-style: none;
  margin: 56px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  counter-reset: phase;
}
.steps5 li {
  position: relative;
  padding-top: 30px;
  border-top: 2px solid var(--border-strong);
  counter-increment: phase;
}
.steps5 li::before {
  content: "0" counter(phase);
  position: absolute;
  top: -11px;
  left: 0;
  padding-right: 10px;
  background: var(--bg);
  font: 600 13px/20px var(--font-head);
  color: var(--accent);
}
.steps5 li:first-child { border-top-color: var(--accent); }
.steps5 strong { display: block; margin-bottom: 8px; font: 600 19px/1.3 var(--font-head); }
.steps5 span { display: block; font-size: 15px; line-height: 1.6; color: var(--muted); }

@media (max-width: 1100px) {
  .steps5 { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 40px; }
}
@media (max-width: 860px) {
  .svc-list { grid-template-columns: minmax(0, 1fr); margin-top: 40px; }
  .steps5 { grid-template-columns: minmax(0, 1fr); gap: 32px; margin-top: 44px; }
}
@media (max-width: 600px) {
  .svc-list li { grid-template-columns: 34px minmax(0, 1fr); gap: 6px 12px; padding: 22px 0 24px; }
  .svc-list h3 { font-size: 19px; }
}

/* ===== demo10/backdrop.css ===== */
/* ---------- Demo 10: fixed photo backdrops + live layer ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg);
}
.bd-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform-origin: 0 0;            /* backdrop.js composes camera + zoom matrices in viewport px */
}
.bd-layer:first-child { opacity: 1; }          /* no-JS: the welcome image only */
.js-backdrop .bd-layer { opacity: 0; visibility: hidden; }
.js-backdrop .bd-layer.is-live { visibility: visible; }
/* handover: outgoing photo on top, shrinking with a feathered edge; will-change only while it runs */
.js-backdrop .bd-layer.is-hand { will-change: transform, opacity; }
.js-backdrop .bd-layer.is-out {
  z-index: 2;
  -webkit-mask-image: radial-gradient(var(--mr, 300%) var(--mr, 300%) at var(--mx, 50%) var(--my, 50%), #000 28%, rgba(0,0,0,.6) 55%, transparent 100%);
  mask-image: radial-gradient(var(--mr, 300%) var(--mr, 300%) at var(--mx, 50%) var(--my, 50%), #000 28%, rgba(0,0,0,.6) 55%, transparent 100%);
}
.js-backdrop .bd-layer.is-in { z-index: 1; }
/* reduced motion: a quick plain cross-fade, no zoom */
.bd-reduce .bd-layer { transition: opacity .35s ease; }
.bd-layer picture, .bd-layer img {
  display: block;
  width: 100%;
  height: 100%;
}
.bd-layer img { object-fit: cover; object-position: 68% 50%; }

.bd-specks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.bd-specks.is-ready { opacity: .9; }
/* soft emerald glow on the image side, breathing slowly */
.bd-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(42% 50% at 76% 46%, rgba(52, 211, 153, .10), rgba(52, 211, 153, 0) 70%);
  animation: bd-breathe 9s ease-in-out infinite;
}
@keyframes bd-breathe { 50% { opacity: .55; } }
/* light scrim (the images already carry baked left-side darkening for AA) */
.bd-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 15, 20, .35) 0%, rgba(11, 15, 20, .12) 45%, rgba(11, 15, 20, 0) 65%),
    linear-gradient(180deg, rgba(11, 15, 20, .35) 0%, rgba(11, 15, 20, 0) 18%);
}
.bd-grain {
  position: absolute;
  inset: -64px;
  background-image: var(--grain, none);
  background-size: 160px 160px;
  opacity: .06;
  animation: bd-grain 1.1s steps(5) infinite;
}
@keyframes bd-grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-24px, 16px); }
  40% { transform: translate(18px, -30px); }
  60% { transform: translate(-10px, 26px); }
  80% { transform: translate(28px, 8px); }
  100% { transform: translate(0, 0); }
}

/* page on top of the backdrop */
body { background: var(--bg); }
.ch-title, .ch-lede, .ch-eyebrow { text-shadow: 0 2px 22px rgba(11, 15, 20, .8); }
.chapter { border-top-color: rgba(31, 42, 54, .55); }
.hero.ch-hero {
  min-height: max(560px, calc(100vh - 85px));
  min-height: max(560px, calc(100svh - 85px));
  justify-content: center;
}
/* only the blocks that run into the image side get a light panel */
.svc-list li {
  padding: 24px 24px 26px;
  margin-bottom: 14px;
  background: rgba(11, 15, 20, .74);
  border: 1px solid rgba(31, 42, 54, .9);
  border-radius: 14px;
}
.svc-list { gap: 0 14px; }
.ch-numbers .stats, .flow-panel, .profile, .contact { background-color: rgba(18, 24, 33, .9); }
.flow-step-btn { background: rgba(11, 15, 20, .72); }

@media (max-aspect-ratio: 4/5) {
  .bd-layer img { object-position: 50% 50%; }
  .bd-glow { background: radial-gradient(70% 40% at 60% 70%, rgba(52, 211, 153, .08), rgba(52, 211, 153, 0) 70%); }
  .bd-scrim { background: linear-gradient(180deg, rgba(11, 15, 20, .3) 0%, rgba(11, 15, 20, .1) 30%, rgba(11, 15, 20, .1) 100%); }
}
@media (max-width: 600px) {
  .svc-list li { padding: 20px 16px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  .bd-glow, .bd-grain { animation: none; }
  .bd-specks { transition: none; }
}
