/* ProAudit "How an audit works": the audit theater and the page around it. Loads after site.css and
   product.css (ported from docs/mockups/public-site/hiw.css). The theater's rules came from the live page's scoped
   sheet and now use the site's tokens; the rest of the page is built from the shared pieces. */

/* ─── Hero: one column, with the audit's headline facts under the call to action ─── */
.hiw-hero .phero__copy { max-width: 780px; }
.hiw-facts { display: flex; flex-wrap: wrap; gap: 16px 56px; margin: 8px 0 0; padding-top: 24px; border-top: 1px solid var(--hair-dk); }
.hiw-facts div { display: flex; flex-direction: column-reverse; gap: 2px; }
.hiw-facts dt { color: var(--cream-2); font-size: 14.5px; }
.hiw-facts dd { margin: 0; font-family: var(--num); font-size: 32px; font-weight: 700; line-height: 1.1; color: var(--card); font-variant-numeric: tabular-nums; }

/* ─── The walkthrough ─── */
.pa-hiw-steps .sec-head { margin-bottom: 28px; }
.pa-hiw-example-note { display: grid; gap: 4px; margin: 0 0 24px; padding: 14px 18px; border-left: 4px solid var(--orange); border-radius: 8px; background: var(--card); overflow-wrap: anywhere; }
.pa-hiw-example-note strong { font-weight: 700; }
.pa-hiw-example-note p { margin: 0; color: var(--muted); }
.pa-hiw-example-back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 650; color: var(--orange-ink); }

/* ─── The audit theater ────────────────────────────────────────────────────────
   Driven by hiw.js (live: wwwroot/js/pro-audit-hiw.js), which owns the pa-hiw-* hooks, the hiw-*
   ids and the data-at / data-lit timings. The authored markup is the finished audit. */

.pa-hiw-th {
    background: var(--card);
    border: 1px solid var(--hair);
    border-radius: var(--radius);
    box-shadow: 0 12px 50px rgba(25, 21, 16, 0.08);
    overflow: hidden;
    margin-bottom: 0;
}

.pa-hiw-th-body {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    min-height: 430px;
}

/* Screen-reader summary. The live counters are aria-hidden, so this is the only
   place the finished numbers are announced. */
.pa-hiw-th-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Timed reveal primitives ─── */

.pa-hiw-tm {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.pa-hiw-tm.is-on {
    opacity: 1;
    transform: none;
}

.pa-hiw-tm.pa-hiw-tm--stamp {
    transform: scale(1.35);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.pa-hiw-tm.pa-hiw-tm--stamp.is-on {
    transform: scale(1);
}

.pa-hiw-tm.pa-hiw-tm--slide {
    transform: translateX(18px);
}

.pa-hiw-tm.pa-hiw-tm--slide.is-on {
    transform: none;
}

/* Suppresses transitions for one paint on replay, scrub and jump. Also the
   authored default, so a visitor without JS never sees a half-played frame. */
.is-no-anim *,
.is-no-anim *::before,
.is-no-anim *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
}

/* ─── Left pane: the estimate document ─── */

.pa-hiw-th-doc {
    position: relative;
    padding: 22px 26px;
    border-right: 1px solid rgba(25, 21, 16, 0.06);
}

.pa-hiw-th-drop {
    position: absolute;
    inset: 14px;
    z-index: 5;
    background: var(--card);
    border: 2px dashed rgba(0, 166, 156, 0.35);
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.pa-hiw-th-drop.is-gone {
    opacity: 0;
    pointer-events: none;
}

.pa-hiw-th-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--paper);
    border: 1px solid rgba(25, 21, 16, 0.1);
    border-radius: 3px;
    padding: 10px 16px;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ink);
    opacity: 0;
    transform: translateY(-46px);
    transition: opacity 0.35s ease, transform 0.55s cubic-bezier(0.3, 1.4, 0.5, 1);
    box-shadow: 0 6px 20px rgba(25, 21, 16, 0.1);
}

.pa-hiw-th-chip.is-on {
    opacity: 1;
    transform: translateY(0);
}

.pa-hiw-th-chip svg {
    color: var(--orange-ink);
    flex-shrink: 0;
}

.pa-hiw-th-uptrack {
    width: 180px;
    height: 3px;
    background: rgba(25, 21, 16, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

/* The bar scales from its left edge (hiw.js sets scaleX); the authored style is the full bar. */
.pa-hiw-th-upbar {
    height: 100%;
    width: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: var(--teal);
}

.pa-hiw-th-upnote {
    font-family: var(--font);
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.04em;
}

.pa-hiw-th-dochead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 10px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--ink);
}

.pa-hiw-th-vehicle {
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.05em;
}

.pa-hiw-th-docmeta {
    font-family: var(--font);
    font-size: 0.62rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-top: 2px;
}

.pa-hiw-th-docflag {
    font-family: var(--font);
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--orange-ink);
    background: rgba(221, 145, 66, 0.12);
    border: 1px solid rgba(221, 145, 66, 0.3);
    padding: 3px 8px;
    border-radius: 2px;
    white-space: nowrap;
}

.pa-hiw-th-lines {
    position: relative;
}

.pa-hiw-th-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: 0.72rem;
    color: var(--ink);
    padding: 5.5px 4px;
    border-bottom: 1px solid rgba(25, 21, 16, 0.05);
}

/* Darker than the mockup's .35: these are rendered text, not decoration.
   rgba(25, 21, 16, .7) resolves to ~5.0:1 on white; .35 was ~2.3:1. */
.pa-hiw-th-num {
    color: rgba(25, 21, 16, 0.7);
    width: 18px;
    flex-shrink: 0;
}

.pa-hiw-th-op {
    color: var(--muted);
    width: 34px;
    flex-shrink: 0;
    font-size: 0.66rem;
}

.pa-hiw-th-desc {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pa-hiw-th-hrs {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

.pa-hiw-th-mark {
    width: 16px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
}

.pa-hiw-th-check {
    color: var(--teal-ink);
}

.pa-hiw-th-flag {
    color: var(--orange-ink);
}

.pa-hiw-th-line.is-flagged.is-lit {
    background: rgba(221, 145, 66, 0.07);
}

@keyframes hiwFlagPulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.45;
    }
}

/* Only while the walkthrough plays: a held or paused frame is perfectly still. */
.pa-hiw-th.is-playing .pa-hiw-th-flag.is-on svg {
    animation: hiwFlagPulse 1.6s ease-in-out infinite;
}

.pa-hiw-th-more {
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: 0.68rem;
    color: rgba(25, 21, 16, 0.7);
    padding: 6px 4px 4px 26px;
}

.pa-hiw-th-totals {
    display: flex;
    justify-content: space-between;
    font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace;
    font-size: 0.7rem;
    color: var(--ink);
    border-top: 2px solid var(--ink);
    margin-top: 6px;
    padding: 8px 4px 0;
    font-variant-numeric: tabular-nums;
}

/* Starts centred on the list's top edge; hiw.js translates it down the list. */
.pa-hiw-th-beam {
    position: absolute;
    left: -6px;
    right: -6px;
    top: -17px;
    height: 34px;
    z-index: 3;
    background: linear-gradient(180deg, rgba(0, 166, 156, 0), rgba(0, 166, 156, 0.14) 45%, rgba(0, 166, 156, 0.35) 50%, rgba(0, 166, 156, 0.14) 55%, rgba(0, 166, 156, 0));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.pa-hiw-th-beam.is-on {
    opacity: 1;
}

.pa-hiw-th-beam::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1.5px;
    background: var(--teal);
    box-shadow: 0 0 12px rgba(0, 166, 156, 0.8);
}

.pa-hiw-th-classify {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    font-family: var(--font);
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.pa-hiw-th-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--teal);
    flex-shrink: 0;
}

/* ─── Right pane: findings ─── */

.pa-hiw-th-find {
    padding: 22px 26px;
    background: linear-gradient(160deg, rgba(221, 145, 66, 0.03), rgba(221, 145, 66, 0.07));
    display: flex;
    flex-direction: column;
}

.pa-hiw-th-findhead {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 4px;
}

.pa-hiw-th-findeyebrow {
    font-family: var(--font);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--orange-ink);
}

.pa-hiw-th-findcount {
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--muted);
    background: rgba(25, 21, 16, 0.05);
    border-radius: 2px;
    padding: 2px 8px;
    margin-left: 8px;
}

.pa-hiw-th-totallabel {
    font-family: var(--font);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    text-align: right;
}

.pa-hiw-th-total {
    display: block;
    font-family: var(--display);
    font-size: 1.7rem;
    line-height: 1.1;
    color: var(--orange-ink);
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.pa-hiw-th-ticker {
    font-family: var(--font);
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    margin: 6px 0 12px;
    min-height: 1em;
}

.pa-hiw-th-findlist {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.pa-hiw-th-findempty {
    border: 1px dashed rgba(25, 21, 16, 0.15);
    border-radius: 3px;
    padding: 26px 16px;
    text-align: center;
    font-family: var(--font);
    font-size: 0.74rem;
    color: rgba(25, 21, 16, 0.7);
    transition: opacity 0.4s ease;
}

.pa-hiw-th-findempty.is-gone {
    display: none;
}

.pa-hiw-th-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card);
    border: 1px solid rgba(221, 145, 66, 0.2);
    border-left: 3px solid var(--orange);
    border-radius: 3px;
    padding: 9px 12px;
    box-shadow: 0 3px 14px rgba(25, 21, 16, 0.05);
}

/* The severity pill: one width, so the finding titles start level down the list. */
.pa-hiw-th-card .prio {
    flex: 0 0 auto;
    justify-content: center;
    min-width: 74px;
    padding: 2px 6px;
    font-size: 0.6rem;
}

.pa-hiw-th-cardbody {
    flex: 1;
    min-width: 0;
}

.pa-hiw-th-cardtitle {
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.3;
}

.pa-hiw-th-cardsrc {
    font-family: var(--font);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal-ink);
    margin-top: 2px;
}

.pa-hiw-th-cardamt {
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--orange-ink);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.pa-hiw-th-findfoot {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.pa-hiw-th-health {
    flex: 1;
    min-width: 150px;
}

.pa-hiw-th-healthlabel {
    display: flex;
    justify-content: space-between;
    font-family: var(--font);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 5px;
}

.pa-hiw-th-healthlabel b {
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.pa-hiw-th-healthtrack {
    height: 5px;
    background: rgba(25, 21, 16, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.pa-hiw-th-healthbar {
    height: 100%;
    width: 100%;
    transform-origin: 0 50%;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--orange), var(--teal));
}

.pa-hiw-th-export {
    font-family: var(--font);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--ink);
    border: 1px solid rgba(25, 21, 16, 0.2);
    border-radius: 2px;
    padding: 7px 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--card);
}

.pa-hiw-th-export svg {
    color: var(--orange-ink);
}

/* ─── Caption footer: four captions stacked in one grid area ─── */

.pa-hiw-th-foot {
    border-top: 1px solid rgba(25, 21, 16, 0.06);
    background: var(--paper);
    padding: 10px 26px;
    display: grid;
}

.pa-hiw-th-caption {
    grid-area: 1 / 1;
    font-family: var(--font);
    font-size: 0.78rem;
    color: var(--ink);
    font-weight: 400;
}

.pa-hiw-th-caption b {
    font-weight: 600;
    color: var(--ink);
}

.pa-hiw-th-caption em {
    font-style: italic;
    font-family: var(--display);
    color: var(--orange-ink);
}

/* ─── Transport controls ─────────────────────────────────────────────────────
   Hidden until pro-audit-hiw.js marks the section .is-synced. Without JS these
   controls would do nothing, and a dead play button is worse than no button.
   WCAG 2.2.2 is satisfied the same way: motion only ever starts once the script
   that owns the pause control is running. */

.pa-hiw-th-scrub {
    display: none;
    align-items: center;
    gap: 14px;
    margin: 14px 2px 6px;
}

.pa-hiw-steps.is-synced .pa-hiw-th-scrub {
    display: flex;
}

.pa-hiw-th-play {
    width: 34px;
    height: 34px;
    border-radius: 2px;
    border: 1px solid rgba(25, 21, 16, 0.15);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.pa-hiw-th-play:hover {
    border-color: var(--orange);
    color: var(--orange-ink);
}

.pa-hiw-th-play:focus-visible {
    outline: 2px solid var(--teal-ink);
    outline-offset: 2px;
}

.pa-hiw-th-scrubwrap {
    flex: 1;
    position: relative;
    padding-top: 2px;
}

input[type=range].pa-hiw-th-range {
    width: 100%;
    height: 22px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: pointer;
    margin: 0;
}

input[type=range].pa-hiw-th-range::-webkit-slider-runnable-track {
    height: 4px;
    background: rgba(25, 21, 16, 0.12);
    border-radius: 2px;
}

input[type=range].pa-hiw-th-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--orange);
    margin-top: -5px;
    border: 2px solid var(--card);
    box-shadow: 0 1px 5px rgba(25, 21, 16, 0.3);
}

input[type=range].pa-hiw-th-range::-moz-range-track {
    height: 4px;
    background: rgba(25, 21, 16, 0.12);
    border-radius: 2px;
}

input[type=range].pa-hiw-th-range::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--orange);
    border: 2px solid var(--card);
    box-shadow: 0 1px 5px rgba(25, 21, 16, 0.3);
}

input[type=range].pa-hiw-th-range:focus-visible {
    outline: 2px solid var(--teal-ink);
    outline-offset: 2px;
}

.pa-hiw-th-ticks {
    display: flex;
    position: relative;
    height: 14px;
    margin-top: 1px;
}

.pa-hiw-th-tick {
    position: absolute;
    transform: translateX(-50%);
    font-family: var(--font);
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(25, 21, 16, 0.7);
    white-space: nowrap;
}

/* ─── Theater responsive ─── */

@media (max-width: 820px) {
    .pa-hiw-th-body {
        grid-template-columns: minmax(0, 1fr);
        /* The 430px floor keeps the two panes level side by side. Once they stack it
           applies to the whole column and leaves dead space under the findings list. */
        min-height: 0;
    }

    .pa-hiw-th-doc {
        border-right: none;
        border-bottom: 1px solid rgba(25, 21, 16, 0.06);
    }
}

@media (max-width: 700px) {
    .pa-hiw-th-doc,
    .pa-hiw-th-find {
        padding: 18px 16px;
    }

    .pa-hiw-th-foot {
        padding: 10px 16px;
    }

    .pa-hiw-th-ticks {
        display: none;
    }
}

/* ═══════════════════════ REDUCED MOTION ═══════════════════════
   Mirrors ProAudit.razor.css:1292. Batch E (37435b639) added that block there and
   missed this file, so the four hero fadeSlideUp animations below were ungated —
   fixed here alongside the theater's own guard.

   The theater's JS half is guarded separately in pro-audit-hiw.js: it never starts
   the rAF loop under reduced motion, renders the finished frame instead, and does
   not let a step-number jump quietly restart playback. */

@media (prefers-reduced-motion: reduce) {
    .pa-hiw-badge,
    .pa-hiw-hero-title,
    .pa-hiw-hero-subtitle,
    .pa-hiw-hero-ctas {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .pa-hiw-tm,
    .pa-hiw-th-chip,
    .pa-hiw-th-drop,
    .pa-hiw-th-beam,
    .pa-hiw-th-findempty,
    .pa-hiw-th-play,
    .pa-hiw-step-icon,
    .pa-hiw-steps.is-synced .pa-hiw-step-card,
    .pa-hiw-steps.is-synced .pa-hiw-step-number {
        transition: none !important;
    }

    .pa-hiw-step-card:hover .pa-hiw-step-icon {
        transform: none;
    }

    .pa-hiw-th-flag.is-on svg {
        animation: none !important;
    }
}

/* ─── The four steps under the theater: always readable; the walkthrough's step is marked ─── */
.pa-hiw-stepgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.pa-hiw-step-card { display: grid; align-content: start; gap: 10px; padding: 20px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--card); transition: border-color 0.25s, background-color 0.25s; }
.pa-hiw-step-number-wrap { display: flex; align-items: center; gap: 12px; }
.pa-hiw-step-number { display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2px var(--orange); color: var(--orange-ink); font: 700 16px/1 var(--num); transition: background-color 0.25s, color 0.25s; }
.pa-hiw-step-connector { flex: 1; height: 2px; border-radius: 2px; background: var(--hair); }
.pa-hiw-step-card--last .pa-hiw-step-connector { display: none; }
.pa-hiw-step-title { margin: 0; font-family: var(--display); font-size: 20px; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.pa-hiw-step-desc { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.pa-hiw-steps.is-synced .pa-hiw-step-card, .pa-hiw-steps.is-synced .pa-hiw-step-number { cursor: pointer; }
.pa-hiw-steps.is-synced .pa-hiw-step-card:hover { border-color: var(--hair-strong); }
.pa-hiw-steps.is-synced .pa-hiw-step-card.is-active { border-color: var(--orange); background: color-mix(in srgb, var(--orange) 7%, var(--card)); }
.pa-hiw-steps.is-synced .pa-hiw-step-card.is-active .pa-hiw-step-number { background: var(--orange); color: var(--orange-fg); box-shadow: none; }
.pa-hiw-step-number:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
/* The hint only makes sense once the steps can jump the walkthrough. */
.pa-hiw-th-hint { display: none; margin: 16px 0 0; color: var(--muted); font-size: 14.5px; text-align: center; }
.pa-hiw-steps.is-synced .pa-hiw-th-hint { display: block; }
@media (max-width: 960px) {
    .pa-hiw-stepgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pa-hiw-step-connector { display: none; }
}
@media (max-width: 600px) { .pa-hiw-stepgrid { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .pa-hiw-step-card, .pa-hiw-step-number { transition: none; } }

/* Figures in the site's numeral face. */
.pa-hiw-th-total, .pa-hiw-th-cardamt, .pa-hiw-th-hrs, .pa-hiw-th-healthlabel b, .pa-hiw-th-findcount { font-family: var(--num); font-variant-numeric: tabular-nums; }
.pa-hiw-th-total { font-weight: 700; }

/* What it finds: the two lists start level. */
.hiw-split { margin-top: 40px; align-items: start; }
