/* Hub page (index): layout, intro, editorial cards, compact/map base. Loaded after hub.css. */
@view-transition { navigation: auto; }

: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;
    --surface: rgba(255, 255, 255, .025);
    --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, .08);
    --border-strong: rgba(255, 255, 255, .16);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --gutter: clamp(16px, 4vw, 40px);
    --container: 1320px;
    color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 var(--font-sans);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: .04em; }
.wrap { max-width: var(--container); margin: 0 auto; padding: 0 calc(var(--gutter) + env(safe-area-inset-left)) 0 calc(var(--gutter) + env(safe-area-inset-right)); position: relative; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(60vw 50vh at 85% -10%, rgba(123, 191, 106, .14), transparent 70%),
        radial-gradient(50vw 50vh at -10% 30%, rgba(64, 140, 160, .10), transparent 70%);
}

/* ---------- Header + intro ---------- */

.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: calc(22px + env(safe-area-inset-top)) 0 22px;
}
.top nav { display: flex; align-items: center; gap: 22px; color: var(--muted); }
.top nav a:hover { color: var(--text); }

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 32px;
    padding: clamp(48px, 11vh, 120px) 0 clamp(36px, 7vh, 72px);
    border-bottom: 1px solid var(--border);
}
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; margin: 0 0 18px; }
h1 {
    margin: 0;
    font: 400 clamp(48px, 7vw, 108px)/.92 var(--font-serif);
    letter-spacing: -.025em;
}
h1 em { color: var(--muted); }
.stats { display: flex; gap: clamp(20px, 4vw, 48px); margin: 0; }
.stats div { display: flex; flex-direction: column-reverse; gap: 6px; }
.stats dd { margin: 0; }
.stats b { font: 400 clamp(36px, 4.4vw, 56px)/1 var(--font-serif); }
.stats dt { color: var(--muted); }
/* The year span's run (hub.js yearRun): the end year rolls along a timeline drawn in the label's place */
.yr-end { display: inline-block; vertical-align: top; position: relative; white-space: nowrap; opacity: 0; transition: opacity .45s; }
.yr-end.on { opacity: 1; }
.yr-roll {
    display: inline-block;
    vertical-align: top;
    height: 1.3em;
    margin: -.15em 0;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
    mask-image: linear-gradient(transparent, #000 14%, #000 86%, transparent);
}
.yr-roll > span { display: block; transition: transform .38s var(--ease); }
.yr-roll > span > span { display: block; padding: .15em 0; white-space: nowrap; }
.stats dt.yr-wait { position: relative; color: transparent; }
.stats dt.yr-done { color: var(--muted); transition: color .5s .1s; }
.yr-line { position: absolute; top: 50%; height: 1px; background: var(--border-strong); transition: opacity .45s; }
.yr-done .yr-line { opacity: 0; }
.yr-line i { position: absolute; }
.yr-win { left: -6px; right: -6px; top: -6px; height: 13px; overflow: hidden; --fade: 0px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade));
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade)); }
.yr-track { left: 6px; top: 6px; height: 1px; width: 0; }
.yr-fill { left: 0; top: 0; height: 1px; background: var(--accent); opacity: .6; }
.yr-tick { top: -2px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 1px var(--faint); transition: background .3s, box-shadow .3s; }
.yr-tick.on { background: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.yr-dot { top: -4px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(155, 224, 122, .14), 0 0 14px rgba(155, 224, 122, .55); }

/* ---------- Tools (only rendered when there are many galleries) ---------- */

.tools[hidden] { display: none; }
.tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 22px 0 0;
}
.tools input {
    flex: 1 1 240px;
    max-width: 340px;
    height: 40px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.tools input::placeholder { color: var(--faint); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
    height: 34px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--muted);
    font: 400 12px var(--font-mono);
    cursor: pointer;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.empty { color: var(--muted); padding: 60px 0; }

/* ---------- Groups ---------- */

.group {
    display: grid;
    grid-template-columns: clamp(96px, 13vw, 200px) minmax(0, 1fr);
    gap: clamp(16px, 3vw, 48px);
    padding: clamp(40px, 7vh, 80px) 0;
    border-bottom: 1px solid var(--border);
}
.g-head { position: sticky; top: 24px; align-self: start; }
.g-year { font: 400 clamp(40px, 5.4vw, 84px)/.9 var(--font-serif); letter-spacing: -.02em; }
.g-year.word { font-style: italic; color: var(--muted); }
.g-count { color: var(--faint); margin-top: 10px; }
.g-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: clamp(16px, 2.4vw, 28px); }

/* ---------- Album card ---------- */

.album {
    --c: #2a302c;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr); /* never wider than the card, whatever the content's min width */
    min-width: 0;
    gap: 18px;
    padding: 12px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--c) 6%, var(--surface));
    isolation: isolate;
    transition: border-color .4s var(--ease), background-color .4s var(--ease), transform .6s var(--ease);
}
.album::before {
    content: "";
    position: absolute;
    inset: -8% -4% 20% 20%;
    z-index: -1;
    background: radial-gradient(closest-side, color-mix(in oklab, var(--c) 70%, transparent), transparent);
    filter: blur(40px);
    opacity: .18;
    transition: opacity .6s var(--ease);
    pointer-events: none;
}
.album:hover, .album:focus-within { border-color: var(--border-strong); background: color-mix(in oklab, var(--c) 11%, var(--surface)); }
.album:hover::before, .album:focus-within::before { opacity: .5; }
.album:target { border-color: color-mix(in oklab, var(--accent) 60%, transparent); }

.al-media { position: relative; aspect-ratio: 16 / 10; }
.al-cover, .al-fan img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 14px;
    background: var(--c);
}
.al-cover { z-index: 2; box-shadow: 0 24px 50px -30px rgba(0, 0, 0, .9); transition: transform .9s var(--ease); }
.al-fan img {
    z-index: 1;
    opacity: 0;
    filter: brightness(.75) saturate(.9);
    box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .9);
    transition: transform .8s var(--ease), opacity .5s var(--ease);
}
.album:hover .al-fan img, .album:focus-within .al-fan img { opacity: 1; }
.album:hover .al-fan img:nth-child(1), .album:focus-within .al-fan img:nth-child(1) { transform: translate(-5%, -4%) rotate(-5deg) scale(.9); }
.album:hover .al-fan img:nth-child(2), .album:focus-within .al-fan img:nth-child(2) { transform: translate(5%, -6%) rotate(4deg) scale(.88); transition-delay: .05s; }
.album:hover .al-fan img:nth-child(3), .album:focus-within .al-fan img:nth-child(3) { transform: translate(0, -9%) rotate(-1deg) scale(.84); transition-delay: .1s; }
.album:hover .al-cover, .album:focus-within .al-cover { transform: translateY(3%) scale(.97); }

.al-body { display: grid; gap: 10px; padding: 0 8px 8px; align-content: start; }
.al-k { color: var(--muted); margin: 0; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.al-k .acc { color: var(--accent); }
.al-t { margin: 0; font: 400 clamp(38px, 4vw, 56px)/.95 var(--font-serif); letter-spacing: -.015em; }
.al-t em { color: var(--muted); }
.al-link::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: 22px; }
.al-link:focus-visible { outline: none; }
.album:has(.al-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.al-sub { margin: 0; color: var(--muted); max-width: 52ch; }
.al-places { margin: 0; color: var(--faint); line-height: 1.7; }

.al-actions {
    position: relative;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
}
.al-open {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-weight: 500;
    font-size: 14px;
    transition: background-color .3s var(--ease), transform .4s var(--ease);
}
.al-open:hover { background: var(--accent); }
.al-open small { font: 400 11px var(--font-mono); opacity: .65; }
.al-modes { display: flex; gap: 4px; }
.al-modes a {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 50%;
    border: 1px solid var(--border);
    color: var(--muted);
    transition: color .25s, border-color .25s, background-color .25s;
}
.al-modes a:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, .04); }
.al-modes a[data-last] { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 40%, transparent); }
.al-modes svg { width: 18px; height: 18px; }

/* A year with a single gallery gets the wide, editorial card. */
.album.feature {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    align-items: stretch;
    gap: clamp(20px, 3vw, 44px);
    padding: 14px;
}
.album.feature .al-media { aspect-ratio: auto; min-height: clamp(280px, 38vw, 520px); }
.album.feature .al-body { padding: clamp(8px, 2vw, 28px) clamp(4px, 1.5vw, 20px) 8px 0; align-content: center; gap: 14px; }
.album.feature .al-t { font-size: clamp(56px, 7vw, 112px); }
.album.feature.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); }
.album.feature.flip .al-media { order: 2; }
.album.feature.flip .al-body { padding-left: clamp(8px, 2vw, 28px); }

/* ---------- Footer ---------- */

footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding: 36px 0 calc(44px + env(safe-area-inset-bottom));
    color: var(--faint);
}
footer a { color: var(--muted); }
footer a:hover { color: var(--text); }
footer nav { display: flex; gap: 22px; flex-wrap: wrap; }

/* Shared-element transition into the album (names are set on the clicked card only). */
::view-transition-group(*) { animation-duration: .6s; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
/* Back from an album: its stage and the card's cover have different proportions, both cropped to the moving box */
::view-transition-old(album-hero), ::view-transition-new(album-hero) { height: 100%; object-fit: cover; overflow: clip; }

@media (max-width: 860px) {
    .intro { grid-template-columns: 1fr; }
    .stats:empty { min-height: 63px; }   /* the counts arrive with hub.js: keep their row so the tools don't jump */
    .group { grid-template-columns: 1fr; gap: 20px; }
    .g-head { position: static; display: flex; align-items: baseline; gap: 14px; }
    .g-count { margin: 0; }
    .album.feature, .album.feature.flip { grid-template-columns: 1fr; }
    .album.feature.flip .al-media { order: 0; }
    .album.feature .al-media { min-height: 0; aspect-ratio: 16 / 11; }
    .album.feature .al-body, .album.feature.flip .al-body { padding: 4px 6px 8px; }
    .top nav .hide-s { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Phones: a compact intro, full-width tools and finger-sized buttons ---------- */
@media (max-width: 640px) {
    .intro { padding: 26px 0 22px; gap: 18px; }
    .eyebrow { margin-bottom: 12px; }
    h1 { font-size: clamp(42px, 12.5vw, 60px); }
    .stats { gap: 26px; }
    .stats b, html:not([data-view="editorial"]) .stats b { font-size: 32px; }
    .stats:empty, html:not([data-view="editorial"]) .stats:empty { min-height: 56px; }
    .tools { gap: 12px; padding-top: 18px; }
    .tools input { flex: 1 1 100%; max-width: none; height: 46px; font-size: 16px; }
    .chips {   /* one row that scrolls sideways instead of two wrapped rows */
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 0 calc(-1 * clamp(16px, 4vw, 40px));
        padding: 0 clamp(16px, 4vw, 40px);
        width: calc(100% + 2 * clamp(16px, 4vw, 40px));
    }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex: none; height: 40px; padding: 0 16px; font-size: 13px; }
    .views { display: flex; width: 100%; margin-left: 0; padding: 4px; }
    .views button { flex: 1; justify-content: center; height: 42px; padding: 0 10px; }
}

/* Narrow phones: the open button and the four mode buttons stay on one row (the mode's name gives way) */
.al-actions { flex-wrap: nowrap; }
.al-modes { flex: none; }
@media (max-width: 400px) {
    .al-open { padding: 0 15px; }
    .al-open small { display: none; }
}
@media (max-width: 340px) {
    .al-modes { gap: 2px; }
    .al-modes a { width: 34px; height: 34px; }
}
