/* =========================================
   EXPLORE.CSS
   Interactive Map Landing Page
   ========================================= */


/* =========================================
   VARIABLES
   ========================================= */

:root {
    --explore-background: #121212;
    --explore-background-dark: #090909;

    --explore-text: #c2baac;
    --explore-text-muted: #918b81;

    --explore-red: #641621;
    --explore-red-light: #a82436;

    --explore-border: rgba(194, 186, 172, 0.24);
    --explore-border-subtle: rgba(255, 255, 255, 0.08);

    --navbar-height: 84px;
}

/* =========================================
   ACCESSIBILITY
   ========================================= */

.screen-reader-only {
    position: absolute;

    width: 1px;
    height: 1px;

    padding: 0;
    margin: -1px;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;
}

/* =========================================
   PAGE
   ========================================= */

body.explore-page {

    display: flex;
    flex-direction: column;
    min-height: 100vh;

    color: var(--explore-text);
    
    background:
        linear-gradient(
            rgba(0, 0, 0, 0.18),
            rgba(0, 0, 0, 0.18)
        ),
        url("/images/elements/map_background.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;

    overflow-x: hidden;
}


.explore-main {
    flex: 1 0 auto;
    min-height: 0;

    padding-top: var(--navbar-height);

    background: transparent;
}


/* =========================================
   HEADER
   ========================================= */

.explore-heading {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;

    padding:
        10px
        5%
        6px;

    text-align: center;

    background:
        linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.62),
            rgba(0, 0, 0, 0.20)
        );
}


.explore-heading-content {
    width: 100%;
    max-width: 1200px;
}


.explore-eyebrow {
    margin-bottom: 5px;

    color: var(--explore-red-light);

    font-family: "Cinzel", serif;
    font-size: 0.72rem;
    font-weight: 600;

    letter-spacing: 0.28rem;

    text-transform: uppercase;
}


.explore-heading h1 {
    margin: 0;

    color: var(--explore-text);

    font-family: "Cinzel", serif;
    font-size: clamp(2.2rem, 4vw, 3.7rem);
    font-weight: 600;

    line-height: 1.05;

    letter-spacing: 0.12rem;

    text-transform: uppercase;
}


.explore-divider {
    width: min(300px, 60vw);
    height: 2px;

    margin:
        4px
        auto
        2px;

    background:
        linear-gradient(
            to right,
            transparent,
            var(--explore-text),
            transparent
        );
}


.explore-introduction {
    max-width: 680px;

    margin: 0 auto;

    color: var(--explore-text-muted);

    font-family: "Lora", serif;
    font-size: 0.9rem;

    line-height: 1.5;
}

/* =========================================================
   RETURN TO WORLD
   ========================================================= */

.explore-return {
    position: absolute;

    top: 100px;
    right: 32px;

    z-index: 30;

    padding: 9px 14px;

    font-family: "Cinzel", serif;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;

    color: rgba(236, 228, 213, 0.85);
    text-decoration: none;

    border: 1px solid rgba(236, 228, 213, 0.35);
    background: rgba(0, 0, 0, 0.40);

    transition:
        color 0.25s ease,
        border-color 0.25s ease,
        background 0.25s ease;
}

.explore-return:hover,
.explore-return:focus-visible {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.85);
    background: rgba(0, 0, 0, 0.65);
}

/* =========================================
   MAP SECTION
   ========================================= */

.map-section {
    position: relative;

    display: flex;
    justify-content: center;

    width: 100%;

    padding:
        12px
        clamp(12px, 2.5vw, 38px)
        22px;

    background: transparent;
}


.map-container {
    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
}


/* =========================================
   MAP
   ========================================= */

.map-stage {
    position: relative;

    display: inline-block;

    max-width: 100%;

    line-height: 0;

    background: var(--explore-background-dark);

    border:
        1px
        solid
        var(--explore-border);

    box-shadow:
        0 18px 55px rgba(0, 0, 0, 0.75),
        0 0 0 1px rgba(0, 0, 0, 0.75);
}


.map-stage::before {
    content: "";

    position: absolute;

    inset: 0;

    z-index: 2;

    pointer-events: none;

    box-shadow:
        inset 0 0 38px rgba(0, 0, 0, 0.50),
        inset 0 0 4px rgba(0, 0, 0, 0.90);
}


.world-map {
    display: block;

    width: auto;
    height: auto;

    max-width: 100%;

    /*
        Keeps the entire map visible rather
        than cropping it.
    */

    max-height:
        calc(
            100vh
            - var(--navbar-height)
            - 150px
        );

    object-fit: contain;
}


/* =========================================
   HOTSPOTS
   ========================================= */

.map-hotspot {
    position: absolute;

    left: var(--x);
    top: var(--y);

    z-index: 5;

    width: 0;
    height: 0;
}


.map-hotspot:hover,
.map-hotspot:focus-within {
    z-index: 100;
}

/* =========================================
   SELECTED HOTSPOT
   ========================================= */

.map-hotspot.is-selected {
    z-index: 100;
}


.map-hotspot.is-selected .marker-ring {
    background: var(--explore-red-light);

    border-color: #e0d8cb;

    box-shadow:
        0 0 0 3px rgba(168, 36, 54, 0.18),
        0 0 12px rgba(168, 36, 54, 0.6);
}

/* =========================================
   MARKERS
   ========================================= */

.map-marker {
    position: absolute;

    left: 0;
    top: 0;

    z-index: 3;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;

    background: transparent;

    border: none;
    border-radius: 50%;

    cursor: pointer;

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

    transition:
        transform 0.2s ease,
        filter 0.2s ease;
}


.marker-ring {
    position: relative;

    display: block;

    width: 15px;
    height: 15px;

    background: var(--explore-red);

    border:
        2px
        solid
        var(--explore-text);

    border-radius: 75%;

    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.60),
        0 0 0 2px rgba(0, 0, 0, 0.25);

    transition:
        background 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}


.marker-ring::after {
    content: "";

    position: absolute;

    top: 50%;
    left: 50%;

    width: 3px;
    height: 3px;

    background: #180609;

    border-radius: 50%;

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


.map-marker:hover,
.map-marker:focus-visible {
    transform:
        translate(-50%, -50%)
        scale(1.2);

    filter: brightness(1.2);
}


.map-marker:hover .marker-ring,
.map-marker:focus-visible .marker-ring {
    background: var(--explore-red-light);

    border-color: #e0d8cb;
}


.map-marker:focus-visible {
    outline:
        2px
        solid
        var(--explore-text);

    outline-offset: 3px;
}


/* =========================================
   MAP RESULT CARDS
   ========================================= */

.location-card,
.creature-card,
.feature-card {
    translate: 0 var(--card-shift-y, 0px);
    position: absolute;

    z-index: 10;

    width: min(310px, 74vw);

    padding:
        18px
        20px;

    color: var(--explore-text);

    background:
        linear-gradient(
            145deg,
            rgba(25, 25, 25, 0.98),
            rgba(8, 8, 8, 0.98)
        );

    border:
        1px
        solid
        rgba(168, 36, 54, 0.68);

    border-radius: 2px;

    box-shadow:
        0 15px 34px rgba(0, 0, 0, 0.78),
        inset 0 0 0 1px rgba(255, 255, 255, 0.025);

    line-height: normal;

    text-align: left;

    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    display: none;

    transition:
        opacity 0.18s ease,
        visibility 0.18s ease,
        transform 0.18s ease;
}

.location-card::before,
.creature-card::before,
.feature-card::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;

    width: 100%;
    height: 3px;

    background:
        linear-gradient(
            90deg,
            transparent,
            var(--explore-red-light),
            transparent
        );
}


/* =========================================
   CARD CONTENT
   ========================================= */

.location-type,
.creature-type,
.feature-type {
    margin-bottom: 5px;

    color: var(--explore-red-light);

    font-family: "Cinzel", serif;
    font-size: 0.65rem;
    font-weight: 600;

    letter-spacing: 0.17rem;

    text-transform: uppercase;
}


.location-card h2,
.creature-card h2,
.feature-card h2 {
    margin-bottom: 8px;

    color: var(--explore-text);

    font-family: "Cinzel", serif;
    font-size: 1.2rem;
    font-weight: 600;

    letter-spacing: 0.04rem;
}


.location-card p,
.creature-card p,
.feature-card p {
    color: #b9b1a4;

    font-size: 0.84rem;

    line-height: 1.5;
}


/* =========================================
   CARD LINKS
   ========================================= */

.location-card a,
.creature-card a,
.feature-card a {
    color: inherit;

    text-decoration: none;
}


.location-card a:hover h2,
.creature-card a:hover h2,
.feature-card a:hover h2 {
    color: #e0d8cb;
}


/* =========================================
   SHOW CARDS
   ========================================= */

.map-hotspot:hover .location-card,
.map-hotspot:hover .creature-card,
.map-hotspot:hover .feature-card,
.map-hotspot:focus-within .location-card,
.map-hotspot:focus-within .creature-card,
.map-hotspot:focus-within .feature-card,
.map-hotspot.is-selected .location-card,
.map-hotspot.is-selected .creature-card,
.map-hotspot.is-selected .feature-card {
    display: block;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}


/* =========================================
   CARD POSITIONING
   ========================================= */

/*
    Location card appears to the left.
*/

.location-card,
.creature-card,
.feature-card {
    padding: 0;

    overflow: hidden;
}

.location-card .map-card-link h2,
.creature-card .map-card-link h2,
.feature-card .map-card-link h2 {
    margin:
        16px
        18px
        8px;
}

.location-card .map-card-subtitle,
.creature-card .map-card-subtitle,
.feature-card .map-card-subtitle {
    margin:
        0
        18px
        8px;
}

.location-card .map-card-link > p,
.creature-card .map-card-link > p,
.feature-card .map-card-link > p {
    margin:
        0
        18px
        16px;
}

.location-card .map-card-action,
.creature-card .map-card-action,
.feature-card .map-card-action {
    margin:
        0
        18px
        18px;
}

.map-hotspot:hover .location-card,
.map-hotspot:focus-within .location-card {
    transform:
        translateY(-50%)
        translateX(0);
}

/* =========================================
   LOCATION FEATURE CARD
   ========================================= */

.feature-card {
    left: 0;
    bottom: 54px;

    padding: 0;

    overflow: hidden;

    transform:
        translateX(-50%)
        translateY(8px);
}


.map-hotspot:hover .feature-card,
.map-hotspot:focus-within .feature-card,
.map-hotspot.is-selected .feature-card {
    transform:
        translateX(-50%)
        translateY(0);
}


.feature-card h2 {
    margin:
        16px
        18px
        8px;
}


.feature-card .map-card-subtitle {
    margin:
        0
        18px
        8px;
}


.feature-card p {
    margin:
        0
        18px
        16px;
}


.feature-card .map-card-action {
    margin:
        0
        18px
        18px;
}

/* =========================================
   FEATURE CARD - FLIP BELOW WHEN NEEDED
   ========================================= */

.map-hotspot.feature-card-below .feature-card {
    top: 54px;
    bottom: auto;

    transform:
        translateX(-50%)
        translateY(-8px);
}


.map-hotspot.feature-card-below:hover .feature-card,
.map-hotspot.feature-card-below:focus-within .feature-card,
.map-hotspot.feature-card-below.is-selected .feature-card {
    transform:
        translateX(-50%)
        translateY(0);
}


/*
    Flip the feature connector downward too.
*/

.map-hotspot.feature-card-below .connector-feature {
    top: 16px;
    bottom: auto;
}


.map-hotspot.feature-card-below .connector-feature::after {
    top: auto;
    bottom: 0;

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

/* =========================================
   CARD CONNECTORS
   ========================================= */

.card-connector {
    position: absolute;

    z-index: 8;

    display: block;

    background:
        rgba(194, 186, 172, 0.58);

    pointer-events: none;

    visibility: hidden;
    opacity: 0;

    transition:
        opacity 0.18s ease,
        visibility 0.18s ease;
}


/* -----------------------------------------
   LOCATION CONNECTOR
   Marker → left card
   ----------------------------------------- */

.connector-location {
    right: 16px;
    top: 0;

    width: 38px;
    height: 1px;

    transform:
        translateY(-50%);
}


/* -----------------------------------------
   CREATURE CONNECTOR
   Marker → right card
   ----------------------------------------- */

.connector-creature {
    left: 16px;
    top: 0;

    width: 38px;
    height: 1px;

    transform:
        translateY(-50%);
}


/* -----------------------------------------
   FEATURE CONNECTOR
   Marker → upper card
   ----------------------------------------- */

.connector-feature {
    left: 0;
    bottom: 16px;

    width: 1px;
    height: 38px;

    transform:
        translateX(-50%);
}

/* =========================================
   EXTRA SPACE FOR FEATURE LOCATIONS
   ========================================= */

.map-hotspot.has-feature .location-card {
    right: 175px;
}

/* -----------------------------------------
   SHOW CONNECTORS
   ----------------------------------------- */

.map-hotspot:hover .card-connector,
.map-hotspot:focus-within .card-connector,
.map-hotspot.is-selected .card-connector {
    visibility: visible;
    opacity: 1;
}

.card-connector::after {
    content: "";

    position: absolute;

    width: 5px;
    height: 5px;

    background:
        var(--explore-text);

    border-radius: 50%;
}

.connector-location::after {
    left: 0;
    top: 50%;

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


.connector-creature::after {
    right: 0;
    top: 50%;

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


.connector-feature::after {
    top: 0;
    left: 50%;

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

/* =========================================
   LOCATION CARD POSITION
   ========================================= */

.location-card {
    right: 54px;
    top: 50%;

    transform:
        translateY(-50%)
        translateX(8px);
}

.map-hotspot:hover .location-card,
.map-hotspot:focus-within .location-card,
.map-hotspot.is-selected .location-card {
    transform:
        translateY(-50%)
        translateX(0);
}

/* =========================================
   CREATURE CARD POSITION
   ========================================= */

.creature-card {
    left: 54px;
    top: 50%;

    transform:
        translateY(-50%)
        translateX(-8px);
}

.map-hotspot:hover .creature-card,
.map-hotspot:focus-within .creature-card,
.map-hotspot.is-selected .creature-card {
    transform:
        translateY(-50%)
        translateX(0);
}

/* =========================================
   MAP CARD IMAGES
   ========================================= */

.map-card-image {
    display: block;

    width: 100%;
    height: 150px;

    margin: 0;

    object-fit: cover;
    object-position: center top;
}

/* =========================================
   CARD LINKS
   ========================================= */

.map-card-link {
    display: block;

    color: inherit;

    text-decoration: none;
}


.map-card-subtitle {
    margin-bottom: 8px;

    color: var(--explore-text-muted);

    font-style: italic;
}


.map-card-action {
    display: flex;
    align-items: center;

    gap: 8px;

    margin-top: 14px;
    padding-top: 10px;

    color: var(--explore-red-light);

    border-top:
        1px
        solid
        rgba(194, 186, 172, 0.13);

    font-family: "Cinzel", serif;
    font-size: 0.62rem;
    font-weight: 600;

    letter-spacing: 0.08rem;

    text-transform: uppercase;
}


.map-card-link:hover .map-card-action,
.map-card-link:focus-visible .map-card-action {
    color: #e0d8cb;
}


.map-card-link:focus-visible {
    outline:
        2px
        solid
        var(--explore-text);

    outline-offset: 4px;
}


.creature-card-entry--additional {
    margin-top: 16px;
    padding-top: 16px;

    border-top:
        1px
        solid
        rgba(194, 186, 172, 0.15);
}

/* =========================================
   MAP INSTRUCTIONS
   ========================================= */

.map-instructions {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    min-height: 34px;

    margin-top: 8px;

    color: var(--explore-text-muted);

    font-size: 0.77rem;

    letter-spacing: 0.02rem;
}


.map-instructions i {
    color: var(--explore-red-light);
}


.mobile-instruction {
    display: none;
}


/* =========================================
   TABLET
   ========================================= */

@media (max-width: 900px) {

    .explore-heading {
        padding:
            20px
            5%
            14px;
    }


    .explore-heading h1 {
        font-size:
            clamp(
                1.8rem,
                6vw,
                2.8rem
            );
    }


    .world-map {
        max-height:
            calc(
                100vh
                - var(--navbar-height)
                - 140px
            );
    }


    .location-card,
    .creature-card,
    .feature-card {
        width:
            min(
                270px,
                66vw
            );
    }

}


/* =========================================
   MOBILE
   ========================================= */

@media (max-width: 600px) {

    .explore-heading {
        padding:
            16px
            16px
            12px;
    }


    .explore-heading h1 {
        font-size:
            clamp(
                1.5rem,
                7vw,
                2.1rem
            );

        letter-spacing: 0.07rem;
    }


    .explore-eyebrow {
        font-size: 0.6rem;

        letter-spacing: 0.2rem;
    }


    .explore-introduction {
        font-size: 0.78rem;
    }


    .map-section {
        padding:
            8px
            6px
            14px;
    }


    .world-map {
        max-height:
            calc(
                100vh
                - var(--navbar-height)
                - 130px
            );
    }


    .map-marker {
        width: 30px;
        height: 30px;
    }


    .location-card,
    .creature-card,
    .feature-card {
        width:
            min(
                230px,
                76vw
            );

        padding:
            14px
            15px;
    }


    /*
        On smaller screens we don't want
        cards stretching horizontally
        off the map.

        Stack them vertically instead.
    */

    .location-card {
        left: 0;
        right: auto;

        bottom: 28px;
        top: auto;

        transform:
            translateX(-50%)
            translateY(8px);
    }


    .creature-card {
        left: 0;

        top: 28px;

        transform:
            translateX(-50%)
            translateY(-8px);
    }

    .feature-card {
        left: 0;

        top: 28px;
        bottom: auto;

        transform:
            translateX(-50%)
            translateY(-8px);
    }


    .map-hotspot:hover .feature-card,
    .map-hotspot:focus-within .feature-card,
    .map-hotspot.is-selected .feature-card {
        transform:
            translateX(-50%)
            translateY(0);
    }


    .map-hotspot:hover .location-card,
    .map-hotspot:focus-within .location-card {
        transform:
            translateX(-50%)
            translateY(0);
    }


    .map-hotspot:hover .creature-card,
    .map-hotspot:focus-within .creature-card {
        transform:
            translateX(-50%)
            translateY(0);
    }


    .desktop-instruction {
        display: none;
    }


    .mobile-instruction {
        display: inline;
    }

}


/* =========================================
   REDUCED MOTION
   ========================================= */

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

    .map-marker,
    .location-card,
    .creature-card {
        transition: none;
    }

}