/* Sangha case study page (layout derived from the P2P page; hand-maintained source since the
   Oct 12 layout correction, see the Sangha layout block at the end). Self-contained: this page loads only this file, so the shared
   /assets/a.css and b.css (and every other route) are untouched. Tokens match the live site
   and the approved film: ink #05080D, navy #021526, deep #041B2E, teal #024059, mid #3F768C,
   pale #C9E7F2, muted #86A9BA. Cardo for headlines, Josefin Sans for body, mono for labels. */

@font-face { font-family: "Cardo"; src: url("/sangha/fonts/cardo-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Cardo"; src: url("/sangha/fonts/cardo-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Josefin Sans"; src: url("/sangha/fonts/josefin-sans-latin-300-normal.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Josefin Sans"; src: url("/sangha/fonts/josefin-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Josefin Sans"; src: url("/sangha/fonts/josefin-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/sangha/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --ink: #05080D; --navy: #021526; --deep: #041B2E; --teal: #024059; --mid: #3F768C;
  --pale: #C9E7F2; --white: #F4F9FB; --muted: #8FB0C0;
  --line: rgba(201, 231, 242, .12); --line2: rgba(201, 231, 242, .24); --soft: rgba(201, 231, 242, .05);
  --serif: Cardo, Georgia, "Times New Roman", serif;
  --sans: "Josefin Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(16px, 4vw, 56px);
  --radius: 14px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ink); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body.sangha {
  margin: 0; color: var(--pale); font: 400 18px/1.65 var(--sans); overflow-x: hidden;
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(63, 118, 140, .26), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(2, 64, 89, .32), transparent 60%),
    var(--ink);
}
img, video, canvas, svg { display: block; max-width: 100%; }
a { color: var(--pale); text-underline-offset: 3px; }
a:hover { color: var(--white); }
:focus-visible { outline: 2px solid var(--pale); outline-offset: 3px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 14px; background: var(--pale); color: var(--ink); border-radius: 8px; font-weight: 600; }
.skip:focus { top: 12px; }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: var(--gutter); }

h1, h2, h3 { margin: 0; color: var(--white); font-weight: 400; text-wrap: balance; }
h1, h2 { font-family: var(--serif); letter-spacing: -.005em; }
h1 em, h2 em { color: var(--pale); }
h3 { font-family: var(--sans); font-weight: 600; font-size: 19px; letter-spacing: .01em; }
p { margin: 0; }

.kicker, .label, .roles, .chg-k, .gitem p span, .step-n, .q-role, .player-note, .bar-role {
  font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.label { margin-bottom: 18px; }
.label span { color: var(--pale); }
.label span::after { content: ""; display: inline-block; width: 44px; height: 1px; margin: 0 12px 0 14px; vertical-align: middle; background: var(--line2); }

/* Top bar */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 20px; border-bottom: 1px solid var(--line); position: relative; z-index: 3; }
.bar-id { display: flex; flex-direction: column; gap: 2px; text-decoration: none; }
.bar-name { font-weight: 600; color: var(--white); letter-spacing: .06em; text-transform: uppercase; font-size: 14px; }
.bar-role { font-size: 11px; }
.bar-nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-size: 15px; }
.bar-nav a { text-decoration: none; color: var(--muted); }
.bar-nav a:hover { color: var(--white); }
.bar-nav .bar-cta { color: var(--white); border: 1px solid var(--line2); padding: 9px 14px 7px; border-radius: 999px; }
@media (max-width: 720px) { .bar-nav a:not(.bar-cta) { display: none; } }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 14px 22px 11px; border-radius: 999px; font: 600 16px/1 var(--sans); letter-spacing: .02em; text-decoration: none; transition: background .2s, border-color .2s, color .2s; }
.btn-primary { background: var(--pale); color: var(--ink); }
.btn-primary:hover { background: var(--white); color: var(--ink); }
.btn-ghost { border: 1px solid var(--line2); color: var(--white); }
.btn-ghost:hover { border-color: var(--pale); }
.pbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 10px 14px 8px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(4, 27, 46, .7); color: var(--white); font: 400 14px/1 var(--sans); letter-spacing: .02em; cursor: pointer; }
.pbtn:hover { border-color: var(--pale); }
.pbtn[aria-pressed="true"] { background: rgba(201, 231, 242, .12); border-color: rgba(201, 231, 242, .45); }
.pbtn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
[data-sound][aria-pressed="true"] .pbtn-dot { background: var(--pale); box-shadow: 0 0 10px var(--pale); }

/* 1. Hero */
.hero { position: relative; min-height: min(86vh, 760px); display: flex; align-items: center; overflow: hidden; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-scrim { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(5, 8, 13, .92) 0%, rgba(5, 8, 13, .7) 38%, rgba(5, 8, 13, 0) 66%), linear-gradient(0deg, var(--ink) 0%, rgba(5, 8, 13, 0) 22%); }
.hero-inner { position: relative; z-index: 2; width: 100%; padding-block: clamp(56px, 9vh, 96px); }
.hero-inner > * { max-width: 640px; }
.hero-inner > h1 { max-width: 820px; }
.hero h1 { font-size: clamp(42px, 6.2vw, 82px); line-height: 1.04; margin: 18px 0 22px; }
.hero h1 em { display: block; }
.lede { font-size: clamp(19px, 1.7vw, 22px); line-height: 1.55; color: var(--pale); margin-bottom: 18px; }
.roles { margin-bottom: 30px; color: var(--muted); }
.hero-mail { margin-top: 16px; font-size: 15px; color: var(--muted); }
@media (max-width: 820px) {
  .hero { min-height: auto; align-items: flex-end; }
  .hero-canvas { opacity: .55; }
  .hero-scrim { background: linear-gradient(0deg, var(--ink) 8%, rgba(5, 8, 13, .78) 52%, rgba(5, 8, 13, .35) 100%); }
  .hero-inner { padding-top: 168px; }
}

/* Section heads */
section { scroll-margin-top: 24px; }
.sec-head { max-width: 760px; margin-bottom: clamp(28px, 4vw, 44px); }
.sec-head h2 { font-size: clamp(32px, 4.2vw, 52px); line-height: 1.1; }
.sec-head h2 em { display: block; }
.sec-sub { margin-top: 16px; color: var(--muted); font-size: 18px; max-width: 640px; }
.sec-head-row { max-width: 1240px; display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.sec-head-row > div { max-width: 760px; }

/* 2. Demo */
.demo { padding-block: clamp(32px, 5vw, 64px) clamp(64px, 8vw, 112px); }
.player-frame { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line2); background: var(--navy); box-shadow: 0 40px 120px rgba(0, 0, 0, .55); aspect-ratio: 16 / 9; }
.player-video { width: 100%; height: 100%; background: var(--navy); }
.player-video::cue { font-family: var(--sans); font-size: 1em; background: rgba(5, 8, 13, .78); color: #fff; }
.player-start { position: absolute; inset: 0; margin: auto; width: max-content; height: max-content; display: inline-flex; align-items: center; gap: 14px; padding: 16px 26px 14px 18px; border-radius: 999px; border: 1px solid rgba(201, 231, 242, .5); background: rgba(5, 8, 13, .72); color: var(--white); font: 600 17px/1 var(--sans); cursor: pointer; backdrop-filter: blur(4px); }
.player-start[hidden] { display: none; }
.player-start-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--pale); position: relative; }
.player-start-icon::after { content: ""; position: absolute; left: 15px; top: 11px; border-left: 13px solid var(--ink); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.player-note { margin-left: auto; font-size: 12px; }
@media (max-width: 640px) { .player-note { margin-left: 0; width: 100%; } .player-frame { border-radius: 10px; } }

/* 3. Context */
.context { padding-block: clamp(56px, 7vw, 104px); border-top: 1px solid var(--line); }
.context-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); }
.context h3 { font-family: var(--mono); font-weight: 400; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.context-before p { margin-bottom: 16px; font-size: 19px; }
.context-before p:last-child { font-family: var(--serif); font-size: 24px; line-height: 1.35; color: var(--white); margin-top: 8px; }
.changes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.changes li { display: grid; grid-template-columns: 200px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.chg-k { color: var(--pale); padding-top: 3px; }
.chg-v { color: var(--pale); }
.ai-note { margin-top: 24px; padding: 18px 20px; border-left: 2px solid var(--mid); background: var(--soft); border-radius: 0 10px 10px 0; font-size: 17px; }
.ai-note strong { color: var(--white); font-weight: 600; }
@media (max-width: 900px) { .context-grid { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .changes li { grid-template-columns: 1fr; gap: 6px; } }

/* 4. Gallery */
.build { padding-block: clamp(56px, 7vw, 104px); border-top: 1px solid var(--line); }
.gallery { position: relative; overflow: hidden; padding-block: 8px 4px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%); }
.gallery-track { list-style: none; margin: 0; padding: 0 var(--gutter); display: flex; gap: clamp(14px, 2vw, 24px); width: max-content; will-change: transform; touch-action: pan-y; cursor: grab; user-select: none; }
.gallery.dragging .gallery-track { cursor: grabbing; }
.gitem { flex: 0 0 auto; width: clamp(260px, 30vw, 400px); }
.gitem button { display: block; width: 100%; padding: 0; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--navy); cursor: zoom-in; aspect-ratio: 16 / 10; }
.gitem img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; filter: brightness(.88); transition: transform .5s, filter .3s; }
.gitem button:hover img, .gitem button:focus-visible img { transform: scale(1.03); filter: none; }
.gitem p { margin-top: 12px; font-size: 15px; line-height: 1.5; color: var(--pale); padding-right: 8px; }
.gitem p span { display: block; font-size: 11px; margin-bottom: 4px; }
.gallery-static .gallery-track { width: auto; overflow-x: auto; scroll-snap-type: x mandatory; cursor: auto; padding-bottom: 16px; transform: none !important; }
.gallery-static .gitem { scroll-snap-align: start; }
.gallery-static { -webkit-mask-image: none; mask-image: none; }

.lightbox { width: min(1200px, 94vw); max-height: 94vh; padding: 16px; border: 1px solid var(--line2); border-radius: 14px; background: var(--deep); color: var(--pale); }
.lightbox::backdrop { background: rgba(5, 8, 13, .86); }
.lightbox figure { margin: 0; }
.lightbox img { width: 100%; height: auto; max-height: 72vh; object-fit: contain; border-radius: 8px; background: var(--navy); }
.lightbox figcaption { margin-top: 12px; font-size: 16px; }
.lightbox figcaption span { display: block; font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.lb-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.lb-count { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.lb-close { margin-left: auto; }

/* 5. Frameworks */
.frameworks { padding-block: clamp(56px, 7vw, 104px); border-top: 1px solid var(--line); }
.fw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.fw { padding: 28px clamp(0px, 2vw, 28px) 32px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 176px 1fr; column-gap: 24px; align-content: start; }
.fw:nth-child(odd) { border-right: 1px solid var(--line); }
.fw:nth-child(even) { padding-left: clamp(16px, 2.5vw, 32px); }
.fw-fig { grid-row: span 3; width: 176px; height: auto; }
.fw h3 { margin-bottom: 6px; }
.fw-what { font-family: var(--serif); font-size: 21px; line-height: 1.35; color: var(--white); margin-bottom: 10px; }
.fw p:last-child { color: var(--muted); font-size: 17px; }
.fw-fig circle, .fw-fig rect, .fw-fig line, .fw-fig path { fill: none; stroke: rgba(201, 231, 242, .45); stroke-width: 1.4; }
.fw-ring circle { stroke-dasharray: 3 5; stroke: rgba(201, 231, 242, .3); }
.fw-nodes circle, .fw-cols rect, .fw-steps rect { fill: rgba(4, 27, 46, .9); }
.fw-fig .hl { stroke: var(--pale); fill: rgba(201, 231, 242, .12); }
.fw-flow path { stroke: var(--pale); stroke-dasharray: 4 4; }
.fw-lanes line { stroke: rgba(201, 231, 242, .18); }
.fw-txt text { fill: var(--pale); font: 400 15px var(--mono); text-anchor: middle; dominant-baseline: middle; }
.fw-txt-sm text { font-size: 15px; }
.fw-txt .hl-t { fill: var(--white); font-weight: 600; }
@media (max-width: 900px) {
  .fw-grid { grid-template-columns: 1fr; }
  .fw, .fw:nth-child(odd), .fw:nth-child(even) { border-right: 0; padding-left: 0; }
}
@media (max-width: 520px) { .fw { grid-template-columns: 1fr; } .fw-fig { grid-row: auto; width: 200px; margin-bottom: 16px; } }

/* 6. Process */
.process { padding-block: clamp(56px, 7vw, 104px); border-top: 1px solid var(--line); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; position: relative; }
.steps::before { content: ""; position: absolute; top: 19px; left: 20px; right: 20px; height: 1px; background: linear-gradient(90deg, var(--mid), rgba(63, 118, 140, .2)); }
.steps li { position: relative; }
.step-n { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--ink); border: 1px solid var(--mid); color: var(--white); font-size: 14px; margin-bottom: 18px; position: relative; }
.steps h3 { font-size: 18px; margin-bottom: 8px; }
.steps p { font-size: 16px; color: var(--muted); }
.ownership { margin-top: 36px; max-width: 820px; font-family: var(--serif); font-size: clamp(21px, 2vw, 26px); line-height: 1.4; color: var(--white); }
@media (max-width: 960px) {
  .steps { grid-template-columns: 1fr; gap: 0; }
  .steps::before { top: 20px; bottom: 20px; left: 19px; right: auto; width: 1px; height: auto; background: linear-gradient(180deg, var(--mid), rgba(63, 118, 140, .2)); }
  .steps li { display: grid; grid-template-columns: 40px 1fr; column-gap: 18px; padding-bottom: 22px; }
  .step-n { grid-row: span 2; margin-bottom: 0; }
}

/* 7. Quote */
.quote { padding-block: clamp(64px, 8vw, 120px); border-top: 1px solid var(--line); }
.quote figure { margin: 0; max-width: 980px; }
.quote blockquote { margin: 0; }
.quote blockquote p { font-family: var(--serif); font-size: clamp(28px, 3.6vw, 46px); line-height: 1.25; color: var(--white); }
.quote figcaption { margin-top: 28px; display: flex; flex-direction: column; gap: 4px; padding-left: 20px; border-left: 2px solid var(--mid); }
.q-name { font-weight: 600; color: var(--white); font-size: 18px; }

/* 8. CTA */
.cta { padding-block: clamp(64px, 8vw, 120px); border-top: 1px solid var(--line); }
.cta h2 { font-size: clamp(34px, 4.6vw, 58px); line-height: 1.08; max-width: 820px; }
.cta h2 em { display: block; }
.cta p { margin: 20px 0 30px; max-width: 620px; font-size: 19px; }

.foot { display: flex; flex-wrap: wrap; gap: 12px 28px; padding-block: 28px 40px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.foot a { color: var(--pale); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}


/* ==== Sangha layout (Oct 12 correction, hand-maintained; do not regenerate from p2p.css) ==== */
.hero h1 { max-width: none; }
.player-caption-note { font: 14px var(--sans); color: var(--muted); }

/* 02: program connection, a full-width band on the same 5fr/7fr grid as the context above. */
.connection {
  margin-top: clamp(44px, 5vw, 72px); padding-block: clamp(28px, 3.4vw, 44px);
  border-top: 1px solid var(--line2); border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start;
}
.connection-head h3 { margin-bottom: 14px; }
.connection-title { font-family: var(--serif); font-size: clamp(28px, 3vw, 38px); line-height: 1.12; color: var(--white); margin: 0; }
.connection-title em { display: block; color: var(--pale); }
.connection-body > p { margin: 22px 0 18px; font-size: 18px; color: var(--pale); max-width: 62ch; }
.connection-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; position: relative; }
.connection-flow li { position: relative; padding: 14px 16px; border: 1px solid var(--line2); border-radius: 12px; background: var(--soft); }
.connection-flow li + li::before { content: "→"; position: absolute; left: -15px; top: 50%; transform: translate(-50%, -50%); color: var(--mid); font-size: 16px; }
.connection-flow li:last-child { border-color: rgba(201, 231, 242, .45); background: rgba(201, 231, 242, .09); }
.cf-k { display: block; color: var(--white); font-weight: 600; font-size: 16px; line-height: 1.3; }
.cf-v { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.connection-link { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--white); text-decoration: none; padding: 11px 18px; border: 1px solid var(--line2); border-radius: 999px; font-size: 16px; transition: border-color .2s, background .2s; }
.connection-link:hover, .connection-link:focus-visible { border-color: var(--pale); background: var(--soft); }
@media (max-width: 900px) { .connection { grid-template-columns: 1fr; gap: 20px; } }
@media (max-width: 560px) {
  .connection-flow { grid-template-columns: 1fr; gap: 22px; }
  .connection-flow li + li::before { content: "↓"; left: 50%; top: -11px; }
  .connection-link { white-space: normal; }
}

/* 04: each framework is a diagram plus one explicit text stack (never auto-placed). */
.fw { grid-template-columns: 176px minmax(0, 1fr); grid-template-areas: "fig text"; align-items: start; }
.fw .fw-fig { grid-area: fig; grid-row: auto; width: 176px; }
.fw .fw-text { grid-area: text; min-width: 0; }
.fw-text h3 { margin-bottom: 6px; }
.fw-text .fw-what { margin-bottom: 10px; }
.fw-text .fw-body { color: var(--muted); font-size: 17px; margin: 0; }
.fw-links line { stroke: rgba(201, 231, 242, .3); }
.fw-pills rect, .fw-card, .fw-mail rect, .fw-auto rect, .fw-weeks rect { fill: rgba(4, 27, 46, .9); }
.fw-fig .fw-loop { stroke: var(--pale); stroke-width: 1.6; }
.fw-auto line { stroke: rgba(201, 231, 242, .3); }
.fw-fig .fw-human { stroke-dasharray: 5 5; stroke: rgba(201, 231, 242, .55); }
.fw-mail path { stroke: rgba(201, 231, 242, .45); }
.fw-txt-xs text { font-size: 13px; }
.fw-txt-start text { text-anchor: start; fill: var(--muted); }
@media (max-width: 520px) {
  .fw { grid-template-columns: 1fr; grid-template-areas: "fig" "text"; }
  .fw .fw-fig { width: 200px; margin-bottom: 18px; }
}

/* 05: the closing statement spans the section, like the steps above it. */
.process .closing-statement {
  max-width: none; margin-top: clamp(40px, 5vw, 64px); padding-top: clamp(24px, 3vw, 36px);
  border-top: 1px solid var(--line); font-size: clamp(22px, 2.3vw, 30px); line-height: 1.38; text-wrap: pretty;
}
