/* Component palette and transition timings. */

* {
    box-sizing: border-box
}

body {
    margin: 0;
    background: #152841;
    color: var(--white);
    font: 14px/1.45 system-ui, sans-serif
}

button {
    font: inherit;
    cursor: pointer
}

button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 5px
}

.hero {
    position: relative;
    width: 100%;
    height: clamp(580px, 56.28vw, 1000px);
    overflow: hidden;
    isolation: isolate
}

.scene {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%)
}

.map-viewport {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    filter: saturate(.8) brightness(1.1) contrast(1.05);
    transition: filter var(--imap-fade) ease-in-out
}

.hero[data-active-project] .map {
    filter: saturate(.4) brightness(.8) contrast(1.05)
}

.colour-reveal {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--imap-fade) ease-in-out
}

.colour-reveal.visible {
    opacity: 1
}

.colour-reveal image {
    filter: saturate(1) brightness(1.1) contrast(1.05)
}

.drawing {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none
}

.feature {
    opacity: 0;
    transition: opacity var(--imap-fade) ease-in-out;
    fill: #b7def32b;
    stroke: var(--white);
    stroke-width: 2;
    vector-effect: non-scaling-stroke
}

.feature.active {
    opacity: 1
}

.feature.emphasized {
    fill: #aee5ff0d;
    stroke: var(--white);
    stroke-width: 3;
    filter: drop-shadow(0 0 4px #152841) drop-shadow(0 0 6px #aee5ff)
}

.feature.emphasized path {
    stroke-width: 3
}

.feature.pipes.emphasized {
    fill: none
}

.feature.pipes.emphasized path:first-child {
    fill: #aee5ff0d;
    stroke: var(--white);
    stroke-width: 3
}

.feature.pipes.emphasized .water, .feature.pipes.emphasized .gas, .feature.pipes.emphasized .telecom {
    stroke-width: 7
}

.pipes {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round
}

.pipes .water {
    stroke: #9bdfff
}

.pipes .gas {
    stroke: #ffce83;
    stroke-dasharray: 10 5
}

.pipes .telecom {
    stroke: #d6c4ff;
    stroke-dasharray: 3 7
}

.node {
    position: absolute;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    background: none;
    z-index: 2;
    padding: 0
}

.node:before {
    content: '';
    width: 13px;
    height: 13px;
    border: 2px solid white;
    background: #152841;
    border-radius: 50%;
    box-shadow: 0 0 0 6px #15284133, 0 2px 10px #15284188;
    transition: box-shadow .4s, transform .4s
}

.node.active:before {
    background: var(--blue-light);
    box-shadow: 0 0 0 12px #cbdfea60;
    transform: scale(1.12)
}

.node>span {
    position: absolute;
    bottom: 40px;
    white-space: nowrap;
    background: linear-gradient(135deg, #163450, #0b1e32);
    border: 1px solid var(--imap-border);
    outline: 2px solid #5effd9;
    color: var(--white);
    padding: 7px 13px;
    border-radius: 5px;
    font-size: var(--font-size-small);
    font-weight: 650;
    letter-spacing: .015em;
    box-shadow: 0 4px 18px #06142480, inset 0 1px 0 #ffffff12
}

.node.portfolio {
    left: auto !important;
    top: 45px !important;
    right: 12px;
    transform: none;
    width: auto;
    display: flex;
    gap: 10px;
    background: linear-gradient(135deg, #163450, #0b1e32);
    border: 1px solid var(--imap-border);
    border-radius: 6px;
    padding: 0 13px;
    outline: 2px solid #5effd9;
}

.node.portfolio:before {
    width: 9px;
    height: 9px;
    box-shadow: none
}

.node.portfolio span {
    position: static;
    border: 0;
    background: none;
    padding: 0;
    font-size: var(--font-size-small);
    box-shadow: none;
    outline: none;
}

.node.portfolio.active:before {
    box-shadow: 0 0 0 4px #cbdfea44;
    transform: none
}

.panel {
    position: absolute;
    z-index: 4;
    width: 360px;
    max-width: calc(100% - 28px);
    max-height: calc(100% - 78px);
    overflow-y: auto;
    padding: 22px;
    background: radial-gradient(ellipse at top right, #214d6c66, transparent 65%), linear-gradient(145deg, #102c48, #071725);
    border: 1px solid var(--imap-border);
    border-radius: 12px;
    box-shadow: 0 20px 65px #020c18a6, 0 0 0 1px #061423, inset 0 1px 0 #ffffff14;
    opacity: 0;
    visibility: hidden;
    transform: translateY(7px);
    transition: opacity var(--imap-fade) ease-in-out, transform var(--imap-fade) ease, visibility 0s var(--imap-fade);
    color: var(--imap-ink);
    scrollbar-width: thin;
    scrollbar-color: #579dc8 #0b1e32
}

.panel.visible {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s
}

.panel.dashboard {
    width: 720px
}

.topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--gap-small)
}

.kicker {
    font: 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--imap-accent)
}

.close {
    border: 1px solid var(--imap-border);
    background: #a8def40d;
    color: white;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: var(--font-size-body);
    line-height: 1.2
}

.panel h2 {
    font-size: 23px;
    line-height: 1.2;
    letter-spacing: -.025em;
    margin: 14px 0 20px;
    font-weight: var(--weight-semibold)
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px
}

.stat {
    min-width: 0;
    padding: 12px 9px;
    background: #a8def40b;
    border: 1px solid #579dc83d;
    border-radius: 7px;
}

.stat strong {
    font-size: 27px;
    color: var(--imap-ink);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
    display: block;
    line-height: 1.2
}

.stat span {
    display: block;
    margin-top: 5px;
    font-size: var(--font-size-caption);
    line-height: 1.4;
    color: var(--imap-muted)
}

.details {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    margin: 0;
    font-size: var(--font-size-label)
}

.details dt, .details dd {
    margin: 0;
    color: var(--imap-muted)
}

.details dd {
    text-align: right;
    color: var(--imap-ink);
    font-weight: var(--weight-semibold);
    font-variant-numeric: tabular-nums
}

.divider {
    border: 0;
    border-top: 1px solid #ffffff30;
    margin: 17px 0
}

.section-label {
    color: var(--imap-accent);
    font: 11px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin-bottom: 10px
}

.alert {
    font-size: var(--font-size-caption);
    line-height: 1.55;
    background: #e4a3a80c;
    border: 1px solid #e4a3a81f;
    border-left: 2px solid #e4a3a8;
    border-radius: 0 5px 5px 0;
    padding: 9px 10px;
    margin-top: 10px;
    color: var(--imap-ink)
}

.prediction {
    background: #a8def40a;
    border-color: #579dc82e;
    border-left-color: var(--imap-accent)
}

.gauges {
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin-bottom: 17px
}

.gauge {
    text-align: center;
    flex: 1
}

.ring {
    width: 66px;
    aspect-ratio: 1;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(var(--blue-light) calc(var(--value) * 1%), #ffffff20 0);
    margin: 0 auto 7px
}

.ring:before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    background: #152841
}

.ring strong {
    position: relative;
    font-size: var(--font-size-small);
    font-weight: 500
}

.gauge span {
    font-size: 10px
}

.row {
    display: grid;
    grid-template-columns: 1fr 75px 60px;
    gap: var(--gap-small);
    font-size: var(--font-size-caption);
    align-items: center;
    margin: 13px 0
}

.track {
    height: 4px;
    border-radius: 4px;
    background: #ffffff25;
    overflow: hidden
}

.track i {
    display: block;
    width: var(--progress);
    height: 100%;
    background: linear-gradient(90deg, #579dc8, #cbdfea)
}

.row small {
    text-align: right;
    color: var(--white);
    font-size: 11px
}

.dash-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px
}

.foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    border-top: 1px solid #ffffff30;
    padding-top: 11px;
    font-size: 11px;
    color: var(--imap-muted)
}

.live-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    background: var(--blue-light);
    border-radius: 50%;
    margin-right: 5px
}

.utility-label {
    display: flex;
    align-items: center;
    gap: 7px
}

.swatch {
    width: 15px;
    height: 3px;
    display: inline-block;
    background: #9bdfff
}

.swatch.gas {
    background: #ffce83
}

.swatch.telecom {
    background: #d6c4ff
}

.pause {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 5;
    color: var(--white);
    background: #152841ed;
    border: 1px solid var(--imap-border);
    border-radius: 5px;
    padding: 7px 11px;
    font-size: 11px
}

.sample {
    position: absolute;
    bottom: 18px;
    left: 18px;
    padding: 4px 7px;
    color: white;
    background: #152841c9;
    font-size: 10px;
    border-radius: 3px;
    pointer-events: none
}

.sr {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden
}

@media(max-width:650px) {
    .hero {
        height: 680px
    }

    .node span {
        font-size: var(--font-size-label);
        padding: 6px 10px
    }

    .node.portfolio {
        top: 16px !important;
        right: 14px
    }

    .panel {
        padding: 18px
    }

    .panel.dashboard {
        width: calc(100% - 28px)
    }

    .panel h2 {
        font-size: 19px
    }

    .dash-cols {
        grid-template-columns: 1fr;
        gap: 14px
    }

    .stats {
        gap: 8px
    }

    .stat strong {
        font-size: var(--font-size-subheading)
    }

    .row {
        grid-template-columns: 1fr 60px 52px;
        gap: 8px
    }

    .sample {
        bottom: 16px;
        left: 12px;
        max-width: 55%;
        font-size: 9px
    }

    .pause {
        right: 12px
    }

    .panel {
        max-height: calc(100% - 110px)
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        transition: none !important
    }
}

html, body {
    height: 100%;
}

body {
    overflow: hidden;
}

.hero {
    height: 100%;
}

.project-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--imap-accent);
    font-weight: var(--weight-semibold);
    text-underline-offset: 4px;
}

.close {
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
}

/* Fine edges and clear data hierarchy, without covering the map in effects. */
.panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #a8def4, transparent);
    pointer-events: none;
}

.node.active span, .node.portfolio.active {
    border-color: var(--imap-accent);
    box-shadow: 0 0 0 1px #a8def426, 0 6px 24px #06142480;
}

.close:hover, .pause:hover {
    background: #24475f;
}

.mobile-map-empty {
    display: none;
}

/* Portfolio HUD: light, separate insight surfaces with the map visible between. */
.portfolio-header, .portfolio-insights article, .portfolio-footer {
    background: linear-gradient(135deg, #102c48e8, #071725d9);
    border: 1px solid var(--imap-border);
    border-radius: 9px;
    padding: 14px;
}

.portfolio-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    gap: var(--gap-small);
    align-items: start;
}

.portfolio-heading {
    min-width: 0;
}

.portfolio-header .close {
    grid-column: 2;
    grid-row: 1;
}

.portfolio-summary {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.portfolio-summary .stat {
    padding: 6px;
    background: transparent;
    border: 0;
}

.portfolio-insights {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--gap-small);
    margin-top: 12px;
}

.portfolio-insights article {
    min-width: 0;
}

.portfolio-insights h3 {
    font-size: var(--font-size-detail);
    line-height: 1.3;
    margin: 6px 0 12px;
}

.portfolio-insights p, .portfolio-footer p {
    font-size: var(--font-size-caption);
    line-height: 1.5;
    margin: 10px 0 0;
    color: var(--imap-muted);
}

.portfolio-metric {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.portfolio-metric strong {
    font-size: 23px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.portfolio-metric span {
    font-size: 11px;
    color: var(--imap-muted);
}

.portfolio-footer {
    margin-top: 12px;
}

.portfolio-footer p {
    margin: 0;
}

.portfolio-footer .project-link {
    margin-top: 8px;
    font-size: var(--font-size-caption);
}

.portfolio-footer .foot {
    gap: 16px;
    margin-top: 10px;
    padding-top: 8px;
}

@media (min-width:651px) {
    .panel.dashboard {
        display: flex;
        flex-direction: column;
        gap: var(--gap-small);
        width: calc(100% - 28px);
        height: calc(100% - 78px);
        max-height: none;
        padding: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        pointer-events: none;
    }

    .panel.dashboard::before {
        display: none;
    }

    .dashboard .portfolio-header, .dashboard .portfolio-insights article, .dashboard .portfolio-footer {
        pointer-events: auto;
    }

    .dashboard .portfolio-header {
        grid-template-columns: minmax(160px, 1fr) minmax(0, 1.6fr) 44px;
        align-items: center;
        margin-right: 220px;
    }

    .dashboard .portfolio-header h2 {
        font-size: 20px;
        margin: 8px 0 0;
    }

    .dashboard .portfolio-summary {
        grid-column: 2;
    }

    .dashboard .portfolio-header .close {
        grid-column: 3;
    }

    .dashboard .portfolio-insights {
        margin-top: auto;
    }

    .dashboard .portfolio-footer {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px 24px;
        margin-top: 0;
        padding: 10px 14px;
    }

    .dashboard .portfolio-footer .project-link,
    .dashboard .portfolio-footer .foot {
        margin: 0;
        padding: 0;
        border: 0;
    }
}

@media (min-width:651px) and (max-width:1000px) {
    .dashboard .portfolio-header {
        grid-template-columns: minmax(0, 1fr) 44px;
        margin-right: 210px;
    }

    .dashboard .portfolio-summary {
        grid-column: 1 / -1;
    }

    .dashboard .portfolio-header .close {
        grid-column: 2;
    }

    .dashboard .portfolio-insights {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .dashboard .portfolio-header, .dashboard .portfolio-insights article {
        padding: 10px;
    }

    .dashboard .portfolio-header h2 {
        font-size: var(--font-size-large);
        margin-top: 4px;
    }

    .dashboard .portfolio-summary .stat strong {
        font-size: var(--font-size-subheading);
    }

    .dashboard .portfolio-insights h3 {
        font-size: var(--font-size-label);
        margin: 3px 0 6px;
    }

    .dashboard .portfolio-metric {
        margin-bottom: 4px;
    }

    .dashboard .portfolio-metric strong {
        font-size: 20px;
        line-height: 1.1;
    }

    .dashboard .portfolio-insights p {
        font-size: 11px;
        line-height: 1.35;
        margin-top: 6px;
    }
}

@media (max-width:650px) {
    .portfolio-summary, .portfolio-insights {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portfolio-insights {
        gap: 8px;
    }

    .portfolio-insights article {
        padding: 10px;
    }
}

.gauge span {
    color: var(--imap-muted);
    font-size: 11px;
}

@media (max-width:650px) {
    .stat {
        padding: 10px 7px;
    }

    .stat strong {
        font-size: clamp(18px, 5.3vw, 22px);
    }

    .stat span {
        font-size: 11px;
    }

    html, body {
        height: 100%;
    }

    body {
        overflow: hidden;
    }

    .hero {
        height: 680px;
        overflow: hidden;
    }

    .map-viewport {
        height: 460px;
    }

    .panel, .panel.dashboard {
        display: block;
        position: absolute;
        left: 0;
        top: 460px;
        width: 100%;
        height: 220px;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 12px 14px;
        overflow: auto;
        border: 0;
        border-top: 1px solid var(--imap-border);
        border-radius: 0;
        transform: none;
    }

    .mobile-summary-header {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        gap: 8px;
        height: 44px;
        align-items: center;
    }

    .mobile-summary-header h2 {
        font-size: var(--font-size-body);
        line-height: 1.25;
        margin: 3px 0 0;
    }

    .mobile-summary-header .kicker {
        font-size: 10px;
    }

    .mobile-summary-metrics {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        height: 62px;
        margin-top: 6px;
    }

    .mobile-summary-metrics .stat {
        padding: 5px 8px;
    }

    .mobile-summary-metrics .stat strong {
        font-size: var(--font-size-subheading);
        line-height: var(--line-height-heading);
    }

    .mobile-summary-metrics .stat span {
        margin-top: 4px;
        font-size: 10px;
        line-height: 1.2;
    }

    .mobile-summary-insight {
        height: 32px;
        margin: 8px 0 6px;
        font-size: var(--font-size-caption);
        line-height: 16px;
        color: var(--imap-muted);
    }

    .mobile-summary-footer {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        height: 24px;
    }

    .mobile-summary-footer .project-link {
        margin: 0;
        font-size: var(--font-size-caption);
    }

    .mobile-summary-footer span {
        font-size: 10px;
        color: var(--imap-muted);
        white-space: nowrap;
    }

    .mobile-map-empty {
        display: flex;
        position: absolute;
        left: 0;
        top: 460px;
        width: 100%;
        height: 220px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 10px;
        padding: 20px;
        text-align: center;
        border-top: 1px solid var(--imap-border);
        color: var(--imap-muted);
        transition: visibility 0s var(--imap-fade);
    }

    .mobile-map-empty strong {
        color: var(--imap-ink);
        font-size: var(--font-size-large);
    }

    .hero[data-active-project] .mobile-map-empty {
        visibility: hidden;
        transition-delay: 0s;
    }
}

/* A compact cue anchored to the map, above the pause and sample-data controls. */
.map-details-arrow {
    display: none;
}

@media (max-width:650px) {
    .map-details-arrow:not([hidden]) {
        display: grid;
        place-items: center;
        position: absolute;
        z-index: 6;
        left: 50%;
        bottom: 56px;
        transform: translateX(-50%);
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid #5effd9;
        border-radius: 50%;
        background: #152841ed;
        color: #5effd9;
        box-shadow: 0 3px 14px #06142480;
    }

    .map-details-arrow span {
        font: 28px/1 Arial, sans-serif;
        animation: imap-arrow-flash .9s ease-in-out 3;
    }
}

@keyframes imap-arrow-flash {
    0%, 100% {
        opacity: .45;
    }

    50% {
        opacity: 1;
    }
}

@media (prefers-reduced-motion:reduce) {
    .map-details-arrow span {
        animation: none;
    }
}
