/* ============================================================
   Work — "The Evidence Room" (evolves the .wk- live demos)
   Steward: S9 Engineering   Page: work.html
   Sprint 5 signature experience. Additive, scoped IIFE + this
   sheet, deletable unit. Does not touch main.js, theme.js, or
   any other namespace. Reuses the existing .wk- artifact
   sub-animations (waveform/merge/vitals) and .sv- shared SVG
   utility layer verbatim, unchanged, inside each exhibit.

   Motion: ratified grammar, cubic-bezier(0.22, 1, 0.36, 1),
   150-400ms, GPU-only (transform/opacity). The room is still
   between inspections — nothing animates until the visitor
   breaks a seal. Reduced motion renders every exhibit already
   open (see evidence.js), so this sheet's transitions never
   run and nothing is ever withheld from anyone.
   ============================================================ */

/* --- Hero soft cue --- */
.evd-soft-cue {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 28px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease, gap 0.2s ease;
}

.evd-soft-cue:hover,
.evd-soft-cue:focus-visible {
    color: var(--text-primary);
    gap: 9px;
}

.evd-soft-cue i {
    width: 15px;
    height: 15px;
}

/* --- Standard of proof --- */
.evd-standard {
    max-width: 640px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* --- The room --- */
.evd-room .container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 860px;
}

/* --- One exhibit --- */
.evd-exhibit {
    position: relative;
    border: 1px solid var(--border-hairline, var(--border));
    border-radius: var(--radius-lg);
    background: var(--bg-elevated);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.3s ease;
    animation: evd-breathe 9s ease-in-out infinite;
}

.evd-exhibit:nth-child(2) { animation-delay: -3s; }
.evd-exhibit:nth-child(3) { animation-delay: -6s; }

@keyframes evd-breathe {
    0%, 100% { box-shadow: var(--shadow-card); }
    50% { box-shadow: var(--shadow-card-hover); }
}

/* Cursor-tracked ambient glow — evd.js writes --evd-mx/--evd-my
   from mousemove; quiet until hovered, never competes with the
   record's own content. */
.evd-exhibit::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    border-radius: inherit;
    background: radial-gradient(360px circle at var(--evd-mx, 50%) var(--evd-my, 0%),
        rgba(139, 124, 255, 0.14), transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.evd-exhibit:hover {
    transform: translateY(-3px);
    border-color: var(--border);
    animation-play-state: paused;
    box-shadow: var(--shadow-card-hover);
}

.evd-exhibit:hover::before {
    opacity: 1;
}

.evd-seal, .evd-record {
    position: relative;
    z-index: 1;
}

.evd-seal {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 30px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.evd-seal-main {
    display: block;
}

.evd-seal-main .overline {
    display: block;
}

.evd-seal-main .heading-md {
    margin: 4px 0 10px;
}

.evd-claim {
    margin: 0;
    max-width: 56ch;
    color: var(--text-secondary);
    line-height: 1.55;
}

.evd-seal-tag {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border-hairline, var(--border));
    background: var(--surface-glass);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.evd-seal-tag i {
    width: 14px;
    height: 14px;
}

.evd-seal:hover .evd-seal-tag,
.evd-seal:focus-visible .evd-seal-tag {
    color: var(--accent-text, var(--accent));
    border-color: var(--accent);
}

.evd-seal:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* Opened state: the seal glyph swaps to unlocked and the tag
   quiets down — the room's attention moves to the record below. */
.evd-exhibit[data-evd-open] .evd-seal-tag {
    color: var(--success-text);
    border-color: var(--success);
}

/* --- The record (revealed on inspection) --- */
.evd-record {
    border-top: 1px solid var(--border-hairline, var(--border));
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.evd-record.is-open {
    max-height: 1400px;
    opacity: 1;
}

.evd-record-inner {
    padding: 28px 30px 32px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 26px;
    /* Reserved space keeps the expansion from ever shifting layout
       outside its own card — zero CLS on the rest of the page. */
}

.evd-layer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.evd-record.is-open .evd-layer {
    opacity: 1;
    transform: none;
}

.evd-record.is-open .evd-layer:nth-child(2) { transition-delay: 0.06s; }
.evd-record.is-open .evd-layer:nth-child(3) { transition-delay: 0.12s; }

.evd-layer-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.evd-layer .metric-strip {
    margin-top: 0;
}

.evd-layer-artifact {
    align-items: flex-start;
}

.evd-layer-artifact .sv-svg {
    width: 100%;
    height: auto;
    color: var(--text-primary);
}

/* Provenance renders as a raw chain-of-custody record, not a
   designed claim — monospace is the signal of credibility. */
.evd-prov {
    margin: 0;
    padding: 14px 16px;
    border: 1px solid var(--border-hairline, var(--border));
    border-radius: var(--radius-sm);
    background: var(--surface-panel);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.8rem;
    line-height: 1.65;
    color: var(--text-secondary);
}

.evd-backref {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.evd-backref a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.evd-backref a:hover,
.evd-backref a:focus-visible {
    color: var(--text-primary);
}

.evd-record-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-text, var(--accent));
    text-decoration: none;
}

.evd-record-link i {
    width: 14px;
    height: 14px;
    transition: transform 0.2s ease;
}

.evd-record-link:hover i,
.evd-record-link:focus-visible i {
    transform: translateX(3px);
}

/* --- Closing CTA --- */
.evd-cta {
    max-width: 620px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.evd-cta .btn {
    margin-top: 14px;
}

@media (min-width: 860px) {
    .evd-record-inner {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "outcome artifact"
            "provenance artifact";
        align-items: start;
    }

    .evd-layer:nth-child(1) { grid-area: outcome; }
    .evd-layer-artifact { grid-area: artifact; }
    .evd-layer:nth-child(3) { grid-area: provenance; }
}

@media (max-width: 640px) {
    .evd-seal {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 22px 20px;
    }

    .evd-seal-tag {
        align-self: flex-start;
    }

    .evd-record-inner {
        padding: 22px 20px 26px;
    }
}

/* The site-wide fixed .mobile-sticky-cta would otherwise sit on
   top of an open exhibit's own controls on mobile, since a fully
   expanded record is tall. evidence.js hides it (via
   .evd-hide-sticky on <body>) while the Evidence Room is in view,
   same pattern as Home's hero fix in Sprint 3 and Studio's Method
   in Sprint 4. */
.evd-hide-sticky .mobile-sticky-cta {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

@media (prefers-reduced-motion: reduce) {
    .evd-record {
        max-height: none;
        opacity: 1;
        overflow: visible;
        transition: none;
    }

    .evd-layer {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .evd-record-link i,
    .evd-soft-cue,
    .evd-seal-tag {
        transition: none;
    }

    .evd-exhibit {
        animation: none;
        transition: none;
    }

    .evd-exhibit::before {
        display: none;
    }
}
