body {
    margin: 0;
    /* 100vw includes the vertical scrollbar width, this avoids a horizontal scroll,
       clip does it without turning the body into a scroll box, so the sticky nav keeps working on mobile */
    overflow-x: hidden;
    overflow-x: clip;
}

/* experience: badges, canvas and text panel are created by ExperienceSelector */
.experience {
    display: flex;
    flex-direction: column;
    /* Space Grotesk is loaded in the page head, system fonts cover the time before it arrives */
    font-family: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: #0a0a0a;
}

.experience-stage {
    position: relative;
}

/* overlay column over the canvas: title, description, building slot, extra and badges
   the scene measures the slot and fits the building inside it */
.experience-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(3 * var(--vh, 1svh));
    /* texts follow the sky ink so they contrast with day and night skies */
    color: var(--sky-ink, #0a0a0a);
    text-align: center;
    transition: color 0.6s ease;
}

/* top band: 10vh for the title plus 15vh for the description, the glass card is centered inside it */
.experience-top {
    flex: none;
    box-sizing: border-box;
    height: calc(25 * var(--vh, 1svh));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(1.5 * var(--vh, 1svh)) 4vw 0;
}

/* crystal glass: translucent tint, blurred sky behind and a bright edge on top */
.experience-glass {
    box-sizing: border-box;
    max-width: 60ch;
    max-height: 100%;
    overflow: hidden;
    padding: clamp(10px, calc(1.8 * var(--vh, 1svh)), 20px) clamp(16px, 2.6vw, 34px);
    border-radius: clamp(14px, 1.6vw, 22px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.32), rgba(255, 255, 255, 0.1));
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 8px 32px rgba(0, 0, 0, 0.12);
    transition: background 0.6s ease, border-color 0.6s ease;
}

/* night skies get light text, so the glass turns smoky to keep the contrast */
.experience-stage[data-ink="light"] .experience-glass {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0.16));
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 32px rgba(0, 0, 0, 0.3);
}

.experience-title {
    margin: 0;
    /* text sizes grow with the smaller of width and height, so they fit their bands on any screen,
       the rem part keeps them following the user's zoom */
    font-size: clamp(1.25rem, 0.6rem + min(3vw, calc(3.4 * var(--vh, 1svh))), 3rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

/* meta: small line under the title with the role and the period, it follows the sky ink with less weight */
.experience-meta {
    margin: 0.35em 0 0;
    font-size: clamp(0.75rem, 0.55rem + min(0.7vw, calc(0.9 * var(--vh, 1svh))), 1rem);
    line-height: 1.35;
}

.experience-role {
    font-weight: 600;
}

.experience-period {
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
}

/* separator only when both parts are shown */
.experience-role:not([hidden]) + .experience-period:not([hidden])::before {
    content: "\00b7";
    margin: 0 0.6em;
}

.experience-meta[hidden],
.experience-role[hidden],
.experience-period[hidden] {
    display: none;
}

.experience-summary {
    margin: 0.5em 0 0;
    font-size: clamp(0.85rem, 0.6rem + min(0.9vw, calc(1.1 * var(--vh, 1svh))), 1.2rem);
    line-height: 1.45;
}

.experience-summary:empty {
    display: none;
}

.experience-extra {
    flex: none;
    box-sizing: border-box;
    width: 100%;
    max-width: calc(60ch + 8vw);
    margin: 0 auto;
    padding: 0 4vw;
    overflow: hidden;
    height: calc(15 * var(--vh, 1svh));
    font-size: clamp(0.85rem, 0.6rem + min(0.9vw, calc(1.1 * var(--vh, 1svh))), 1.2rem);
    line-height: 1.45;
}

.experience-extra {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
}

.experience-slot {
    flex: 1;
    min-height: 0;
}

.experience-badges {
    flex: none;
    display: flex;
    gap: clamp(6px, 1.2vw, 12px);
    /* vertical room keeps the glow from being clipped by the scrolling row */
    padding: 12px 4vw;
    /* badges scroll horizontally on narrow screens */
    overflow-x: auto;
    scrollbar-width: none;
}

/* auto margins center the row while it fits, and keep the first badge reachable once it scrolls */
.experience-badge:first-child {
    margin-left: auto;
}

.experience-badge:last-child {
    margin-right: auto;
}

.experience-badge {
    flex: none;
    /* size follows the viewport between phone and desktop limits */
    padding: clamp(7px, 0.9vw, 10px) clamp(12px, 1.8vw, 20px);
    border: 1px solid #0a0a0a;
    border-radius: 999px;
    /* translucent white keeps badges readable over day and night skies */
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(6px);
    color: #0a0a0a;
    font: inherit;
    font-size: clamp(12px, 0.65rem + 0.35vw, 15px);
    letter-spacing: 0.04em;
    white-space: nowrap;
    cursor: pointer;
    /* soft halo plus a thin top highlight give a slight shine */
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.3s ease;
}

.experience-badge:hover {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.experience-badge[aria-selected="true"] {
    background: #0a0a0a;
    color: #fff;
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* double ring stays visible over light and dark skies, the halo is kept around it */
.experience-badge:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0a0a0a, 0 0 14px rgba(255, 255, 255, 0.6);
}

/* larger touch target on touch screens */
@media (pointer: coarse) {
    .experience-badge {
        min-height: 40px;
    }
}

/* narrow screens: badges turn into dots in the sky ink color, the place name is read in the panel below */
@media (max-width: 600px) {
    .experience-badges {
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
        overflow: visible;
    }

    .experience-badge:first-child,
    .experience-badge:last-child {
        margin: 0;
    }

    /* the button keeps a comfortable touch area, the dot is drawn inside it */
    .experience-badge {
        position: relative;
        width: 34px;
        height: 34px;
        min-height: 0;
        padding: 0;
        border: none;
        background: none;
        backdrop-filter: none;
        box-shadow: none;
        /* text stays as the accessible name but takes no space */
        font-size: 0;
        color: var(--sky-ink, #0a0a0a);
    }

    .experience-badge:hover,
    .experience-badge[aria-selected="true"] {
        background: none;
        box-shadow: none;
    }

    .experience-badge::before,
    .experience-badge::after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        width: 12px;
        height: 12px;
        border-radius: 999px;
        transform: translate(-50%, -50%);
    }

    .experience-badge::before {
        background: currentColor;
        transition: width 0.25s ease;
    }

    /* selected dot stretches into a short pill */
    .experience-badge[aria-selected="true"]::before {
        width: 24px;
    }

    /* shine travels from dot to dot, each one waits its turn with its index */
    .experience-badge::after {
        box-shadow: 0 0 8px 3px currentColor;
        opacity: 0;
        animation: experience-dot-shine calc(var(--count, 4) * 0.35s + 1.6s) ease-out infinite;
        animation-delay: calc(var(--i, 0) * 0.35s);
    }

    .experience-badge:focus-visible {
        box-shadow: none;
        outline: 2px solid currentColor;
        outline-offset: -4px;
        border-radius: 999px;
    }
}

@keyframes experience-dot-shine {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    8% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.3);
    }
    22%, 100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.6);
    }
}

@media (prefers-reduced-motion: reduce) {
    .experience-badge,
    .experience-badge::before {
        transition: none;
    }

    .experience-badge::after {
        animation: none;
    }
}

/* canvases are sized in viewport units, the sprite engine follows them on every resize,
   --vh keeps the height fixed while the mobile toolbars show and hide, 1svh covers pages without the script */
.experience-canvas {
    display: block;
    width: 100vw;
    height: calc(90 * var(--vh, 1svh));
}

.experience-panel {
    padding: 20px 4vw 40px;
}

.experience-panel h3 {
    margin: 0 0 4px;
    font-size: clamp(1.3rem, 0.8rem + 1.8vw, 2rem);
    font-weight: 400;
}


