/* Anchor (Kellton) — bespoke motion and layout inside its story sheets.
   Loaded after sheets.css. Every animation here is transform / opacity /
   stroke-dashoffset only, and every one resolves to its final state without
   .os-motion (reduced motion or Pause Motion). */

/* ---------- SVG type, in viewBox units (scaled with the diagram) ---------- */
.osheet .an-t  { font-family: var(--sans); fill: var(--gray); font-size: 19px; letter-spacing: .005em; }
.osheet .an-sm { font-size: 16px; }
.osheet .an-ts { font-family: var(--sans); fill: var(--gray); font-size: 13px; letter-spacing: .1em; }
.osheet .an-tb { font-family: var(--display); fill: var(--ink); font-weight: 500; font-size: 22px; letter-spacing: -.01em; }
.osheet .an-tn { font-family: var(--display); fill: var(--ink); font-weight: 500; font-size: 36px; letter-spacing: -.03em; }
.osheet .an-ink { fill: var(--ink); }
.osheet .an-hot, .osheet .an-hotl { fill: var(--shu-text); }

/* ---------- product frames (live HTML documents) inside a sheet ---------- */
.osheet .anc-shot { border-radius: 16px; }
.an-gallery .os-slide .anc-shot { transition: transform .8s cubic-bezier(.16,1,.3,1), opacity .6s ease; }
.an-gallery .os-slide:not(.is-near) .anc-shot { opacity: .55; transform: scale(.965); }
.an-gallery .os-slide figcaption { margin-top: 14px; }
.an-kind { display: block; font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; color: var(--shu-text); margin-bottom: 6px; }

.an-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.an-pair figure, .an-figure { margin: 0; }
.an-pair figcaption, .an-figure figcaption { margin-top: 14px; font-size: var(--t-small); color: var(--gray); line-height: 1.55; max-width: 52ch; }
.an-pair figcaption b, .an-figure figcaption b { color: var(--ink); font-weight: 500; }

/* ---------- frame-level moves: start displaced, settle when the frame is on ---------- */
.an-fmv, .an-col, .an-widen, .an-drop { transform-box: fill-box; transform-origin: center; }
.osheet.os-motion .an-fmv {
  transform: translate(var(--x0, 0px), var(--y0, 0px)) rotate(var(--r0, 0deg)); opacity: .35;
  transition: transform 1.3s cubic-bezier(.16,1,.3,1), opacity .8s ease; transition-delay: calc(var(--d, 0) * 1ms);
}
.osheet.os-motion .os-frame.is-on .an-fmv { transform: none; opacity: 1; }

/* reasons collapsing into one score (the direction that lost) */
.osheet .an-col { transition: transform 1.1s cubic-bezier(.65,0,.35,1); transition-delay: calc(var(--d, 0) * 1ms); }
.osheet:not(.os-motion) .an-col, .osheet .os-frame.is-on .an-col { transform: translateX(var(--x1, 0px)); }
/* a band that widens when a citation is rejected */
.osheet .an-widen { transition: transform 1.2s cubic-bezier(.16,1,.3,1); transition-delay: calc(var(--d, 0) * 1ms); }
.osheet:not(.os-motion) .an-widen, .osheet .os-frame.is-on .an-widen { transform: scaleX(1.45); }
/* risk flags that fall out of the template */
.osheet .an-drop { transition: transform 1s cubic-bezier(.5,0,.75,0), opacity .8s ease; transition-delay: calc(var(--d, 0) * 1ms); }
.osheet:not(.os-motion) .an-drop, .osheet .os-frame.is-on .an-drop { transform: translate(34px, 26px); opacity: 0; }

/* ---------- the page budget ---------- */
.an-budget { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, .8fr); gap: clamp(20px, 3vw, 40px); align-items: center; }
.an-budget-read p, .an-band-read p, .an-forty-read p, .an-reach-read p { margin: 12px 0 0; color: var(--gray); font-size: var(--t-small); line-height: 1.55; max-width: 30ch; }
.an-budget-read p b, .an-forty-read p b { color: var(--ink); font-weight: 500; }
.an-fill { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .7s cubic-bezier(.2,.8,.2,1); transition-delay: calc(var(--d, 0) * 1ms); }
.osheet.os-motion [data-os]:not(.is-in) .an-fill { transform: scaleY(0); }
.osheet.os-motion .is-in .an-refuse { animation: an-refuse 1.6s cubic-bezier(.2,.8,.2,1) 1.5s both; }
@keyframes an-refuse {
  0%   { transform: translateX(46px); opacity: 0; }
  45%  { transform: translateX(-4px); opacity: 1; }
  62%  { transform: translateX(14px); }
  78%  { transform: translateX(2px); }
  100% { transform: none; opacity: 1; }
}

/* ---------- the estimate band narrows ---------- */
.an-band-read { display: flex; align-items: flex-end; gap: 22px; flex-wrap: wrap; margin-bottom: 18px; }
.an-band-read p { margin: 0 0 10px; }
.an-band { transform-box: fill-box; transform-origin: center; transform: scaleX(.3235); transition: transform 2.4s cubic-bezier(.65,0,.35,1) .2s; }
.osheet.os-motion [data-os]:not(.is-in) .an-band { transform: none; }

/* ---------- forty uses ---------- */
.an-forty { display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.6fr); gap: clamp(20px, 3vw, 44px); align-items: center; }

/* ---------- reach: 36 of 180, then all 180 ---------- */
.an-reach-read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin-bottom: 26px; }
.an-reach svg { margin-bottom: 18px; }
.an-lit { transition: opacity .5s ease; transition-delay: calc(var(--d, 0) * 1ms); }
.osheet.os-motion [data-os]:not(.is-in) .an-lit { opacity: 0; }
.an-reach .os-caption b { color: var(--ink); font-weight: 500; }

/* a second model sweeping the page */
.osheet.os-motion .an-scan { animation: an-scan 3.2s ease-in-out infinite alternate; }
@keyframes an-scan { from { transform: translateY(60px); } to { transform: translateY(270px); } }

/* ---------- 6,800 × $150 = ≈$1.0M ---------- */
.an-sum { display: flex; align-items: flex-start; gap: 10px 26px; flex-wrap: wrap; }
.an-sum > div { border-top: 1px solid var(--os-line); padding-top: 20px; min-width: 0; }
.an-sum .os-num { font-size: var(--t-stat); }
.an-sum > i { font-style: normal; font-family: var(--display); font-size: var(--t-stat); line-height: 1; color: var(--gray); padding-top: 20px; }
.an-sum p { margin: 12px 0 0; color: var(--gray); font-size: var(--t-small); line-height: 1.5; max-width: 20ch; }
.an-sum-hot { border-top-color: var(--shu) !important; }

/* ---------- range: a rail from research to production that follows the gallery ---------- */
.an-rail { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; margin-bottom: 18px; }
.an-rail > span { font-size: var(--t-label); letter-spacing: .16em; text-transform: uppercase; color: var(--gray); }
.an-rail-track { position: relative; height: 1px; background: var(--os-line); }
.an-rail-fill { position: absolute; inset: 0; background: var(--shu); transform-origin: 0 50%; transform: scaleX(calc(var(--at, 0) / (var(--n, 8) - 1))); transition: transform .9s cubic-bezier(.16,1,.3,1); }
.an-rail-track b { position: absolute; top: 50%; left: calc(var(--k) / (var(--n) - 1) * 100%); width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--os-bg); box-shadow: inset 0 0 0 1px rgba(245,242,235,.35); transition: transform .6s cubic-bezier(.2,1.4,.3,1), background .4s, box-shadow .4s; }
.an-rail-track b.is-past { box-shadow: inset 0 0 0 1px var(--shu); }
.an-rail-track b.is-on { background: var(--shu); box-shadow: 0 0 0 6px rgba(195,21,55,.18); transform: scale(1.25); }
.osheet.os-motion .an-rail:not(.is-in) .an-rail-track b { transform: scale(0); }
.an-rail-track b { transition-delay: calc(var(--k) * 70ms); }
.an-rail-now { min-height: 1.6em; margin: 0 0 22px; font-size: var(--t-small); color: var(--ink); }
.an-rail-now em { font-style: normal; color: var(--shu-text); font-size: var(--t-label); letter-spacing: .14em; text-transform: uppercase; margin-right: 12px; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .an-pair { grid-template-columns: minmax(0, 1fr); }
  .an-budget, .an-forty { grid-template-columns: 1fr; }
  .an-reach-read { grid-template-columns: 1fr; gap: 18px; }
  .an-sum { flex-direction: column; gap: 6px; }
  .an-sum > i { padding-top: 0; }
  .an-rail { gap: 10px; }
  .osheet .an-ts { font-size: 15px; }
  .osheet .an-sm { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .an-fmv, .an-col, .an-widen, .an-drop, .an-fill, .an-band, .an-lit, .an-rail-fill, .an-rail-track b, .an-gallery .os-slide .anc-shot { transition: none !important; }
}

/* =====================================================================
   In the page: the compact decision list that replaced the long ledger
   ===================================================================== */
.an-dlist { list-style: none; margin: 44px 0 0; padding: 0; counter-reset: andl; max-width: 980px; }
.an-dlist li { counter-increment: andl; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 8px 22px; align-items: baseline; padding: 20px 0; border-top: 1px solid rgba(245,242,235,.1); }
.an-dlist li:last-child { border-bottom: 1px solid rgba(245,242,235,.1); }
.an-dlist li::before { content: counter(andl, decimal-leading-zero); font-size: var(--t-caption); letter-spacing: .08em; color: var(--shu-text); }
.an-dlist b { font-family: var(--display); font-weight: 500; font-size: var(--t-h4); letter-spacing: -.015em; color: var(--ink); line-height: 1.25; }
.an-dlist em { font-style: normal; font-size: var(--t-small); color: var(--gray); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 760px) {
  .an-dlist li { grid-template-columns: 38px minmax(0, 1fr); }
  .an-dlist em { grid-column: 2; text-align: left; }
}

/* In the page: the short routing summary that replaced the routing panel and failure cards */
.case-anchor .ai-more { width: min(1280px, 84vw); margin: 64px auto 0; text-align: center; }
.ai-more .lede { max-width: 62ch; margin: 0 auto; color: var(--gray); font-size: var(--t-body); line-height: 1.75; }
.ai-more .lede b { color: var(--ink); font-weight: 500; }
.ai-more .pill-row { margin-top: 32px; }

/* frames in a gallery are cropped to one height so the row reads as a set;
   the full document opens in the viewer */
.an-gallery .os-slide .anc-shot { max-height: min(58vh, 460px); }

/* The glossary's sticky search: Chromium measures sticky offsets inside the
   scroll container's padding, so top:-1px parked it ~120px down with terms
   showing above it. Pull it up by the sheet's top padding, and make it opaque. */
.osheet .os-gloss-tools { top: calc(-1 * clamp(72px, 11vh, 120px) - 1px); padding-top: 18px; background: linear-gradient(var(--os-bg) 86%, rgba(12,12,14,0)); }
@media (max-width: 760px) { .osheet .os-gloss-tools { top: -65px; } }
.an-cards2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) { .an-cards2 { grid-template-columns: 1fr; } }

/* a diagram drawn twice: landscape on wide screens, portrait on phones */
.osheet .an-port { display: none !important; }
@media (max-width: 760px) {
  .osheet .an-land { display: none !important; }
  .osheet .an-port { display: block !important; }
}
@media (max-width: 760px) {
  .osheet .os-gloss-letters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
  .osheet .os-gloss-letters::-webkit-scrollbar { display: none; }
  .osheet .os-gloss-letters button { flex: none; }
}

/* a slide is a flex item: without min-width:0 the 1440px frame document
   inside it (scaled by transform, which does not shrink layout) widens it */
.an-gallery .os-slide { min-width: 0; }
.an-gallery .os-slide .anc-shot { width: 100%; }
/* the two wide charts keep their labels legible when scaled down to a phone */
@media (max-width: 760px) {
  .osheet .an-chart .an-t { font-size: 25px; }
  .osheet .an-chart .an-ts { font-size: 21px; }
  .osheet .an-chart .an-tb { font-size: 30px; }
}
.an-pair > figure, .an-figure { min-width: 0; }
