/* ==========================================================================
   Telefoon-layout

   viewport_boot.js zet `weerlab-phone` op <html> wanneer `window.weerlab.BP`
   matcht. We hangen de telefoon CSS aan die class, niet alleen aan @media, omdat
   een browser zonder viewport meta anders een 980px layout gebruikt en de
   telefoonregels niet pakt.
   ========================================================================== */

html.weerlab-phone {

    /* Panel is bij 720px al full width. Op telefoon maken we padding kleiner,
       zodat de charts meer bruikbare breedte krijgen. */
    .weerlab-panel-body {
        padding: 14px 14px 24px;
    }

    /* ---- Panel header: titel en acties onder elkaar ---------------------- */
    .weerlab-panel-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }

    .weerlab-actions {
        width: 100%;
    }

    /* Grote tap targets, als de rij wrapt krijgen de buttons de hele breedte. */
    .weerlab-actions > * {
        flex: 1;
    }

    .weerlab-actions button {
        width: 100%;
        min-height: 44px;
    }

    /* wrap voor de verdict op een smal scherm */
    .weerlab-verdict__row {
        flex-wrap: wrap;
        gap: 8px;
    }

    .weerlab-verdict__text {
        flex: 1 1 100%;
        min-width: 0;
    }

    .weerlab-verdict__legend {
        flex: 1 1 100%;
        padding-top: 0;
    }

    .weerlab-verdict__headline {
        text-wrap: balance;
    }


    .weerlab-plot-card {
        padding: 8px 4px;
    }

    .weerlab-plot-card,
    .weerlab-plot-card .js-plotly-plot {
        width: 100% !important;
        min-width: 0 !important;
    }

    /* De weercode strip moet mee met dezelfde phone margin.l als de charts.
       Inline style zegt 72px, daarom is hier !important nodig. */
    .weerlab-wc-strip {
        margin-left: 34px !important;
    }

    /* De strip is HTML, dus we draaien de HH:MM labels zelf net als Plotly op
       telefoon. De flex cells blijven even breed; alleen het label draait. */
    .weerlab-wc-strip__ticks {
        margin-top: 8px !important;
        min-height: 34px;
        align-items: flex-start;
    }

    .weerlab-wc-strip__tick {
        position: relative;
        height: 34px;
        min-width: 0;
        overflow: visible;
        font-size: 9px !important;
        line-height: 1;
    }

    .weerlab-wc-strip__tick-label {
        position: absolute;
        top: 16px;
        left: 50%;
        display: inline-block;
        transform: translate(-50%, -50%) rotate(-90deg);
        transform-origin: center;
        white-space: nowrap;
    }

    /* ---- Versleepbare weercode-scrubber --------------------------------- */
    .weerlab-wc-strip__row {
        position: relative;
        touch-action: none;
        cursor: ew-resize;
    }

    .wc-scrubber {
        display: block;
        position: absolute;
        inset: 0;
        pointer-events: none;   /* pointer events worden op de rij afgehandeld */
    }

    .wc-scrubber__thumb {
        display: none;
        position: absolute;
        top: -3px;
        bottom: -3px;
        width: 2px;
        background: #00577d;     /* od-blauw */
        transform: translateX(-1px);
        box-shadow: 0 0 0 1px #fff;
    }

    .wc-scrubber__tooltip {
        display: none;
        position: absolute;
        bottom: calc(100% + 6px);
        transform: translateX(-50%);
        background: #00577d;     /* od-blauw */
        color: #fff;
        font-size: 11px;
        line-height: 1.2;
        padding: 3px 7px;
        border-radius: 4px;
        white-space: nowrap;
        pointer-events: none;
    }

    .wc-scrubber.is-active .wc-scrubber__thumb,
    .wc-scrubber.is-active .wc-scrubber__tooltip {
        display: block;
    }

    /* ---- Chart-secties accordion inkallpen op telefoon ----------------------------- */
    .weerlab-chart-section__toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 44px;
        padding: 10px 0;
        cursor: pointer;
    }

    .weerlab-chart-section__toggle:focus-visible {
        outline: 2px solid #00a3a6;
        outline-offset: 2px;
    }

    .weerlab-chart-section.is-collapsed .weerlab-chart-section__body {
        display: none;
    }

    .weerlab-chart-section__chevron {
        display: block;
        width: 9px;
        height: 9px;
        margin: 0 5px 0 12px;
        border-right: 2px solid #00577d;
        border-bottom: 2px solid #00577d;
        transform: rotate(45deg);
        transition: transform 140ms ease;
        flex: 0 0 auto;
    }

    .weerlab-chart-section:not(.is-collapsed) .weerlab-chart-section__chevron {
        transform: rotate(225deg);
    }

    /* ---- Mobiele chip-legend onder de wind chart ------------------------ */
    .weerlab-chiplegend {
        display: flex;
        flex-wrap: wrap;
        gap: 8px 16px;
        margin-top: 8px;
    }

    /* ---- Control bar blijft binnen het scherm ---------------------------- */
    .weerlab-control-bar {
        padding: 12px 14px;
    }

    .weerlab-control-bar__top {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* De frame-slider is te smal op telefoon. de slider-note gaat mee weg  */
    .weerlab-frame-slider {
        display: none;
    }

    .weerlab-frame-stepper {
        display: flex;
    }

    .weerlab-control-bar__note {
        display: none;
    }

    /* Pin-knop krijgt genoeg tapruimte wanneer de top row wrapt. */
    .weerlab-control-bar__top #map-mode-btn {
        min-height: 44px;
    }

    /* ---- Map-legend: mini variant op telefoon ---------------------------- */
    /* Zelfde HTML legend als desktop, alleen compacter. Rechtsboven blijft de
       brede control bar onderaan vrij. We laten alleen key ticks zien, zodat de
       labels niet over elkaar vallen. */
    .weerlab-map-legend {
        --map-legend-bar-height: 104px;
        top: calc(var(--nav-h) + 12px);
        bottom: auto;
        right: 12px;
        padding: 10px 11px 11px;
    }

    .weerlab-map-legend__title {
        margin-bottom: 7px;
        font-size: 10px;
    }

    .weerlab-map-legend__bar {
        border-radius: 5px;
    }

    .weerlab-map-legend__labels {
        width: 24px;
    }

    .weerlab-map-legend__tick {
        font-size: 9.5px;
    }

    /* Alleen de key ticks blijven over: eerste, midden en laatste. */
    .weerlab-map-legend__tick:not(.is-key) {
        display: none;
    }

    /* ---- Info-hub: op telefoon naar linksboven (de vrijgekomen ?-plek), weg
       van de full-width control bar + stepper onderaan.  -------- */
    .weerlab-map-info-btn {
        right: auto;
        bottom: auto;
        top: calc(var(--nav-h) + 12px);
        left: 12px;
        width: 44px;          /* touch target */
        height: 44px;
        font-size: 20px;
    }

    .weerlab-map-info-card {
        right: auto;
        bottom: auto;
        top: calc(var(--nav-h) + 64px);
        left: 12px;
        width: calc(100vw - 24px);
        max-width: 340px;
        max-height: calc(100vh - var(--nav-h) - 120px);
        transform: translateY(-6px);   /* klapt naar onderen uit */
    }

    .weerlab-map-info-card.is-open {
        transform: translateY(0);
    }
}
