/* Measurement comparisons and restrained, severity-based motion. */
:root body.observatory-interface .ob-design-system .ob-welcome-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}
:root body.observatory-interface .ob-design-system .ob-welcome-copy > p,
:root body.observatory-interface .ob-design-system .ob-welcome-copy .ob-mode {
    margin: 0;
}
:root body.observatory-interface .ob-design-system .ob-location {
    font-size: 18px;
    font-weight: 600;
    color: #204a8c;
}
:root body.observatory-interface .ob-design-system .ob-primary,
:root body.observatory-interface .ob-station-tab,
:root body.observatory-interface .ob-preview-point,
:root body.observatory-interface .ob-stat {
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        border-color 0.2s ease;
}
@media (hover: hover) {
    :root body.observatory-interface .ob-design-system .ob-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px #2563eb30;
    }
    :root body.observatory-interface .ob-stat:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 25px #24487812;
    }
}
/* Keep all measurement internals separate from older card layout rules. */
:root body.observatory-interface .metric:has(> .measurement-gauge) {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
}
:root
    body.observatory-interface
    .metric:has(> .measurement-gauge)
    .metric-icon {
    width: 28px;
    height: 28px;
}
:root
    body.observatory-interface
    .ob-design-system
    .instrument-readings
    .metric {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
}
:root body.observatory-interface .measurement-gauge {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 12px 0 0;
    border-top: 1px solid #dbe5f2;
    padding-top: 10px;
    color: #405674;
    font-size: 12px;
    line-height: 1.5;
}
:root body.observatory-interface .measurement-gauge div {
    min-width: 0;
}
:root body.observatory-interface .measurement-gauge small {
    color: inherit;
    font-size: 12px;
    line-height: 1.5;
}
:root body.observatory-interface .measurement-gauge .gauge-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
}
:root body.observatory-interface .measurement-gauge .gauge-heading small {
    font-size: 10px;
    background: #e7effb;
    border: 1px solid #d6e2f5;
    border-radius: 4px;
    padding: 1px 5px;
    letter-spacing: 0;
}
:root body.observatory-interface .measurement-gauge .gauge-visual {
    position: relative;
    padding-top: 33px;
    margin: 4px 0 8px;
}
:root body.observatory-interface .measurement-gauge .gauge-track {
    position: relative;
    height: 10px;
    border-radius: 10px;
    box-shadow: 0 0 0 2px #fff5;
    overflow: hidden;
}
:root body.observatory-interface .measurement-gauge .gauge-track > i {
    position: absolute;
    height: 100%;
}
:root body.observatory-interface .measurement-gauge .gauge-tick {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fff9;
    transform: translateX(-1px);
}
:root body.observatory-interface .measurement-gauge .gauge-current {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
:root body.observatory-interface .measurement-gauge .gauge-current b {
    position: absolute;
    left: var(--gauge-label-position);
    top: 0;
    transform: translateX(-50%);
    border-radius: 5px;
    padding: 2px 7px;
    background: #fff;
    color: #213a60;
    box-shadow: 0 2px 6px #11294d18;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    border-bottom: 2px solid var(--gauge-color);
}
:root body.observatory-interface .measurement-gauge .gauge-current i {
    position: absolute;
    left: var(--gauge-position);
    top: 27px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid #233e68;
}
:root body.observatory-interface .measurement-gauge .gauge-scale {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 5px;
    font-size: 10px;
    font-variant-numeric: tabular-nums;
    opacity: 0.85;
}
:root body.observatory-interface .measurement-gauge .gauge-rules {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    font-variant-numeric: tabular-nums;
}
:root body.observatory-interface .measurement-gauge .gauge-rules > span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    white-space: nowrap;
}
:root body.observatory-interface .measurement-gauge .gauge-rules i {
    width: 5px;
    height: 8px;
    background: var(--rule-color);
    border-radius: 2px;
}
:root body.observatory-interface .measurement-gauge .gauge-reading-note {
    display: block;
    margin-top: 7px;
}
:root body.observatory-interface .measurement-gauge .gauge-details {
    margin-top: 4px;
    font-size: 11px;
}
:root body.observatory-interface .measurement-gauge .gauge-details summary {
    cursor: pointer;
    width: fit-content;
    padding: 6px 0;
    min-height: 30px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
:root
    body.observatory-interface
    .measurement-gauge
    .gauge-details
    summary:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 3px;
    border-radius: 3px;
}
:root body.observatory-interface .measurement-gauge .gauge-details p {
    margin: 5px 0;
    color: inherit;
    font-size: 11px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}
:root body.observatory-interface .measurement-gauge.gauge-unconfigured {
    margin-top: auto;
    padding-top: 12px;
    border-top: 0;
}
:root body.observatory-interface .gauge-empty-line {
    display: block;
    height: 5px;
    margin: 6px 0;
    border-radius: 5px;
    background: repeating-linear-gradient(
        90deg,
        #c8d5e7 0 10px,
        #e9eff7 10px 13px
    );
}
:root body.observatory-interface .measurement-gauge.gauge-muted .gauge-track {
    opacity: 0.45;
}
:root
    body.observatory-interface
    .ob-design-system
    .metric[data-parameter="DO"]
    .measurement-gauge {
    color: #dceaff;
    border-color: #ffffff30;
}
:root
    body.observatory-interface
    .ob-design-system
    .metric[data-parameter="DO"]
    .gauge-heading
    small {
    background: #ffffff15;
    border-color: #ffffff30;
    color: #dceaff;
}
:root
    body.observatory-interface
    .ob-design-system
    .metric[data-parameter="DO"]
    .gauge-current
    i {
    border-top-color: #fff;
}
/* Motion uses the published level only. Unknown, stale and normal stay still. */
:root
    body.observatory-interface
    .instrument-readings
    .metric:has(.measurement-gauge:not(.gauge-unconfigured))
    .metric-spark,
:root
    body.observatory-interface
    .instrument-readings
    .measurement-gauge
    .gauge-heading,
:root
    body.observatory-interface
    .instrument-readings
    .measurement-gauge
    .gauge-scale,
:root
    body.observatory-interface
    .instrument-readings
    .measurement-gauge:not(.gauge-muted)
    .gauge-reading-note {
    display: none;
}
body.observatory-interface
    :is(
        .ob-tab-status .badge,
        .hydro-hero > .badge,
        .map-status-badge,
        .ob-preview-point,
        .river-station,
        .alert-map-pin,
        .map-situation
    )[data-alert-level="1"]
    svg {
    animation: signal-breathe 3.6s ease-in-out infinite;
}
body.observatory-interface
    :is(
        .ob-tab-status .badge,
        .hydro-hero > .badge,
        .map-status-badge,
        .ob-preview-point,
        .river-station,
        .alert-map-pin,
        .map-situation
    )[data-alert-level="2"]
    svg,
body.observatory-interface
    .ob-kpi-attention[data-has-attention="true"]
    .ob-stat-icon
    svg {
    animation: signal-attention 4s ease-in-out infinite;
    transform-origin: 50% 65%;
}
body.observatory-interface
    :is(
        .ob-tab-status .badge,
        .hydro-hero > .badge,
        .map-status-badge,
        .ob-preview-point,
        .river-station,
        .alert-map-pin,
        .map-situation
    ):is([data-alert-level="3"], [data-alert-level="4"])
    svg {
    animation: signal-urgent 2.6s ease-in-out infinite;
    transform-origin: center;
}
body.observatory-interface
    .alert-map-pin:is([data-alert-level="0"], [data-alert-level="unknown"])
    .signal-ring {
    animation: none;
}
body.observatory-interface .alert-map-pin[data-alert-level="1"] .signal-ring {
    animation-duration: 4s;
}
body.observatory-interface .alert-map-pin[data-alert-level="2"] .signal-ring {
    animation-duration: 3s;
}
body.observatory-interface
    .ob-preview-point:is(
        [data-alert-level="2"],
        [data-alert-level="3"],
        [data-alert-level="4"]
    )
    .ob-preview-dot {
    animation: signal-halo 3s ease-out infinite;
}
@keyframes signal-breathe {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}
@keyframes signal-attention {
    0%,
    68%,
    100% {
        transform: rotate(0);
    }
    74%,
    86% {
        transform: rotate(-8deg);
    }
    80%,
    92% {
        transform: rotate(8deg);
    }
}
@keyframes signal-urgent {
    0%,
    60%,
    100% {
        transform: scale(1);
    }
    70%,
    90% {
        transform: scale(1.13);
    }
    80% {
        transform: scale(1.03);
    }
}
@keyframes signal-halo {
    0% {
        box-shadow: 0 0 0 0
            color-mix(in srgb, var(--preview-color) 35%, transparent);
    }
    70%,
    100% {
        box-shadow: 0 0 0 9px transparent;
    }
}
@media (max-width: 760px) {
    :root body.observatory-interface .ob-design-system .ob-welcome-copy {
        gap: 12px;
    }
    :root body.observatory-interface .ob-design-system .ob-location {
        font-size: 16px;
    }
    :root
        body.observatory-interface
        .ob-design-system
        .instrument-readings
        .metric:has(.measurement-gauge:not(.gauge-unconfigured)) {
        grid-column: 1 / -1;
    }
    :root
        body.observatory-interface
        .ob-design-system
        .instrument-readings
        .metric:has(.measurement-gauge:not(.gauge-unconfigured))
        .gauge-rules {
        gap: 6px 14px;
    }
    :root body.observatory-interface .measurement-gauge .gauge-details summary {
        min-height: 40px;
        padding-top: 10px;
    }
}
@media (max-width: 600px) {
    :root body.observatory-interface .metric-grid:has(.compact-metric) {
        grid-template-columns: minmax(0, 1fr) !important;
    }
    :root body.observatory-interface .compact-metric .metric-value {
        display: flex;
        align-items: baseline;
        flex-wrap: wrap;
        gap: 4px;
    }
}
@media (prefers-reduced-motion: reduce) {
    body.observatory-interface [data-alert-level] svg,
    body.observatory-interface .ob-kpi-attention .ob-stat-icon svg,
    body.observatory-interface .ob-preview-dot,
    body.observatory-interface .signal-ring {
        animation: none !important;
    }
    :root
        body.observatory-interface
        :is(
            .ob-primary,
            .ob-station-tab,
            .ob-preview-point,
            .ob-stat,
            .metric
        ) {
        transition: none !important;
    }
}
