/* ==========================================================================
   Tides page (page-tides.hbs + js/tides.js)
   Builds on weather.css (.wx-* layout); only the tide-specific parts live here.
   ========================================================================== */
    .td {
        --td-water: var(--accent);
        --td-obs: var(--signal);
        --td-minus: var(--wx-cold);
    }

    /* --- Next tide ------------------------------------------------------ */
    .td-now__icon svg { width: clamp(4rem, 2.8rem + 5vw, 7rem); height: auto; }
    .td-i-arrow,
    .td-i-wave { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
    .td-i-arrow { stroke: var(--text); }
    .td-i-wave { stroke: var(--td-water); }

    @media (min-width: 900px) {
        .td-now { grid-template-areas: "main facts" "main today"; }
        .td-today { grid-area: today; }
    }

    .td-today__title {
        font-size: var(--step--2);
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--text-muted);
        margin-bottom: var(--space-2);
        font-weight: 400;
    }

    .td-today .wx-sun__times dd b { font-weight: 600; margin-left: 0.6em; font-variant-numeric: tabular-nums; }
    .td-today .is-past { color: var(--text-muted); }
    .td-today .is-past b { font-weight: 400; }
    .td-today .is-next dt { color: var(--text); }

    /* --- Chart ---------------------------------------------------------- */
    .td .c-tide { fill: none; stroke: var(--td-water); stroke-width: 2.5; stroke-linejoin: round; }
    .td .c-tide-area { fill: color-mix(in oklab, var(--td-water) 13%, transparent); }
    .td .c-obs { fill: none; stroke: var(--td-obs); stroke-width: 2; stroke-linejoin: round; }
    .td .c-mhhw { stroke: var(--td-minus); stroke-width: 1; stroke-dasharray: 2 4; }
    .td .c-zero { stroke: var(--line-strong); stroke-width: 1; }
    .td .c-now { stroke: var(--text); stroke-width: 1; stroke-dasharray: 3 3; }
    .td .c-nowdot { fill: var(--signal); stroke: var(--bg); stroke-width: 3; }
    .td .c-ext { fill: var(--bg); stroke: var(--td-water); stroke-width: 2; }
    .td .c-ext.is-past { stroke: var(--text-muted); }
    .td .wx-chart__svg .c-time { font-size: 10.5px; fill: var(--text-muted); }
    .td .wx-chart__svg .c-nowname { fill: var(--text); }
    .td .wx-chart__svg .c-label,
    .td .wx-chart__svg .c-time { paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }

    .td .wx-chart__legend .k-tide { border-color: var(--td-water); }
    .td .wx-chart__legend .k-obs { border-color: var(--td-obs); border-top-width: 2px; }
    .td .wx-chart__legend .k-mhhw { border-top: 1.5px dashed var(--td-minus); }
    .td .wx-chart__legend .k-day { border-top-width: 8px; border-color: light-dark(rgb(242 181 68 / 0.25), rgb(242 181 68 / 0.16)); }

    /* --- 7-day table ---------------------------------------------------- */
    .td-days { display: grid; }

    .td-day {
        display: grid;
        grid-template-columns: 7.5rem minmax(0, 1fr) 10rem;
        align-items: center;
        gap: var(--space-4);
        padding: var(--space-3) 0;
        border-bottom: var(--hairline);
    }

    .td-day__name { display: grid; line-height: 1.25; }
    .td-day__name b { font-weight: 600; }
    .td-day__name .mono { font-size: var(--step--2); color: var(--text-muted); letter-spacing: 0.06em; }

    .td-day__evs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: var(--space-2);
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .td-ev {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 0.6em;
        align-items: baseline;
        padding: 0.35em 0.6em;
        border-left: 2px solid var(--line-strong);
        font-variant-numeric: tabular-nums;
    }

    .td-ev.is-high { border-left-color: var(--td-water); }
    .td-ev__k {
        grid-row: 1 / 3;
        align-self: center;
        font-size: var(--step--2);
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--text-muted);
        min-width: 2.6em;
    }
    .td-ev__t { font-size: var(--step--1); }
    .td-ev__v { font-size: var(--step--1); font-weight: 600; }
    .td-ev.is-minus .td-ev__v { color: var(--td-minus); }
    .td-ev.is-extreme { background: var(--accent-wash); }
    .td-ev.is-past { opacity: 0.55; }

    .td-day__sun { font-size: var(--step--2); color: var(--text-muted); text-align: right; }
    .td-sun__k { letter-spacing: 0.12em; text-transform: uppercase; }

    .td-day.is-today .td-day__name b::after {
        content: "";
        display: inline-block;
        width: 6px;
        height: 6px;
        margin-left: 0.5em;
        background: var(--signal);
        vertical-align: 0.15em;
    }

    .td-extremes {
        margin-top: var(--space-3);
        font-size: var(--step--1);
        color: var(--text-muted);
    }

    @media (max-width: 900px) {
        .td-day { grid-template-columns: 6rem minmax(0, 1fr); }
        .td-day__sun { grid-column: 2; text-align: left; }
    }

    @media (max-width: 560px) {
        .td-day { grid-template-columns: 1fr; gap: var(--space-2); }
        .td-day__name { display: flex; gap: 0.6em; align-items: baseline; }
        .td-day__sun { grid-column: 1; }
        .td-day__evs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    }

    /* --- Print: just the tables and the curve --------------------------- */
    @media print {
        .td .wx-units,
        .td .wx-chart__tip,
        .td .c-hit,
        .td .c-cursor { display: none; }
        .td-ev.is-past { opacity: 1; }
        .td-day { break-inside: avoid; }
    }
