/*
GeoRankle Micro Country Detail View 1.0
micro-country-detail.css

Visual layer for micro-country-detail.js.
The panel is intentionally independent from camera transforms.
*/

:root {
    --gr-detail-bg:
        rgba(8, 17, 31, 0.94);

    --gr-detail-bg-soft:
        rgba(15, 31, 52, 0.92);

    --gr-detail-border:
        rgba(125, 211, 252, 0.3);

    --gr-detail-inner-border:
        rgba(148, 163, 184, 0.18);

    --gr-detail-text:
        #f8fafc;

    --gr-detail-muted:
        #94a3b8;

    --gr-detail-accent:
        #38bdf8;

    --gr-detail-country:
        #f59e0b;

    --gr-detail-country-stroke:
        #fde68a;

    --gr-detail-answer:
        #22c55e;

    --gr-detail-answer-stroke:
        #bbf7d0;

    --gr-detail-context:
        #26364d;

    --gr-detail-context-stroke:
        #64748b;

    --gr-detail-ocean:
        #081525;

    --gr-detail-radius:
        18px;

    --gr-detail-transition:
        210ms;
}

/* =========================================================
   Panel
   ========================================================= */

.gr-micro-detail {
    position: absolute;
    z-index: 12;
    left: 16px;
    bottom: 16px;

    width:
        min(
            390px,
            calc(100% - 94px)
        );

    overflow: hidden;

    border:
        1px solid
        var(--gr-detail-border);

    border-radius:
        var(--gr-detail-radius);

    background:
        linear-gradient(
            145deg,
            var(--gr-detail-bg-soft),
            var(--gr-detail-bg)
        );

    color:
        var(--gr-detail-text);

    box-shadow:
        0 24px 60px
            rgba(2, 6, 23, 0.48),
        0 8px 24px
            rgba(2, 6, 23, 0.34),
        inset 0 1px 0
            rgba(255, 255, 255, 0.05);

    opacity: 0;

    transform:
        translate3d(0, 12px, 0)
        scale(0.975);

    transform-origin:
        left bottom;

    pointer-events: none;
    cursor: default;
    touch-action: auto;
    user-select: none;
    -webkit-user-select: none;

    backdrop-filter:
        blur(18px)
        saturate(125%);

    -webkit-backdrop-filter:
        blur(18px)
        saturate(125%);

    contain:
        layout paint style;

    isolation:
        isolate;

    transition:
        opacity
            var(--gr-detail-transition)
            ease,
        transform
            var(--gr-detail-transition)
            cubic-bezier(
                0.2,
                0.8,
                0.2,
                1
            );
}

.gr-micro-detail[hidden] {
    display: none !important;
}

.gr-micro-detail-visible {
    opacity: 1;

    transform:
        translate3d(0, 0, 0)
        scale(1);

    pointer-events: auto;
}

/* Keep the normal map controls above the detail card. */

.gr-map:has(.gr-micro-detail-visible)
    .gr-map-controls {
    z-index: 14;
}

/* =========================================================
   Header
   ========================================================= */

.gr-micro-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;

    min-height: 58px;
    padding: 10px 11px 9px 16px;

    border-bottom:
        1px solid
        var(--gr-detail-inner-border);

    background:
        linear-gradient(
            180deg,
            rgba(255, 255, 255, 0.045),
            rgba(255, 255, 255, 0)
        );
}

.gr-micro-detail-heading {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.gr-micro-detail-eyebrow {
    color:
        var(--gr-detail-accent);

    font-size: 9px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: 0.15em;
}

.gr-micro-detail-title {
    margin-top: 2px;
    overflow: hidden;

    color:
        var(--gr-detail-text);

    font-size:
        clamp(
            15px,
            2vw,
            19px
        );

    font-weight: 900;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gr-micro-detail-close {
    display: grid;
    flex: 0 0 auto;
    place-items: center;

    width: 34px;
    height: 34px;
    padding: 0 0 2px;

    border:
        1px solid
        rgba(148, 163, 184, 0.24);

    border-radius: 11px;

    background:
        rgba(15, 23, 42, 0.72);

    color:
        #cbd5e1;

    box-shadow:
        inset 0 1px 0
            rgba(255, 255, 255, 0.04);

    cursor: pointer;
    font: inherit;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;

    transition:
        color 150ms ease,
        background-color 150ms ease,
        border-color 150ms ease,
        transform 150ms ease;
}

.gr-micro-detail-close:hover {
    border-color:
        rgba(125, 211, 252, 0.5);

    background:
        rgba(30, 41, 59, 0.96);

    color:
        #ffffff;

    transform:
        translateY(-1px);
}

.gr-micro-detail-close:active {
    transform:
        scale(0.96);
}

.gr-micro-detail-close:focus-visible {
    outline:
        3px solid
        var(--gr-map-focus-ring, rgba(56, 189, 248, 0.5));

    outline-offset: 2px;
}

/* =========================================================
   SVG map
   ========================================================= */

.gr-micro-detail-map-frame {
    position: relative;
    overflow: hidden;

    width: 100%;
    aspect-ratio: 420 / 250;

    background:
        radial-gradient(
            circle at 50% 46%,
            rgba(56, 189, 248, 0.11),
            transparent 52%
        ),
        linear-gradient(
            180deg,
            #0b1c31,
            var(--gr-detail-ocean)
        );
}

.gr-micro-detail-map-frame::before {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    pointer-events: none;

    box-shadow:
        inset 0 0 35px
            rgba(2, 6, 23, 0.42);
}

.gr-micro-detail-svg {
    position: relative;
    z-index: 0;
    display: block;

    width: 100%;
    height: 100%;

    overflow: hidden;
    shape-rendering: geometricPrecision;
    text-rendering: geometricPrecision;
}

.gr-micro-detail-grid line {
    stroke:
        rgba(125, 211, 252, 0.09);

    stroke-width: 0.75;
    vector-effect: non-scaling-stroke;
}

.gr-micro-detail-neighbour {
    fill:
        var(--gr-detail-context);

    stroke:
        var(--gr-detail-context-stroke);

    stroke-width: 0.9;
    opacity: 0.72;
    vector-effect: non-scaling-stroke;
}

.gr-micro-detail-target-halo {
    fill:
        rgba(245, 158, 11, 0.24);

    stroke:
        rgba(253, 230, 138, 0.48);

    stroke-width: 7;
    opacity: 0.82;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.gr-micro-detail-target {
    fill:
        var(--gr-detail-country);

    stroke:
        var(--gr-detail-country-stroke);

    stroke-width: 2.1;
    paint-order: stroke fill;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}

.gr-micro-detail-target-halo.gr-micro-detail-answer {
    fill:
        rgba(34, 197, 94, 0.24);

    stroke:
        rgba(187, 247, 208, 0.55);
}

.gr-micro-detail-target.gr-micro-detail-answer {
    fill:
        var(--gr-detail-answer);

    stroke:
        var(--gr-detail-answer-stroke);
}

.gr-micro-detail-focus {
    pointer-events: none;
}

.gr-micro-detail-focus line {
    stroke:
        rgba(248, 250, 252, 0.7);

    stroke-width: 0.9;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.gr-micro-detail-focus circle {
    fill:
        #ffffff;

    stroke:
        rgba(8, 17, 31, 0.88);

    stroke-width: 1.2;
    vector-effect: non-scaling-stroke;
}

/* =========================================================
   Footer
   ========================================================= */

.gr-micro-detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;

    min-height: 37px;
    padding: 8px 14px;

    border-top:
        1px solid
        var(--gr-detail-inner-border);

    color:
        var(--gr-detail-muted);

    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
}

.gr-micro-detail-location {
    color:
        #cbd5e1;

    font-variant-numeric:
        tabular-nums;

    letter-spacing: 0.02em;
}

.gr-micro-detail-source {
    position: relative;
    padding-left: 12px;
    white-space: nowrap;
}

.gr-micro-detail-source::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;

    width: 6px;
    height: 6px;

    border-radius: 50%;

    background:
        var(--gr-detail-accent);

    box-shadow:
        0 0 8px
        rgba(56, 189, 248, 0.72);

    transform:
        translateY(-50%);
}

/* =========================================================
   Map movement and performance
   ========================================================= */

.gr-camera-moving
    .gr-micro-detail,
.gr-camera-preparing
    .gr-micro-detail,
.gr-route-animation-active
    .gr-micro-detail {
    pointer-events: none;
}

.gr-camera-moving
    .gr-micro-detail-target-halo,
.gr-camera-preparing
    .gr-micro-detail-target-halo,
.gr-route-animation-active
    .gr-micro-detail-target-halo {
    filter: none !important;
}

.gr-camera-moving
    .gr-micro-detail,
.gr-route-animation-active
    .gr-micro-detail {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* =========================================================
   Responsive layout
   ========================================================= */

@media (max-width: 760px) {
    .gr-micro-detail {
        left: 10px;
        bottom: 10px;

        width:
            min(
                350px,
                calc(100% - 64px)
            );

        border-radius: 15px;
    }

    .gr-micro-detail-header {
        min-height: 50px;
        padding: 8px 9px 7px 13px;
    }

    .gr-micro-detail-title {
        font-size: 15px;
    }

    .gr-micro-detail-close {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 22px;
    }

    .gr-micro-detail-footer {
        min-height: 32px;
        padding: 6px 11px;
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .gr-micro-detail {
        top: 10px;
        right: 10px;
        bottom: auto;
        left: 10px;
        width: auto;
        max-height: calc(100% - 66px);
        transform-origin: center top;
    }

    .gr-micro-detail-map-frame {
        aspect-ratio: 420 / 220;
    }

    .gr-micro-detail-eyebrow {
        font-size: 8px;
    }

    .gr-micro-detail-source {
        display: none;
    }
}

@media (max-height: 620px) and (max-width: 760px) {
    .gr-micro-detail-map-frame {
        aspect-ratio: 420 / 190;
    }

    .gr-micro-detail-footer {
        display: none;
    }
}

/* =========================================================
   Reduced motion, forced colours and print
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .gr-micro-detail,
    .gr-micro-detail-close {
        transition: none !important;
    }
}

@media (forced-colors: active) {
    .gr-micro-detail {
        border: 2px solid CanvasText;
        background: Canvas;
        color: CanvasText;
        backdrop-filter: none;
    }

    .gr-micro-detail-target {
        fill: Highlight;
        stroke: HighlightText;
    }

    .gr-micro-detail-neighbour {
        fill: Canvas;
        stroke: CanvasText;
    }
}

@media print {
    .gr-micro-detail {
        display: none !important;
    }
}
