/*
 * FIFA World Cup 26 Stadiums — playground map styles
 * Layout is intentionally close to the original; the brand fonts are the only
 * visual change for now (display on headings, primary on body). Zalando Sans is
 * served from the studio root; kaneda-gothic comes from the Adobe Typekit link
 * in index.html.
 */

/* -- Brand fonts -- */
@font-face {
    font-family: "Zalando Sans";
    src: url("/assets/fonts/zalando-sans/ZalandoSans-VariableFont_wdth,wght.ttf") format("truetype");
    font-weight: 300 900;
    font-stretch: 75% 125%;
    font-style: normal;
    font-display: swap;
}

:root {
    --font-display: "kaneda-gothic", "Zalando Sans", sans-serif;
    --font-primary: "Zalando Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
    margin: 0;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1.5;
}

/* -- Accessibility helpers -- */
.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 12px 20px;
    background: #111;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Desktop layout - side by side */
.map-wrapper {
    position: fixed;
    width: 50%;
    top: 0;
    bottom: 0;
    left: 0;
}

#map {
    width: 100%;
    height: 100%;
}

figcaption {
    font-size: .7rem;;
}

#mapContent,
.map-content {
    width: 50%;
    margin-left: 50%;
    height: 100vh;
    font-family: var(--font-primary);
    overflow-y: scroll;
    background-color: #fafafa;
}

.map-section {
    box-sizing: border-box;
    padding: 25px 50px;
    border-bottom: 1px solid #ddd;
    min-height: 100vh;
}

.map-section:last-child {
    border-bottom: none;
}

section:last-child {
    border-bottom: none;
}

/* Host-city photo at the top of each section (intrinsic 1600×901 ≈ 16:9) */
.map-section-figure {
    margin: 0 0 25px;
}

.map-section-image {
    display: block;
    width: 100%;
    height: auto;
}

/* Image credit / rights line */
.map-section-credit {
    margin-top: 6px;
    line-height: 1.3;
    color: #888;
}

h2 {
    font-family: var(--font-display);
    font-size: 4.5rem;
    line-height: 1.1;
    text-transform: uppercase;
}

/* -- Loading overlay -- */
/* Branded mask over the map during its heavy first paint. Scoped inside .map-wrapper
   (which is position: fixed), so it covers exactly the map region and leaves the stadium
   guide usable. Removed by teardownMapLoading() in script.js. */
.map-loading {
    position: absolute;
    inset: 0;
    z-index: 5; /* above the map canvas, below the skip-link (z-index 100) */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fafafa;
    /* fade-out mirrors design-system --duration-s (400ms) / ease-out; becomes the motion
       token when this page moves onto the design system (HANDOVER §5). */
    transition: opacity 400ms ease;
}

.map-loading--hidden {
    opacity: 0;
}

.map-loading__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.map-loading__mark {
    display: block;
    width: 56px;
    height: 56px;
}

.map-loading__spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #ddd;
    border-top-color: #111;
    border-radius: 50%;
}

/* Spin only when motion is welcome. Opting *into* the animation (rather than turning it
   off) keeps both the reduced-motion and unknown-preference cases static — the mask can
   sit on screen for up to 8s, so a spinner must respect the preference. */
@media (prefers-reduced-motion: no-preference) {
    .map-loading__spinner {
        animation: map-loading-spin 0.8s linear infinite;
    }
}

@keyframes map-loading-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mobile/Tablet layout - map on top, content below */
@media (max-width: 768px) {
    .map-wrapper {
        position: fixed;
        width: 100%;
        height: 40vh;
        top: 0;
        left: 0;
        bottom: auto;
    }

    #map {
        width: 100%;
        height: 100%;
    }

    #mapContent,
    .map-content {
        width: 100%;
        margin-left: 0;
        margin-top: 40vh;
        height: calc(100vh - 40vh);
    }

    .map-section {
        padding: 20px 25px;
        min-height: 60vh;
    }

    h2 {
        font-size: 2rem;
        line-height: 2rem;
    }
}
