/* SANJIRO orbit chapter component (mountOrbit). Scoped under .sjo (the mounted root). Uses the web_v1 tokens when present
   (--ink --paper --stone --amber --light --dim --line-d --kr --lat --gx --fast --base --expo --inout); the defaults below are
   the same values, so the component also stands alone. The amber 1 px line is the only accent; 7 states per control.
   Pinned root: height = 100svh + --sjo-scroll (90vh) -> page scroll adds up to scroll_turn_deg of turn. data-pin="off": 100svh. */
.sjo { --ink: #0E0F11; --stone: #8C877E; --amber: #D98A3A; --light: #ECE9E2; --dim: rgba(236, 233, 226, .64); --line-d: rgba(236, 233, 226, .16);
  --kr: 'SNJ Dash', 'SUIT', system-ui, sans-serif; --lat: 'SNJ Dash', 'Satoshi', 'SUIT', system-ui, sans-serif;
  --gx: clamp(16px, 4.45vw, 64px); --fast: 240ms; --base: 600ms; --expo: cubic-bezier(.16, 1, .3, 1); --inout: cubic-bezier(.65, 0, .35, 1);
  color: var(--light); font: 400 16px/1.6 var(--kr); word-break: keep-all; }
.sjo *, .sjo *::before, .sjo *::after { box-sizing: border-box; }
.sjo [hidden] { display: none !important; }
.sjo p, .sjo ol { margin: 0; } .sjo ol { padding: 0; list-style: none; }
.sjo button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
.sjo canvas, .sjo svg { display: block; max-width: none; }
.sjo :focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.sjo .vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sjo .tag { display: inline-block; font: 500 11px/1 var(--kr); padding: 5px 7px 4px; border: 1px solid currentColor; border-radius: 2px; white-space: nowrap; }
.sjo[data-pin="off"] { height: 100svh; }
.sjo.is-error .ob-pin::after { content: ''; position: absolute; left: 50%; top: 50%; width: 120px; height: 1px; margin-left: -60px; background: var(--line-d); }
/* ---------------------------------------------------------------- orbit chapter: pinned stage, page scroll adds turn */
.sjo { position: relative; height: calc(100svh + var(--sjo-scroll, 90vh)); }
.ob-pin { position: sticky; top: 0; height: 100svh; overflow: hidden;
  background: radial-gradient(120% 70% at 50% 58%, #1a1d24 0%, #121418 46%, var(--ink) 100%); }
.ob-pin::after { content: ''; position: absolute; inset: auto 0 0 0; height: 150px; pointer-events: none; z-index: 1;
  background: linear-gradient(0deg, rgba(14, 15, 17, .82), rgba(14, 15, 17, 0)); }
.ob-pin::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 110px; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(14, 15, 17, .7), rgba(14, 15, 17, 0)); }
.ob-labels, .ob-svg, .ob-hud, .ob-hint { z-index: 2; }
.ob-stage { position: absolute; inset: 0; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.ob-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.ob-fr { opacity: 1; transition: opacity var(--base) var(--expo); }
.ob-stage.is-loading .ob-fr { opacity: 0; }
.ob-stage.is-error::after { content: ''; position: absolute; left: 50%; top: 50%; width: 120px; height: 1px; margin-left: -60px; background: var(--line-d); }
/* loading: the amber 1 px loader line (UI signature) runs under the dial until the LQIP sprite is in */
.ob-pin.is-loading .ob-dial::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -6px; height: 1px; background: var(--amber); transform-origin: 0 50%; animation: ob-load 1.2s var(--inout) infinite; }
@keyframes ob-load { 0% { transform: scaleX(0); } 60% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.ob-stage.is-drag { cursor: grabbing; }

/* spotlight (target "brightens"): darken around, clear disc at the anchor; no target masks yet */
.ob-spot { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity var(--base) var(--expo);
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%), rgba(236, 233, 226, .07) 0, rgba(236, 233, 226, 0) calc(var(--sr, 120px) * .9), rgba(9, 10, 12, .5) calc(var(--sr, 120px) * 2.2)); }
.ob-spot.is-on { opacity: 1; }

/* leaders, dots, connection zone */
.ob-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
/* 3 px ink halo under each 1 px amber leader: keeps >= 3:1 where a leader crosses lit glass */
.ob-halo { fill: none; stroke: rgba(14, 15, 17, .62); stroke-width: 3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.ob-ld { fill: none; stroke: var(--amber); stroke-width: 1; vector-effect: non-scaling-stroke; transition: stroke-width var(--fast); }
.ob-dot { fill: var(--ink); stroke: var(--amber); stroke-width: 1; transition: r var(--fast) var(--expo); }
.ob-dot.is-active { r: 5; fill: var(--amber); }
.ob-zone { fill: rgba(217, 138, 58, .05); stroke: var(--amber); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; animation: ob-flow 1.4s linear infinite; transition: opacity var(--base); }
@keyframes ob-flow { to { stroke-dashoffset: -16; } }

/* ---------------------------------------------------------------- labels */
.ob-labels { position: absolute; inset: 0; pointer-events: none; }
.ob-li { position: absolute; left: 0; top: 0; width: max-content; max-width: min(300px, 40vw); opacity: var(--o, 0); will-change: transform, opacity; }
.ob-lb { position: relative; display: grid; gap: 3px; padding: 0 12px 10px; min-width: 150px; pointer-events: auto; color: var(--light);
  background: linear-gradient(180deg, rgba(14, 15, 17, .72), rgba(14, 15, 17, .62)); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: background var(--fast), transform var(--fast) var(--expo), opacity var(--fast); }
.ob-row { display: flex; align-items: center; gap: 10px; height: 18px; margin: 0 -12px 4px; }
.ob-li[data-side="R"] .ob-row, .ob-li[data-side="T"] .ob-row, .ob-li[data-side="B"] .ob-row { flex-direction: row; }
.ob-li[data-side="L"] .ob-row { flex-direction: row-reverse; }
.ob-rule { flex: 1; height: 1px; background: var(--amber); opacity: .55; transform-origin: var(--ro, 0) 50%; transition: opacity var(--fast), transform var(--base) var(--expo); }
.ob-li[data-side="L"] .ob-rule { --ro: 100%; }
.ob-n { font: 500 12px/1 var(--lat); color: var(--amber); letter-spacing: .06em; padding-inline: 12px 0; display: inline-flex; font-feature-settings: 'tnum' 1, 'lnum' 1; }
.ob-li[data-side="L"] .ob-n { padding-inline: 0 12px; }
.ob-tag { color: var(--amber); font-size: 10.5px; padding: 3px 5px 2px; margin-right: 12px; }
.ob-li[data-side="L"] .ob-tag { margin: 0 0 0 12px; order: -1; }
.ob-name { font: 500 15px/1.3 var(--kr); letter-spacing: -.005em; }
.ob-fact { font: 400 12.5px/1.45 var(--kr); color: rgba(236, 233, 226, .78); }
/* odometer (B2): the second digit rolls to the label number when the labels arrive */
.odo .od { display: inline-block; height: 1em; overflow: hidden; line-height: 1; }
.odo .od-c { display: flex; flex-direction: column; transition: transform 1.1s var(--expo); }
.odo .od-c span { height: 1em; }
.ob-li.is-in .od-c { transform: translateY(calc(var(--d) * -1em)); }
/* arrival */
.ob-li .ob-lb { transform: translateY(6px); }
.ob-li.is-in .ob-lb { transform: none; }
/* hover / focus / active */
.ob-lb:hover, .ob-li.is-active .ob-lb { background: linear-gradient(180deg, rgba(14, 15, 17, .9), rgba(14, 15, 17, .84)); }
.ob-lb:hover .ob-rule, .ob-li.is-active .ob-rule { opacity: 1; }
.ob-lb:active { transform: translateY(1px) scale(.99); opacity: .85; }
.ob-lb:focus-visible { outline: 1px solid var(--amber); outline-offset: 4px; }
.ob-li.is-active { z-index: 3; }   /* the open card sits above the other labels */
.ob-labels.has-active .ob-li:not(.is-active) { opacity: calc(var(--o, 1) * .55); }
/* occluded / away / disabled */
.ob-li.is-away .ob-rule { opacity: .25; }
.ob-li.is-disabled .ob-lb, .ob-lb[aria-disabled="true"] { cursor: default; }
.ob-li.is-disabled .ob-rule { background: var(--line-d); opacity: 1; }
.ob-li.is-disabled .ob-n { color: var(--stone); }
/* loading: skeleton bars (text kept for screen readers via aria-busy on the stage) */
.ob-li.is-loading .ob-name, .ob-li.is-loading .ob-fact { color: transparent; background: linear-gradient(90deg, rgba(236, 233, 226, .08), rgba(236, 233, 226, .16), rgba(236, 233, 226, .08)) 0 0 / 200% 100%; animation: ob-skel 1.4s linear infinite; border-radius: 2px; }
@keyframes ob-skel { to { background-position: -200% 0; } }
/* compact (portrait): number + name; the fact moves into the card */
.ob-labels.is-compact .ob-li { width: min(106px, 28vw); max-width: none; }
.ob-labels.is-compact .ob-lb { min-width: 0; width: 100%; padding: 0 8px 7px; }
.ob-labels.is-compact .ob-row { margin: 0 -8px 3px; gap: 6px; }
.ob-labels.is-compact .ob-n { padding-inline: 8px 0; }
.ob-labels.is-compact .ob-tag { margin-right: 8px; }
.ob-labels.is-compact .ob-name { font-size: 12.5px; line-height: 1.3; }
.ob-labels.is-compact .ob-fact { display: none; }
.ob-labels.is-compact .ob-card { width: min(248px, calc(100vw - 32px)); }
.ob-labels.is-compact .ob-li[data-x="r"] .ob-card { left: auto; right: 0; }

/* card */
.ob-card { position: absolute; top: calc(100% + 6px); left: 0; width: max(100%, 248px); pointer-events: auto; }
.ob-li[data-side="R"] .ob-card { left: auto; right: 0; }
.ob-li.card-up .ob-card { top: auto; bottom: calc(100% + 6px); }
.ob-card-in { display: grid; gap: 6px; padding: 12px; border-top: 1px solid var(--amber); background: rgba(14, 15, 17, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font-size: 13px; line-height: 1.55; animation: ob-card var(--base) var(--expo) both; }
.ob-card .ob-note { color: rgba(236, 233, 226, .74); font-size: 12px; }
/* the label shows number + short name; the fact line and the notes open in the card (an empty card never opens) */
.ob-lb .ob-fact { display: none; }
.ob-card .ob-fact-c { display: block; color: var(--light); }
.ob-card-min { display: none !important; }
@keyframes ob-card { from { clip-path: inset(0 0 100% 0); transform: translateY(-4px); } to { clip-path: inset(0 0 0 0); transform: none; } }

/* ---------------------------------------------------------------- HUD: ground-ellipse dial (slider), readout, tags */
.ob-hud { position: absolute; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 16px; padding: 0 var(--gx) 22px; pointer-events: none; }
.ob-tags { display: flex; gap: 6px; color: var(--dim); align-self: end; }
.ob-tags .tag { color: rgba(236, 233, 226, .8); }
.ob-dial { position: relative; display: grid; justify-items: center; gap: 6px; pointer-events: auto; padding: 4px 8px; border-radius: 4px; touch-action: pan-y; }
.ob-dial svg { width: 240px; height: 54px; overflow: visible; }
.ob-track { fill: none; stroke: var(--line-d); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ob-tick { stroke: rgba(236, 233, 226, .4); stroke-width: 1; vector-effect: non-scaling-stroke; }
.ob-arc { fill: none; stroke: var(--amber); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* arc sets: the unrendered sector stays a faint dotted ellipse, the rendered arc is the amber line */
.ob-track.is-arc { stroke: rgba(236, 233, 226, .3); stroke-dasharray: 1 4; stroke-linecap: round; }
.ob-arc.is-range { stroke-linecap: round; }
.ob-stage { transition: none; }
.ob-mark { fill: var(--amber); }
/* today's sun on the outer ellipse: the azimuth path sunrise -> sunset (amber dots), the sun now as a small symbol
   (size / brightness follow the altitude, faintly); at night only the path stays, faint */
.ob-sunpath { fill: none; stroke: var(--amber); stroke-width: 1.2; stroke-dasharray: .1 3.2; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .75; transition: opacity var(--base); }
.ob-sunpath.is-night { opacity: .28; }
.ob-sun circle { fill: var(--amber); }
.ob-sun path { stroke: var(--amber); stroke-width: 1; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ob-sun.is-night { display: none; }
.ob-read { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; }
.ob-read .ob-vp { color: rgba(236, 233, 226, .74); }
.ob-deg { font: 500 13px/1 var(--lat); font-feature-settings: 'tnum' 1, 'lnum' 1; min-width: 4ch; text-align: right; }
.ob-dir { min-width: 2.5em; }
.ob-dial:hover .ob-track { stroke: rgba(236, 233, 226, .34); }
.ob-dial:active { opacity: .85; }
.ob-dial:focus-visible { outline: 1px solid var(--amber); outline-offset: 4px; }
.ob-dial[aria-disabled="true"] { opacity: .38; }
.ob-credit { justify-self: end; font-size: 11px; color: rgba(236, 233, 226, .7); text-align: right; max-width: 30ch; }
/* zoom: + / − (bounded by the source pixels; hidden when the screen already shows the frames at source resolution) */
.ob-zoom { position: absolute; z-index: 3; right: var(--gx); bottom: 72px; display: flex; gap: 6px; pointer-events: auto; }   /* after the labels in the tab order: dial -> labels -> zoom */
.ob-zoom[hidden] { display: none; }
.ob-zoom button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 1px solid rgba(236, 233, 226, .28); border-radius: 999px; background: rgba(14, 15, 17, .55); color: var(--light); font: 400 17px/1 var(--lat); cursor: pointer; transition: border-color var(--base), opacity var(--base); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.ob-zoom button:hover:not(:disabled) { border-color: var(--amber); }
.ob-zoom button:focus-visible { outline: 1px solid var(--amber); outline-offset: 3px; }
.ob-zoom button:disabled { opacity: .32; cursor: default; }
.sjo.is-zoomed .ob-stage { touch-action: none; }   /* zoomed: one finger pans, two pinch - the page does not scroll under it */
.sjo.is-locked .ob-zoom { opacity: .4; pointer-events: none; }
.cursor[data-c="drag"] .cur-ring { transform: scale(var(--sjo-cz, 1)); }
.cursor.is-grab[data-c="drag"] .cur-ring { transform: scale(calc(var(--sjo-cz, 1) * .9)); }
.ob-hint { position: absolute; left: 0; right: 0; bottom: 104px; text-align: center; font-size: 13px; color: rgba(236, 233, 226, .82); pointer-events: none; transition: opacity var(--base) var(--expo); display: none; }
@media (hover: none) { .ob-hint { display: block; } }
.ob-hint.is-gone { opacity: 0; }
.sjo.is-locked .ob-hint { opacity: 0; }   /* input locked (lockInput, e.g. a host's auto-turn): no drag invitation; back when unlocked */
@media (max-width: 860px) {
  .ob-hud { grid-template-columns: 1fr auto; grid-template-areas: 'tags credit' 'dial dial'; row-gap: 10px; padding-bottom: 16px; }
  .ob-tags { grid-area: tags; } .ob-credit { grid-area: credit; max-width: 22ch; } .ob-dial { grid-area: dial; }
  .ob-dial svg { width: 200px; height: 46px; }
  .ob-hint { bottom: 178px; }
  .ob-zoom { flex-direction: column; bottom: 96px; }
}

/* ---------------------------------------------------------------- reduced motion: complete, still, no transitions */
:is(html.rm, .sjo-rm) .ob-li, :is(html.rm, .sjo-rm) .ob-lb, :is(html.rm, .sjo-rm) .ob-rule, :is(html.rm, .sjo-rm) .odo .od-c, :is(html.rm, .sjo-rm) .ob-spot, :is(html.rm, .sjo-rm) .ob-card-in, :is(html.rm, .sjo-rm) .ob-fr { transition: none !important; animation: none !important; }
:is(html.rm, .sjo-rm) .ob-zone { animation: none; }
:is(html.rm, .sjo-rm) .ob-li .ob-lb { transform: none; }
@media (prefers-reduced-motion: reduce) { .ob-zone, .ob-card-in, .ob-li.is-loading .ob-name, .ob-li.is-loading .ob-fact { animation: none; } }

/* zoomed: fewer words over the building - fact lines step back (number + name stay; the active label keeps its line) */
.sjo .ob-fact { transition: opacity var(--fast); }
.sjo.is-zoomed .ob-li:not(.is-active) .ob-fact { opacity: 0; }
