/* Magnetometer observations and archive. */

.magnetometer-section {
    background: #f7fafb;
}

.magnetometer-toolbar > *,
.magnetometer-toolbar__controls,
.magnetometer-mode-switch,
.magnetometer-viewer,
.magnetometer-chart,
.magnetometer-chart__canvas-wrap,
.magnetometer-chart canvas {
    min-width: 0;
}

.magnetometer-viewer,
.magnetometer-chart {
    width: 100%;
    max-width: 100%;
}

.magnetometer-view-head {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: end;
    margin: 34px 0 14px;
}

.magnetometer-view-head h2 {
    margin: 4px 0 5px;
    font-size: clamp(25px, 3vw, 34px);
}

.magnetometer-view-head p:last-child {
    margin: 0;
    color: var(--muted);
}

.magnetometer-day-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px 16px;
    font-size: 14px;
    font-weight: 700;
}

.magnetometer-day-nav a {
    color: var(--teal-dark);
}

.magnetometer-status {
    display: flex;
    gap: 9px;
    align-items: center;
    min-height: 26px;
    margin-bottom: 13px;
    color: var(--muted);
    font-size: 14px;
}

.magnetometer-status[hidden],
.magnetometer-legend[hidden] {
    display: none;
}

.magnetometer-date-notice {
    margin: 0 0 14px;
}

.magnetometer-status__dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #c58a22;
    box-shadow: 0 0 0 4px rgba(197, 138, 34, 0.12);
}

.magnetometer-status.is-ready .magnetometer-status__dot {
    background: var(--teal);
    box-shadow: 0 0 0 4px rgba(20, 120, 119, 0.12);
}

.magnetometer-status.is-error {
    color: #8b2f2f;
}

.magnetometer-status.is-error .magnetometer-status__dot {
    background: #b84747;
    box-shadow: 0 0 0 4px rgba(184, 71, 71, 0.12);
}

.magnetometer-viewer {
    display: grid;
    gap: 14px;
    overflow: hidden;
}

.magnetometer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.magnetometer-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 700;
}

.magnetometer-toolbar__controls {
    display: flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.magnetometer-mode-switch {
    display: inline-grid;
    grid-template-columns: auto minmax(0, 1fr);
    flex: 0 1 auto;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f3f7f7;
}

.magnetometer-mode-switch button {
    min-height: 32px;
    padding: 6px 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--teal-dark);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.magnetometer-mode-switch button:hover {
    background: rgba(9, 112, 111, 0.08);
}

.magnetometer-mode-switch button[aria-pressed="true"] {
    background: var(--teal);
    color: #fff;
    box-shadow: 0 2px 7px rgba(7, 55, 68, 0.16);
}

.magnetometer-mode-switch button:focus-visible {
    outline: 3px solid rgba(197, 138, 34, 0.42);
    outline-offset: 2px;
}

.magnetometer-date-control {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}

.magnetometer-date-control input {
    min-height: 38px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.magnetometer-date-control .button {
    min-height: 38px;
    padding: 8px 14px;
}

.magnetometer-legend span {
    display: inline-flex;
    gap: 7px;
    align-items: center;
}

.magnetometer-legend i {
    width: 25px;
    height: 3px;
    border-radius: 999px;
}

.magnetometer-chart {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    background: #fff;
    box-shadow: var(--card-shadow);
}

.magnetometer-chart > header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
    padding: 14px 18px 8px;
}

.magnetometer-chart > header > * {
    min-width: 0;
}

.magnetometer-chart header p {
    margin: 0 0 2px;
    color: #9a6510;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.magnetometer-chart h3 {
    margin: 0;
    font-size: 21px;
}

.magnetometer-chart__range {
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.magnetometer-chart__canvas-wrap {
    position: relative;
    min-height: 260px;
}

.magnetometer-chart canvas {
    display: block;
    max-width: 100%;
    width: 100%;
    height: 260px;
}

.magnetometer-tooltip {
    position: absolute;
    z-index: 2;
    min-width: 150px;
    max-width: 230px;
    padding: 9px 11px;
    border: 1px solid rgba(7, 55, 68, 0.2);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.97);
    color: var(--ink);
    box-shadow: 0 10px 26px rgba(7, 55, 68, 0.16);
    font-size: 12px;
    line-height: 1.45;
    pointer-events: none;
}

.magnetometer-tooltip strong,
.magnetometer-tooltip span {
    display: block;
}

.magnetometer-tooltip span {
    margin-top: 3px;
}

.magnetometer-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.magnetometer-summary div {
    display: grid;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.magnetometer-summary span {
    color: var(--muted);
    font-size: 12px;
}

.magnetometer-summary strong {
    font-size: 17px;
}

.magnetometer-note {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
    gap: 28px;
    margin-top: 32px;
    padding: 24px;
    border-radius: var(--card-radius);
    background: #e9f2f1;
}

.magnetometer-note h2 {
    margin: 0 0 8px;
    font-size: 23px;
}

.magnetometer-note p {
    margin: 0;
    line-height: 1.55;
}

.magnetometer-note dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
}

.magnetometer-note dl div {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.72);
}

.magnetometer-note dt {
    color: var(--muted);
    font-size: 12px;
}

.magnetometer-note dd {
    margin: 0;
    font-weight: 700;
}

@media (max-width: 900px) {
    .magnetometer-toolbar {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .magnetometer-toolbar__controls {
        width: 100%;
        justify-content: space-between;
    }

    .magnetometer-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .magnetometer-note {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .magnetometer-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .magnetometer-toolbar__controls {
        display: grid;
        gap: 9px;
    }

    .magnetometer-mode-switch {
        width: 100%;
        grid-template-columns: minmax(0, 0.72fr) minmax(0, 1.5fr);
    }

    .magnetometer-mode-switch button {
        padding-inline: 8px;
        white-space: normal;
    }

    .magnetometer-date-control {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .magnetometer-date-control input {
        width: 100%;
    }

    .magnetometer-view-head {
        display: grid;
        align-items: start;
        margin-top: 28px;
    }

    .magnetometer-day-nav {
        justify-content: flex-start;
    }

    .magnetometer-chart > header {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
        gap: 5px;
        padding-inline: 14px;
    }

    .magnetometer-chart__range {
        text-align: left;
    }

    .magnetometer-chart__canvas-wrap,
    .magnetometer-chart canvas {
        min-height: 230px;
        height: 230px;
    }

    .magnetometer-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .magnetometer-note dl {
        grid-template-columns: 1fr;
    }

    .magnetometer-note {
        padding: 18px;
    }
}

