/* ==========================================================================
   Sheets — the "+" pills open a full, scrollable story sheet (the Apple
   All-Access pattern): the pill grows into the sheet, the page falls back
   behind a veil, and inside the sheet every block animates as it scrolls
   into view. Loaded on the case studies only, after main.css.

   Authoring (see CLAUDE.md "Sheets"):
     <div class="osheet" id="ovX" role="dialog" aria-modal="true" aria-labelledby="ovX-t" hidden>
       <div class="os-scroll">
         <header class="os-hero"> eyebrow · title · lede </header>
         <section class="os-block"> modules… </section>
       </div>
     </div>
   A pill opens it with data-overlay="#ovX" (same as the old overlays).
   Any element with [data-os] reveals when it enters the sheet's viewport.
   ========================================================================== */

.osheet {
  --os-w: min(1120px, calc(100vw - 64px));
  --os-pad: clamp(24px, 6vw, 96px);
  --os-col: 780px;
  --os-radius: 30px;
  --os-bg: #0c0c0e;
  --os-card: rgba(245,242,235,.035);
  --os-line: rgba(245,242,235,.10);
  --os-dim: rgba(245,242,235,.44);
  position: fixed;
  z-index: 160;
  top: 20px; bottom: 20px;
  left: 50%;
  width: var(--os-w);
  margin-left: calc(var(--os-w) / -2);
  background: var(--os-bg);
  border-radius: var(--os-radius);
  box-shadow: 0 40px 120px rgba(0,0,0,.55), inset 0 0 0 1px rgba(245,242,235,.07);
  overflow: hidden;
  color: var(--ink);
  outline: none;
}
.osheet[hidden] { display: none; }
.os-scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(245,242,235,.18) transparent;
  --os-pt: clamp(72px, 11vh, 120px);
  padding: var(--os-pt) 0 180px;
}
.os-scroll::-webkit-scrollbar { width: 8px; }
.os-scroll::-webkit-scrollbar-thumb { background: rgba(245,242,235,.14); border-radius: 8px; }

/* reading progress: a crimson hairline along the top edge */
.os-progress {
  position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 3;
  background: var(--shu); transform-origin: 0 50%; transform: scaleX(0);
  pointer-events: none;
}

/* close: a round glass button floating at the bottom centre (and Esc) */
.os-close {
  position: absolute; z-index: 4; left: 50%; bottom: 26px;
  width: 52px; height: 52px; margin-left: -26px; border-radius: 50%;
  border: 0; cursor: pointer; appearance: none; -webkit-appearance: none;
  background: rgba(38,38,42,.72);
  -webkit-backdrop-filter: blur(22px) saturate(1.6); backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 0 0 1px rgba(245,242,235,.12), 0 10px 30px rgba(0,0,0,.4);
  display: grid; place-items: center; color: var(--ink);
  transition: transform .35s cubic-bezier(.2,.9,.25,1.3), background .25s;
}
.os-close:hover { transform: scale(1.08); background: rgba(58,58,62,.8); }
.os-close:focus-visible { outline: 2px solid var(--shu-text); outline-offset: 3px; border-radius: 50%; }
.osheet:focus, .osheet:focus-visible { outline: none; border-radius: var(--os-radius); }
.os-close::before, .os-close::after { content: ""; position: absolute; width: 18px; height: 2px; border-radius: 2px; background: currentColor; }
.os-close::before { transform: rotate(45deg); }
.os-close::after { transform: rotate(-45deg); }

/* veil behind the sheet */
.os-veil {
  position: fixed; inset: 0; z-index: 155;
  background: rgba(6,6,7,.62);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  opacity: 0; pointer-events: none;
}
html.os-open .os-veil { pointer-events: auto; }
html.os-open { overflow: hidden; }
html.os-open .depth-dock, html.os-open .motion-toggle, html.os-open .rail { opacity: 0 !important; visibility: hidden !important; }

/* ---------- layout ---------- */
.os-hero, .os-block { width: min(var(--os-col), calc(100% - var(--os-pad) * 2)); margin: 0 auto; }
.os-block { margin-top: clamp(var(--sp-8), 11vh, 120px); }
.os-block--wide { width: calc(100% - var(--os-pad) * 1.2); }
.os-block--full { width: 100%; }

.os-eyebrow {
  font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase;
  color: var(--shu-text); margin: 0 0 var(--sp-4); display: flex; align-items: center; gap: var(--sp-3);
}
.os-eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .8; }
.os-title {
  font-family: var(--display); font-weight: 500; letter-spacing: -.03em; line-height: 1.02;
  font-size: var(--t-h2); margin: 0; max-width: 18ch;
}
.os-h {
  font-family: var(--display); font-weight: 500; letter-spacing: -.025em; line-height: 1.06;
  font-size: var(--t-h3); margin: 0 0 var(--sp-5); max-width: 24ch;
}
.os-h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.02em; font-size: var(--t-h4); margin: 0 0 10px; line-height: 1.2; }
.os-lede, .os-text {
  font-size: var(--t-body); line-height: 1.65; color: var(--os-dim);
  margin: var(--sp-5) 0 0; max-width: var(--measure); font-weight: 400;
}
.os-lede { font-size: var(--t-lede); line-height: 1.55; color: rgba(245,242,235,.58); }
.os-text { margin-top: 0; }
.os-text + .os-text { margin-top: var(--sp-4); }
.os-lede b, .os-text b, .os-lede strong, .os-text strong { font-weight: 500; color: var(--ink); }
.os-small { font-size: var(--t-small); line-height: 1.65; color: var(--gray); }
.os-note { font-size: var(--t-caption); color: var(--gray); letter-spacing: .02em; margin-top: 22px; line-height: 1.6; }

/* A statement that owns the screen for a beat (Apple's "Extreme performance by design.") */
.os-statement {
  font-family: var(--display); font-weight: 500; letter-spacing: -.035em; line-height: 1.02;
  font-size: var(--t-pull); margin: 0; max-width: 22ch;
}
.os-statement em { font-style: normal; color: var(--shu-text); }

/* a faint crimson dawn at the top of every sheet */
.os-scroll::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 520px; pointer-events: none; background: radial-gradient(60% 100% at 50% 0%, rgba(195,21,55,.13), rgba(195,21,55,0) 70%); }
.os-hero, .os-block { position: relative; }

/* ---------- reveal system ---------- */
.osheet [data-os] { transition: opacity .6s cubic-bezier(.2,.8,.2,1), transform .75s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i, 0) * 70ms); }
.osheet.os-motion [data-os]:not(.is-in) { opacity: 0; transform: translate3d(0, 24px, 0); }
.osheet.os-motion [data-os="fade"]:not(.is-in) { transform: none; }
.osheet.os-motion [data-os="scale"]:not(.is-in) { transform: scale(.94); }
.osheet.os-motion [data-os="left"]:not(.is-in) { transform: translate3d(-40px, 0, 0); }
.osheet.os-motion [data-os="right"]:not(.is-in) { transform: translate3d(40px, 0, 0); }
/* children of a stagger group come in one after another */
.osheet.os-motion [data-os-stagger] > * { transition: opacity .55s cubic-bezier(.2,.8,.2,1), transform .7s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i, 0) * 70ms + 80ms); }
.osheet.os-motion [data-os-stagger]:not(.is-in) > * { opacity: 0; transform: translate3d(0, 26px, 0); }

/* highlighted phrases: grey text whose key phrases turn to ink as you arrive */
.osheet.os-motion [data-os="ink"] b, .osheet.os-motion [data-os="ink"] strong { color: var(--os-dim); transition: color .9s ease; transition-delay: calc(var(--k, 0) * 180ms + 200ms); }
.osheet.os-motion [data-os="ink"].is-in b, .osheet.os-motion [data-os="ink"].is-in strong { color: var(--ink); }
.osheet.os-motion [data-os="ink"]:not(.is-in) { transform: none; opacity: 1; }

/* headlines that rise word by word: data-os="words" (split by sheets.js) */
.osheet [data-os="words"] .os-w { display: inline-block; transition: opacity .55s cubic-bezier(.2,.8,.2,1), transform .7s cubic-bezier(.16,1,.3,1), filter .6s; transition-delay: calc(var(--w, 0) * 40ms + 60ms); }
.osheet.os-motion [data-os="words"]:not(.is-in) { opacity: 1; transform: none; }
.osheet.os-motion [data-os="words"]:not(.is-in) .os-w { opacity: 0; transform: translate3d(0, .5em, 0); filter: blur(6px); }

/* SVG strokes that draw themselves: give a path data-draw (pathLength is set by JS) */
.osheet [data-draw] { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s cubic-bezier(.65,0,.35,1); transition-delay: calc(var(--d, 0) * 1ms); }
.osheet.os-motion [data-os]:not(.is-in) [data-draw] { stroke-dashoffset: 1; }
/* elements that pop into place inside a drawn diagram */
.osheet [data-pop] { transition: opacity .6s ease, transform .8s cubic-bezier(.2,1.4,.3,1); transition-delay: calc(var(--d, 0) * 1ms); transform-box: fill-box; transform-origin: center; }
.osheet.os-motion [data-os]:not(.is-in) [data-pop] { opacity: 0; transform: scale(.4); }

/* inside scrub frames, drawing and popping follow the frame being on */
.osheet.os-motion .os-frame:not(.is-on) [data-draw] { stroke-dashoffset: 1; transition-duration: .3s; transition-delay: 0s; }
.osheet.os-motion .os-frame:not(.is-on) [data-pop] { opacity: 0; transform: scale(.4); transition-delay: 0s; }
/* live things (SVG pulses, loops) only run with motion on */
.osheet:not(.os-motion) .os-live { display: none; }

/* ---------- modules ---------- */
/* modules are observed automatically (sheets.js adds data-os="fade" when absent) */

/* stats: big numbers that count up */
.os-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 44px 36px; }
.os-stat { border-top: 1px solid var(--os-line); padding-top: 22px; }
.os-num { font-family: var(--display); font-weight: 500; letter-spacing: -.04em; line-height: .95; font-size: var(--t-stat); display: block; font-variant-numeric: tabular-nums; }
.os-num i { font-style: normal; color: var(--shu-text); }
.os-stat p { margin: 14px 0 0; color: var(--gray); font-size: var(--t-small); line-height: 1.5; max-width: 22ch; }

/* comparison bars (Apple's "M5 compared to…"): each bar grows to --v (0–1) */
.os-bars { display: grid; gap: 34px; }
.os-bargroup h5 { margin: 0 0 14px; font-size: var(--t-small); font-weight: 500; color: var(--ink); }
.os-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 18px; margin-top: 10px; }
.os-bar > span { display: block; height: 8px; border-radius: 8px; background: rgba(245,242,235,.07); overflow: hidden; }
.os-bar > span::before { content: ""; display: block; height: 100%; width: calc(var(--v, .5) * 100%); border-radius: inherit; background: rgba(245,242,235,.34); transform-origin: 0 50%; transition: transform 1.1s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--i, 0) * 120ms + 150ms); }
.os-bar--hi > span::before { background: linear-gradient(90deg, #7a0e24, var(--shu) 55%, #ff5a7c); }
.os-bar small { font-size: var(--t-caption); color: var(--gray); min-width: 12ch; text-align: right; }
.os-bar--hi small { color: var(--ink); }
.osheet.os-motion .os-bars[data-os]:not(.is-in) .os-bar > span::before { transform: scaleX(0); }

/* steps: numbered phases joined by a line that draws, each lighting in turn */
.os-steps { position: relative; display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); gap: 18px; counter-reset: osstep; }
.os-steps::before { content: ""; position: absolute; left: 0; right: 0; top: 23px; height: 1px; background: var(--os-line); }
.os-steps::after { content: ""; position: absolute; left: 0; right: 0; top: 23px; height: 1px; background: var(--shu); transform-origin: 0 50%; transition: transform 1.4s cubic-bezier(.65,0,.35,1) .15s; }
.osheet.os-motion .os-steps[data-os]:not(.is-in)::after { transform: scaleX(0); }
.os-step { position: relative; padding-top: 64px; }
.os-step::before { counter-increment: osstep; content: counter(osstep, decimal-leading-zero); position: absolute; top: 0; left: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: var(--t-caption); letter-spacing: .04em; background: var(--os-bg); box-shadow: inset 0 0 0 1px var(--os-line); color: var(--gray); transition: box-shadow .6s, color .6s, background .6s; transition-delay: calc(var(--i, 0) * 300ms + 200ms); }
.osheet .os-steps.is-in .os-step::before, .osheet:not(.os-motion) .os-step::before { box-shadow: inset 0 0 0 1px var(--shu); color: var(--ink); background: rgba(195,21,55,.14); }
.os-step b { display: block; font-family: var(--display); font-weight: 500; font-size: var(--t-h4); letter-spacing: -.015em; margin-bottom: 8px; }
.os-step p { margin: 0; color: var(--gray); font-size: var(--t-small); line-height: 1.55; }
.os-steps[data-loop] .os-step.is-now::before { box-shadow: inset 0 0 0 1px var(--shu), 0 0 0 7px rgba(195,21,55,.14); background: var(--shu); }

/* list of points with a crimson tick that draws in */
.os-points { display: grid; gap: 0; }
.os-point { display: grid; grid-template-columns: 56px 1fr; gap: 8px 22px; padding: 26px 0; border-top: 1px solid var(--os-line); }
.os-point:last-child { border-bottom: 1px solid var(--os-line); }
.os-point > span { font-size: var(--t-caption); color: var(--shu-text); letter-spacing: .06em; padding-top: 6px; }
.os-point h5 { margin: 0 0 8px; font-family: var(--display); font-weight: 500; font-size: var(--t-h4); letter-spacing: -.015em; }
.os-point p { margin: 0; color: var(--gray); font-size: var(--t-body); line-height: 1.6; max-width: 58ch; }
.os-point p b { color: var(--ink); font-weight: 500; }

/* cards grid */
.os-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.os-card { background: var(--os-card); border-radius: 22px; padding: 28px 26px 30px; box-shadow: inset 0 0 0 1px var(--os-line); position: relative; overflow: hidden; }
.os-card > small { display: block; font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--shu-text); margin-bottom: 16px; }
.os-card h5 { margin: 0 0 10px; font-family: var(--display); font-weight: 500; font-size: var(--t-h4); letter-spacing: -.015em; line-height: 1.2; }
.os-card p { margin: 0; color: var(--gray); font-size: var(--t-small); line-height: 1.6; }

/* a stage: an SVG/HTML diagram in a framed panel */
.os-stage { position: relative; background: radial-gradient(120% 90% at 50% 0%, rgba(245,242,235,.05), rgba(245,242,235,.012) 60%); border-radius: 26px; box-shadow: inset 0 0 0 1px var(--os-line); padding: clamp(14px, 2.4vw, 32px); overflow: hidden; }
.os-stage svg { display: block; width: 100%; height: auto; overflow: visible; }
.os-stage .os-caption { margin-top: 18px; }
.os-caption { font-size: var(--t-caption); color: var(--gray); line-height: 1.6; letter-spacing: .01em; max-width: 64ch; }
.os-svg-text { font-family: var(--sans); fill: var(--gray); letter-spacing: .01em; }
.os-svg-text:not([font-size]) { font-size: 15px; }
.os-svg-strong { font-family: var(--display); fill: var(--ink); font-weight: 500; }

/* sticky scrub: a pinned visual on one side, steps of copy scrolling on the other.
   The active step (the one crossing the middle of the sheet) sets data-step on the stage. */
.os-scrub { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
.os-scrub-stage { position: sticky; top: 12vh; height: 72vh; display: grid; place-items: center; }
.os-scrub-stage > .os-stage { width: 100%; }
.os-scrub-steps { padding: 18vh 0 24vh; }
.os-scrub-step { min-height: 52vh; display: flex; flex-direction: column; justify-content: center; opacity: .28; transition: opacity .6s ease; }
.os-scrub-step.is-active { opacity: 1; }
.os-scrub-step .os-h3 { font-size: var(--t-h3); margin-bottom: var(--sp-3); }
.os-scrub-step p { color: var(--gray); font-size: var(--t-body); line-height: 1.65; margin: 0; max-width: 40ch; }
.os-scrub-step p b { color: var(--ink); font-weight: 500; }
/* frames inside a stage keyed to the active step */
.os-frame { transition: opacity .7s ease, transform .9s cubic-bezier(.16,1,.3,1); }
[data-step] .os-frame:not(.is-on) { opacity: 0; transform: scale(.97); pointer-events: none; }
.os-frames { display: grid; }
.os-frames > .os-frame { grid-area: 1 / 1; }

/* horizontal gallery with snap, arrows and a counter */
.os-gallery { position: relative; }
.os-gallery-track { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px var(--os-pad) 8px; margin: 0 calc(var(--os-pad) * -1); scroll-padding: 0 var(--os-pad); }
.os-gallery-track::-webkit-scrollbar { display: none; }
.os-slide { flex: 0 0 min(78%, 720px); min-width: 0; scroll-snap-align: start; margin: 0; }
.os-slide img { display: block; width: 100%; height: auto; aspect-ratio: var(--ar, 16 / 10); object-fit: cover; object-position: top; border-radius: 20px; background: #141416; box-shadow: inset 0 0 0 1px var(--os-line); cursor: zoom-in; transition: transform .8s cubic-bezier(.16,1,.3,1), opacity .6s; }
.os-slide figcaption { margin-top: 14px; font-size: var(--t-small); color: var(--gray); line-height: 1.55; max-width: 52ch; }
.os-slide figcaption b { color: var(--ink); font-weight: 500; }
.os-slide:not(.is-near) img { opacity: .55; transform: scale(.965); }
.os-gallery-nav { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.os-gallery-nav button { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(245,242,235,.07); color: var(--ink); cursor: pointer; display: grid; place-items: center; transition: background .25s, opacity .25s; }
.os-gallery-nav button:hover { background: rgba(245,242,235,.14); }
.os-gallery-nav button:disabled { opacity: .3; cursor: default; }
.os-gallery-nav button svg { width: 14px; height: 14px; }
.os-gallery-count { font-size: var(--t-caption); color: var(--gray); font-variant-numeric: tabular-nums; letter-spacing: .06em; }

/* a figure that eases in and settles (slow push) */
.os-figure { margin: 0; }
.os-figure img, .os-figure video { display: block; width: 100%; height: auto; border-radius: 22px; box-shadow: inset 0 0 0 1px var(--os-line); background: #141416; cursor: zoom-in; }
.osheet.os-motion .os-figure[data-os] img { transition: transform 1.4s cubic-bezier(.16,1,.3,1); }
.osheet.os-motion .os-figure[data-os]:not(.is-in) img { transform: scale(1.06); }
.os-figure figcaption { margin-top: 14px; font-size: var(--t-caption); color: var(--gray); line-height: 1.6; }

/* before / after columns with a divider that grows */
.os-compare { display: grid; grid-template-columns: 1fr 1px 1fr; gap: clamp(22px, 4vw, 52px); align-items: start; }
.os-compare > i { display: block; width: 1px; align-self: stretch; background: linear-gradient(var(--os-line), var(--shu), var(--os-line)); transform-origin: 50% 0; transition: transform 1s cubic-bezier(.65,0,.35,1) .15s; }
.osheet.os-motion .os-compare[data-os]:not(.is-in) > i { transform: scaleY(0); }
.os-compare h5 { margin: 0 0 16px; font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--gray); font-weight: 500; }
.os-compare > div:last-child h5 { color: var(--shu-text); }
.os-compare ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.os-compare li { font-size: var(--t-body); line-height: 1.5; color: var(--gray); padding-left: 22px; position: relative; }
.os-compare li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 1px; background: currentColor; }
.os-compare > div:last-child li { color: var(--ink); }
.os-compare > div:last-child li::before { background: var(--shu); }

/* quote */
.os-quote { margin: 0; }
.os-quote blockquote { margin: 0; font-family: var(--display); font-weight: 500; letter-spacing: -.025em; line-height: 1.2; font-size: var(--t-pull); max-width: 26ch; }
.os-quote blockquote::before { content: "\201C"; color: var(--shu-text); }
.os-quote blockquote::after { content: "\201D"; color: var(--shu-text); }
.os-quote figcaption { margin-top: 20px; font-size: var(--t-caption); letter-spacing: .12em; text-transform: uppercase; color: var(--gray); }

/* glossary: search + letter rail + terms that filter live */
.os-gloss-tools { position: sticky; top: calc(-1px - var(--os-pt, 0px)); z-index: 2; padding: 16px 0 18px; background: var(--os-bg); box-shadow: 0 18px 24px -8px var(--os-bg); display: grid; gap: 14px; }
.os-gloss { padding-bottom: 40px; }
.os-gloss-search { width: 100%; font: inherit; font-size: var(--t-body); color: var(--ink); background: rgba(245,242,235,.05); border: 0; box-shadow: inset 0 0 0 1px var(--os-line); border-radius: 14px; padding: 14px 18px 14px 46px; outline: none; transition: box-shadow .25s; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8A85' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-size: 18px; background-position: 16px 50%; }
.os-gloss-search:focus { box-shadow: inset 0 0 0 1px var(--shu); }
.os-gloss-letters { display: flex; flex-wrap: wrap; gap: 4px; }
.os-gloss-letters button { font: inherit; font-size: var(--t-caption); min-width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; color: var(--gray); cursor: pointer; transition: background .2s, color .2s; }
.os-gloss-letters button:hover, .os-gloss-letters button.is-on { background: rgba(195,21,55,.18); color: var(--ink); }
.os-gloss-letters button:disabled { opacity: .25; cursor: default; background: none; }
.os-gloss { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 44px; }
.os-term { padding: 22px 0; border-top: 1px solid var(--os-line); transition: opacity .35s, transform .45s cubic-bezier(.16,1,.3,1); }
.os-term dt { font-family: var(--display); font-weight: 500; font-size: var(--t-h4); letter-spacing: -.015em; margin-bottom: 8px; }
.os-term dd { margin: 0; color: var(--gray); font-size: var(--t-small); line-height: 1.6; }
.os-term dd em { font-style: normal; color: var(--shu-text); font-size: var(--t-caption); letter-spacing: .04em; display: block; margin-bottom: 4px; }
.os-term.is-hidden { display: none; }
.os-gloss-empty { color: var(--gray); font-size: var(--t-small); padding: 20px 0; display: none; }

/* closing line + optional link back into the page */
.os-end { text-align: center; }
.os-end .os-statement { margin: 0 auto; }
.os-end .os-note { margin-left: auto; margin-right: auto; max-width: 52ch; }

/* ---------- the "+" pill: plus turns as the sheet opens ---------- */
.glass-pill .plus { transition: transform .5s cubic-bezier(.2,.9,.25,1.3); }
.glass-pill:hover .plus { transform: rotate(90deg); }
.glass-pill[aria-expanded="true"] .plus { transform: rotate(45deg); }

/* ---------- small screens: a full-height sheet ---------- */
@media (max-width: 760px) {
  .osheet { --os-w: 100vw; --os-pad: 22px; --os-radius: 22px; top: 10px; bottom: 0; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .os-scroll { --os-pt: 64px; padding-bottom: 140px; }
  .os-block { margin-top: 88px; }
  .os-steps { grid-template-columns: 1fr; gap: 26px; }
  .os-steps::before, .os-steps::after { left: 23px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .os-steps::after { transform-origin: 50% 0; }
  .osheet.os-motion .os-steps[data-os]:not(.is-in)::after { transform: scaleY(0); }
  .os-step { padding: 8px 0 0 70px; min-height: 46px; }
  .os-scrub { grid-template-columns: 1fr; }
  .os-scrub-stage { top: 0; height: auto; z-index: 1; background: var(--os-bg); padding: 10px 0 14px; }
  .os-scrub-steps { padding: 4vh 0 10vh; }
  .os-scrub-step { min-height: 44vh; }
  .os-compare { grid-template-columns: 1fr; }
  .os-compare > i { width: auto; height: 1px; transform-origin: 0 50%; }
  .os-gloss { grid-template-columns: 1fr; }
  .os-slide { flex-basis: 86%; }
  .os-point { grid-template-columns: 38px 1fr; }
  .os-close { bottom: 20px; }
}

/* ---------- reduced motion / pause: everything present, nothing moves ---------- */
@media (prefers-reduced-motion: reduce) {
  .osheet [data-os], .osheet [data-os-stagger] > *, .osheet [data-draw], .osheet [data-pop], .os-bar > span::before, .os-steps::after, .os-compare > i { transition: none !important; }
}

/* v0.215 glass motion: the close button arrives like every glass pill on the
   site (a dot rises and grows on a spring, a crimson bloom, then the cross
   pops in). Uses the individual translate/scale properties so the hover
   transform still works. */
.osheet.os-motion[aria-hidden="false"] .os-close {
  animation: osCloseRise .68s var(--gm-spring, cubic-bezier(.3,1.25,.5,1)) .22s both, osCloseBloom .6s linear .3s both;
}
.osheet.os-motion[aria-hidden="false"] .os-close::before,
.osheet.os-motion[aria-hidden="false"] .os-close::after { animation: osClosePop .36s var(--gm-pop, cubic-bezier(.3,1.6,.5,1)) .78s both; }
@keyframes osCloseRise { from { translate: 0 90px; scale: .01; } to { translate: 0 0; scale: 1; } }
@keyframes osClosePop { from { scale: 0; } to { scale: 1; } }
@keyframes osCloseBloom {
  0%   { box-shadow: inset 0 0 0 1px rgba(245,242,235,.12), 0 10px 30px rgba(0,0,0,.4), 0 0 0 0 rgba(195,21,55,0); animation-timing-function: var(--gm-soft, ease-out); }
  57%  { box-shadow: inset 0 0 0 1px rgba(245,242,235,.12), 0 10px 30px rgba(0,0,0,.4), 0 0 0 20px rgba(195,21,55,.38); animation-timing-function: var(--gm-exit, ease-in); }
  100% { box-shadow: inset 0 0 0 1px rgba(245,242,235,.12), 0 10px 30px rgba(0,0,0,.4), 0 0 0 0 rgba(195,21,55,0); }
}
.os-scroll:focus-visible { outline: 2px solid var(--shu-text, #F7225B); outline-offset: -4px; }

/* ---------- v0.227: a tighter close ----------
   The closing statement used to sit a full section gap (up to 120px) below
   the last content, plus whatever padding that section carried (a scrub's
   24vh tail, the glossary's list padding), and 180px of empty scroll ran
   on under it. It now sits one step closer, and the scroll ends just above
   the close button. */
.os-scroll { padding-bottom: 128px; }
.os-block.os-end { margin-top: clamp(56px, 8vh, 80px); }
.os-gloss { padding-bottom: 0; }
.os-block:has(+ .os-end) .os-scrub-steps { padding-bottom: 4vh; }
@media (max-width: 760px) {
  .os-scroll { padding-bottom: 112px; }
  .os-block.os-end { margin-top: 56px; }
  .os-block:has(+ .os-end) .os-scrub-steps { padding-bottom: 2vh; }
}
/* a scrub that closes the sheet: its last step sits on its text, so the
   closing line follows it instead of half a screen of empty step */
.os-block:has(+ .os-end) .os-scrub-step:last-child { min-height: 0; padding-top: 14vh; }
@media (max-width: 760px) { .os-block:has(+ .os-end) .os-scrub-step:last-child { padding-top: 8vh; } }
