/* The Ledger (/architecture/ledger/): page-only styles. The shell is layer.css.
   Acts: hero (shell) · two tables (reveal, light) · the trace (pin, the peak,
   the signature) · how it holds (pan, light) · run history + work board (live
   mockup, dark) · the other nine and the close (shell). */

/* ---------------------------------------------------------------- 1 · two tables: the reveal */
.lgx-sec { padding-block: clamp(88px, 10vw, 150px); }
.lgx { position: relative; margin: 0; width: 100%; aspect-ratio: 4 / 3.3; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgb(26 16 51 / .05), 0 6px 8px -4px rgb(26 16 51 / .06); }
.lgx__back, .lgx__front { position: absolute; inset: 0; padding: clamp(20px, 2.6vw, 32px); display: flex; flex-direction: column; }
.lgx__back { background: var(--panel-2); border: 1px solid var(--line-2); }
.lgx__front { background: var(--panel); border: 1.5px solid var(--lc); will-change: clip-path; }
.lgx__tag { margin: 0 0 16px; font-size: 12px; font-weight: 600; color: var(--ink-4); letter-spacing: .01em; }
.lgx__tag--on { color: var(--lc); }
.lgx__line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); font: 500 13px/1.4 var(--sc-font-mono); }
.lgx__line span { color: var(--ink-4); font-weight: 500; }
.lgx__line b { color: var(--sc-ink); font-weight: 600; }
.lgx__row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.lgx__k { color: var(--ink-4); font-weight: 600; }
.lgx__row b { color: var(--sc-ink); font-weight: 500; font-family: var(--sc-font-mono); font-size: 12.5px; }
.lgx__row b i { color: var(--lc); font-style: normal; }
.lgx__q { margin-top: auto; padding-top: 16px; font-family: var(--sc-font-display); font-weight: 600; font-size: clamp(18px, 1.7vw, 22px); color: var(--sc-ink); letter-spacing: -.015em; }
.lgx__q--on { color: var(--lc); }
.lgx__copy .prose { margin-top: 20px; }
@media (max-width: 560px) { .lgx { aspect-ratio: 4 / 4.4; } }

/* ---------------------------------------------------------------- 2 · the trace (pin, peak, signature) */
.lgt__stage { display: grid; grid-template-columns: minmax(0, .86fr) minmax(0, 1.14fr); gap: clamp(28px, 4vw, 72px); align-items: center; padding: calc(var(--bar-h) + 20px) clamp(20px, 7vw, 120px) 28px; }
.lgt__lede { max-width: 46ch; }
.lgt__pick { display: flex; gap: 8px; margin-top: 26px; flex-wrap: wrap; }
.lgt__pick button { min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line-2); background: #12141c; color: var(--ink-2); font-weight: 600; font-size: 14px; cursor: pointer; transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease); }
.lgt__pick button:hover { color: var(--sc-ink); }
.lgt__pick button[aria-selected="true"] { color: #fff; background: color-mix(in oklab, var(--lh) 26%, #12141c); border-color: color-mix(in oklab, var(--lh) 60%, transparent); }
.lgt__pick button:focus-visible { outline: 2px solid var(--lh); outline-offset: 2px; }
.lgt__hint { margin: 16px 0 0; font-size: 13px; color: var(--ink-4); }

.lgt__mock .win { box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 18px 30px -18px rgb(0 0 0 / .7); }
.lgc { list-style: none; margin: 0; padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 0; min-height: 420px; }
.lgc__row { position: relative; padding: 14px 16px 14px 46px; border-radius: 12px; opacity: 0; transform: translateY(10px); transition: opacity .4s var(--ease), transform .45s var(--ease); }
.lgc__row.on { opacity: 1; transform: none; }
.lgc__row::before { content: ""; position: absolute; left: 14px; top: 0; bottom: -2px; width: 1.5px; background: var(--line-2); }
.lgc__row--root::before { bottom: 50%; }
.lgc__row:first-child::before { top: 50%; }
.lgc__dot { position: absolute; left: 8px; top: 18px; width: 13px; height: 13px; border-radius: 50%; background: #12141c; border: 2px solid var(--lh); z-index: 1; }
.lgc__row--root .lgc__dot { background: var(--lh); }
.lgc__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.lgc__who { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px/1 var(--sc-font-text); color: var(--sc-ink); background: var(--bubble); border: 1px solid var(--line-2); padding: 5px 10px 5px 8px; border-radius: 999px; }
.lgc__who i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--lh); font-style: normal; }
.lgc__who[data-kind="person"] i { background: #eef2fb; }
.lgc__when { font: 500 11.5px/1 var(--sc-font-mono); color: var(--ink-4); }
.lgc__what { margin: 0; font-size: 14px; line-height: 1.55; color: var(--fg-body); }
.lgc__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; }
.lgc__meta span { color: var(--ink-4); }
.lgc__meta b { color: var(--sc-ink); font-weight: 500; font-family: var(--sc-font-mono); }
.lgc__cap { display: block; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: color-mix(in oklab, var(--lh) 9%, #12141c); border: 1px solid color-mix(in oklab, var(--lh) 28%, transparent); font: 500 13px/1.5 var(--sc-font-text); color: var(--sc-ink); }
.lgc__more { padding: 12px 16px 4px 46px; font-size: 12.5px; color: var(--ink-4); }
@media (max-width: 960px) {
  .lgt__stage { grid-template-columns: 1fr; align-content: start; gap: 14px; padding: calc(var(--bar-h) + 12px) 16px 12px; }
  .lgt__copy .h2 { font-size: 26px; }
  .lgt__hint { display: none; }
  .lgc { min-height: 260px; padding: 12px 10px 16px; }
  .lgc__row { padding-left: 40px; }
}

/* ---------------------------------------------------------------- 3 · how it holds (pan)
   The lead is a true flex sibling of the viewport, so it never moves: only
   .lgh__track (inside the overflow:hidden .lgh__viewport) carries the scroll
   transform. The engine measures its travel as trackScrollWidth minus the
   FULL window width, which overstates the visible area by exactly the
   lead's own rendered width, so .lgh__spacer reserves that same width at
   the end of the track to make the last card land flush with the true
   (narrower) viewport edge. --lead-reserve is zeroed in the stacked mobile
   layout, where the lead sits above the track instead of beside it. */
.lgh { --lead-x: clamp(20px, 7vw, 120px); --lead-w: clamp(230px, 27vw, 380px); --lead-reserve: var(--lead-w); }
.lgh__stage { display: flex; align-items: center; overflow: hidden; }
.lgh__lead { flex: none; width: var(--lead-w); padding: 0 28px 0 var(--lead-x); align-self: center; }
.lgh__viewport { flex: 1 1 auto; min-width: 0; overflow: hidden; align-self: center; }
.lgh__track { display: flex; align-items: center; gap: 18px; padding: calc(var(--bar-h) + 20px) clamp(20px, 7vw, 120px) 24px 0; }
.lgh__spacer { flex: none; width: var(--lead-reserve); }
.lgh__card { flex: none; align-self: stretch; display: flex; flex-direction: column; justify-content: center; width: clamp(320px, 25vw, 372px); min-height: clamp(300px, 30vw, 380px); padding: 30px 28px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 1px 2px rgb(26 16 51 / .05); }
.lgh__card--w { width: clamp(360px, 32vw, 460px); }
.lgh__card h3 { font-size: clamp(19px, 1.7vw, 23px); }
.lgh__card > p { margin: 14px 0 0; font-size: 15.5px; line-height: 1.65; color: var(--fg-body); }
.lgh__ex { margin-top: auto !important; padding-top: 18px; border-top: 1px solid var(--line-2); font-size: 13.5px !important; line-height: 1.55 !important; color: var(--ink-2) !important; }
.lgh__ex b { display: block; margin-bottom: 3px; font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--lc); text-transform: uppercase; }
.lgh__end { flex: none; width: 320px; padding-left: 16px; align-self: center; }
.lgh__end .lede { margin-top: 10px; }
.lgh__end .ulink { display: inline-block; margin-top: 18px; }
@media (max-width: 760px) {
  .lgh { --lead-reserve: 0px; }
  .lgh__stage { flex-direction: column; justify-content: center; gap: 14px; padding-block: calc(var(--bar-h) + 14px) 12px; }
  .lgh__lead { width: auto; max-width: 88vw; padding: 0 20px; }
  .lgh__lead .lede { display: none; }
  .lgh__viewport { flex: none; width: 100%; height: clamp(300px, 56vh, 420px); }
  .lgh__track { padding: 0 20px 0 20px; }
  .lgh__card, .lgh__card--w { width: 78vw; min-height: 0; }
  .lgh__end { width: 78vw; }
}
@media (prefers-reduced-motion: reduce) {
  .lgh { height: auto !important; }
  .lgh > .lgh__stage { height: auto !important; overflow: visible !important; flex-direction: column; }
  .lgh__lead { width: auto; max-width: 720px; padding: 0 20px; }
  .lgh__lead .lede { display: block; }
  .lgh__viewport { flex: none; width: 100%; height: auto; overflow: visible; }
  .lgh__track { flex-wrap: wrap; align-items: stretch; transform: none !important; padding: clamp(24px, 4vw, 48px) 20px; }
  .lgh__spacer { display: none; }
  .lgh__card, .lgh__card--w { align-self: stretch; flex: 1 1 280px; width: auto; }
  .lgh__end { flex-basis: 100%; width: auto; max-width: 720px; }
}

/* ---------------------------------------------------------------- 4 · run history + work board */
.lgb .split { align-items: start; }
.lgb__copy { padding-top: clamp(0px, 3vw, 40px); }
.lgb__copy .prose { margin-top: 20px; }
.lgb__rules { margin: 28px 0 0; display: grid; gap: 18px; }
.lgb__rules div { padding-top: 16px; border-top: 1px solid var(--line-2); }
.lgb__rules dt { font-weight: 600; font-size: 16px; color: var(--sc-ink); }
.lgb__rules dd { margin: 6px 0 0; color: var(--sc-ink-soft); max-width: 52ch; line-height: 1.65; }

.lgb__mock .win { box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 18px 30px -18px rgb(0 0 0 / .7); }
.lgb__tabs { display: flex; gap: 4px; margin: 14px 16px 0; padding: 4px; border-radius: 11px; background: #0a0b10; border: 1px solid var(--line); }
.lgb__tabs button { flex: 1; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background-color .18s var(--ease), color .18s var(--ease); }
.lgb__tabs button:hover { color: var(--sc-ink); }
.lgb__tabs button[aria-selected="true"] { color: #fff; background: color-mix(in oklab, var(--lh) 26%, #12141c); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--lh) 60%, transparent); }
.lgb__tabs button:focus-visible { outline: 2px solid var(--lh); outline-offset: 2px; }
.lgb__panel { padding: 14px 16px 18px; }

.lgr[hidden], .lgw[hidden] { display: none !important; }
.lgr { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lgr__row { border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); overflow: hidden; }
.lgr__btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 10px 14px; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.lgr__btn:hover { background: rgb(255 255 255 / .03); }
.lgr__btn:focus-visible { outline: 2px solid var(--lh); outline-offset: -2px; }
.lgr__name { flex: 1; min-width: 0; }
.lgr__name b { display: block; font-size: 13.5px; color: var(--sc-ink); font-weight: 600; }
.lgr__name span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--ink-4); }
.lgr__dur { font: 500 12px/1 var(--sc-font-mono); color: var(--ink-4); white-space: nowrap; }
.lgr__stat { flex: none; font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.lgr__stat--succeeded { color: #b9f5cf; background: #0f2a1b; border: 1px solid #1f5f3a; }
.lgr__stat--failed { color: #ffc4bd; background: #341210; border: 1px solid #6b2620; }
.lgr__stat--withheld { color: #d9d2ff; background: #1c1830; border: 1px solid #362e5c; }
.lgr__stat--silent { color: var(--ink-2); background: #14161f; border: 1px solid var(--line-2); }
.lgr__chev { flex: none; width: 18px; height: 18px; color: var(--ink-4); transition: transform .22s var(--ease); }
.lgr__row[data-open="true"] .lgr__chev { transform: rotate(180deg); }
.lgr__trace { max-height: 0; overflow: hidden; transition: max-height .32s var(--ease); border-top: 1px solid var(--line-2); }
.lgr__row[data-open="true"] .lgr__trace { max-height: 340px; }
.lgr__trace-in { padding: 12px 14px 14px; display: grid; gap: 8px; }
.lgr__trace-in p { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--fg-body); }
.lgr__trace-in p b { color: var(--sc-ink); font-weight: 600; }
.lgr__steps { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; }
.lgr__steps li { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); padding-left: 14px; position: relative; }
.lgr__steps li::before { content: ""; position: absolute; left: 0; top: 8px; width: 5px; height: 5px; border-radius: 50%; background: var(--lh); }
.lgr__fail { color: #ff9c8f !important; }

.lgw { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.lgw__col { display: flex; flex-direction: column; gap: 10px; }
.lgw__colh { margin: 0 2px 2px; font: 600 11.5px/1 var(--sc-font-text); color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; }
.lgw__card { padding: 12px 12px 11px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--panel-2); }
.lgw__card b { display: block; font-size: 12.5px; line-height: 1.4; color: var(--sc-ink); font-weight: 600; }
.lgw__card p { margin: 6px 0 0; font-size: 11.5px; line-height: 1.4; color: var(--ink-2); }
.lgw__who { display: inline-flex; align-items: center; gap: 5px; margin-top: 8px; font: 500 11px/1 var(--sc-font-mono); color: var(--ink-4); }
.lgw__who i { width: 6px; height: 6px; border-radius: 50%; background: var(--lh); font-style: normal; }
.lgw__who[data-kind="person"] i { background: #eef2fb; }
@media (max-width: 900px) { .lgb__copy { padding-top: 0; order: -1; } }
@media (max-width: 640px) {
  .lgw { grid-template-columns: 1fr; }
  .lgr__name span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lgc__row { transition-duration: .01s; }
}
