/* ══════════════════════════════════════════════════════════════
   TC Climatology — page-specific layout
   ══════════════════════════════════════════════════════════════
   Page-specific layout only. Shared chrome (topbar, basin chips,
   .ace-modal-*, .clim-grid, .clim-panel) lives in tc_radar_styles
   and global_archive_styles, which are loaded before this file.
   ══════════════════════════════════════════════════════════════ */

.tc-clim-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px 64px;
}

@media (max-width: 720px) {
    .tc-clim-main { padding: 16px 12px 32px; }
}

/* ── Header + sub-nav strip ────────────────────────────────── */
.tc-clim-header {
    margin-bottom: 18px;
}
.tc-clim-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tc-clim-h1 {
    margin: 0 0 4px 0;
    font-size: 1.5rem;
    color: var(--text);
    font-weight: 600;
}
.tc-clim-subtitle {
    margin: 0;
    color: var(--text-dim, #8a93a3);
    font-size: 0.86rem;
    line-height: 1.5;
    max-width: 720px;
}

.tc-clim-subnav {
    display: inline-flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(15, 22, 35,0.02);
}
.tc-clim-subnav-btn {
    padding: 9px 18px;
    background: transparent;
    color: var(--text-dim, #8a93a3);
    border: none;
    border-right: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.tc-clim-subnav-btn:last-child { border-right: none; }
.tc-clim-subnav-btn:hover { color: var(--text); background: rgba(15, 22, 35,0.04); }
.tc-clim-subnav-btn.active {
    background: var(--um-green-tint);
    color: var(--um-green);
    font-weight: 600;
}

/* ── Sub-views ─────────────────────────────────────────────── */
.tc-clim-subview { display: block; }
.tc-clim-subview[hidden] { display: none; }

/* The .clim-layout / .clim-grid / .clim-panel rules from
   global_archive_styles.css apply directly on the Stats sub-view —
   no duplication here. Just ensure the layout breathes when
   embedded directly in <main> instead of inside a tab section. */
#tc-clim-stats .clim-layout {
    margin: 0;
}
#tc-clim-stats .clim-header {
    margin-bottom: 14px;
}

/* ── Reanalysis Globe sub-view: hybrid split-panel banner ─── */
/* Compact banner that sits above the featured-views gallery: icon +
   description on the left, prominent launch button on the right.
   Replaces the older full-card launcher with its 5-bullet list —
   the bullets' content is now demonstrated by the gallery tiles. */
.tc-clim-globe-banner {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 22px;
    margin: 12px 0 22px;
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-left: 3px solid var(--um-green);
    border-radius: 10px;
}
.tc-clim-globe-banner-icon {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* SVG wireframe strokes inherit this via currentColor — flips with
       theme so the green is readable on both light + dark backgrounds.
       In dark mode --um-green resolves to the brightened emerald. */
    color: var(--um-green);
}
.tc-clim-globe-banner-icon svg {
    width: 56px;
    height: 56px;
}
.tc-clim-globe-banner-text {
    flex: 1 1 auto;
    min-width: 0;
}
.tc-clim-globe-banner-title {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}
.tc-clim-globe-banner-lede {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-dim, #8a93a3);
}
.tc-clim-globe-banner-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: var(--um-green);
    color: #ffffff;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.01em;
    border-radius: 8px;
    transition: background 0.15s, transform 0.15s;
    white-space: nowrap;
}
.tc-clim-globe-banner-btn:hover {
    background: var(--um-green-deep);
    transform: translateY(-1px);
}
.tc-clim-globe-banner-btn:focus {
    outline: 2px solid var(--um-green);
    outline-offset: 3px;
}
.tc-clim-globe-banner-btn .tc-clim-cta-arrow {
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.15s;
}
.tc-clim-globe-banner-btn:hover .tc-clim-cta-arrow {
    transform: translateX(3px);
}

@media (max-width: 720px) {
    .tc-clim-globe-banner {
        flex-wrap: wrap;
        gap: 12px;
        padding: 14px 16px;
    }
    .tc-clim-globe-banner-icon { display: none; }
    .tc-clim-globe-banner-btn  { width: 100%; justify-content: center; }
}

/* "Featured views" heading directly under the banner — no extra
   top margin needed since the banner already provides spacing. */
#tc-clim-globe > .tc-clim-gallery-heading {
    margin-top: 16px;
}

/* ── Featured-views gallery (2×3 tile grid) ──────────────── */
.tc-clim-gallery-heading {
    margin: 36px 0 4px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    text-align: center;
}
.tc-clim-gallery-sub {
    margin: 0 0 18px 0;
    text-align: center;
    color: var(--text-dim, #8a93a3);
    font-size: 0.84rem;
}
.tc-clim-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 32px;
}
@media (max-width: 1100px) {
    .tc-clim-gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .tc-clim-gallery { grid-template-columns: 1fr; }
}

.tc-clim-tile {
    display: flex;
    flex-direction: column;
    background: var(--surface-raised, rgba(15, 22, 35,0.03));
    border: 1px solid var(--border, var(--border));
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.tc-clim-tile:hover {
    border-color: rgba(244, 115, 33,0.45);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.1);
}

.tc-clim-tile-thumb {
    aspect-ratio: 16 / 9;
    background: linear-gradient(135deg, #0d1318, #1a2230);
    overflow: hidden;
    position: relative;
}
.tc-clim-tile-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Placeholder gradients for tiles whose thumbnails haven't been
   captured yet. <img onerror> hides itself, leaving the gradient
   visible underneath. data-grad swaps palettes per tile so the
   wall-of-tiles doesn't look flat while screenshots are pending. */
.tc-clim-tile-thumb-placeholder[data-grad="mpi"]   { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.tc-clim-tile-thumb-placeholder[data-grad="corr"]  { background: linear-gradient(135deg, #4a9b6e, #ef4444); }
.tc-clim-tile-thumb-placeholder[data-grad="shear"] { background: linear-gradient(135deg, #34d399, #fb923c); }
.tc-clim-tile-thumb-placeholder::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 25%, rgba(15, 22, 35,0.18) 0%, rgba(0,0,0,0) 55%);
}

.tc-clim-tile-body {
    padding: 12px 14px 14px;
}
.tc-clim-tile-title {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92rem;
    margin-bottom: 4px;
}
.tc-clim-tile-desc {
    color: var(--text-dim, #8a93a3);
    font-size: 0.78rem;
    line-height: 1.45;
}
.tc-clim-tile-desc strong { color: var(--text); }

/* ── Subseasonal subview: segmented toggle (mode + season) ─────────
   Matches the basin-chip visual language for consistency. The vendored
   GC-ATLAS .segmented styles only ship on the climatology_globe page,
   so we redefine a minimal version here. */
#tc-clim-subseasonal .segmented {
    display: inline-flex;
    gap: 4px;
    flex-wrap: wrap;
}
#tc-clim-subseasonal .segmented button {
    padding: 4px 12px;
    border-radius: 12px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--surface);
    color: var(--slate);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
}
#tc-clim-subseasonal .segmented button:hover:not(.active) {
    border-color: var(--blue);
    color: var(--text);
}
#tc-clim-subseasonal .segmented button.active {
    background: var(--blue);
    color: white;
    border-color: var(--blue);
}

/* ════════════════════════════════════════════════════════════════
   Evolution-only iframe mode — applied when the URL hash contains
   evoOnly=1 (or evo=1). Used by the RT Monitor's Subseasonal tab to
   embed the full phase-evolution modal in an iframe without leaving
   the RT page. Strips every chrome element so the modal floats clean
   inside the parent iframe's bounding box.
   ════════════════════════════════════════════════════════════════ */
html.evo-only-mode body > *:not(#sub-evolution-modal):not(script):not(style) {
    display: none !important;
}
html.evo-only-mode body {
    margin: 0; padding: 0; background: transparent !important;
    height: 100%; min-height: 0;
}
html.evo-only-mode #sub-evolution-modal {
    position: static !important;
    background: transparent !important;
    display: flex !important;
    align-items: stretch;
    justify-content: stretch;
    min-height: 100vh;
}
html.evo-only-mode #sub-evolution-modal .ace-modal-content {
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh !important;
}

/* ════════════════════════════════════════════════════════════════
   Phase clock cards on the Subseasonal subview. Mirrors the layout
   used in the RT Monitor's Subseasonal tab (realtime_ir_styles.css)
   so the two surfaces stay visually consistent. Classes are scoped
   to .sub-clock-* so no risk of collision with other widgets.
   ════════════════════════════════════════════════════════════════ */
.sub-clock-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.sub-clock-card {
    position: relative;
    background: var(--surface-raised, #ffffff);
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: 6px;
    padding: 6px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sub-clock-card:hover {
    border-color: rgba(46, 125, 255, 0.55);
    box-shadow: 0 1px 4px rgba(46, 125, 255, 0.12);
}
.sub-clock-mode {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--text-dim, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 2px;
}
.sub-clock-svg {
    width: 110px;
    height: 110px;
    display: block;
}
.sub-clock-readout {
    display: flex;
    gap: 8px;
    margin-top: 3px;
    font-size: 0.65rem;
    font-variant-numeric: tabular-nums;
}
.sub-clock-key {
    color: var(--text-dim, #64748b);
    margin-right: 3px;
}
.sub-clock-val { font-weight: 600; }
.sub-clock-status {
    margin-top: 3px;
    font-size: 0.6rem;
    color: var(--text-dim, #64748b);
    text-align: center;
    min-height: 14px;
    line-height: 1.3;
}
.sub-clock-save-btn {
    position: absolute;
    top: 3px;
    right: 3px;
    z-index: 3;
    width: 24px;
    height: 24px;
    padding: 0;
    line-height: 1;
    font-size: 0.8rem;
    color: var(--text-dim, #64748b);
    background: rgba(255,255,255,0.78);
    border: 1px solid var(--border, rgba(0,0,0,0.08));
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.sub-clock-save-btn:hover,
.sub-clock-save-btn:focus-visible {
    background: rgba(46,125,255,0.18);
    color: var(--text, #0f172a);
    border-color: rgba(46,125,255,0.55);
    outline: none;
}
[data-theme="dark"] .sub-clock-save-btn { background: rgba(22,27,36,0.78); }

@media (max-width: 700px) {
    /* Stack the clock grid + embedded Hovmöller into one column on
       mobile so neither column gets squeezed below readable width. */
    #sub-now-widget { grid-template-columns: 1fr !important; }
}

/* ════════════════════════════════════════════════════════════════
   Save-PNG buttons in the Phase Evolution modal (PC chart + amp
   chart). Always visible (not hover-only) so the affordance works
   on touch devices too. Positioned over the chart-wrap header on
   the right so the chart canvas isn't cropped.
   ════════════════════════════════════════════════════════════════ */
.sub-evo-save-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 4;
    padding: 4px 10px;
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text, #0f172a);
    background: rgba(46,125,255,0.12);
    border: 1px solid var(--border, rgba(0,0,0,0.12));
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
/* Keep the chart-wrap's section title from underlapping the save
   button: pad the title's right edge so any hint text wraps before
   running into the absolutely-positioned Save PNG button. */
#sub-evolution-modal .ace-chart-wrap > .ace-section-title {
    padding-right: 110px;
}
.sub-evo-save-btn:hover,
.sub-evo-save-btn:focus-visible {
    background: rgba(46,125,255,0.28);
    border-color: rgba(46,125,255,0.55);
    outline: none;
}
.sub-evo-save-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}
[data-theme="dark"] .sub-evo-save-btn {
    color: #e2e8f0;
    background: rgba(46,125,255,0.18);
    border-color: rgba(148,163,184,0.25);
}
@media (max-width: 600px) {
    /* Tighter padding on mobile so the button doesn't overlap the
       section title. Bottom-right would be ideal but the chart fills
       the bottom — keep top-right and rely on the smaller footprint. */
    .sub-evo-save-btn { padding: 4px 8px; font-size: 0.66rem; }
}
