[x-cloak] { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.map-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    overflow: clip;
}

.map-topic {
    --map-bg: var(--background);
    --map-fg: var(--text-primary);
    --map-selected: #d62d2d;
    --map-focus: #0c3b2e;
    --ease: cubic-bezier(0.65, 0, 0.35, 1);
    --dur: 0.65s;

    --card-w: clamp(300px, 30vw, 440px);
    --card-h: clamp(190px, 34vh, 280px);
    --wheel-cx: 73%;
    --wheel-cy: 46%;
    --x-step: clamp(40px, 6vw, 100px);
    --y-step: clamp(160px, 31vh, 270px);
    --hero-h: clamp(190px, 36vh, 340px);

    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    background: var(--map-bg);
    color: var(--map-fg);
    transition: background-color 0.6s ease, color 0.6s ease;
}

.map-topic[data-themed="true"] {
    --map-fg: #fff;
    --map-focus: #fff;
}

/* Header */

.map-bar {
    position: relative;
    z-index: 6;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 24px;
}

.map-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.95rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.25s ease;
}

.map-back:hover:not(:disabled) {
    background: rgba(127, 127, 127, 0.14);
    transform: translateX(-2px);
}

.map-back:disabled {
    opacity: 0.5;
    cursor: default;
}

.map-title {
    font-size: 1.15rem;
    font-weight: 600;
}

.map-search {
    position: relative;
    margin-left: auto;
    width: min(380px, 42vw);
}

.map-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    opacity: 0.7;
    pointer-events: none;
}

.map-search-input {
    width: 100%;
    padding: 9px 14px 9px 38px;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: rgba(127, 127, 127, 0.1);
    color: inherit;
    font: inherit;
    font-size: 0.95rem;
}

.map-search-input::placeholder {
    color: inherit;
    opacity: 0.65;
}

.map-search-input:focus-visible {
    outline: 3px solid var(--map-focus);
    outline-offset: 2px;
}

.map-search-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 30;
    max-height: min(60vh, 440px);
    overflow-y: auto;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(12, 59, 46, 0.28);
    color: var(--text-primary);
}

.map-search-status {
    padding: 12px 18px 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
}

.map-search-result {
    display: grid;
    gap: 2px;
    padding: 10px 18px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    list-style: none;
}

.map-search-result.is-highlighted {
    background: #eef4ef;
}

.result-title {
    font-weight: 700;
}

.result-meta {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
}

.result-snippet {
    font-size: 0.85rem;
    line-height: 1.4;
    opacity: 0.85;
}

.map-back:focus-visible,
.detail-more:focus-visible,
.map-see:focus-visible,
.map-more:focus-visible,
.wheel-dot:focus-visible,
.wheel-card:focus-visible,
.map-detail-body a:focus-visible {
    outline: 3px solid var(--map-focus);
    outline-offset: 3px;
}

/* Stage and map */

.map-stage {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    overflow: clip;
}

.map-canvas {
    position: absolute;
    inset: 0;
    transition: opacity 0.5s ease, transform 0.6s var(--ease);
}

.map-canvas svg {
    display: block;
    width: 100%;
    height: 100%;
}

.map-region {
    fill: #d6e5d9;
    stroke: #fff;
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
    cursor: pointer;
    outline: none;
    transition: fill 0.25s ease, stroke 0.25s ease;
}

.map-region:hover,
.map-region:focus-visible {
    fill: var(--accent);
}

.map-region:focus-visible {
    stroke: var(--map-focus);
    stroke-width: 3px;
}

.map-region.is-selected {
    fill: var(--map-selected);
}

.map-topic[data-themed="true"] .map-region.is-selected {
    fill: #fff;
    stroke: rgba(255, 255, 255, 0.9);
    cursor: default;
}

.map-border {
    fill: none;
    stroke: rgba(12, 59, 46, 0.35);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.map-tip {
    position: absolute;
    z-index: 5;
    padding: 6px 12px;
    border-radius: 8px;
    background: var(--text-primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 14px));
}

.map-hint {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
}

.map-selection {
    position: absolute;
    left: 50%;
    bottom: 22px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 8px 8px 22px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--card-bg);
    box-shadow: 0 12px 32px rgba(12, 59, 46, 0.18);
    transform: translateX(-50%);
    animation: map-pop 0.35s var(--ease);
}

@keyframes map-pop {
    from { opacity: 0; transform: translate(-50%, 14px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

.map-selection-name {
    font-weight: 700;
}

.map-see {
    padding: 10px 26px;
    border: 0;
    border-radius: 999px;
    background: var(--text-primary);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.map-see:hover {
    background: #145241;
    transform: scale(1.04);
}

.map-see:focus-visible {
    outline-color: var(--text-primary);
}

.map-credit {
    padding: 6px 24px 10px;
    font-size: 0.72rem;
    text-align: right;
    opacity: 0.7;
}

/* Wheel */

.map-wheel {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    touch-action: none;
}

.map-wheel.is-entering {
    opacity: 0;
}

.map-wheel.is-entering .wheel-slot {
    transition: none;
}

.wheel-slot {
    --x: 0px;
    --y: 0px;
    --s: 1;

    position: absolute;
    left: var(--wheel-cx);
    top: var(--wheel-cy);
    width: var(--card-w);
    height: var(--card-h);
    border-radius: 28px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -50%) translate(var(--x), var(--y)) scale(var(--s));
    translate: 0 var(--enter-y, 0px);
    transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease), filter 0.5s ease, visibility var(--dur);
}

.wheel-slot[data-state="active"] {
    z-index: 3;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wheel-slot[data-state="next"] {
    --x: var(--x-step);
    --y: var(--y-step);
    --s: 0.55;
    z-index: 2;
    opacity: 0.92;
    visibility: visible;
    pointer-events: auto;
}

.wheel-slot[data-state="previous"] {
    --x: var(--x-step);
    --y: calc(var(--y-step) * -1);
    --s: 0.55;
    z-index: 1;
    visibility: visible;
}

.wheel-slot[data-state="inactive"][data-side="below"] {
    --x: calc(var(--x-step) * 1.5);
    --y: calc(var(--y-step) * 1.9);
    --s: 0.3;
}

.wheel-slot[data-state="inactive"][data-side="above"] {
    --x: calc(var(--x-step) * 1.5);
    --y: calc(var(--y-step) * -1.9);
    --s: 0.3;
}

.wheel-slot.is-moving {
    filter: blur(6px);
}

.map-wheel[data-mode="summary"] .wheel-slot[data-state="next"],
.map-wheel[data-mode="summary"] .wheel-slot[data-state="previous"] {
    filter: blur(4px);
    opacity: 0.4;
}

.map-wheel[data-mode="summary"] .wheel-slot[data-state="previous"] {
    opacity: 0;
}

.wheel-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
    height: 100%;
    padding: 22px 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: inherit;
    background:
        linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.05) 70%),
        var(--card-image, none) center / cover no-repeat,
        color-mix(in srgb, var(--card-color) 80%, #000);
    box-shadow: 0 28px 60px -20px rgba(0, 0, 0, 0.5);
    color: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.wheel-slot[data-state="active"] .wheel-card:hover {
    transform: scale(1.05);
}

.wheel-slot[data-state="next"] .wheel-card:hover {
    transform: scale(1.08);
}

.wheel-card-icon {
    position: absolute;
    top: 20px;
    left: 22px;
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    font-size: 1.2rem;
}

.wheel-card-label {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.15;
}

.wheel-card-soon {
    align-self: flex-start;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.22);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.wheel-dots {
    position: absolute;
    right: 18px;
    top: 50%;
    display: flex;
    flex-direction: column;
    transform: translateY(-50%);
    pointer-events: auto;
}

.wheel-dot {
    position: relative;
    width: 24px;
    height: 24px;
    border: 0;
    background: none;
    cursor: pointer;
}

.wheel-dot::before {
    content: "";
    position: absolute;
    inset: 7px;
    border: 2px solid #fff;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.wheel-dot.is-active::before {
    background: #fff;
}

/* Summary, coming soon */

.map-summary {
    position: absolute;
    left: 5%;
    bottom: 7%;
    z-index: 4;
    width: min(40%, 440px);
}

.map-summary-kicker {
    margin-bottom: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
}

.map-summary-text {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 600;
    line-height: 1.3;
}

.map-more {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 18px;
    padding: 10px 22px;
    border: 1px solid #fff;
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.map-more:hover {
    background: #fff;
    color: var(--text-primary);
}

.map-soon {
    position: absolute;
    left: 55%;
    right: 5%;
    top: 50%;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 36px 28px;
    border: 1px dashed var(--border);
    border-radius: 28px;
    background: var(--card-bg);
    text-align: center;
    transform: translateY(-50%);
}

.map-soon i {
    font-size: 2rem;
    color: var(--accent);
}

.map-soon p {
    color: var(--text-secondary);
}

/* Detail */

.map-detail {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: calc(var(--hero-h) - 28px);
    z-index: 4;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 28px 28px 0 0;
    background: var(--card-bg);
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18);
    color: var(--text-primary);
}

.map-detail {
    --map-focus: var(--text-primary);
}

.map-detail.is-pending {
    opacity: 0;
}

.map-detail-body {
    max-width: 880px;
    margin: 0 auto;
    padding: 36px 22px 72px;
}

.detail-kicker {
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.detail-intro {
    font-size: 1.15rem;
    line-height: 1.7;
}

.detail-credit,
.detail-item-figure figcaption {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.detail-credit {
    margin-top: 10px;
}

.detail-credit a,
.detail-item-figure figcaption a {
    color: inherit;
}

.detail-notice {
    display: flex;
    gap: 12px;
    margin-top: 22px;
    padding: 14px 18px;
    border: 1px solid #e6c36a;
    border-radius: 14px;
    background: #fff7e0;
    color: #6b4e00;
    font-size: 0.92rem;
    line-height: 1.55;
}

.detail-notice i {
    margin-top: 3px;
}

.detail-section {
    margin-top: 30px;
}

.detail-section-title {
    margin-top: 30px;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.detail-section .detail-section-title {
    margin-top: 0;
}

.detail-emergency,
.detail-embassies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
    margin-top: 14px;
    list-style: none;
}

.emergency-card,
.embassy-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.emergency-number {
    color: var(--cat, var(--text-primary));
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
}

.emergency-number:hover {
    text-decoration: underline;
}

.emergency-label {
    font-weight: 700;
}

.emergency-note,
.embassy-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.badge-example {
    align-self: flex-start;
    padding: 2px 10px;
    border-radius: 999px;
    background: #fff1c2;
    color: #6b4e00;
    font-size: 0.72rem;
    font-weight: 700;
}

.embassy-card h4 {
    font-size: 1rem;
}

.embassy-line {
    display: flex;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.45;
}

.embassy-line i {
    margin-top: 3px;
    color: var(--cat, var(--accent));
}

.embassy-line a {
    color: inherit;
}

.embassy-line a:not([href]) {
    text-decoration: none;
}

.detail-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

.detail-chip {
    padding: 7px 16px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.detail-chip:hover,
.detail-chip.is-active {
    background: var(--cat, var(--text-primary));
    border-color: var(--cat, var(--text-primary));
    color: #fff;
}

.detail-chip:focus-visible {
    outline: 3px solid var(--text-primary);
    outline-offset: 3px;
}

.is-found {
    animation: found 2.4s ease-out;
}

@keyframes found {
    0%, 35% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--cat, #6d9773) 55%, transparent); }
    100% { box-shadow: 0 0 0 5px transparent; }
}

.detail-items {
    display: grid;
    gap: 22px;
    margin-top: 32px;
    list-style: none;
}

.detail-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: #fff;
}

.detail-item.has-image {
    grid-template-columns: 260px minmax(0, 1fr);
}

.detail-item-figure {
    position: relative;
    min-height: 190px;
}

.detail-item-figure img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.detail-item-figure figcaption {
    position: absolute;
    margin: 0;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 18px 10px 6px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    color: #fff;
}

.detail-item-figure.is-broken {
    background: color-mix(in srgb, var(--cat, #3d4f8c) 75%, #000);
}

.detail-item-figure.is-broken img {
    display: none;
}

.detail-item-figure.is-broken::before {
    content: "\f03e";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.55);
    font: 900 2.2rem "Font Awesome 6 Free";
}

.detail-gallery figure.is-broken {
    display: none;
}

.detail-item-text {
    padding: 20px 24px;
}

.detail-item-summary {
    line-height: 1.65;
}

.detail-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 8px 16px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.detail-more:hover {
    background: var(--accent);
    color: #fff;
}

.detail-more i {
    transition: transform 0.35s var(--ease);
}

.detail-item.is-open .detail-more i {
    transform: rotate(180deg);
}

.detail-item-full {
    grid-column: 1 / -1;
    overflow: hidden;
}

.detail-item-full[hidden] {
    display: none;
}

.detail-item-full-inner {
    padding: 4px 24px 26px;
    border-top: 1px solid var(--border);
}

.detail-item-full-inner p {
    max-width: 68ch;
    margin-top: 16px;
    line-height: 1.75;
}

.detail-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 22px;
}

.detail-gallery img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 12px;
}

.detail-gallery figcaption {
    margin-top: 5px;
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.detail-gallery figcaption a {
    color: inherit;
}

.detail-item-text h3 {
    margin-bottom: 8px;
    font-size: 1.15rem;
}

.detail-item-text p {
    line-height: 1.65;
}

.detail-soon {
    padding: 48px 0;
    text-align: center;
    color: var(--text-secondary);
}

.detail-soon i {
    display: block;
    margin-bottom: 12px;
    font-size: 2rem;
}

/* Hero: the active card takes the top of the screen (see Flip in map/transitions.js) */

.wheel-slot.is-hero {
    --x: 0px;
    --y: 0px;
    --s: 1;
    left: 0;
    top: 0;
    z-index: 2;
    width: 100%;
    height: var(--hero-h);
    border-radius: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    translate: none;
}

.wheel-slot.is-hero .wheel-card,
.wheel-slot.is-hero .wheel-card:hover {
    padding: 22px 28px 52px;
    border: 0;
    box-shadow: none;
    cursor: default;
    transform: none;
}

.wheel-slot.is-hero .wheel-card-label {
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.map-topic[data-stage="detail"] .wheel-slot:not(.is-hero) {
    opacity: 0;
    pointer-events: none;
}

.map-topic[data-stage="detail"] .map-canvas {
    opacity: 0;
    transform: translateX(-6%);
}

.map-topic:not([data-stage="map"]) .map-canvas {
    pointer-events: none;
}

.wheel-slot.is-flipping,
.wheel-slot.is-flipping .wheel-card {
    transition: none !important;
}

/* Mobile: the province on top, the options as a horizontal carousel below */

@media (max-width: 768px) {
    .map-topic {
        --card-w: min(72vw, 320px);
        --card-h: 190px;
        --wheel-cx: 50%;
        --wheel-cy: 57%;
        --x-step: min(58vw, 250px);
        --y-step: 0px;
        --hero-h: 170px;
    }

    .map-bar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 14px;
    }

    .map-search {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .map-title {
        margin-left: auto;
    }

    .map-title {
        font-size: 1rem;
    }

    .wheel-slot[data-state="next"] {
        --x: var(--x-step);
        --y: 0px;
        --s: 0.62;
    }

    .wheel-slot[data-state="previous"] {
        --x: calc(var(--x-step) * -1);
        --y: 0px;
        --s: 0.62;
        opacity: 0.55;
        pointer-events: auto;
    }

    .wheel-slot[data-state="inactive"][data-side="below"] {
        --x: calc(var(--x-step) * 1.8);
        --y: 0px;
    }

    .wheel-slot[data-state="inactive"][data-side="above"] {
        --x: calc(var(--x-step) * -1.8);
        --y: 0px;
    }

    .map-wheel[data-mode="summary"] .wheel-slot[data-state="previous"] {
        opacity: 0.4;
    }

    .map-summary-kicker {
        display: none;
    }

    .wheel-dots {
        top: 73%;
        right: 0;
        left: 0;
        flex-direction: row;
        justify-content: center;
        transform: none;
    }

    .map-summary {
        left: 6%;
        right: 6%;
        bottom: 2%;
        width: auto;
    }

    .map-summary-text {
        font-size: 1.1rem;
    }

    .map-soon {
        left: 6%;
        right: 6%;
        top: 62%;
    }

    .detail-item.has-image {
        grid-template-columns: minmax(0, 1fr);
    }

    .detail-item-figure {
        min-height: 200px;
    }

    .map-detail-body {
        padding: 28px 18px 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-topic,
    .map-canvas,
    .map-region,
    .wheel-card,
    .map-back,
    .map-see {
        transition: none;
    }

    .wheel-slot {
        transition: opacity 0.2s linear, visibility 0.2s;
    }

    .wheel-slot.is-moving {
        filter: none;
    }

    .map-selection {
        animation: none;
    }

    .detail-more i {
        transition: none;
    }

    .is-found {
        animation: none;
        box-shadow: 0 0 0 5px color-mix(in srgb, var(--cat, #6d9773) 55%, transparent);
    }

    .map-topic[data-stage="detail"] .map-canvas {
        transform: none;
    }
}
