/* ============================================================
   OROSEIMETEO · GRAFICI 48 ORE
   Coerente con Home, Stazioni, Stazione e Previsioni.
   Un grafico per riga, ampio e leggibile.
   ============================================================ */

.charts-page {
    padding: 0 0 64px;
    background: #fff;
}

.charts-page .container {
    width: min(1280px, calc(100% - 40px));
}


/* ============================================================
   HERO
   ============================================================ */

.charts-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
    padding: 56px 0 46px;
    border-bottom: 1px solid var(--om-line-strong);
    background: #fff;
}

.charts-hero-copy {
    min-width: 0;
}

.charts-kicker,
.chart-card-kicker {
    display: block;
    color: var(--om-blue);
    font-size: 14px;
    line-height: 1.25;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .055em;
}

.charts-hero h1 {
    margin: 8px 0 0;
    color: var(--om-blue-dark);
    font-size: clamp(42px, 4.8vw, 60px);
    line-height: 1.02;
    letter-spacing: -.8px;
    font-weight: 700;
}

.charts-hero p {
    max-width: 760px;
    margin: 15px 0 0;
    color: var(--om-muted);
    font-size: 18px;
    line-height: 1.5;
}

.charts-period-badge {
    flex: 0 0 auto;
    min-width: 190px;
    padding: 4px 0 4px 28px;
    border-left: 1px solid var(--om-line-strong);
    text-align: left;
}

.charts-period-badge span {
    display: block;
    color: var(--om-muted-2);
    font-size: 13px;
    line-height: 1.2;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.charts-period-badge strong {
    display: block;
    margin-top: 5px;
    color: var(--om-blue-dark);
    font-size: 31px;
    line-height: 1;
    font-weight: 700;
}


/* ============================================================
   SELETTORE STAZIONE
   4 stazioni sulla stessa riga su desktop.
   ============================================================ */

.station-chart-switch {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-top: 30px;
}

.station-chart-switch a {
    min-width: 0;
    position: relative;
    display: block;
    padding: 18px 20px 17px;
    border: 1px solid var(--om-line);
    border-radius: 4px;
    background: #fff;
    color: var(--om-blue-dark);
    text-decoration: none;
    transition:
        border-color .16s ease,
        background-color .16s ease;
}

.station-chart-switch a:hover {
    border-color: #aebdc5;
    background: #fafafa;
}

.station-chart-switch a.is-active {
    border-color: var(--om-blue);
}

.station-chart-switch a.is-active::before {
    content: "";
    position: absolute;
    top: -1px;
    left: -1px;
    bottom: -1px;
    width: 4px;
    background: var(--om-blue);
    border-radius: 4px 0 0 4px;
}

.station-chart-switch strong {
    display: block;
    color: var(--om-blue-dark);
    font-size: 21px;
    line-height: 1.15;
    font-weight: 700;
}

.station-chart-switch a.is-active strong {
    color: var(--om-blue);
}

.station-chart-switch small {
    display: block;
    margin-top: 5px;
    color: var(--om-muted);
    font-size: 15px;
    line-height: 1.35;
    white-space: normal;
}


/* ============================================================
   ALLINEAMENTO SELETTORE · DESKTOP
   Riserva lo stesso spazio a nome e descrizione.
   ============================================================ */

@media (min-width: 1101px) {

    .station-chart-switch strong {
        min-height: 49px;
    }

    .station-chart-switch small {
        min-height: 41px;
    }
}


/* ============================================================
   CONTESTO
   ============================================================ */

.charts-context {
    display: grid;
    grid-template-columns:
        minmax(0, 1.3fr)
        minmax(240px, .8fr)
        auto;
    align-items: center;
    gap: 22px;
    margin-top: 18px;
    padding: 18px 20px;
    border-top: 1px solid var(--om-line);
    border-bottom: 1px solid var(--om-line);
    background: #fff;
}

.charts-context-station > span,
.charts-context-range span {
    display: block;
    color: var(--om-muted-2);
    font-size: 12px;
    line-height: 1.2;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.charts-context-station strong,
.charts-context-range strong {
    display: block;
    margin-top: 4px;
    color: var(--om-blue-dark);
    font-size: 18px;
    line-height: 1.25;
    font-weight: 700;
}

.charts-context-station small {
    display: block;
    margin-top: 3px;
    color: var(--om-muted);
    font-size: 14px;
    line-height: 1.35;
}

.charts-context-range {
    text-align: center;
}

.charts-status {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    color: var(--om-muted);
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
    white-space: nowrap;
}

.charts-status-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: #48a776;
}

.charts-status.is-error {
    color: #a15353;
}

.charts-status.is-error .charts-status-dot {
    background: #cf6666;
}


/* ============================================================
   GRAFICI
   ============================================================ */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 28px;
}

.chart-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--om-line);
    border-radius: 4px;
    background: #fff;
    box-shadow: none;
}

.chart-card.is-unavailable {
    display: none;
}

.chart-card-head {
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    padding: 18px 24px 17px;
    border-bottom: 1px solid var(--om-line);
}

.chart-card-head > div {
    min-width: 0;
}

.chart-card-kicker {
    margin-bottom: 4px;
    font-size: 12px;
}

.chart-card-head h2 {
    margin: 0;
    color: var(--om-blue-dark);
    font-size: 24px;
    line-height: 1.15;
    font-weight: 700;
}

.chart-unit {
    flex: 0 0 auto;
    padding-left: 18px;
    border-left: 1px solid var(--om-line-strong);
    color: var(--om-muted);
    font-size: 15px;
    line-height: 1.2;
    font-weight: 700;
}

.chart-box {
    width: 100%;
    height: 390px;
    padding: 8px 12px 6px;
}

.chart-box-tall {
    height: 420px;
}

.chart-box .highcharts-container,
.chart-box .highcharts-root {
    width: 100% !important;
}

.chart-box .highcharts-axis-labels text {
    font-family: "Roboto Condensed", Arial, Helvetica, sans-serif !important;
    font-size: 13px !important;
    fill: #6f7880 !important;
}

.chart-box .highcharts-axis-title {
    font-family: "Roboto Condensed", Arial, Helvetica, sans-serif !important;
    font-size: 13px !important;
    fill: #6f7880 !important;
}

.chart-box .highcharts-legend-item text {
    font-family: "Roboto Condensed", Arial, Helvetica, sans-serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    fill: #465c67 !important;
}

.chart-box .highcharts-tooltip text {
    font-family: "Roboto Condensed", Arial, Helvetica, sans-serif !important;
    font-size: 13px !important;
}

.chart-box .highcharts-grid-line {
    stroke: #e7e7e7 !important;
}

.chart-box .highcharts-axis-line,
.chart-box .highcharts-tick {
    stroke: #cfcfcf !important;
}


/* ============================================================
   NOTA
   ============================================================ */

.charts-note {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--om-line-strong);
    color: var(--om-muted);
    font-size: 14px;
    line-height: 1.55;
}

.charts-note strong {
    color: var(--om-blue-dark);
    font-weight: 700;
}


/* ============================================================
   DESKTOP / TABLET ORIZZONTALE
   2 × 2 quando quattro colonne diventano troppo strette.
   ============================================================ */

@media (max-width: 1100px) {

    .station-chart-switch {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 900px) {

    .charts-context {
        grid-template-columns: 1fr 1fr;
    }

    .charts-status {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 760px) {

    .charts-page {
        padding-bottom: 48px;
    }

    .charts-page .container {
        width: min(100% - 24px, 1280px);
    }

    .charts-hero {
        align-items: stretch;
        flex-direction: column;
        gap: 24px;
        padding: 40px 0 34px;
    }

    .charts-hero h1 {
        font-size: 38px;
        letter-spacing: -.4px;
    }

    .charts-hero p {
        font-size: 17px;
        line-height: 1.5;
    }

    .charts-period-badge {
        min-width: 0;
        padding: 18px 0 0;
        border-left: 0;
        border-top: 1px solid var(--om-line);
    }

    .charts-period-badge strong {
        font-size: 28px;
    }

    .station-chart-switch {
        grid-template-columns: 1fr;
        gap: 9px;
        margin-top: 22px;
    }

    .station-chart-switch a {
        padding: 16px 18px;
    }

    .station-chart-switch strong {
        min-height: 0;
        font-size: 20px;
    }

    .station-chart-switch small {
        min-height: 0;
        font-size: 14px;
    }

    .charts-context {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 0;
    }

    .charts-context-range {
        text-align: left;
    }

    .charts-status {
        grid-column: auto;
    }

    .charts-grid {
        gap: 18px;
        margin-top: 22px;
    }

    .chart-card-head {
        min-height: 0;
        padding: 16px 18px 15px;
    }

    .chart-card-head h2 {
        font-size: 21px;
    }

    .chart-card-kicker {
        font-size: 12px;
    }

    .chart-unit {
        padding-left: 12px;
        font-size: 14px;
    }

    .chart-box,
    .chart-box-tall {
        height: 330px;
        padding: 6px 4px 4px;
    }

    .chart-box .highcharts-axis-labels text {
        font-size: 12px !important;
    }

    .chart-box .highcharts-legend-item text {
        font-size: 13px !important;
    }

    .charts-note {
        margin-top: 22px;
        font-size: 13px;
    }
}


@media (max-width: 430px) {

    .charts-page .container {
        width: min(100% - 20px, 1280px);
    }

    .chart-card-head {
        gap: 12px;
        padding-left: 15px;
        padding-right: 15px;
    }

    .chart-card-head h2 {
        font-size: 19px;
    }

    .chart-unit {
        font-size: 13px;
    }

    .chart-box,
    .chart-box-tall {
        height: 310px;
    }
}