/* FIA forest type transitions dashboard. Standalone page; FEMC tones. */

/* FEMC 2026 palette (femc-scripts regeneration/FEMC_palette-contrasts_2026.png).
   Pairings hold WCAG AA or better: ink #26292C on white/pale panels is AAA,
   slate #5D646B on white/#F4F9EB is AA, white on #097954 is AA (5.41:1). */
:root {
    color-scheme: light;
    --ink: #26292c;
    --body: #5d646b;
    --green: #097954;
    --green-dark: #075e42;
    --pale: #f4f9eb;
    --hairline: #bcd97c;
    --surface: #ffffff;
    --muted: #5d646b;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--surface);
    color: var(--body);
    font-family: 'Open Sans', sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

/* fluid to 1900px: the alluvial earns the width; prose blocks below keep
   their own readable max-widths */
.wrap {
    max-width: 1900px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */

.page-head {
    background: var(--pale);
    border-bottom: 1px solid var(--hairline);
    padding: 24px 0 20px;
}

.head-row {
    display: flex;
    align-items: center;
    gap: 28px;
    margin-bottom: 16px;
}

.brand { flex: none; }

.brand img {
    display: block;
    height: 84px;
    width: auto;
}

.head-text { min-width: 0; }

.page-head h1 {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 300;
    color: var(--ink);
}

.lede {
    margin: 0;
    max-width: 760px;
}

@media (max-width: 620px) {
    .head-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .brand img { height: 64px; }
}

.vintage { color: var(--muted); }

.kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.kpi {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 6px 14px;
    line-height: 1.3;
}

.kpi strong {
    display: block;
    font-size: 19px;
    font-weight: 600;
    color: var(--ink);
}

.kpi span { font-size: 12px; }

/* Sticky control bar */

.controls {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--surface);
    border-bottom: 1px solid var(--hairline);
    box-shadow: 0 1px 4px rgba(70, 70, 70, 0.06);
}

.tabs {
    display: flex;
    gap: 4px;
    padding-top: 4px;
    border-bottom: 1px solid #ececec;
}

.tab {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--body);
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 8px 14px;
    margin-bottom: -1px;
    cursor: pointer;
}

.tab:hover { color: var(--ink); }

.tab.active {
    color: var(--green);
    border-bottom-color: var(--green);
}

.tab:focus-visible {
    outline: 2px solid var(--green-dark);
    outline-offset: -2px;
}

/* chart left, filter panel right */
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 26px;
    align-items: start;
}

.side-col {
    position: sticky;
    top: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 22px;
}

.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--pale);
    border: 1px solid var(--hairline);
    border-radius: 6px;
    padding: 14px 16px 18px;
}

/* stats stack under the filters in the side column */
.side-col .kpis { flex-direction: column; gap: 8px; }

.side-col .kpi {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    padding: 8px 14px;
}

.side-col .kpi strong { font-size: 17px; }

.side-col .kpi span { text-align: right; }

.filter-title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--green);
    border-bottom: 1px solid var(--hairline);
    padding-bottom: 8px;
}

.filter-panel .seg label:not(legend) { margin: 2px 4px 2px 0; }

.filter-panel .picker select { width: 100%; max-width: none; }

@media (max-width: 900px) {
    .content-grid { grid-template-columns: 1fr; }
    .side-col { position: static; order: -1; margin-top: 12px; }
}

/* About link + arrival dialog */

.about-link {
    font: inherit;
    font-size: 13px;
    color: var(--green);
    background: none;
    border: 0;
    padding: 0;
    margin-left: 10px;
    text-decoration: underline;
    cursor: pointer;
}

.about-link:hover { color: var(--green-dark); }

/* house modal anatomy (see FHA / indicators aboutModal): wide dialog,
   header with centered title + corner close, tab row, well content boxes */
#about-dialog {
    width: min(800px, calc(100vw - 40px));
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0;
    color: var(--body);
    font-family: 'Open Sans', sans-serif;
    box-shadow: 0 8px 30px rgba(38, 41, 44, 0.25);
}

#about-dialog::backdrop { background: rgba(38, 41, 44, 0.55); }

.modal-head {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    padding: 16px 20px;
}

.modal-head h2 {
    flex: 1;
    margin: 0;
    text-align: center;
    font-size: 24px;
    font-weight: 300;
    color: var(--ink);
}

.modal-x {
    font-size: 26px;
    line-height: 1;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: 0;
    padding: 0 2px;
    cursor: pointer;
}

.modal-x:hover { color: var(--ink); }

.modal-body { padding: 16px 20px 4px; }

.about-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 14px;
}

.about-tab {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--body);
    background: none;
    border: 0;
    border-bottom: 3px solid transparent;
    padding: 7px 14px;
    margin-bottom: -1px;
    cursor: pointer;
}

.about-tab:hover { color: var(--ink); }

.about-tab.active {
    color: var(--green);
    border-bottom-color: var(--green);
}

.about-sec.well {
    background: var(--pale);
    border: 1px solid var(--hairline);
    border-radius: 4px;
    padding: 14px 18px;
    min-height: 210px;
}

#about-dialog ul { padding-left: 20px; margin: 4px 0; }

#about-dialog li { margin-bottom: 8px; }

.about-note { font-size: 12.5px; color: var(--muted); }

.about-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 20px 18px;
}

.about-dismiss { font-size: 13px; }

.about-start {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--green);
    border: 0;
    border-radius: 16px;
    padding: 7px 20px;
    cursor: pointer;
}

.about-start:hover { background: var(--green-dark); }

.seg {
    border: 0;
    margin: 0;
    padding: 0;
}

.seg legend, .picker label {
    display: block;
    padding: 0 0 3px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.seg input[type="radio"],
.seg input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.seg label:not(legend) {
    display: inline-block;
    margin: 0 2px 0 0;
    padding: 4px 12px;
    border: 1px solid #d5d5d5;
    border-radius: 14px;
    font-size: 13px;
    color: var(--body);
    cursor: pointer;
    user-select: none;
}

.seg input:not(:checked):not(:disabled) + label:hover {
    border-color: var(--green);
    color: var(--ink);
}

.seg input:checked + label {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    font-weight: 600;
}

.seg input:focus-visible + label {
    outline: 2px solid var(--green-dark);
    outline-offset: 2px;
}

.seg input:disabled + label {
    opacity: 0.45;
    cursor: not-allowed;
}

.picker select {
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    padding: 4px 8px;
    border: 1px solid #d5d5d5;
    border-radius: 4px;
    background: var(--surface);
    max-width: 240px;
}

.hint {
    width: fit-content;
    font-size: 12px;
    color: var(--body);
    background: #ddefee;
    border-radius: 10px;
    padding: 3px 10px;
}

/* Charts */

main.wrap { padding-top: 22px; padding-bottom: 30px; }

.load-note {
    text-align: center;
    color: var(--muted);
    padding: 30px 0;
}

.load-error { color: #b03a2e; }

.chart-block {
    margin: 0 0 34px;
}

/* Highcharts 13 sets color-scheme on its own container; keep charts on the
   light theme to match this light-only page. */
.highcharts-container { color-scheme: light; }

.chart-tall { min-height: 660px; }

/* per-interval map row: small multiples spread edge to edge so each sits
   under its alluvial column, like the year labels above them */
.map-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}

.map-cell {
    flex: 0 1 250px;
    min-width: 200px;
    min-height: 200px;
}

/* phones scroll the alluvial horizontally instead of crushing 4 columns */
.chart-scroll { overflow-x: auto; }

.chart-scroll .chart-tall { min-width: 640px; }

.caption {
    margin: 8px auto 0;
    max-width: 900px;
    font-size: 12.5px;
    color: var(--muted);
}

/* Footer */

.page-foot {
    background: var(--pale);
    border-top: 1px solid var(--hairline);
    padding: 18px 0 24px;
    font-size: 13px;
}

#methodology { max-width: 900px; }

.credit { color: var(--muted); margin-bottom: 0; }

@media (max-width: 760px) {
    .controls { position: static; }
    .chart-tall { min-height: 480px; } /* matches the Highcharts responsive rule */
}

/* short viewports (landscape phones): a sticky bar would eat half the screen */
@media (max-height: 600px) {
    .controls { position: static; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

@media print {
    .controls, .filter-panel, .kpis, .page-foot .credit { display: none; }
    .content-grid { grid-template-columns: 1fr; }
    .page-head { background: none; border: 0; padding-bottom: 0; }
    .chart-scroll { overflow: visible; }
    .caption { max-width: none; }
    body { font-size: 12px; }
}
