/* ==========================================================================
   THE CODEX — CARTOGRAPHIC ARCHIVE
   ========================================================================== */

.veil-codex-map {
    --map-gold: #c6a45c;
    --map-gold-bright: #e1c47a;
    --map-border: rgba(198, 164, 92, 0.24);
    --map-panel: rgba(10, 10, 12, 0.96);
    --map-text: #eee8dc;
    --map-muted: #9d978d;
    --map-blood: #721d2e;

    position: relative;
    overflow: hidden;

    margin-top: 32px;

    border: 1px solid var(--map-border);
    border-radius: 5px;

    background: #070708;

    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.42),
        inset 0 0 70px rgba(0, 0, 0, 0.28);
}


/* HEADER */

.veil-codex-map__header {
    position: relative;
    z-index: 20;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;

    padding: 17px 20px;

    border-bottom: 1px solid var(--map-border);

    background:
        linear-gradient(
            180deg,
            rgba(20, 19, 22, 0.98),
            rgba(11, 11, 13, 0.98)
        );
}

.veil-codex-map__heading small {
    display: block;
    margin-bottom: 3px;

    color: var(--map-gold);

    font-family: var(--lpds-font-body);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.veil-codex-map__heading h2 {
    margin: 0;

    color: var(--map-text);

    font-family: var(
        --lpds-font-decorative,
        "Cinzel Decorative",
        Cinzel,
        serif
    );

    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: 700;
}


/* CONTROLS */

.veil-codex-map__controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.veil-codex-map__control {
    min-width: 38px;
    min-height: 36px;

    padding: 7px 11px;

    color: var(--map-gold-bright);

    background: rgba(198, 164, 92, 0.055);

    border: 1px solid rgba(198, 164, 92, 0.23);
    border-radius: 3px;

    font-family: var(--lpds-font-body);
    font-size: 0.7rem;
    font-weight: 600;

    cursor: pointer;

    transition:
        background 160ms ease,
        border-color 160ms ease,
        color 160ms ease;
}

.veil-codex-map__control:hover:not(:disabled),
.veil-codex-map__control:focus-visible:not(:disabled) {
    color: #fff;
    background: rgba(198, 164, 92, 0.13);
    border-color: rgba(225, 196, 122, 0.55);
}

.veil-codex-map__control:disabled {
    opacity: 0.3;
    cursor: default;
}


/* VIEWPORT */

.veil-codex-map__viewport {
    position: relative;
    overflow: hidden;

    width: 100%;
    min-height: 500px;

    background:
        radial-gradient(
            circle at center,
            rgba(88, 63, 34, 0.12),
            transparent 55%
        ),
        #050506;
}

.veil-codex-map__stage {
    position: relative;

    width: 100%;

    transform-origin: center center;

    transition: transform 180ms ease;

    cursor: default;
    user-select: none;
    touch-action: pan-y;
}

.veil-codex-map__stage.is-dragging {
    cursor: grabbing;
    transition: none;
}

.veil-codex-map__image {
    display: block;

    width: 100%;
    height: auto;

    opacity: 1;

    user-select: none;
    pointer-events: none;

    transition:
        opacity 180ms ease,
        filter 180ms ease;
}

.veil-codex-map__image.is-changing {
    opacity: 0.2;
    filter: blur(3px);
}


/* MARKER LAYER */

.veil-codex-map__markers {
    position: absolute;
    inset: 0;

    z-index: 10;

    pointer-events: none;
}

.veil-codex-map__marker {
    position: absolute;

    width: 22px;
    height: 22px;

    padding: 0;

    transform: translate(-50%, -50%);

    border: 0;
    background: transparent;

    cursor: pointer;
    pointer-events: auto;
}

.veil-codex-map__marker-core {
    position: absolute;
    inset: 6px;

    border-radius: 50%;

    background: var(--map-gold-bright);

    box-shadow:
        0 0 7px rgba(225, 196, 122, 0.9),
        0 0 18px rgba(198, 164, 92, 0.6);
}

.veil-codex-map__marker-pulse {
    position: absolute;
    inset: 1px;

    border: 1px solid rgba(225, 196, 122, 0.75);
    border-radius: 50%;

    animation: veilCodexMapPulse 2.2s ease-out infinite;
}

.veil-codex-map__marker-label {
    position: absolute;
    top: 27px;
    left: 50%;

    width: max-content;
    max-width: 180px;

    padding: 4px 7px;

    transform: translateX(-50%);

    color: #f2ead9;

    background: rgba(5, 5, 7, 0.88);

    border: 1px solid rgba(198, 164, 92, 0.24);
    border-radius: 2px;

    font-family: var(--lpds-font-display);
    font-size: 0.67rem;
    font-weight: 600;
    letter-spacing: 0.025em;

    text-shadow: 0 1px 3px #000;

    white-space: nowrap;

    opacity: 0.78;

    transition:
        opacity 150ms ease,
        border-color 150ms ease,
        color 150ms ease;
}

.veil-codex-map__marker:hover .veil-codex-map__marker-label,
.veil-codex-map__marker:focus-visible .veil-codex-map__marker-label {
    opacity: 1;
    color: #fff;
    border-color: rgba(225, 196, 122, 0.62);
}


/* STATUS */

.veil-codex-map__status {
    position: relative;
    z-index: 20;

    display: flex;
    align-items: center;
    gap: 9px;

    min-height: 42px;
    padding: 9px 18px;

    color: var(--map-muted);

    background: rgba(10, 10, 12, 0.98);

    border-top: 1px solid var(--map-border);

    font-family: var(--lpds-font-body);
    font-size: 0.7rem;
}

.veil-codex-map__status-sigil {
    color: var(--map-gold);
}


/* LOCATION DRAWER */

.veil-codex-map__drawer {
    position: absolute;
    top: 74px;
    right: 0;
    bottom: 42px;
    z-index: 30;

    width: min(390px, 90%);

    padding: 28px;

    transform: translateX(105%);

    background:
        radial-gradient(
            circle at 100% 0%,
            rgba(111, 29, 45, 0.18),
            transparent 40%
        ),
        rgba(10, 10, 13, 0.97);

    border-left: 1px solid rgba(198, 164, 92, 0.30);

    box-shadow:
        -20px 0 50px rgba(0, 0, 0, 0.48);

    transition: transform 240ms ease;
}

.veil-codex-map__drawer.is-open {
    transform: translateX(0);
}

.veil-codex-map__drawer-close {
    position: absolute;
    top: 10px;
    right: 12px;

    width: 34px;
    height: 34px;

    color: var(--map-muted);

    background: transparent;
    border: 0;

    font-size: 1.5rem;

    cursor: pointer;
}

.veil-codex-map__drawer-content small {
    display: block;
    margin-bottom: 8px;

    color: var(--map-gold);

    font-family: var(--lpds-font-body);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.veil-codex-map__drawer-content h3 {
    margin: 0 0 13px;

    color: var(--map-text);

    font-family: var(
        --lpds-font-decorative,
        "Cinzel Decorative",
        Cinzel,
        serif
    );

    font-size: 1.5rem;
    font-weight: 700;
}

.veil-codex-map__drawer-content p {
    color: var(--map-muted);

    font-family: var(--lpds-font-body);
    font-size: 0.88rem;
    line-height: 1.7;
}

.veil-codex-map__drawer-link {
    display: inline-block;
    margin-top: 12px;

    color: var(--map-gold-bright);

    font-family: var(--lpds-font-body);
    font-size: 0.76rem;
    font-weight: 700;

    text-decoration: none;
}


/* BLOOD MOON */

.veil-codex2:not(.veil-codex2--bloodmoon-stable)
.veil-codex-map {
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.48),
        0 0 55px rgba(111, 29, 45, 0.10);
}


/* ANIMATION */

@keyframes veilCodexMapPulse {
    0% {
        transform: scale(0.65);
        opacity: 1;
    }

    70%,
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}


/* TABLET */

@media (max-width: 850px) {

    .veil-codex-map__header {
        align-items: flex-start;
        flex-direction: column;
    }

    .veil-codex-map__controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .veil-codex-map__viewport {
        min-height: 350px;
    }
}


/* MOBILE */

@media (max-width: 560px) {

    .veil-codex-map {
        margin-top: 22px;
    }

    .veil-codex-map__header {
        padding: 14px;
    }

    .veil-codex-map__control {
        flex: 1 1 auto;
    }

    .veil-codex-map__viewport {
        min-height: 240px;
    }

    .veil-codex-map__marker-label {
        display: none;
    }

    .veil-codex-map__drawer {
        top: auto;
        right: 0;
        bottom: 42px;
        left: 0;

        width: 100%;
        max-height: 70%;

        transform: translateY(105%);

        border-top: 1px solid rgba(198, 164, 92, 0.30);
        border-left: 0;
    }

    .veil-codex-map__drawer.is-open {
        transform: translateY(0);
    }
}


/* REDUCED MOTION */

@media (prefers-reduced-motion: reduce) {

    .veil-codex-map *,
    .veil-codex-map *::before,
    .veil-codex-map *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ==========================================================
   CODEX WORLD MAP — REGION LABEL HOTSPOTS
   The printed map label is the navigation target.
   ========================================================== */

.veil-codex-map__marker--region {
    width: auto;
    height: auto;

    padding: 0;

    transform: translate(-50%, -50%);

    border: 0;
    background: transparent;

    pointer-events: auto;
}

.veil-codex-map__marker--region .veil-codex-map__marker-label {
    position: relative;
    top: auto;
    left: auto;

    display: block;

    width: max-content;
    max-width: none;

    padding: 7px 12px;

    transform: none;

    color: transparent;
    background: transparent;

    border: 1px solid transparent;
    border-radius: 4px;

    font-size: 0.78rem;
    line-height: 1.2;

    text-shadow: none;

    white-space: nowrap;

    opacity: 1;

    transition:
        color 160ms ease,
        background 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

/*
 * Keep the artwork's printed label visible normally.
 * On hover/focus, reveal a subtle interactive Veil highlight.
 */
.veil-codex-map__marker--region:hover .veil-codex-map__marker-label,
.veil-codex-map__marker--region:focus-visible .veil-codex-map__marker-label {
    color: rgba(242, 234, 217, 0.95);

    background: rgba(5, 5, 7, 0.72);

    border-color: rgba(225, 196, 122, 0.62);

    box-shadow:
        0 0 10px rgba(198, 164, 92, 0.20),
        0 0 24px rgba(111, 29, 45, 0.18);

    text-shadow: 0 1px 3px #000;
}

.veil-codex-map__marker--region:focus-visible {
    outline: none;
}

@media (max-width: 689px) {
    .veil-codex-map__marker--region .veil-codex-map__marker-label {
        display: block;
        padding: 9px 13px;
    }
}

/* ==========================================================
   CODEX WORLD MAP — INVISIBLE REGION HOTSPOTS
   Preserve the artwork exactly as printed.
   ========================================================== */

.veil-codex-map__marker--region {
    width: auto;
    height: auto;
    padding: 0;

    transform: translate(-50%, -50%);

    border: 0 !important;
    outline: 0;
    background: transparent !important;
    box-shadow: none !important;

    cursor: pointer;
    pointer-events: auto;
}

.veil-codex-map__marker--region .veil-codex-map__marker-label {
    position: relative;
    top: auto;
    left: auto;

    display: block;

    width: max-content;
    max-width: none;

    /*
     * Padding creates the clickable area around the
     * name printed into the map artwork.
     */
    padding: 10px 14px;

    transform: none;

    color: transparent !important;
    background: transparent !important;

    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;

    text-shadow: none !important;

    white-space: nowrap;
    opacity: 0 !important;
}

/* Absolutely no visual hover/focus overlay. */
.veil-codex-map__marker--region:hover,
.veil-codex-map__marker--region:focus,
.veil-codex-map__marker--region:focus-visible,
.veil-codex-map__marker--region:hover .veil-codex-map__marker-label,
.veil-codex-map__marker--region:focus .veil-codex-map__marker-label,
.veil-codex-map__marker--region:focus-visible .veil-codex-map__marker-label {
    color: transparent !important;
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

/* World-map hotspot hover — subtle Veil glow only */
.veil-codex-map__marker--region:hover .veil-codex-map__marker-label,
.veil-codex-map__marker--region:focus-visible .veil-codex-map__marker-label {
    opacity: 1 !important;

    color: transparent !important;
    background: transparent !important;

    border: 0 !important;
    outline: 0 !important;

    box-shadow:
        0 0 8px rgba(225, 196, 122, 0.42),
        0 0 18px rgba(225, 196, 122, 0.22),
        0 0 30px rgba(111, 29, 45, 0.18) !important;

    text-shadow: none !important;
}

/* World-map hotspot — stronger Veil glow */
.veil-codex-map__marker--region:hover .veil-codex-map__marker-label,
.veil-codex-map__marker--region:focus-visible .veil-codex-map__marker-label {
    opacity: 1 !important;

    color: transparent !important;
    background: transparent !important;

    border: 0 !important;
    outline: 0 !important;

    box-shadow:
        0 0 6px rgba(255, 226, 145, 0.95),
        0 0 14px rgba(225, 196, 122, 0.85),
        0 0 28px rgba(198, 164, 92, 0.65),
        0 0 45px rgba(111, 29, 45, 0.48),
        0 0 65px rgba(111, 29, 45, 0.28) !important;

    text-shadow: none !important;
}

/* ==========================================================
   CODEX WORLD MAP — SIZED REGION HOTSPOTS
   ========================================================== */

.veil-codex-map__marker--region {
    padding: 0 !important;

    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;

    cursor: pointer;
}

/* Hidden accessibility label fills the hotspot */
.veil-codex-map__marker--region .veil-codex-map__marker-label {
    position: absolute !important;
    inset: 0 !important;

    width: 100% !important;
    height: 100% !important;

    padding: 0 !important;

    color: transparent !important;
    background: transparent !important;
    border: 0 !important;

    font-size: 0 !important;
    line-height: 0 !important;

    opacity: 0 !important;
}

/* Strong Veil glow — no box or duplicate text */
.veil-codex-map__marker--region:hover,
.veil-codex-map__marker--region:focus-visible {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;

    box-shadow:
        inset 0 0 18px rgba(255, 226, 145, 0.20),
        0 0 8px rgba(255, 226, 145, 0.95),
        0 0 18px rgba(225, 196, 122, 0.85),
        0 0 34px rgba(198, 164, 92, 0.65),
        0 0 58px rgba(111, 29, 45, 0.48) !important;

    border-radius: 12px;
}


/* ==========================================================
   CODEX WORLD MAP — FINAL REGION HOTSPOT POSITIONING
   x/y coordinates represent the CENTER of each region target.
   ========================================================== */

.veil-codex-map__marker.veil-codex-map__marker--region {
    transform: translate(-50%, -50%) !important;
    transform-origin: center center !important;
}

/* Strong Veil glow — artwork remains visible */
.veil-codex-map__marker--region:hover,
.veil-codex-map__marker--region:focus-visible {
    background: transparent !important;
    border: 0 !important;
    outline: 0 !important;

    box-shadow:
        inset 0 0 18px rgba(255, 226, 145, 0.20),
        0 0 8px rgba(255, 226, 145, 0.95),
        0 0 18px rgba(225, 196, 122, 0.85),
        0 0 34px rgba(198, 164, 92, 0.65),
        0 0 58px rgba(111, 29, 45, 0.48) !important;

    border-radius: 12px;
}
