/* sn0w — Snowfinder map application: Winkel renderer, controls, hover cards. */

/* SNOWFINDER — MAPS AND SHARED PORTAL STYLES
   Extracted from page.css; resort-specific styling lives in resort.css.
*/

/* =========================================================
   03. SNOWFINDER PORTAL
   ========================================================= */

/* Full-width Snowfinder experiment.
   Map and resort pages share the viewport; no fixed 1200 × 700 cap.
   Preserve the original as maps-boxed.css for an instant rollback. */
.snowfinder-map-wrap {
    position: absolute;
    top: 6rem;
    left: 0;
    transform: none;
    z-index: 10;

    width: 100%;
    height: calc(100dvh - 9.5rem);
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1rem;

	background: rgba(5, 20, 38, 0.50);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;

    touch-action: none;
    cursor: grab;
}

/* Map-only views start beneath the shared charcoal stripe.
   Resort pages retain their existing toolbar and its original offset. */
.snowfinder-map-wrap:not(:has(.snowfinder-resort)) {
    top: var(--sn0w-content-start, 9.625rem);
    height: calc(100dvh - var(--sn0w-content-start, 9.625rem) - 3.5rem);
}

.snowfinder-map-wrap:not(:has(.snowfinder-resort))::after {
    content: "+";
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 15;
    color: rgba(5, 20, 38, 0.55);
    font: 300 22px Arial, sans-serif;
    pointer-events: none;
}
/* =========================================================
   05. MAP INTERACTION
   ========================================================= */

.snowfinder-map-wrap.dragging {
    cursor: grabbing;
}

/* =========================================================
   07. RESORT HOVER CARDS
   ========================================================= */

/* Tooltip belongs outside .snowfinder-map-wrap to avoid clipping. */
#resort-tooltip {
    position: fixed;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;

    background: #1b1b1b;
    border: 1px solid #555;
    border-radius: 6px;
    color: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

#resort-tooltip[hidden] {
    display: none;
}

#resort-tooltip-logo {
    display: block;
    max-width: 130px;
    max-height: 50px;
    width: auto;
    height: auto;
    object-fit: contain;
}

#resort-tooltip-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}
/* Map controls — lower right */
.map-controls {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, 2rem);
    grid-template-rows: repeat(5, 2rem);
    gap: 0.25rem;
}

/* Directional pad */
#pan-up {
    grid-column: 2;
    grid-row: 1;
}

#pan-left {
    grid-column: 1;
    grid-row: 2;
}

#pan-reset {
    grid-column: 2;
    grid-row: 2;
}

#pan-right {
    grid-column: 3;
    grid-row: 2;
}

#pan-down {
    grid-column: 2;
    grid-row: 3;
}

/* Zoom controls */
#zoom-out {
    grid-column: 1;
    grid-row: 5;
    transform: translateX(1.2rem);
}

#zoom-in {
    grid-column: 2;
    grid-row: 5;
    transform: translateX(1.2rem);
}

.map-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0 0 2px 0;

    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

/* Map debug and CAPTURE — upper left */
.map-debug {
    position: absolute;
    left: 0.75rem;
    top: 0.75rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #fff;
    font: 12px monospace;
}

.map-debug button {
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

#map-coordinates {
    display: inline-block;
    width: 27ch;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* =========================================================
   10. BREADCRUMB NAVIGATION
   ========================================================= */

/* Ancestors are links; current geographic location is plain text. */
.map-breadcrumbs {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem;
    width: max-content;
    max-width: calc(100% - 2rem);
    padding: 9px 12px;

    background: #000;
    border: 1px solid #555;
    border-radius: 16px 16px 0 0;
    white-space: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    font: 700 10px Arial, Helvetica, sans-serif;
    letter-spacing: 0.06em;
}

.map-breadcrumbs::-webkit-scrollbar {
    display: none;
}

.map-breadcrumbs > * {
    flex-shrink: 0;
}

.map-breadcrumbs a {
    display: inline-block;
    color: #999;
    text-decoration: none;
    transition: transform 0.15s ease, color 0.15s ease;
}

.map-breadcrumbs a:hover {
    color: #fff;
    transform: translateY(-1px) scale(1.25);
}

.map-breadcrumbs .current {
    color: #fff;
}

.map-breadcrumbs .separator {
    color: #555;
}

/* =========================================================
   13. RESPONSIVE ADJUSTMENTS
   ========================================================= */

@media (max-height: 500px) and (orientation: landscape) {
    .snowfinder-map-wrap {
        top: 7rem;
        height: calc(100dvh - 12rem);
        padding: 1rem;
    }
}

/* Resort logo fallback: consistent boxed initials on maps and overview pages. */
.resort-monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
    background: #17365c;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 7px;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.03em;
    user-select: none;
}
.resort-monogram[hidden], #resort-tooltip-logo[hidden] { display: none; }
.resort-tooltip-art { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.resort-monogram-tooltip { width: 54px; height: 54px; font-size: 22px; }
.resort-monogram-overview { width: 110px; height: 110px; font-size: 40px; }
@media (max-width: 700px) {
    .resort-monogram-overview { width: 84px; height: 84px; font-size: 32px; }
}

/* Keep the stripe clear on short landscape map views as well. */
@media (max-height: 500px) and (orientation: landscape) {
    .snowfinder-map-wrap:not(:has(.snowfinder-resort)) {
        top: var(--sn0w-content-start, 9.625rem);
        height: calc(100dvh - var(--sn0w-content-start, 9.625rem) - 3.5rem);
    }
}


/* =========================================================
   WINKEL WORLD — CANVAS, DRIFT, AND INTERACTION OVERLAYS
   ========================================================= */

/* SNOWFINDER WORLD — moving snow behind the original ocean tint.
   World-portal only: never animate or modify the shared masthead/page background. */
.snowfinder-map-wrap.snowfinder-winkel-wrap {
    display: block;
    padding: 0;
    background: transparent;
    isolation: isolate;
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.snowfinder-winkel-wrap.dragging { cursor: grabbing; }

/* World-only copy of the snowy photo, with the same darkness used by
   the site's original .page::before. It moves *under* the ocean overlay.
   Overscan prevents an animated image edge from appearing in the map portal. */
.snowfinder-map-wrap.snowfinder-winkel-wrap::before {
    content: "";
    position: absolute;
    inset: -72px;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(0, 0, 0, var(--snow-darkness, .85)), rgba(0, 0, 0, var(--snow-darkness, .85))),
        url('/public/assets/site/snow.png');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
    opacity: 1;
    animation: sn0w-world-snow-drift 20s ease-in-out infinite alternate;
    will-change: transform;
}

/* The shared portal uses this same ::after for its center reticle, setting
   left:50%, top:50%, transform:translate(-50%,-50%). Explicitly reset ALL of
   that geometry, using a selector at least as specific as the original rule.
   One full-portal navy tint: same exact color and opacity as North America. */
.snowfinder-map-wrap.snowfinder-winkel-wrap:not(:has(.snowfinder-resort))::after {
    content: "";
    display: block !important;
    position: absolute;
    inset: 0;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transform: none;
    z-index: 1;
    pointer-events: none;
    background: rgba(5, 20, 38, 0.50);
    border: 0;
    border-radius: 0;
}

.snowfinder-winkel-wrap #snowfinder-world-canvas {
    display: block;
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: transparent;
}
.snowfinder-winkel-message {
    position: absolute;
    bottom: 42px;
    left: 14px;
    max-width: min(460px, 60vw);
    background: rgba(8,16,25,.76);
    color: #d4e1e8;
    border-radius: 6px;
    padding: 8px 10px;
    font: 12px/1.35 Arial,sans-serif;
    pointer-events: none;
    z-index: 19;
}
.snowfinder-winkel-wrap .map-controls { z-index: 25; }
.snowfinder-winkel-wrap .snowfinder-winkel-message[hidden] { display: none !important; }
@media (max-width: 650px) {
    .snowfinder-winkel-message { max-width: calc(100% - 28px); font-size: 11px; }
}
@keyframes sn0w-world-snow-drift {
    from { transform: translate(-25px, 17px); }
    to   { transform: translate(25px, -17px); }
}
@media (prefers-reduced-motion: reduce) {
    .snowfinder-map-wrap.snowfinder-winkel-wrap::before {
        animation: none;
        transform: none;
        will-change: auto;
    }
}
