/* ReFrame case study: scroll-driven system map plus page-specific blocks.
   Ported from the October 8 motion story onto the v6 tokens. The steps carry all the
   content; the stage is a visual aid and is hidden from assistive tech. */

.story { background: var(--cool-white); color: var(--ink); padding: clamp(72px, 9vw, 120px) 0 clamp(40px, 6vw, 80px); }
.story__grid { width: var(--wrap); margin: 0 auto; display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.story__steps { list-style: none; margin: 0; padding: 2vh 0 12vh; }
.story__step { min-height: 72vh; display: flex; flex-direction: column; justify-content: center; transition: opacity .45s ease; }
.story.is-live .story__step { opacity: .3; }
.story.is-live .story__step.is-active { opacity: 1; }
.story__step .eyebrow { color: var(--forest); }
.story__step h3 { font: 800 clamp(1.5rem, 2.4vw, 2rem)/1.15 var(--display); letter-spacing: -.005em; margin: 10px 0 14px; }
.story__step p { color: var(--ink-2); max-width: 500px; margin: 0; }
.story__chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.story__chips li { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--mint-deep); font-size: .82rem; font-weight: 700; color: var(--forest); background: var(--paper); }
.story__chips li b { color: var(--ink); }

.story__stagewrap { position: sticky; top: calc(var(--header-h) + 24px); }
.smap { position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--forest-black); color: var(--cool-white); box-shadow: var(--shadow); }
.smap::before { content: ''; position: absolute; inset: 0; background-image: linear-gradient(rgba(198, 242, 78, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(198, 242, 78, .05) 1px, transparent 1px); background-size: 28px 28px; }
.smap__svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.smap__ring { fill: none; stroke: rgba(198, 242, 78, .16); stroke-width: .2; stroke-dasharray: .7 1.2; }
.smap__ln { stroke: rgba(244, 247, 248, .2); stroke-width: .24; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset .9s ease, stroke .35s ease, opacity .35s ease; }
.smap__pl { fill: none; stroke: var(--lime); stroke-width: .7; stroke-linecap: round; stroke-dasharray: 4 96; stroke-dashoffset: 4; opacity: 0; }
@keyframes smapOut { from { stroke-dashoffset: 4; } to { stroke-dashoffset: -96; } }
@keyframes smapIn { from { stroke-dashoffset: -96; } to { stroke-dashoffset: 4; } }

.smap__node { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 5px; pointer-events: none; z-index: 2; transition: opacity .45s ease, transform .55s cubic-bezier(.2, 1.4, .4, 1), filter .35s ease; }
.smap__node .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(198, 242, 78, .18); }
.smap__node .lbl { font: 700 .74rem/1.05 var(--display); letter-spacing: .08em; white-space: nowrap; text-align: center; color: var(--cool-white); text-shadow: 0 1px 6px var(--forest-black); }
.smap__node .chip { display: block; padding: 6px 10px; border-radius: 9px; background: var(--cool-white); color: var(--forest-deep); font: 700 .8rem/1 var(--display); letter-spacing: .04em; white-space: nowrap; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
.smap__core { position: absolute; left: 50%; top: 50%; width: 26%; aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-content: center; justify-items: center; gap: 6px; border-radius: 18px; background: var(--forest); border: 2px solid var(--lime); box-shadow: 0 0 0 10px rgba(198, 242, 78, .07), 0 0 60px rgba(198, 242, 78, .22); z-index: 3; text-align: center; padding: 8px; }
.smap__core img { width: 78%; height: auto; }
.smap__core b { font: 700 clamp(.62rem, 1.15vw, .8rem)/1 var(--display); letter-spacing: .14em; color: var(--lime); }
.smap__foot { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; font: 700 .72rem/1 var(--display); letter-spacing: .14em; color: rgba(244, 247, 248, .65); z-index: 4; }
.smap__foot i { display: inline-block; width: 14px; height: 3px; margin-left: 4px; border-radius: 2px; background: rgba(244, 247, 248, .2); transition: background .3s ease; }
.smap__foot i.on { background: var(--lime); }
.smap__foot [data-stage-label] { color: var(--lime); }

/* Live states driven by data-stage. Stage 1 is the people; later stages light their nodes. */
.story.is-live .smap__node { opacity: 0; transform: translate(-50%, -50%) scale(.6); transition-delay: var(--d, 0ms); }
.story.is-live .smap__ln { stroke-dashoffset: 100; transition-delay: var(--d, 0ms); }
.story.is-live .smap:not([data-stage="0"]) .smap__node.person,
.story.is-live .smap:not([data-stage="0"]):not([data-stage="1"]) .smap__node.tool { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.story.is-live .smap:not([data-stage="0"]) .smap__ln.person,
.story.is-live .smap:not([data-stage="0"]):not([data-stage="1"]) .smap__ln.tool { stroke-dashoffset: 0; }
.story.is-live .smap[data-stage="1"] .smap__pl.person { opacity: 1; animation: smapIn 2.4s linear 3; animation-delay: var(--pd, 0ms); }
.story.is-live .smap:not([data-stage="0"]):not([data-stage="1"]):not([data-stage="last"]) .smap__node:not(.hot) { opacity: .18; filter: grayscale(1); transition-delay: 0ms; }
.story.is-live .smap:not([data-stage="0"]):not([data-stage="1"]):not([data-stage="last"]) .smap__ln:not(.hot) { opacity: .2; transition-delay: 0ms; }
.story.is-live .smap .smap__node.hot { transform: translate(-50%, -50%) scale(1.12); }
.story.is-live .smap .smap__node.tool.hot .chip { background: var(--lime); }
.story.is-live .smap .smap__ln.hot { stroke: rgba(244, 247, 248, .65); }
.story.is-live .smap .smap__pl.hot { opacity: 1; animation: smapOut 1.8s linear 3; animation-delay: var(--pd, 0ms); }
.story.is-live .smap .smap__pl.hot.inbound { animation-name: smapIn; }

@media (max-width: 900px) {
  .story__grid { grid-template-columns: 1fr; gap: 0; }
  .story__stagewrap { order: -1; top: calc(var(--header-h) - 4px); z-index: 5; padding: 8px 0 14px; background: linear-gradient(to bottom, var(--cool-white) 88%, rgba(244, 247, 248, 0)); }
  .smap { width: min(100%, 44vh); margin: 0 auto; }
  .story__step { min-height: 62vh; justify-content: flex-start; padding-top: 4vh; }
  .story.is-static .story__step { min-height: 0; padding: 28px 0; }
}
@media (max-width: 640px) {
  .smap__node .chip { font-size: .58rem; padding: 4px 6px; border-radius: 6px; }
  .smap__node .lbl { font-size: .56rem; }
  .smap__node .dot { width: 8px; height: 8px; box-shadow: 0 0 0 3px rgba(198, 242, 78, .18); }
  .smap__foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .smap__pl { display: none; }
}

/* Lockup + stats strip */
.rf-lockup { display: flex; align-items: center; gap: 16px; margin: 0 0 20px; flex-wrap: wrap; }
.rf-lockup img { height: 34px; width: auto; }
.rf-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-top: 44px; border-top: 1px solid rgba(244, 247, 248, .16); }
.rf-stats > div { padding: 22px 18px 6px 0; display: grid; gap: 6px; }
.rf-stats b { font: 700 clamp(2.4rem, 4.4vw, 3.6rem)/1 var(--display); color: var(--lime); }
.rf-stats span { color: var(--steel-light); font-size: .9rem; line-height: 1.4; }
@media (max-width: 760px) { .rf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Stack ledger: every connected service with its job */
.rf-stack { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.rf-stack li { padding: 18px 18px 16px; border-radius: var(--radius-sm); background: var(--paper); border: 1px solid rgba(21, 26, 22, .1); display: grid; gap: 6px; }
.rf-stack b { font: 700 1.25rem/1 var(--display); letter-spacing: .02em; color: var(--forest-deep); }
.rf-stack span { font-size: .92rem; color: var(--ink-2); line-height: 1.45; }
.rf-stack small { font: 700 .7rem/1 var(--display); letter-spacing: .14em; color: var(--steel); }

/* Delivery loop */
.rf-loop { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: loop; }
.rf-loop li { counter-increment: loop; position: relative; padding: 16px 18px 16px 64px; border-radius: var(--radius-sm); background: var(--paper); border: 1px solid rgba(21, 26, 22, .1); display: grid; gap: 2px; }
.rf-loop li::before { content: counter(loop, decimal-leading-zero); position: absolute; left: 18px; top: 15px; font: 800 1.3rem/1 var(--display); color: var(--forest); }
.rf-loop li.gate { background: var(--lime); border-color: var(--forest-deep); }
.rf-loop b { font: 700 1.2rem/1.1 var(--display); }
.rf-loop span { font-size: .92rem; color: var(--ink-2); }

/* Timeline */
.rf-time { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .rf-time { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .rf-time { grid-template-columns: 1fr; } }
.rf-time li { padding: 22px; border-radius: var(--radius); border: 1px solid rgba(244, 247, 248, .14); background: rgba(244, 247, 248, .03); display: grid; gap: 8px; align-content: start; }
.rf-time time { font: 700 .8rem/1 var(--display); letter-spacing: .16em; color: var(--lime); }
.rf-time b { font: 700 1.5rem/1.05 var(--display); }
.rf-time p { margin: 0; color: var(--steel-light); font-size: .94rem; }
