/* ============================================================
   hv-scale.css — #scale-studio · "the economics race"
   Two lanes run the same 10-task autonomous mission on the
   figure's graph-paper ground. Top lane summons a huge frontier
   block for every action, burns budget steeply and stalls at the
   rust autonomy-envelope wall. Bottom lane runs small specialist
   chips (frontier only for two hard escalations), crosses the
   wall and extends the envelope. A live tally card per lane keeps
   score. hv-scale.js drives everything from one virtual clock;
   home-page.js remains the state controller (buttons + readout).
   Every class is prefixed hv6-. Type floor 13px.
   Rules only activate once JS adds .hv6-live — no-JS keeps the
   original static axis/envelope markup.
   ============================================================ */

/* ---- the stage claims the visual panel ---------------------- */
.home-scale-visual.hv6-live {
    display: block;
    position: relative;
    min-height: 0;
    height: auto;
    padding: clamp(1rem, 2.4vw, 1.5rem);
    overflow: hidden;
    border: 0;
    border-left: 1px solid var(--home-ink, #191917);
    border-bottom: 1px solid var(--home-ink, #191917);
    background:
        linear-gradient(to right, color-mix(in srgb, var(--home-line, #b9b2a5) 42%, transparent) 1px, transparent 1px),
        linear-gradient(to bottom, color-mix(in srgb, var(--home-line, #b9b2a5) 42%, transparent) 1px, transparent 1px);
    background-size: 4rem 4rem;
}

.home-scale-visual.hv6-live > .home-scale-axis,
.home-scale-visual.hv6-live > .home-scale-envelope,
.home-scale-visual.hv6-live > .home-scale-markers {
    display: none;
}

/* ---- stage grid --------------------------------------------- */
.hv6-stage {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(200px, 26%, 258px);
    gap: 16px clamp(14px, 2.4vw, 26px);
    min-width: 0;
    color: var(--home-ink, #191917);
    font-family: var(--home-sans, "Geist", Arial, sans-serif);
}

.hv6-stage.hv6-narrow {
    grid-template-columns: minmax(0, 1fr);
}

.hv6-field {
    position: relative;
    display: grid;
    gap: 26px;
    align-content: start;
    min-width: 0;
}

.hv6-narrow .hv6-field {
    gap: 30px;
}

/* ---- lanes --------------------------------------------------- */
.hv6-lane {
    position: relative;
    z-index: 2;
    min-width: 0;
    transition: opacity .5s var(--home-ease, ease), filter .5s var(--home-ease, ease);
}

.hv6-lane-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 2px 12px;
    margin-bottom: 6px;
}

.hv6-lane-name {
    position: relative;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.hv6-lane-name::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 2px;
    background: var(--home-rust, #bd4321);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform .45s var(--home-ease, ease);
}

.hv6-on-gen .hv6-lane-gen .hv6-lane-name::after,
.hv6-on-spec .hv6-lane-spec .hv6-lane-name::after {
    transform: scaleX(1);
}

.hv6-lane-rate {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--home-muted, #5f5b53);
    white-space: nowrap;
}

/* the un-selected lane keeps running, dimmed */
.hv6-on-gen .hv6-lane-spec,
.hv6-on-spec .hv6-lane-gen {
    opacity: .38;
    filter: saturate(.55) contrast(.94);
}

/* the escalation tag cannot survive the .38 dim at any color — hide it
   with the dimmed lane and bring it back when the lane is selected */
.hv6-on-gen .hv6-lane-spec .hv6-esctag,
.hv6-on-spec .hv6-lane-gen .hv6-esctag {
    opacity: 0;
    transition: opacity .3s ease;
}

/* ---- track --------------------------------------------------- */
.hv6-track {
    position: relative;
    min-width: 0;
}

.hv6-track-gen { height: 96px; }
.hv6-track-spec { height: 108px; }

.hv6-scanclip {
    position: absolute;
    inset: 0;
    z-index: 6;
    overflow: hidden;
    pointer-events: none;
}

.hv6-scan {
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(189, 67, 33, .14) 44%,
        rgba(25, 25, 23, .10) 56%,
        transparent 100%);
    transform: translateX(-101%);
}

.hv6-scan-go {
    animation: hv6-scango .62s var(--home-ease, ease);
}

@keyframes hv6-scango {
    0% { opacity: 1; transform: translateX(-101%); }
    100% { opacity: 1; transform: translateX(101%); }
}

.hv6-base {
    position: absolute;
    left: 0;
    right: 0;
    top: 64px;
    height: 2px;
    background: var(--home-ink, #191917);
    opacity: .82;
}

/* ---- task ticks ---------------------------------------------- */
.hv6-tick {
    position: absolute;
    top: 64px;
    width: 13px;
    height: 13px;
    margin: -7px 0 0 -7px;
    border: 2px solid var(--home-ink, #191917);
    background: var(--home-paper, #f4f1e9);
    transition: background-color .25s ease, border-color .25s ease, opacity .25s ease;
}

.hv6-tick-on {
    background: var(--home-ink, #191917);
    animation: hv6-tickpop .38s var(--home-ease, ease);
}

@keyframes hv6-tickpop {
    0% { transform: scale(1.45); }
    100% { transform: scale(1); }
}

.hv6-tick-void {
    border-style: dashed;
    border-color: var(--home-muted, #5f5b53);
    opacity: .7;
}

/* ---- workers ------------------------------------------------- */
.hv6-worker {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    will-change: transform, opacity;
}

.hv6-worker-big {
    top: 16px;
    width: 104px;
    height: 46px;
    flex-direction: column;
    gap: 4px;
    border: 2px solid var(--home-ink, #191917);
    background: var(--home-ink, #191917);
    color: var(--home-white, #fffaf1);
    box-shadow: 4px 4px 0 rgba(25, 25, 23, .16);
}

.hv6-worker-big b {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.hv6-wbars {
    display: flex;
    gap: 3px;
}

.hv6-wbars s {
    display: block;
    width: 20px;
    height: 3px;
    background: color-mix(in srgb, var(--home-white, #fffaf1) 42%, transparent);
    text-decoration: none;
}

.hv6-worker-chip {
    top: 37px;
    width: 54px;
    height: 25px;
    border: 1.5px solid var(--home-ink, #191917);
    background: var(--home-white, #fffaf1);
    color: var(--home-ink, #191917);
    box-shadow: 2px 2px 0 rgba(25, 25, 23, .12);
}

.hv6-worker-chip b {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: .03em;
}

.hv6-esctag {
    position: absolute;
    top: -19px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .04em;
    color: var(--home-rust-dark, #8c3018);
    white-space: nowrap;
}

/* ---- cost blips ---------------------------------------------- */
.hv6-blip {
    position: absolute;
    z-index: 4;
    top: 71px;
    opacity: 0;
    transform: translate(-50%, 0);
    padding: 1px 4px;
    background: color-mix(in srgb, var(--home-paper, #f4f1e9) 86%, transparent);
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 700;
    color: var(--home-muted, #5f5b53);
    white-space: nowrap;
    pointer-events: none;
}

.hv6-blip-heavy {
    color: var(--home-rust-dark, #8c3018);
}

/* ---- the autonomy-envelope wall ------------------------------ */
.hv6-wall {
    position: absolute;
    z-index: 1;
    top: -6px;
    bottom: -6px;
    left: 62%;
    width: 0;
    pointer-events: none;
}

.hv6-wall i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: -1.5px;
    width: 3px;
    background: var(--home-rust, #bd4321);
    transition: box-shadow .3s ease;
}

.hv6-wall-hit i {
    box-shadow: 0 0 0 3px rgba(189, 67, 33, .28);
}

.hv6-wall span {
    position: absolute;
    left: 9px;
    white-space: nowrap;
    padding: 2px 5px;
    background: color-mix(in srgb, var(--home-paper, #f4f1e9) 84%, transparent);
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--home-rust-dark, #8c3018);
}

.hv6-narrow .hv6-wall span {
    left: auto;
    right: 9px;
}

/* ---- envelope extension (specialists run past the wall) ------ */
.hv6-ext {
    position: absolute;
    z-index: 2;
    top: 78px;
    left: 62%;
    width: 0;
    height: 2px;
    opacity: 0;
    background: repeating-linear-gradient(90deg,
        var(--home-rust, #bd4321) 0 6px,
        transparent 6px 12px);
    pointer-events: none;
}

.hv6-ext::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    border-left: 6px solid var(--home-rust, #bd4321);
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.hv6-extlab {
    position: absolute;
    z-index: 2;
    top: 88px;
    left: calc(62% + 10px);
    opacity: 0;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--home-rust-dark, #8c3018);
    white-space: nowrap;
    pointer-events: none;
}

.hv6-narrow .hv6-extlab {
    left: auto;
    right: 0;
}

/* ---- verdict stamps ------------------------------------------ */
.hv6-stamp {
    position: absolute;
    z-index: 5;
    opacity: 0;
    padding: 4px 8px;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
}

.hv6-stamp-on {
    opacity: 1;
    animation: hv6-stamppop .45s var(--home-ease, ease);
}

@keyframes hv6-stamppop {
    0% { transform: scale(1.28) rotate(-2deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.hv6-stamp-stall {
    top: 74px;
    right: calc(38% + 12px);
    background: var(--home-rust, #bd4321);
    color: var(--home-white, #fffaf1);
}

.hv6-stamp-done {
    top: 4px;
    right: 0;
    border: 1.5px solid var(--home-ink, #191917);
    background: var(--home-white, #fffaf1);
    color: var(--home-ink, #191917);
}

/* ---- burn bars ----------------------------------------------- */
.hv6-burn {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    min-width: 0;
}

.hv6-burn-l {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--home-muted, #5f5b53);
    white-space: nowrap;
}

.hv6-burn-bar {
    position: relative;
    flex: 1 1 auto;
    min-width: 50px;
    height: 8px;
    border: 1px solid var(--home-line, #b9b2a5);
    background: color-mix(in srgb, var(--home-white, #fffaf1) 55%, transparent);
}

.hv6-burn-bar i {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 0;
    background: var(--home-ink, #191917);
    transition: background-color .3s ease;
}

.hv6-burn-hot .hv6-burn-bar i {
    background: var(--home-rust, #bd4321);
}

.hv6-burn-n {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 5ch;
    text-align: right;
    white-space: nowrap;
}

/* ---- tally cards --------------------------------------------- */
.hv6-tally {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
}

.hv6-narrow .hv6-tally {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.hv6-card {
    padding: 12px 14px;
    border: 1px solid var(--home-line, #b9b2a5);
    background: color-mix(in srgb, var(--home-white, #fffaf1) 72%, transparent);
    transition: border-color .45s var(--home-ease, ease), opacity .45s var(--home-ease, ease), box-shadow .45s var(--home-ease, ease);
    min-width: 0;
}

.hv6-on-gen .hv6-card-gen,
.hv6-on-spec .hv6-card-spec {
    border-color: var(--home-ink, #191917);
    box-shadow: .35rem .35rem 0 rgba(189, 67, 33, .14);
}

.hv6-on-gen .hv6-card-spec,
.hv6-on-spec .hv6-card-gen {
    opacity: .5;
}

.hv6-card-k {
    display: block;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--home-rust-dark, #8c3018);
}

.hv6-card-n {
    display: block;
    margin-top: 7px;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.hv6-cn { font-size: 25px; }

.hv6-cd {
    font-size: 14px;
    font-weight: 600;
    color: var(--home-muted, #5f5b53);
}

.hv6-card-l {
    display: block;
    margin-top: 4px;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--home-muted, #5f5b53);
}

.hv6-cost {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
    min-width: 0;
}

.hv6-cost-bar {
    position: relative;
    flex: 1 1 auto;
    min-width: 40px;
    height: 6px;
    border: 1px solid var(--home-line, #b9b2a5);
    background: color-mix(in srgb, var(--home-white, #fffaf1) 55%, transparent);
}

.hv6-cost-bar s {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: block;
    width: 0;
    background: var(--home-ink, #191917);
    text-decoration: none;
}

.hv6-card-gen .hv6-cost-bar s {
    background: var(--home-rust, #bd4321);
}

.hv6-cost-n {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.hv6-verdict {
    display: block;
    margin-top: 9px;
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--home-muted, #5f5b53);
    transition: color .3s ease;
}

.hv6-verdict-stall { color: var(--home-rust-dark, #8c3018); }
.hv6-verdict-done { color: var(--home-ink, #191917); }

.hv6-note {
    font-family: var(--home-mono, "Geist Mono", monospace);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
    color: var(--home-muted, #5f5b53);
}

.hv6-narrow .hv6-note {
    grid-column: 1 / -1;
}

/* ---- loop veil (positions against .home-scale-visual, which is
   the nearest positioned ancestor — covers the padding too) ----- */
.hv6-veil {
    position: absolute;
    inset: 0;
    z-index: 9;
    opacity: 0;
    background: var(--home-paper, #f4f1e9);
    /* spread shadow paints the panel's padding ring without
       inflating scrollWidth — the panel clips the excess */
    box-shadow: 0 0 0 3rem var(--home-paper, #f4f1e9);
    pointer-events: none;
}

/* ---- compact sizes ------------------------------------------- */
.hv6-slim .hv6-worker-big {
    top: 24px;
    width: 84px;
    height: 38px;
    gap: 3px;
}

.hv6-slim .hv6-wbars s { width: 15px; }

.hv6-slim .hv6-worker-chip {
    top: 39px;
    width: 47px;
    height: 23px;
}

.hv6-slim .hv6-tick {
    width: 11px;
    height: 11px;
    margin: -6px 0 0 -6px;
}

.hv6-slim .hv6-lane-name { white-space: normal; }

.hv6-slim .hv6-stamp-stall { right: calc(38% + 6px); }

/* forced colors: the scene is decorative — hide it, the figure's
   readout and hidden summary carry the content */
@media (forced-colors: active) {
    .hv6-stage { display: none; }
}
