/* Option 2 "Depth" - service page: the beats layer (ordered steps, stage index, captions, chip).
   Static document styles come first; html.o2-gl adds what the immersive play needs. */

/* ---------- ordered steps list (one per beat; current + done marked at runtime) ---------- */
.o2-steps { list-style: none; margin: 20px 0 4px; padding: 0; }
.o2-step { border-top: 1px solid var(--line); }
.o2-step:last-child { border-bottom: 1px solid var(--line); }
.o2-step-btn { position: relative; display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 11px 0 11px 15px; background: none; border: 0; text-align: left; color: var(--muted); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.o2-step-btn::before { content: ""; position: absolute; left: 0; top: 13px; bottom: 13px; width: 2px; background: transparent; transition: background .2s ease, top .2s ease, bottom .2s ease; }
.o2-step-n { font-family: var(--mono); font-size: var(--o2-fs); letter-spacing: .14em; color: var(--dim); padding-top: 2px; min-width: 2em; }
.o2-step-t { flex: 1; font-size: .98rem; line-height: 1.5; color: var(--muted); }
.o2-step-c { font-family: var(--mono); font-size: calc(var(--o2-fs) - .01rem); white-space: nowrap; padding-top: 3px; color: var(--acc); }
.o2-step-out { display: table; margin-top: 6px; padding: 1px 7px; font-family: var(--mono); font-size: calc(var(--o2-fs) - .03rem); letter-spacing: .02em; line-height: 1.5; color: var(--acc); border: 1px solid color-mix(in oklab, var(--acc) 45%, transparent); border-radius: 2px; }
.o2-step-out::before { content: "\2192\00a0"; }
/* identifiers stay, compact: the label sits inline and the codes flow on the full width */
.o2-sp .o2-codes { margin-top: 14px; line-height: 1.6; }
.o2-sp .o2-codes .o2-wk { min-width: 0; margin-right: 10px; }
.o2-sp .o2-codes code { margin-right: 6px; }
/* opt14: the steps follow the loop; they are not controls */
.o2-step-btn { cursor: default; -webkit-tap-highlight-color: transparent; }
.o2-step-btn:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.o2-step.done .o2-step-t { color: var(--dim); }
.o2-step.done .o2-step-n { color: var(--acc); }
.o2-step.cur .o2-step-btn::before { background: var(--acc); top: 8px; bottom: 8px; }
.o2-step.cur .o2-step-t { color: var(--text); }
.o2-step.cur .o2-step-n { color: var(--acc); }

/* ---------- stage index (01..0N): a fast jump to any stage ---------- */
.o2-sindex { display: none; }
.o2-si-t { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.o2-gl .o2-sp .o2-sindex { display: block; position: fixed; right: 16px; top: 50%; transform: translateY(-50%); z-index: 6; }
.o2-sindex ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.o2-sindex a { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 44px; min-width: 46px; font-family: var(--mono); font-size: var(--o2-fs); letter-spacing: .1em; color: var(--dim); text-decoration: none; }
.o2-sindex a::after { content: ""; display: block; width: 10px; height: 1px; background: currentColor; transition: width .2s ease; }
.o2-sindex a.cur { color: var(--acc); }
.o2-sindex a.cur::after { width: 22px; }
.o2-sindex a:focus-visible { outline: 2px solid var(--acc); outline-offset: 4px; }
@media (hover: hover) { .o2-sindex a:hover { color: var(--text); } }

/* ---------- captions (beat text at a system) and the deliver artefact chip ---------- */
.o2-caproot { position: absolute; inset: 0; pointer-events: none; }
.o2-cap { position: absolute; left: 0; top: 0; max-width: min(320px, 46vw); padding: 7px 11px 8px 12px; background: rgba(var(--sky-rgb), .9); border: 1px solid var(--line); border-left: 2px solid var(--acc); will-change: transform, opacity; }
.o2-cap .t { display: block; font-family: var(--sans); font-size: .9rem; line-height: 1.42; color: var(--text); letter-spacing: 0; white-space: normal; }
.o2-cap code { display: inline-block; margin-top: 4px; font-family: var(--mono); font-size: calc(var(--o2-fs) - .01rem); letter-spacing: .02em; color: var(--acc); }
.o2-cap[data-k="flag"] { border-left-style: double; border-left-width: 4px; }
.o2-cap[data-k="decide"] { border-left-style: dashed; }
.o2-chip { position: absolute; left: 0; top: 0; display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--acc); color: var(--sky); font-family: var(--mono); font-size: var(--o2-fs); letter-spacing: .02em; white-space: nowrap; border-radius: 2px; will-change: transform, opacity; }
.o2-chip i { position: relative; width: 14px; height: 1px; background: currentColor; }
.o2-chip i::after { content: ""; position: absolute; right: -1px; top: -3px; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-top: 1.5px solid currentColor; transform: rotate(45deg); }

/* ---------- phone: captions legible, stage index as a bottom strip ---------- */
@media (max-aspect-ratio: 9/10) {
  .o2-cap { max-width: calc(100vw - 28px); background: rgba(var(--sky-rgb), .94); }
  .o2-cap .t { font-size: .95rem; }
  .o2-gl .o2-sp .o2-sindex { top: auto; right: 0; left: 0; bottom: 0; transform: none; background: var(--sky); border-top: 1px solid var(--line); }
  :root.o2-gl[data-o2="service"] body { padding-bottom: var(--o2-ixh, calc(54px + env(safe-area-inset-bottom))); }
  .o2-sindex ol { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 0; padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
  .o2-sindex a { min-width: 44px; min-height: 44px; justify-content: center; gap: 0; }
  .o2-sindex a::after { display: none; }
  .o2-sindex a.cur { text-decoration: underline; text-underline-offset: 4px; }
}

/* ---------- reduced motion: no autoplay; every stage shows its final state and all steps ---------- */
@media (prefers-reduced-motion: reduce) {
  .o2-step-btn::before, .o2-sindex a::after { transition: none; }
  .o2-cap, .o2-chip { transition: none; }
}

/* ---------- short landscape (phone on its side): stage index between the nav and the bottom edge, captions sized to the scene,
   one compact service bar, and the play control as an icon on the same row as what is playing ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .o2-gl .o2-sp .o2-sindex { top: calc(var(--nav-h, 64px) + 4px); bottom: max(4px, env(safe-area-inset-bottom)); transform: none; }
  .o2-sindex ol { height: 100%; justify-content: center; }
  .o2-sindex li { display: flex; flex: 0 1 44px; min-height: 24px; }
  .o2-sindex a { flex: 1; min-height: 0; }
  .o2-cap { max-width: min(300px, calc(60vw - 96px)); }
  /* the service name fits its 40vw column instead of running into the scene */
  .o2-sp-intro .o2-h1 { font-size: min(2.1rem, calc((40vw - 60px) / 5.6)); }
  .o2-cap .t { font-size: .86rem; line-height: 1.38; }
  .o2-gl .o2-svcbar { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 0; padding: 6px 0 2px; background: var(--sky); border-top: 1px solid var(--line); }
  .o2-svcbar::before { display: none; }
  .o2-svcbar b { font-size: 1rem; line-height: 1.3; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .o2-svcbar span { display: none; }
  .o2-svcbar a { min-height: 32px; padding-bottom: 2px; letter-spacing: .06em; white-space: nowrap; }
  .o2-gl .o2-pp { left: calc(var(--o2-col) + 10px); bottom: max(6px, env(safe-area-inset-bottom)); width: 44px; padding: 0; justify-content: center; }
  .o2-pp .o2-pp-a, .o2-pp .o2-pp-s { display: none; }
  .o2-gl .o2-playing { left: calc(var(--o2-col) + 64px); bottom: max(6px, env(safe-area-inset-bottom)); line-height: 44px; max-width: calc(100vw - var(--o2-col) - 64px - 78px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
/* an earlier narration line: muted colour at full opacity (contrast holds), no code */
.o2-cap .t.old { color: var(--muted); }
