/* The live status page of the GRH Lean verification run (templates/grh.html,
   static/js/grh-dashboard.js, docs/grh_dashboard.md). Builds on public.css.
   The dashboard sits above the fold: a one-line title, then the stats card
   beside a short column of context and the checks. */

.grh-wrap { padding-top: 1.3rem; }
.grh-title {
    font-family: var(--font-display); font-size: 1.55rem; font-weight: 700; line-height: 1.25;
    color: var(--text-strong); margin: 0 0 0.9rem;
}
/* Desktop: the stats card over the claims on the left, the context and checks
   on the right. The right card spans both rows; the second row is 1fr, so it
   takes up whatever height the right card needs beyond the stats card, and the
   claims card stretches to end level with it. */
.grh-top {
    display: grid; gap: 1rem;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    grid-template-areas: "dash side" "claims side";
}
.grh-dash { grid-area: dash; }
.grh-side { grid-area: side; }
.grh-claims { grid-area: claims; }
/* Narrow: one column, and the checks before the claims. */
@media (max-width: 900px) {
    .grh-top { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "dash" "side" "claims"; }
}

/* ── The stats card ── */
.grh-dash { padding: 1.1rem 1.3rem 1rem; }
.grh-dash-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin-bottom: 0.85rem; }
.grh-updated { font-size: 0.82rem; color: var(--text-3); }
.grh-views { margin-left: auto; font-size: 0.82rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.grh-views strong { color: var(--text-2); font-weight: 650; }

.grh-live {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-size: 0.78rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--danger-vivid);
}
.grh-live-dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.grh-live.is-live .grh-live-dot { animation: grh-blink 1.6s ease-in-out infinite; }
.grh-live.is-live .grh-live-dot::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%; background: currentColor;
    animation: grh-ring 1.6s ease-out infinite;
}
.grh-live.is-waiting, .grh-live.is-stale { color: var(--text-4); }
.grh-live.is-done { color: var(--success); }
@keyframes grh-ring { from { transform: scale(1); opacity: 0.55; } to { transform: scale(2.8); opacity: 0; } }
@keyframes grh-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) {
    .grh-live.is-live .grh-live-dot, .grh-live.is-live .grh-live-dot::after { animation: none; }
}

.grh-progress-head {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
    gap: 0.3rem 1rem; margin-bottom: 0.55rem;
}
.grh-progress-count { font-size: 1rem; color: var(--text-2); }
.grh-progress-count #grh-built {
    font-family: var(--font-display); font-size: 1.85rem; font-weight: 700;
    color: var(--text-strong); font-variant-numeric: tabular-nums;
}
.grh-progress-percent {
    font-family: var(--font-display); font-size: 1.25rem; font-weight: 650;
    color: var(--accent-deep); font-variant-numeric: tabular-nums;
}
.grh-bar { height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.grh-bar-fill { height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.8s ease; }
.grh-bar-fill.is-done { background: var(--success); }
.grh-bar-fill.is-failed { background: var(--danger); }

/* Columns as wide as their values, spread across the card: one row on a
   laptop, two rows of three on a phone. */
.grh-stats {
    display: flex; flex-wrap: wrap; justify-content: space-between;
    gap: 0.9rem 1.2rem; margin-top: 1rem;
}
.grh-stats .pub-stat-value { font-size: 1.35rem; white-space: nowrap; }
.grh-stats .pub-stat-value.is-bad { color: var(--danger-strong); }

.grh-chart { margin-top: 1rem; min-height: 1px; }
.grh-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.grh-chart .grh-area { fill: var(--accent-wash-1); stroke: none; }
.grh-chart .grh-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.grh-chart .grh-dot { fill: var(--accent); }
.grh-chart .grh-grid { stroke: var(--border-2); stroke-width: 1; }
.grh-chart .grh-tick { fill: var(--text-3); font-size: 11px; font-family: var(--font-ui); }
.grh-machine { margin: 0.7rem 0 0; font-size: 0.8rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.grh-machine:empty { display: none; }

/* ── The side column ── */
.grh-side { padding: 1.1rem 1.2rem; }
.grh-blurb { margin: 0 0 1rem; font-size: 0.9rem; line-height: 1.55; color: var(--text-2); }
.grh-label {
    font-size: 0.74rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-3); margin: 0 0 0.5rem;
}
.grh-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.grh-check {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 0.1rem 0.7rem;
    padding: 0.5rem 0; border-top: 1px solid var(--border-2);
}
.grh-check:first-child { border-top: none; padding-top: 0.15rem; }
.grh-check-name { font-size: 0.9rem; font-weight: 600; color: var(--text-strong); }
.grh-check-detail { font-size: 0.8rem; line-height: 1.45; color: var(--text-3); margin-top: 0.1rem; }
.grh-check .pub-badge { margin-top: 0.05rem; }
.grh-side-note { margin: 0.6rem 0 0; font-size: 0.8rem; color: var(--text-3); }

/* ── The claims ── */
.grh-claims { display: flex; flex-direction: column; padding: 1.1rem 1.3rem 1.2rem; }
.grh-claims-lede { margin: 0 0 0.75rem; font-size: 0.85rem; line-height: 1.5; color: var(--text-2); }
/* The code takes whatever height the row leaves and scrolls inside it. Being
   absolutely positioned, it adds nothing to the column's own height, so it can
   never push the left column past the right one. */
.grh-code-wrap { position: relative; flex: 1 1 auto; min-height: 11rem; }
.grh-code {
    position: absolute; inset: 0; margin: 0; padding: 0.85rem 1rem; overflow: auto;
    background: var(--surface-2); border: 1px solid var(--border-3); border-radius: var(--radius-lg);
    font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.6; color: var(--text-1);
}
.grh-code:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 900px) {
    .grh-code-wrap { position: static; min-height: 0; }
    .grh-code { position: static; max-height: 24rem; }
}
.pub-body code { font-family: var(--font-mono); font-size: 0.9em; }

/* ── The checks at a glance, in the stats card: narrow screens only ── */
.grh-checks-summary { display: none; }
.grh-cs-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--surface-5); flex-shrink: 0; }
.grh-cs-dot.is-pass { background: var(--success); }
.grh-cs-dot.is-running { background: var(--accent); }
.grh-cs-dot.is-fail { background: var(--danger); }
.grh-cs-dot.is-review { background: var(--warning); }
.grh-cs-label { font-size: 0.82rem; color: var(--text-2); margin-left: 0.35rem; }
.grh-cs-label strong { color: var(--text-strong); }

/* ── Phones: everything vital in the first screen ── */
@media (max-width: 900px) {
    .grh-checks-summary {
        display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap;
        margin-top: 0.9rem; padding-top: 0.75rem; border-top: 1px solid var(--border-2);
    }
}
@media (max-width: 560px) {
    .grh-wrap { padding: 0.9rem 0.85rem 3rem; }
    .grh-title { font-size: 1.2rem; margin-bottom: 0.6rem; }
    .grh-dash { padding: 0.85rem 0.95rem 0.8rem; }
    .grh-dash-head { margin-bottom: 0.6rem; }
    .grh-progress-count { font-size: 0.9rem; }
    .grh-progress-count #grh-built { font-size: 1.5rem; }
    .grh-progress-percent { font-size: 1.05rem; }
    .grh-stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: space-between; gap: 0.7rem 0.8rem; margin-top: 0.8rem; }
    .grh-stats .pub-stat-value { font-size: 1.08rem; }
    .grh-stats .pub-stat-label { font-size: 0.66rem; letter-spacing: 0.03em; }
    .grh-chart { margin-top: 0.8rem; }
    .grh-side { padding: 0.95rem 1rem; }
}

/* ── About this page, with the event log ── */
.grh-about { margin-top: 2rem; max-width: 860px; }
.grh-about-title {
    font-family: var(--font-display); font-size: 1.15rem; font-weight: 700;
    color: var(--text-strong); margin: 0 0 0.6rem;
}
.grh-about-list {
    margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.35rem;
    font-size: 0.92rem; line-height: 1.6; color: var(--text-2);
}
.grh-log { margin: 0.3rem 0 0; padding-left: 1.1rem; list-style: disc; }
.grh-log time { margin-right: 0.25rem; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Rolling digits (grh-dashboard.js rollTo): a mechanical counter ── */
.rd { --rd-h: 1.2em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rd-cell {
    position: relative; display: inline-block; height: var(--rd-h); line-height: var(--rd-h);
    /* clip-path, not overflow: hidden, which would move the cell's baseline to its bottom edge */
    clip-path: inset(0);
}
.rd-ghost { visibility: hidden; }
.rd-strip {
    position: absolute; top: 0; left: 0; width: 100%;
    display: flex; flex-direction: column; text-align: center;
    transition: transform 1.1s cubic-bezier(0.33, 1, 0.68, 1);
}
.rd-strip > span { display: block; height: var(--rd-h); line-height: var(--rd-h); }
.rd.is-still .rd-strip { transition: none; }
@media (prefers-reduced-motion: reduce) { .rd-strip { transition: none; } }

