/* ============================================================
   charts.css — donut figures and their value tables.

   Colour comes entirely from the --fh-chart-* ramps in main.css (D-011: no hex
   outside main.css). This file is layout only.

   Every figure pairs the donut with a value table carrying the same swatches.
   That is not decoration: the light end of the day ramp falls below 3:1 on the
   card, and a visible label or table view is the required relief. Identity is
   therefore never carried by hue alone, and the figure still reads if the
   colours fail entirely.
   ============================================================ */

.fh-fig {
    background: var(--fh-surface);
    border: 1px solid var(--fh-rule);
    border-radius: var(--fh-radius);
    padding: var(--fh-space-lg);
    margin: var(--fh-space-xl) 0;
}

.fh-fig__kicker {
    display: block;
    font-family: var(--fh-font-mono);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
    margin-bottom: var(--fh-space-xs);
}

.fh-fig__title {
    display: block;
    font-family: var(--fh-font-display);
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.25;
    margin-bottom: var(--fh-space-xs);
}

.fh-fig__sub {
    display: block;
    font-size: 0.9rem;
    color: var(--fh-ink-2);
    margin-bottom: var(--fh-space-lg);
}

.fh-fig__body {
    display: flex;
    gap: var(--fh-space-xl);
    align-items: center;
    flex-wrap: wrap;
}

.fh-donut-wrap {
    position: relative;
    flex: 0 0 auto;
}

.fh-donut-centre {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    pointer-events: none;
}

.fh-donut-centre__big {
    display: block;
    font-family: var(--fh-font-display);
    font-weight: 800;
    font-size: 2.1rem;
    line-height: 1;
    letter-spacing: -0.02em;
}

.fh-donut-centre__small {
    display: block;
    font-family: var(--fh-font-mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
    margin-top: var(--fh-space-xs);
    max-width: 110px;
}

/* The value table. Wide content scrolls inside its own container so the page
   body never scrolls sideways. */
.fh-fig__table-wrap {
    flex: 1 1 250px;
    min-width: 250px;
    overflow-x: auto;
}

.fh-vt {
    width: 100%;
    border-collapse: collapse;
}

.fh-vt th {
    text-align: left;
    font-family: var(--fh-font-mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
    font-weight: 400;
    border-bottom: 1px solid var(--fh-rule);
    padding: 0 0 var(--fh-space-sm);
}

.fh-vt th.fh-vt__num,
.fh-vt td.fh-vt__num {
    text-align: right;
}

.fh-vt td {
    padding: var(--fh-space-sm) 0;
    border-bottom: 1px solid var(--fh-rule);
    font-size: 0.94rem;
}

.fh-vt tr:last-child td {
    border-bottom: 0;
}

.fh-vt__sw {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: var(--fh-space-sm);
    vertical-align: -1px;
}

.fh-vt td.fh-vt__num {
    font-family: var(--fh-font-mono);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.fh-vt td.fh-vt__pct {
    font-family: var(--fh-font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
}

.fh-vt tr.is-on td {
    background: var(--fh-tint);
}

.fh-fig__src {
    font-size: 0.8rem;
    color: var(--fh-ink-2);
    margin-top: var(--fh-space-lg);
    line-height: 1.5;
}

/* Stat tiles, for a measure the donut cannot carry. */
.fh-tiles {
    display: flex;
    gap: var(--fh-space-md);
    flex-wrap: wrap;
    margin-top: var(--fh-space-lg);
    border-top: 1px solid var(--fh-rule);
    padding-top: var(--fh-space-lg);
}

.fh-tile {
    flex: 1 1 150px;
    border: 1px solid var(--fh-rule);
    border-radius: var(--fh-radius-sm);
    padding: var(--fh-space-md);
}

.fh-tile__lab {
    display: block;
    font-family: var(--fh-font-mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fh-ink-2);
}

.fh-tile__val {
    display: block;
    font-family: var(--fh-font-display);
    font-weight: 800;
    font-size: 2rem;
    line-height: 1.1;
    margin-top: var(--fh-space-xs);
}

.fh-tile__note {
    display: block;
    font-size: 0.82rem;
    color: var(--fh-ink-2);
    margin-top: var(--fh-space-xs);
}

/* Hover / focus: dim the rest, keep the hovered slice lit. */
.fh-donut__seg {
    transition: opacity 0.12s;
}

.fh-donut.is-dim .fh-donut__seg {
    opacity: 0.35;
}

.fh-donut.is-dim .fh-donut__seg.is-on {
    opacity: 1;
}

.fh-donut__seg:focus-visible {
    outline: 2px solid var(--fh-accent-text);
    outline-offset: 2px;
}

#fhChartTip {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    background: var(--fh-surface-inverse);
    color: var(--fh-on-inverse);
    border-radius: var(--fh-radius-sm);
    padding: var(--fh-space-sm) 0.7rem;
    font-size: 0.82rem;
    line-height: 1.35;
    max-width: 220px;
}

#fhChartTip .fh-tip__name {
    font-weight: 600;
}

#fhChartTip .fh-tip__val {
    font-family: var(--fh-font-mono);
    font-size: 0.78rem;
    opacity: 0.85;
    margin-top: 0.15rem;
}

@media (max-width: 620px) {
    .fh-fig__body {
        gap: var(--fh-space-md);
    }
    .fh-fig__table-wrap {
        min-width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fh-donut__seg,
    #fhChartTip {
        transition: none;
    }
}
