:root {
    --nx-tool-tp-warm: #ea580c;
    --nx-tool-tp-threshold: #f59e0b;
    --nx-tool-tp-deep: #dc2626;
    --nx-tool-tp-safe: #14b8a6;
    --nx-tool-tp-band-cryo: rgba(56, 189, 248, 0.45);
    --nx-tool-tp-band-bio: rgba(52, 211, 153, 0.45);
    --nx-tool-tp-band-ocean: rgba(45, 212, 191, 0.45);
    --nx-tool-tp-band-atmo: rgba(167, 139, 250, 0.45);
}

.tp-hero-panel {
    margin-top: 1rem;
}

.tp-thermo-value-row {
    text-align: center;
    margin: 0.5rem 0 0.75rem;
}

.tp-thermo-value {
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 700;
    color: var(--nx-tool-tp-threshold);
    line-height: 1.1;
}

.tp-thermo-baseline {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0.35rem 0 0;
}

.tp-thermo-host {
    width: 100%;
    /* Height comes from the SVG's aspectRatio (set inline) so it scales with
       container width. The old 4.5 rem fixed height fits only the old flat
       dial; the new row layout needs a taller box.
       Background is left transparent so the rows sit on the surrounding
       card surface — same visual register as the closest-five panel. */
    border-radius: 6px;
    overflow: visible;
    background: transparent;
}

.tp-thermo-host svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Old axis under the flat dial — hidden now that axis labels live in the
   SVG header. Kept in CSS so existing markup doesn't trip if reused. */
.tp-thermo-axis {
    display: none;
}

/* Small legend explaining the four category colours plus the CROSSED
   chip outline. Sits between the dial and its caption. */
.tp-thermo-legend {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.tp-thermo-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.tp-thermo-swatch {
    display: inline-block;
    width: 14px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.tp-thermo-swatch--crossed {
    background: rgba(220, 38, 38, 0.18);
    border: 1.5px solid #dc2626;
}

/* "How close are the top five?" ranked-bars panel. Each row stacks the
   element name + percent-into-band label, a horizontal track with a
   gradient fill (cool to hot), and the per-element 'if it tipped' line. */
.tp-closest-list {
    list-style: none;
    counter-reset: closest;
    padding: 0;
    margin: 0.65rem 0 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.tp-closest-row {
    counter-increment: closest;
    position: relative;
    padding-left: 2.1rem;
}
.tp-closest-row::before {
    content: counter(closest);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.18);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}
.tp-closest-row--crossed::before {
    background: #dc2626;
    color: #fff;
}
.tp-closest-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.25rem;
}
.tp-closest-name {
    font-weight: 600;
    font-size: 0.98rem;
}
.tp-closest-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.tp-closest-row--crossed .tp-closest-status {
    color: #dc2626;
}
.tp-closest-track {
    position: relative;
    height: 12px;
    border-radius: 6px;
    background: rgba(148, 163, 184, 0.14);
    overflow: hidden;
}
.tp-closest-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 200ms ease-out;
}
.tp-closest-tip {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* 4×4 gauge grid */
.tp-gauge-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}

@media (max-width: 960px) {
    .tp-gauge-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .tp-gauge-grid {
        grid-template-columns: 1fr;
    }
}

.tp-gauge {
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.8rem;
    background: rgba(148, 163, 184, 0.06);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.tp-gauge--priority {
    border-color: rgba(245, 158, 11, 0.55);
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.12);
    background: rgba(245, 158, 11, 0.04);
}

.tp-gauge.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.tp-gauge-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
}

.tp-gauge-name {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.25;
    margin: 0;
}

.tp-gauge-badge {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.14rem 0.4rem;
    border-radius: 3px;
    line-height: 1.2;
}

.tp-gauge-badge.is-live {
    background: rgba(20, 184, 166, 0.18);
    color: var(--nx-tool-tp-safe);
}

.tp-gauge-badge.is-ref {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
}

.tp-gauge-bar-wrap {
    position: relative;
    height: 1.25rem;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(148, 163, 184, 0.12);
}

.tp-gauge-bar-wrap svg {
    display: block;
    width: 100%;
    height: 100%;
}

.tp-gauge-thresholds {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.tp-gauge-footer {
    margin: 0.45rem 0 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.tp-gauge-footer strong {
    color: var(--text-primary);
    font-weight: 600;
}

.tp-gauge-tips {
    margin: 0.5rem 0 0;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 0.88rem;
    line-height: 1.45;
}

.tp-gauge-tips strong {
    color: var(--nx-tool-tp-threshold);
}

.tp-gauge--below .tp-gauge-bar-wrap {
    background: rgba(20, 184, 166, 0.12);
}

.tp-gauge--in-band .tp-gauge-bar-wrap {
    background: rgba(245, 158, 11, 0.14);
}

.tp-gauge--past-high .tp-gauge-bar-wrap {
    background: rgba(234, 88, 12, 0.14);
}

/* Crossed — declared by the Global Tipping Points Report 2025 as having
   passed its tipping point, not just inside the warning band. Stronger
   visual treatment: red card border, red wash on the bar, and a CROSSED
   chip overrides the LIVE / REF badge on that card. */
.tp-gauge--crossed {
    border-color: rgba(220, 38, 38, 0.55);
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.18);
}

.tp-gauge--crossed .tp-gauge-bar-wrap {
    background: rgba(220, 38, 38, 0.18);
}

.tp-gauge-badge.is-crossed {
    background: rgba(220, 38, 38, 0.18);
    color: #b91c1c;
    font-weight: 700;
}

/* GISTEMP chart */
.chart-wrap {
    position: relative;
    height: 320px;
    margin-top: 0.5rem;
}

.tp-chart-legend {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
}

.tp-chart-legend li {
    margin: 0;
}

.tp-chart-legend strong {
    color: var(--text-primary);
}

.tp-lit-hover {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-left: 3px solid var(--nx-tool-tp-threshold);
    font-size: 0.85rem;
    color: var(--text-muted);
    background: rgba(245, 158, 11, 0.06);
    border-radius: 0 4px 4px 0;
}

/* Scrollytelling */
.tp-scrolly-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 1.5rem;
    margin-top: 0.75rem;
}

@media (max-width: 768px) {
    .tp-scrolly-layout {
        grid-template-columns: 1fr;
    }

    .tp-scrolly-sticky {
        position: relative !important;
        top: auto !important;
    }
}

.tp-scrolly-sticky {
    position: sticky;
    top: 1rem;
    align-self: start;
}

.tp-scrolly-preview {
    padding: 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    min-height: 12rem;
    background: var(--bg-subtle, rgba(15, 23, 42, 0.25));
}

.tp-scrolly-preview-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 0.5rem;
    color: var(--text-primary);
}

.tp-scrolly-preview-band {
    font-size: 0.85rem;
    color: var(--nx-tool-tp-threshold);
    margin: 0 0 0.5rem;
    font-weight: 600;
}

.tp-scrolly-preview-status {
    display: inline-block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

.tp-scrolly-preview-status.st-warning {
    background: rgba(245, 158, 11, 0.18);
    color: var(--nx-tool-tp-threshold);
}

.tp-scrolly-preview-status.st-breach {
    background: rgba(234, 88, 12, 0.18);
    color: var(--nx-tool-tp-warm);
}

.tp-scrolly-preview-status.st-monitor {
    background: rgba(20, 184, 166, 0.18);
    color: var(--nx-tool-tp-safe);
}

.tp-scrolly-preview-expl {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-muted);
    margin: 0;
}

.tp-scrolly-step {
    min-height: 55vh;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-subtle);
    opacity: 0.45;
    transition: opacity 0.25s;
}

.tp-scrolly-step.is-active {
    opacity: 1;
}

.tp-scrolly-step h3 {
    font-size: 0.95rem;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tp-scrolly-step-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Cascade — editorial vertical flow (Pattern C). The SVG is laid out by
   hand; these class rules give the inner text editorial polish without the
   bare-SVG defaults. */
.tp-cascade-host {
    width: 100%;
    margin-top: 0.5rem;
}

.tp-cascade-host svg {
    display: block;
    width: 100%;
    height: auto;
}

/* Stage labels — small uppercase eyebrow + display step name. Both
   intentionally restrained so the cards (which carry the actual story)
   read first. */
/* Cascade text — share the page font ("Plus Jakarta Sans") rather than
   the SVG default system-ui, so this panel reads as crisp as the rest
   of the dashboard. text-rendering: geometricPrecision keeps glyphs
   sharp when the viewBox scales. */
.tp-cas-stage-label,
.tp-cas-stage-step,
.tp-cas-el-name,
.tp-cas-el-sub,
.tp-cas-amoc-name,
.tp-cas-amoc-sub {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    text-rendering: geometricPrecision;
}

.tp-cas-stage-label {
    font-weight: 700;
    font-size: 10.5px;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    fill: #94a3b8;
}
.tp-cas-stage-step {
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    fill: #475569;
    letter-spacing: -0.005em;
}

/* Element labels inside each card. The sub class is used multiple times
   per card to render the explanatory sentence on two or three lines. */
.tp-cas-el-name {
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.2;
    fill: var(--text-primary, #0f172a);
}
.tp-cas-el-sub {
    font-weight: 500;
    font-size: 11.5px;
    line-height: 1.4;
    fill: var(--text-muted, #475569);
}

/* AMOC hero block — white type on the teal gradient. */
.tp-cas-amoc-name {
    font-weight: 800;
    font-size: 20px;
    line-height: 1;
    fill: #fff;
    letter-spacing: -0.015em;
    text-anchor: start;
}
.tp-cas-amoc-sub {
    font-weight: 500;
    font-size: 11.5px;
    line-height: 1.35;
    fill: rgba(255, 255, 255, 0.92);
    text-anchor: start;
}

/* AMOC wind-icon waves — all three paths animate in unison via
   stroke-dashoffset (stroke enters from the right, draws across, exits
   to the left). Fades at the start and end of the loop prevent a hard
   pop at the boundary. No animation-delay: the three lines move as one
   unified group. */
.tp-cas-amoc-waves path {
    fill: none;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: tp-cas-amoc-wind 2.4s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
@keyframes tp-cas-amoc-wind {
    0%   { stroke-dashoffset: 50;  opacity: 0; }
    15%  { opacity: 1; }
    60%  { stroke-dashoffset: 0;   opacity: 1; }
    85%  { stroke-dashoffset: -50; opacity: 0.2; }
    100% { stroke-dashoffset: -50; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .tp-cas-amoc-waves path {
        animation: none;
        stroke-dashoffset: 0;
        opacity: 1;
    }
}


.tp-gauge-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    list-style: none;
    padding: 0.5rem 0 0.85rem;
    margin: 0 0 0.75rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.tp-gauge-legend li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.tp-legend-mark {
    display: inline-block;
    width: 24px;
    height: 12px;
    flex-shrink: 0;
}

.tp-legend-mark--band {
    background: rgba(245, 158, 11, 0.55);
    border-radius: 2px;
}

/* Footer note explaining which gauge cards are the priority/most-watched
   six. Sits between the legend and the grid. */
.tp-gauge-priority-note {
    margin: 0 0 0.85rem;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.tp-gauge-priority-swatch {
    display: inline-block;
    width: 14px;
    height: 10px;
    vertical-align: -1px;
    background: rgba(245, 158, 11, 0.18);
    border: 1px solid rgba(245, 158, 11, 0.55);
    border-radius: 2px;
    margin: 0 0.1rem;
}

.tp-legend-mark--central {
    border-left: 2px dashed #f59e0b;
    width: 14px;
    height: 16px;
}

.tp-legend-mark--today {
    background: #0f172a;
    width: 4px;
    height: 16px;
    border-radius: 1px;
}

[data-theme="light"] .tp-legend-mark--today {
    background: #0f172a;
}

.nx-empty {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    margin: 0.25rem 0;
}
