/* Nebula additions on top of cs.css (cs.css is reused as is; nothing there is restyled).
   Accent = Nebula brand violet (token: color/surface/brand/primary/bold, #7033CC). */
:root { --accent: #7033CC; --accent-ink: #5E29AE; --accent-soft: #F3EEFC; }
.rbox { box-shadow: 0 0 0 2px #fff, 0 0 0 5px rgba(112, 51, 204, .18); }
.why-stage { background: var(--accent-soft); }
.steps li { background: var(--accent-soft); }
html { scroll-behavior: smooth; }
section.s, .micro { scroll-margin-top: 64px; }

/* desktop screenshots in a thin browser frame */
.web { margin: 0; }
.web .frame { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; box-shadow: 0 24px 48px -32px rgba(0,0,0,.35); }
.web .frame::before { content: ''; display: block; height: 22px; background: #F5F5F4 radial-gradient(circle at 14px 11px, #E5E2DC 4px, transparent 4.5px) , #F5F5F4; border-bottom: 1px solid var(--line); }
.web img { display: block; width: 100%; }
.web figcaption, .fig-cap { margin-top: 10px; font-size: 14px; color: var(--muted); }
.web figcaption b { color: var(--ink); }

/* before | callouts | after for desktop crops: annotate.js looks for ".phone img", so the crop wears .phone.web-shot */
.ba.web { grid-template-columns: minmax(0, 1fr) minmax(200px, 250px) minmax(0, 1fr); }
.ba.web .phone { max-width: none; }
.ba.web .phone img { aspect-ratio: 640 / 500; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 40px -30px rgba(0,0,0,.35); }
.ba .call .src { margin: 6px 0 0; }

/* hero */
.hero-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 28px; }
.hero-stats div { background: #fff; padding: 16px 18px; }
.hero-stats b { display: block; font: 500 40px/1 var(--display); letter-spacing: -.04em; }
.hero-stats span { font-size: 14px; color: var(--muted); }
.three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 18px; }
.three figcaption.how { max-width: none; }

/* micro case study chapters */
.micro { padding: 72px 0 8px; border-top: 1px solid var(--line); margin-top: 56px; }
.micro-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; margin-bottom: 28px; }
.micro-no { font: 500 96px/0.85 var(--display); letter-spacing: -.06em; color: var(--accent); }
.micro-head .eyebrow { margin: 0; }
.micro-head h2 { font-size: clamp(30px, 3.6vw, 44px); margin: 6px 0 8px; }
.bet { display: inline-block; margin-top: 4px; padding: 10px 14px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; font-size: 16px; }
.bet b { font: 400 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); margin-right: 8px; }
.beat { margin-top: 40px; }
.beat > h3 { font: 600 22px/1.25 var(--serif); margin: 0 0 4px; letter-spacing: -.01em; }
.beat > .sub { font-size: 16px; margin-bottom: 16px; }
.takeaway { margin-top: 40px; padding: 22px 26px; border-radius: var(--r); background: #161513; color: #fff; display: flex; gap: 18px; align-items: baseline; }
.takeaway span { font: 400 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #C8B6F2; white-space: nowrap; }
.takeaway p { margin: 0; font: 500 21px/1.35 var(--serif); }

/* index of micro case studies */
.mindex { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.mindex a { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); transition: border-color .2s, transform .2s; }
.mindex a:hover { border-color: var(--accent); transform: translateY(-2px); }
.mindex .no { font: 500 40px/1 var(--display); color: var(--accent); letter-spacing: -.04em; }
.mindex b { font-size: 16px; line-height: 1.3; }
.mindex span { font-size: 14px; color: var(--muted); line-height: 1.4; }

/* colour ramps (live from the tokens) */
.ramps { display: grid; gap: 4px; }
.ramp { display: grid; grid-template-columns: 92px repeat(10, 1fr); gap: 4px; align-items: center; }
.ramp > span:first-child { font: 400 12px/1 var(--mono); color: var(--muted); text-transform: capitalize; }
.sw { position: relative; height: 26px; border-radius: 5px; }
.sw.aa::after { content: ''; position: absolute; right: 5px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.ramp-head { display: grid; grid-template-columns: 92px repeat(10, 1fr); gap: 4px; font: 400 11px/1 var(--mono); color: var(--faint); text-align: center; margin-bottom: 4px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); margin-right: 6px; vertical-align: 1px; }

/* token chain + pipeline */
.chain { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: stretch; }
.chain .tier { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.chain .tier .sw { height: 40px; border-radius: 8px; }
.chain .tier small { font: 400 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); }
.chain .tier code { font: 400 12.5px/1.4 var(--mono); word-break: break-all; }
.chain .tier p { margin: 0; font-size: 14px; color: var(--muted); }
.chain .arrow { display: grid; place-items: center; font-size: 22px; color: var(--faint); }
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flow span { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 14.5px; background: #fff; }
.flow span.k { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.flow i { color: var(--faint); font-style: normal; }

/* type scale bars */
.tscale { display: grid; gap: 6px; }
.trow { display: grid; grid-template-columns: 96px 1fr 1fr; gap: 14px; align-items: center; font-size: 13px; }
.trow code { font: 400 12px/1 var(--mono); color: var(--muted); }
.tbar { display: flex; align-items: center; gap: 8px; }
.tbar i { display: block; height: 10px; border-radius: 5px; background: #D6C2F4; }
.tbar.d i { background: var(--accent); }
.tbar span { font: 400 12px/1 var(--mono); color: var(--muted); white-space: nowrap; }
.tscale .thead { font: 400 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }

/* spacing + grid mini visuals */
.spbars { display: flex; align-items: flex-end; gap: 6px; height: 120px; }
.spbars i { flex: 1; background: #D6C2F4; border-radius: 4px 4px 0 0; }
.gridmini { display: grid; gap: 4px; height: 120px; }
.gridmini i { background: #E8DCF9; border-radius: 4px; }
.foundation { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: var(--ink); }
.foundation .viz { height: 140px; display: flex; flex-direction: column; justify-content: center; }
.foundation:hover h3 { color: var(--accent-ink); }

/* checklist (testing layers) */
.check { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; font-size: 15px; }
.check li::before { content: '✓'; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #E2F3E7; color: #12502B; font-weight: 700; font-size: 13px; }
.check li.no::before { content: '✕'; background: #FDE7E7; color: #9B1C1C; }
.check b { display: block; }
.check span { color: var(--muted); font-size: 14px; }

/* lifecycle loop */
.loop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.loop span { padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); font-size: 14.5px; }
.loop span.here { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.loop i { color: var(--faint); font-style: normal; }

/* options: chosen vs not */
.opts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.opt { border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.opt.pick { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt small { font: 400 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.opt.pick small { color: var(--accent-ink); }
.opt b { display: block; font-size: 17px; margin: 6px 0 4px; }
.opt p { margin: 0; font-size: 14.5px; color: var(--muted); line-height: 1.45; }

/* "explore it": live docs site in a laptop-sized frame, scaled to fit */
.live { position: relative; width: 100%; aspect-ratio: 1440 / 860; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: 0 40px 80px -50px rgba(0,0,0,.5); background: #fff; }
.live iframe { position: absolute; left: 0; top: 0; width: 1440px; height: 860px; border: 0; transform-origin: 0 0; transform: scale(var(--ls, .7)); }

/* the guiding principle, near the top */
.principle { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.principle > div { background: #fff; padding: 24px; }
.principle > div:first-child { background: #161513; color: #fff; }
.principle .k { display: block; font: 400 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.principle > div:first-child .k { color: #C8B6F2; }
.principle > div:first-child .q { color: #fff; }
.principle .q { font: 500 26px/1.25 var(--display); letter-spacing: -.02em; margin: 0; }
.principle h3 { font: 600 22px/1.2 var(--serif); margin: 0 0 6px; }
.principle p { margin: 0; font-size: 15.5px; line-height: 1.5; color: var(--muted); }
.principle .eg { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); font-size: 14.5px; color: var(--ink); }
.principle .eg b { font: 400 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink); display: block; margin-bottom: 4px; }

/* "rule from my notes → what Nebula does": why things are the way they are */
.rules { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.rules > div { display: grid; grid-template-columns: 1fr 1.25fr; border-top: 1px solid var(--line); }
.rules > div:first-child { border-top: 0; }
.rules > div > * { padding: 14px 18px; margin: 0; font-size: 15px; line-height: 1.45; }
.rules > div > :first-child { background: var(--soft); color: var(--ink); }
.rules > div > :first-child b { display: block; font: 400 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.rules > div > :last-child { color: var(--muted); }
.rules > div > :last-child b { color: var(--ink); }
.rules .head > * { font: 400 11px/1 var(--mono) !important; letter-spacing: .08em; text-transform: uppercase; color: var(--faint) !important; background: #fff !important; padding-top: 12px; padding-bottom: 12px; }

/* big analogy quote */
.analogy { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.analogy > div { border-radius: var(--r); padding: 24px; }
.analogy .monster { background: #161513; color: #fff; }
.analogy .child { background: var(--accent-soft); }
.analogy .q { font: 500 28px/1.2 var(--display); letter-spacing: -.02em; margin: 0 0 12px; }
.analogy p { margin: 0; font-size: 15.5px; line-height: 1.5; }
.analogy .monster p { color: #D9D6CF; }
.analogy ul { margin: 12px 0 0; padding-left: 18px; font-size: 15px; line-height: 1.5; }
.analogy .monster ul { color: #D9D6CF; }

/* a single strong statement */
.statement { font: 500 clamp(24px, 3vw, 34px)/1.25 var(--display); letter-spacing: -.02em; margin: 0; max-width: 900px; }
.statement em { font-style: normal; color: var(--accent); }

.strip.six { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 900px) { .principle, .analogy, .rules > div { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .strip.six { grid-template-columns: 1fr 1fr; } }
.untested { display: inline-block; font: 400 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px; background: #FBEAD6; color: #8A4B08; }

@media (max-width: 900px) {
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .three, .opts { grid-template-columns: 1fr; }
  .mindex { grid-template-columns: 1fr 1fr; }
  .chain { grid-template-columns: 1fr; }
  .chain .arrow { transform: rotate(90deg); }
  .ba.web { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .micro-head { grid-template-columns: 1fr; gap: 8px; }
  .micro-no { font-size: 64px; }
  .trow { grid-template-columns: 74px 1fr 1fr; gap: 8px; }
}
@media (max-width: 560px) {
  .mindex { grid-template-columns: 1fr; }
  .ramp, .ramp-head { grid-template-columns: 58px repeat(10, 1fr); gap: 2px; }
  .sw { height: 20px; }
  .sw.aa::after { right: 2px; width: 5px; height: 5px; margin-top: -2.5px; }
  .takeaway { flex-direction: column; gap: 8px; }
}

/* audit: real-product method beside what I did */
.audit2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.audit2 .steps { max-width: none; }
.audit2 .steps-note { max-width: none; }
@media (max-width: 900px) { .audit2 { grid-template-columns: 1fr; } }

/* Small mono labels: cs.css sets them at line-height 1, which is fine on one line but makes wrapped lines
   collide on phones. Give them room, and lay a label + badge out as a row with a proper gap. */
.steps-lead { line-height: 1.5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.steps-lead + .steps-note { margin-top: 0 !important; }
.untested { line-height: 1.2; vertical-align: middle; }
.beat > h3 .untested { margin-left: 8px; }
.rules .head > * { line-height: 1.4 !important; }
.rules > div > :first-child b { line-height: 1.35; }
.principle .k, .opt small, .chain .tier small, .mindex span, .dec .lbl { line-height: 1.4; }
.ramp > span:first-child { line-height: 1.2; }
