/* Glob mode */
:root {
    --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --font-serif: 'Instrument Serif', ui-serif, Georgia, serif;
    --bg: #0b0d0c;
    --text: #e9ede9;
    --muted: #97a299;
    --faint: #808a83; /* ≥ 4.5:1 on the dark background (WCAG AA for small text) */
    --accent: #9be07a;
    --border: rgba(255, 255, 255, .1);
    --glass: rgba(16, 19, 17, .66);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --tint: #1d2a24;
    --gutter: clamp(16px, 3.4vw, 32px);
    --route-h: 84px;
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

#stage {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
    cursor: grab;
    background: var(--bg); /* a dark stage for the hub card's photo to grow into, like Cinema's and Canvas's */
}
#stage.point { cursor: pointer; }

/* Ambient colour from the current photo + vignette */
.tint {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(120% 70% at 50% 115%, color-mix(in srgb, var(--tint) 14%, transparent), transparent 60%),
        radial-gradient(140% 100% at 50% 50%, transparent 62%, rgba(0, 0, 0, .5) 100%),
        linear-gradient(to top, rgba(8, 10, 9, .72), rgba(8, 10, 9, .25) 30%, transparent 48%);
}

.grain {
    position: fixed;
    inset: -50%;
    pointer-events: none;
    opacity: .06;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    animation: grain 1.2s steps(6) infinite;
}
@keyframes grain {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-3%, 2%); }
    50% { transform: translate(2%, -3%); }
    75% { transform: translate(-1%, -2%); }
    100% { transform: translate(3%, 1%); }
}

/* ---------- Counter, lined up with the shared nav bar ---------- */

.counter {
    position: fixed;
    z-index: 5;
    top: calc(var(--gnav-top, 20px) + env(safe-area-inset-top));
    right: calc(var(--gnav-x, 24px) + env(safe-area-inset-right));
    height: 40px;
    display: flex;
    gap: 14px;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--faint);
    text-transform: uppercase;
    letter-spacing: .08em;
    pointer-events: none;
}
.counter b { color: var(--text); font-weight: 500; }

/* ---------- Overview title ---------- */

.hero {
    position: fixed;
    left: var(--gutter);
    bottom: calc(var(--route-h) + 40px + env(safe-area-inset-bottom));
    z-index: 3;
    pointer-events: none;
    max-width: 660px;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .7s var(--ease), transform .9s var(--ease);
}
body.overview .hero { opacity: 1; transform: none; transition-delay: .4s; }
.eyebrow {
    margin: 0 0 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.hero h1 {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(48px, 7vw, 108px);
    line-height: .92;
    letter-spacing: -.02em;
    text-shadow: 0 2px 30px rgba(0, 0, 0, .5);
}
.hero em { color: var(--accent); }
.hero .h-year { color: var(--muted); font-style: italic; }
.h-sub { margin: 14px 0 0; font-size: 17px; color: var(--muted); max-width: 46ch; }

/* ---------- In flight: where to ---------- */

.flight {
    position: fixed;
    left: 50%;
    top: 22%;
    z-index: 3;
    transform: translate(-50%, 8px);
    pointer-events: none;
    opacity: 0;
    text-align: center;
    transition: opacity .5s var(--ease), transform .7s var(--ease);
}
.flight span {
    display: block;
    margin-bottom: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}
.flight b {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(34px, 4.4vw, 64px);
    line-height: 1;
    text-shadow: 0 2px 30px rgba(0, 0, 0, .6);
}
body.flying .flight { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }

/* ---------- The photo card above its place ---------- */

.leader {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s var(--ease);
}
.leader.on { opacity: 1; }
.leader line { stroke: rgba(233, 237, 233, .55); stroke-width: 1; }
.leader circle { fill: none; stroke: var(--accent); stroke-width: 1.5; }

.card {
    --iw: min(620px, 44vw);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 3;
    width: var(--iw);
    padding: 8px;
    border-radius: 18px;
    background: var(--glass);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .2);
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s var(--ease), visibility 0s .45s;
    will-change: transform;
}
.card.on { opacity: 1; visibility: visible; transition: opacity .7s var(--ease) .1s, visibility 0s; }
.c-img {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 12px;
    overflow: hidden;
    background: var(--c, #1a1f1c);
    aspect-ratio: var(--ar, 16 / 10);
    max-height: 38vh;
    cursor: zoom-in;
}
.c-img img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity .25s var(--ease), transform 1.2s var(--ease);
}
.c-img:hover img { transform: scale(1.025); }
.card.swap .c-img img, .card.swap .c-cap { opacity: 0; }
.c-row { display: flex; align-items: flex-end; gap: 16px; padding: 12px 8px 6px; }
.c-cap { flex: 1; min-width: 0; transition: opacity .25s var(--ease); }
.c-meta {
    display: flex;
    gap: 12px;
    margin: 0 0 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.c-idx { color: var(--accent); }
.c-title {
    margin: 0;
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(26px, 2.4vw, 36px);
    line-height: 1.02;
    letter-spacing: -.01em;
}
.c-place { margin: 5px 0 0; font-size: 14px; color: var(--muted); }
.c-thumbs { display: flex; gap: 6px; flex: none; max-width: 52%; overflow-x: auto; scrollbar-width: none; }
.c-thumbs::-webkit-scrollbar { display: none; }
.c-thumbs button {
    flex: none;
    width: 52px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: #111;
    opacity: .6;
    transition: opacity .3s, border-color .3s;
}
.c-thumbs button:hover { opacity: 1; }
.c-thumbs button[aria-current] { opacity: 1; border-color: var(--accent); }
.c-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Clips: poster in the card, the video over it once a frame plays ---------- */

.c-media { position: relative; }
.c-img { position: relative; }
.c-vid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease), transform 1.2s var(--ease);
}
.c-vid.on { opacity: 1; }
.c-img:hover .c-vid { transform: scale(1.025); }
.card.swap .c-vid { opacity: 0; }
.c-tag {
    position: absolute;
    left: 10px;
    bottom: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    height: 24px;
    padding: 0 10px 0 5px;
    border-radius: 999px;
    background: rgba(11, 13, 12, .62);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-family: var(--font-mono);
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text);
    pointer-events: none;
    transition: opacity .25s var(--ease);
}
.c-tag[hidden] { display: none; }
.c-tag svg { width: 16px; height: 16px; color: var(--accent); }
.card.swap .c-tag { opacity: 0; }
/* A labelled pill ("Play video"), not a bare circle, so it reads as an action */
.c-play, .f-play {
    position: absolute;
    left: 50%;
    top: 50%;
    height: 52px;
    padding: 0 20px 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font: 500 11.5px/1 var(--font-mono);
    letter-spacing: .12em;
    text-transform: uppercase;
    white-space: nowrap;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .4);
    background: rgba(11, 13, 12, .55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transform: translate(-50%, -50%);
    transition: border-color .3s, background-color .3s;
}
.c-play[hidden], .f-play[hidden] { display: none; }
.c-play:hover, .f-play:hover { border-color: var(--accent); background: rgba(11, 13, 12, .75); }
.c-play svg, .f-play svg { width: 28px; height: 28px; flex: none; }
.f-fig { position: relative; }
.f-vid {
    position: absolute;
    object-fit: cover;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transform: scale(.97);
    transition: opacity .3s var(--ease), transform .7s var(--ease);
}
.f-vid.on { opacity: 1; }
body.focused .f-vid { transform: none; }
.f-play { z-index: 1; }
/* play marks on the thumbnails of clips (card) and on the stops that have clips (rail) */
.c-thumbs .th-clip, .stop.has-clip { position: relative; }
.c-thumbs .th-clip::after, .stop.has-clip::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(11, 13, 12, .78) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 6.5v11l9-5.5z' fill='%23fff'/%3E%3C/svg%3E") center / 12px no-repeat;
    pointer-events: none;
}
.c-thumbs .th-clip::after { left: 50%; top: 50%; transform: translate(-50%, -50%); }
.stop.has-clip::after { left: 12px; bottom: 12px; }
.stop.has-clip { max-width: 300px; }

/* ---------- Hint ---------- */

.hint {
    position: fixed;
    left: 50%;
    bottom: calc(var(--route-h) + 36px + env(safe-area-inset-bottom));
    z-index: 3;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    transition: opacity .8s var(--ease), transform .8s var(--ease);
    text-align: center;
}
.hint.gone { opacity: 0; transform: translate(-50%, 10px); }
.hint-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(var(--accent), transparent);
    transform-origin: top;
    animation: cue 2.2s var(--ease) infinite;
}
@keyframes cue {
    0% { transform: scaleY(0); opacity: 1; }
    60% { transform: scaleY(1); opacity: 1; }
    100% { transform: scaleY(1); opacity: 0; }
}
.hint-txt { font-size: 14px; color: var(--text); text-shadow: 0 1px 12px rgba(0, 0, 0, .8); }
.hint-sub { font-family: var(--font-mono); font-size: 11px; color: var(--muted); letter-spacing: .06em; }

/* ---------- Route rail: the stops of the journey ---------- */

.route {
    position: fixed;
    left: calc(var(--gnav-x, 24px) + env(safe-area-inset-left));
    right: calc(var(--gnav-x, 24px) + env(safe-area-inset-right));
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 4;
    display: flex;
    gap: 8px;
    align-items: stretch;
    height: var(--route-h);
    transition: opacity .4s var(--ease);
}
.route-all {
    flex: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 84px;
    padding: 0 8px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}
.route-all svg { width: 22px; height: 22px; }
.route-all:hover, body.overview .route-all { color: var(--text); border-color: rgba(155, 224, 122, .5); }
.route-all[hidden] { display: none; }
.stops {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent);
    padding-inline: 12px;
}
.stops::-webkit-scrollbar { display: none; }
.stops li { flex: none; scroll-snap-align: center; }
.stop {
    display: grid;
    grid-template-columns: 56px auto;
    grid-template-rows: 1fr 1fr;
    column-gap: 10px;
    align-items: center;
    height: 100%;
    max-width: 240px;
    padding: 8px 14px 8px 8px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    text-align: left;
    transition: border-color .3s, background-color .3s;
}
.stop img {
    grid-row: 1 / 3;
    width: 56px;
    height: 100%;
    object-fit: cover;
    border-radius: 9px;
    opacity: .7;
    transition: opacity .3s;
}
.st-t {
    align-self: end;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
}
.st-t b { margin-right: 8px; font: 500 11px var(--font-mono); color: var(--faint); }
.st-m { align-self: start; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop:hover { border-color: rgba(255, 255, 255, .22); }
.stop:hover img, .stop.on img { opacity: 1; }
.stop.seen .st-t b { color: var(--muted); }
.stop.on { border-color: var(--accent); background: rgba(24, 32, 22, .78); }
.stop.on .st-t b { color: var(--accent); }

/* ---------- Focus: the photo large ---------- */

.focus {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    background: rgba(8, 10, 9, .9);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .45s var(--ease), visibility 0s .45s;
}
body.focused .focus { opacity: 1; visibility: visible; transition: opacity .5s var(--ease), visibility 0s; }
.f-fig {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: calc(80px + env(safe-area-inset-top)) var(--gutter) 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.f-fig img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 12px;
    box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .9);
    transform: scale(.97);
    transition: transform .7s var(--ease);
}
body.focused .f-fig img { transform: none; }
.f-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    padding: 8px var(--gutter) calc(var(--gutter) + env(safe-area-inset-bottom));
}
.f-meta {
    display: flex;
    gap: 14px;
    margin: 0 0 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}
.f-idx { color: var(--accent); }
.f-title {
    margin: 0;
    overflow: hidden;
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(36px, 4.6vw, 68px);
    line-height: 1.02;
    letter-spacing: -.02em;
}
.f-title span { display: inline-block; transform: translateY(105%); }
body.focused .f-title span.in { transform: none; transition: transform .9s var(--ease) .15s; }
.f-place { margin: 8px 0 0; font-size: 16px; color: var(--muted); }
.f-ctrl { display: flex; gap: 8px; flex: none; }
.f-ctrl button {
    min-width: 48px;
    height: 48px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .04);
    font-size: 16px;
}
.f-ctrl button:hover { border-color: var(--accent); }
/* Icons and the "Esc" label sit exactly in the middle of their circle */
.f-ctrl button { display: inline-grid; place-items: center; line-height: 1; }
.f-ctrl svg { width: 20px; height: 20px; display: block; }
.f-close { font-family: var(--font-mono); font-size: 12px !important; letter-spacing: .06em; }

body.focused .route, body.focused .hint { opacity: 0; pointer-events: none; }
body.overview .card { opacity: 0; visibility: hidden; }

/* ---------- Photo list: screen readers / SEO, and the no-WebGL fallback ---------- */

.list {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}
.photo-list { list-style: none; margin: 0; padding: 0; }

body.no-webgl { overflow: auto; }
body.no-webgl #stage, body.no-webgl .route, body.no-webgl .hint, body.no-webgl .hero, body.no-webgl .card,
body.no-webgl .leader, body.no-webgl .flight, body.no-webgl .focus, body.no-webgl .counter { display: none; }
body.no-webgl .list {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
    white-space: normal;
    padding: 100px var(--gutter) 60px;
}
body.no-webgl .list-title { font-family: var(--font-serif); font-weight: 400; font-size: 56px; margin: 0 0 24px; }
body.no-webgl .photo-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
body.no-webgl .photo-list a { color: var(--text); text-decoration: none; }
body.no-webgl .photo-list img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 12px; display: block; }
body.no-webgl .photo-list span { display: block; margin-top: 8px; font-size: 14px; color: var(--muted); }

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
    :root { --route-h: 64px; }
    .counter { display: none; }
    .card { --iw: calc(100vw - 32px); padding: 6px; border-radius: 16px; }
    .c-img { max-height: 30vh; }
    .c-row { flex-direction: column; align-items: stretch; gap: 10px; padding: 10px 6px 4px; }
    .c-thumbs { max-width: none; }
    .c-title { font-size: 26px; }
    .route { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
    .route-all { width: 60px; }
    .route-all span { display: none; }
    .stop { grid-template-columns: 44px auto; max-width: 190px; padding: 6px 12px 6px 6px; }
    .stop img { width: 44px; }
    .stop.has-clip { max-width: 280px; }
    .hero { bottom: calc(var(--route-h) + 30px); }
    /* The swipe hint sits under the top bar, so it never covers the album title at the bottom */
    .hint { top: calc(var(--gnav-top, 20px) + 72px + env(safe-area-inset-top)); bottom: auto; flex-direction: column-reverse; }
    .hint-sub { display: none; }
    .h-sub { font-size: 15px; }
    .f-bar { flex-direction: column; align-items: stretch; gap: 16px; }
    .f-ctrl .f-close { margin-left: auto; }
    .f-ctrl { gap: 12px; }
    .f-ctrl button { min-width: 56px; height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    .grain, .hint-line { animation: none; }
    .f-title span { transform: none; }
    .card, .hero, .flight, .leader, .focus { transition-duration: .01s !important; }
}
