/* Distributors: searchable list and the map of Europe. */
@layer pages {
    .bar {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 24px;
        flex-wrap: wrap;
    }
    .dhead {
        padding-bottom: 36px;
    }
    .dmap {
        display: grid;
        grid-template-columns: 420px 1fr;
        height: calc(100dvh - 68px - var(--kz-adminbar, 0px));
        min-height: 620px;
        max-height: 960px;
        border-top: 1px solid var(--line);
    }
    /* List pane: search, type filters, grouped cards */
    .dpane {
        display: flex;
        flex-direction: column;
        min-height: 0;
        background: var(--paper);
        border-right: 1px solid var(--line);
    }
    .dp-top {
        padding: 20px 22px 14px;
        border-bottom: 1px solid var(--line);
    }
    .dsearch {
        display: flex;
        align-items: center;
        gap: 10px;
        height: 48px;
        padding: 0 14px;
        background: #fff;
        border: 1px solid var(--field);
        border-radius: 2px;
        transition:
            border-color var(--t1) var(--ease),
            box-shadow var(--t1) var(--ease);
        &:focus-within {
            border-color: var(--ink);
            box-shadow: 0 0 0 3px rgba(33, 33, 33, 0.1);
        }
        & svg {
            width: 16px;
            height: 16px;
            fill: none;
            stroke: var(--soft);
            stroke-width: 1.6;
            flex: none;
        }
        & input {
            border: 0;
            outline: 0;
            flex: 1;
            font-size: 0.96875rem;
            background: transparent;
            min-width: 0;
        }
    }
    .dtypes {
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        margin-top: 12px;
        & button {
            height: 32px;
            padding: 0 12px;
            border-radius: 16px;
            border: 1px solid var(--line);
            font-size: 0.8125rem;
            font-weight: 500;
            color: #3f4646;
            transition:
                background var(--t1) var(--ease),
                color var(--t1) var(--ease),
                border-color var(--t1) var(--ease);
        }
        & button:hover {
            border-color: var(--ink);
        }
        & button.on {
            background: var(--graphite);
            color: #fff;
            border-color: var(--graphite);
        }
    }
    .dmeta {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 14px;
        font-size: 0.84375rem;
        color: var(--soft);
        min-height: 26px;
    }
    .dchip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        border: 1px solid var(--ink);
        color: var(--ink);
        padding: 2px 4px 2px 10px;
        border-radius: 13px;
        font-weight: 500;
        & button {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--graphite);
            color: #fff;
            font-size: 0.75rem;
        }
    }
    .dlist {
        flex: 1;
        overflow: auto;
        padding: 0 22px 28px;
        overscroll-behavior: contain;
    }
    .dgrp {
        & h2 {
            display: flex;
            justify-content: space-between;
            font-size: 0.78125rem;
            font-weight: 600;
            color: var(--soft);
            position: sticky;
            top: 0;
            margin: 0 -22px;
            padding: 14px 22px 8px;
            background: var(--paper);
            z-index: 2;
            box-shadow: 0 1px 0 var(--line);
        }
        & ul {
            list-style: none;
            display: grid;
            gap: 6px;
            /* Gap below the sticky country heading. */
            padding-top: 8px;
        }
        & li {
            margin: 0;
            padding: 0;
            display: flex;
            flex-direction: column;
        }
        & li::before,
        & li::after {
            display: none;
        }
        .dcard {
            margin-top: 0;
        }
    }
    .dcard {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 3px;
        padding: 14px 16px;
        cursor: pointer;
        transition:
            border-color var(--t1) var(--ease),
            box-shadow var(--t1) var(--ease);
        &:hover,
        &.hov {
            border-color: rgba(33, 33, 33, 0.45);
        }
        &.on {
            border-color: var(--ink);
            box-shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.35);
        }
        /* Focus ring around the whole card. */
        &:has(.dc-h:focus-visible) {
            outline: 2px solid var(--orange);
            outline-offset: 2px;
        }
        &.hq {
            border-left: 3px solid var(--orange);
        }
    }
    .dc-h:focus-visible {
        outline: 0;
    }
    .dc-h {
        width: 100%;
        padding: 0;
        text-align: left;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 12px;
    }
    .dc-t {
        & b {
            display: block;
            font-weight: 600;
            font-size: 1rem;
            line-height: 1.25;
        }
        & span {
            font-size: 0.84375rem;
            color: var(--soft);
        }
    }
    .dc-h {
        & em {
            font-style: normal;
            font-size: 0.71875rem;
            font-weight: 600;
            padding: 3px 8px;
            border-radius: 10px;
            white-space: nowrap;
            background: var(--concrete);
            color: #3f4646;
        }
        & em.dt-hq {
            background: var(--orange);
            color: var(--graphite);
        }
        & em.dt-supplier {
            background: var(--mint);
            color: var(--graphite);
        }
        & em.dt-showroom {
            background: var(--graphite);
            color: #fff;
        }
    }
    .dc-b {
        display: none;
        > * {
            min-height: 0;
            overflow: hidden;
        }
        & p {
            font-size: 0.875rem;
            color: var(--soft);
            margin-bottom: 10px;
        }
    }
    .dcard.on .dc-b {
        display: block;
        margin-top: 12px;
        animation: m2fade var(--t1) var(--ease) both;
    }
    .dc-b {
        & dl div {
            display: grid;
            grid-template-columns: 70px 1fr;
            gap: 10px;
            padding: 6px 0;
            border-top: 1px solid var(--line);
            font-size: 0.84375rem;
        }
        & dt {
            color: var(--soft);
        }
        & dd {
            font-weight: 500;
            word-break: break-word;
        }
    }
    .dc-a {
        display: flex;
        gap: 8px;
        margin-top: 12px;
        flex-wrap: wrap;
    }
    .dmiss {
        background: var(--graphite);
        color: #fff;
        border-radius: 3px;
        padding: 18px;
        margin: 14px 0 4px;
        & p {
            color: var(--soft-d);
            font-size: 0.875rem;
            margin: 6px 0 4px;
        }
        .btn-l {
            border-color: rgba(255, 255, 255, 0.4);
            color: #fff;
        }
    }
    .dempty {
        padding: 28px 0;
        color: var(--soft);
        & b {
            display: block;
            color: var(--ink);
            margin-bottom: 4px;
        }
    }
    .dmiss[hidden],
    .dempty[hidden],
    .dgrp[hidden],
    .dcard[hidden],
    li[hidden] {
        display: none;
    }
    /* Map: countries, pins, zoom, legend */
    .dmapbox {
        position: relative;
        overflow: hidden;
        background: #dfe6e6;
        cursor: grab;
        touch-action: none;
        &.pan {
            cursor: grabbing;
        }
    }
    #dsvg {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        display: block;
        .sea {
            fill: #dfe6e6;
        }
        .cty {
            fill: #f4f6f6;
            stroke: #c8d1d1;
            stroke-width: 0.6;
            vector-effect: non-scaling-stroke;
            transition: fill var(--t1) var(--ease);
        }
        .cty[data-c] {
            fill: #fff;
        }
        .cty[data-c]:hover {
            fill: #f1d9cf;
            cursor: pointer;
        }
        .cty.has {
            fill: var(--mint);
        }
        .cty.has:hover {
            fill: #b3dbbf;
        }
        .cty.hqc {
            fill: #f6c7b3;
        }
        .cty.sel {
            fill: var(--orange) !important;
        }
    }
    .dpins {
        position: absolute;
        inset: 0;
        pointer-events: none;
    }
    .dpin {
        position: absolute;
        left: 0;
        top: 0;
        pointer-events: auto;
        width: 0;
        height: 0;
        .pb {
            position: absolute;
            left: -13px;
            top: -34px;
            width: 26px;
            height: 26px;
            border-radius: 50% 50% 50% 0;
            transform: rotate(-45deg);
            background: var(--orange);
            border: 2px solid #fff;
            box-shadow: 0 6px 12px -4px rgba(0, 0, 0, 0.45);
            transition:
                transform var(--t1) var(--ease),
                background var(--t1) var(--ease);
        }
        .pb::after {
            content: '';
            position: absolute;
            left: 50%;
            top: 50%;
            width: 7px;
            height: 7px;
            margin: -3.5px;
            border-radius: 50%;
            background: var(--graphite);
        }
        &.hq .pb {
            background: var(--graphite);
            width: 34px;
            height: 34px;
            left: -17px;
            top: -44px;
            display: block;
            padding: 0;
        }
        &.hq .pb::after {
            display: none;
        }
        &.hq .pb svg {
            position: absolute;
            left: 50%;
            top: 50%;
            width: 20px;
            height: 20px;
            transform: translate(-50%, -50%) rotate(45deg);
        }
        &:hover .pb,
        &.hov .pb {
            transform: rotate(-45deg) scale(1.15);
        }
        &.on .pb {
            background: var(--graphite);
            transform: rotate(-45deg) scale(1.25);
        }
        &.hq.on .pb {
            background: var(--orange);
        }
        &.dim {
            opacity: 0.25;
        }
        .pl {
            position: absolute;
            left: 18px;
            top: -52px;
            white-space: nowrap;
            background: var(--graphite);
            color: #fff;
            padding: 6px 10px;
            border-radius: 3px;
            font-size: 0.8125rem;
            font-weight: 600;
            line-height: 1.2;
            opacity: 0;
            transform: translateY(4px);
            transition:
                opacity var(--t1) var(--ease),
                transform var(--t1) var(--ease);
            pointer-events: none;
            box-shadow: 0 10px 20px -8px rgba(0, 0, 0, 0.4);
        }
        .pl small {
            display: block;
            font-weight: 400;
            color: var(--soft-d);
            font-size: 0.75rem;
        }
        &:hover .pl,
        &.hov .pl,
        &.on .pl {
            opacity: 1;
            transform: none;
        }
        &.on {
            z-index: 3;
        }
        &:hover {
            z-index: 4;
        }
    }
    .dzoom {
        position: absolute;
        right: 20px;
        top: 20px;
        display: grid;
        background: #fff;
        border-radius: 3px;
        box-shadow: 0 8px 20px -10px rgba(0, 0, 0, 0.3);
        overflow: hidden;
        & button {
            width: 42px;
            height: 42px;
            font-size: 1.25rem;
            display: grid;
            place-items: center;
            border-bottom: 1px solid var(--line);
        }
        & button:last-child {
            border-bottom: 0;
        }
        & button:hover {
            background: var(--concrete);
        }
        & svg {
            width: 15px;
            height: 15px;
            fill: none;
            stroke: var(--ink);
            stroke-width: 1.6;
        }
    }
    .dlegend {
        position: absolute;
        left: 20px;
        bottom: 20px;
        display: flex;
        gap: 16px;
        flex-wrap: wrap;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(6px);
        padding: 9px 14px;
        border-radius: 3px;
        font-size: 0.8125rem;
        color: #3f4646;
        & i {
            display: inline-block;
            width: 12px;
            height: 12px;
            border-radius: 2px;
            vertical-align: -2px;
            margin-right: 7px;
            border: 1px solid #c8d1d1;
        }
    }
    .lg-has {
        background: var(--mint);
    }
    .lg-dir {
        background: #fff;
    }
    .lg-hq {
        background: #f6c7b3;
    }
    @media (max-width: 1000px) {
        .dmap {
            grid-template-columns: 340px 1fr;
        }
    }
    @media (max-width: 760px) {
        .dmap {
            grid-template-columns: 1fr;
            height: auto;
            max-height: none;
        }
        .dmapbox {
            height: 58svh;
            min-height: 360px;
            order: -1;
        }
        .dlegend {
            gap: 10px;
            font-size: 0.75rem;
        }
        .dpane {
            border-right: 0;
        }
        .dlist {
            overflow: visible;
        }
    }
    /* iOS Safari zooms into inputs under 16px */
    @media (max-width: 800px) {
        .dsearch input {
            font-size: 1rem;
        }
    }
}
