/* Hub: view switcher, compact grid and map view (the editorial cards stay in index.html). */

/* ---------- View switcher ---------- */

.views {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}
.views button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 14px 0 11px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: 500 13px var(--font-sans);
    cursor: pointer;
    transition: color .25s, background-color .25s;
}
.views button:hover { color: var(--text); }
.views button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.views svg { width: 17px; height: 17px; }
.tools .tools-filters[hidden] { display: none; }
.tools-filters { display: contents; }

/* Until hub.js has drawn the galleries, keep their room so the footer doesn't jump (layout shift) */
.js #groups { min-height: 100vh; }

/* Skeleton of the list while hub.js waits for the data (pages/hub.php): the chosen view's shape, shimmering;
   it fades in only after 300 ms (a quick load replaces it before), and hub.js's first drawing removes it */
.hub-skel { display: none; }
.js .hub-skel { display: block; opacity: 0; animation: hs-in .3s ease .3s forwards; }
@keyframes hs-in { to { opacity: 1; } }
.hs-media, .hs-bar, .hs-tile, .hs-mapbox {
    display: block;
    background: #141816 linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .07) 50%, rgba(255, 255, 255, 0) 70%) no-repeat;
    background-size: 200% 100%;
    background-position: 150% 0;
    animation: skel-shimmer 1.5s linear .6s infinite;
}
.hs-ed {
    display: grid;
    grid-template-columns: clamp(96px, 13vw, 200px) minmax(0, 1fr);
    gap: clamp(16px, 3vw, 48px);
    padding: clamp(40px, 7vh, 80px) 0;
}
.hs-head { display: grid; gap: 14px; align-content: start; }
.hs-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: clamp(16px, 2.4vw, 28px); }
.hs-card { display: grid; gap: 14px; padding: 12px; border-radius: 22px; border: 1px solid var(--border); }
.hs-media { aspect-ratio: 16 / 10; border-radius: 14px; }
.hs-bar { height: 14px; width: 62%; border-radius: 6px; }
.hs-sm { height: 11px; width: 38%; }
.hs-year { height: clamp(40px, 5vw, 72px); width: 86%; }
.hs-cp, .hs-map { display: none; }
html[data-view="compact"] .hs-ed, html[data-view="harta"] .hs-ed { display: none; }
html[data-view="compact"] .hs-cp { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; padding: 24px 0; }
.hs-tile { aspect-ratio: 4 / 5; border-radius: 14px; }
html[data-view="harta"] .hs-map { display: block; padding: 22px 0; }
.hs-mapbox { height: min(70vh, 640px); border-radius: 22px; }
@media (max-width: 860px) { .hs-ed { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
    .js .hub-skel { animation: none; opacity: 1; }
    .hs-media, .hs-bar, .hs-tile, .hs-mapbox { animation: none; }
}

/* Compact and map views shrink the intro so the galleries start higher. */
html:not([data-view="editorial"]) .intro { padding: clamp(28px, 5vh, 56px) 0 clamp(22px, 3.5vh, 36px); }
html:not([data-view="editorial"]) h1 { font-size: clamp(42px, 5.6vw, 84px); }
html:not([data-view="editorial"]) h1 br { display: none; }
html:not([data-view="editorial"]) .stats b { font-size: clamp(28px, 3vw, 40px); }
@media (max-width: 860px) { html:not([data-view="editorial"]) .stats:empty { min-height: 55px; } }
html:not([data-view="editorial"]) .eyebrow { margin-bottom: 10px; }
html[data-view="compact"] .intro { padding: 20px 0 18px; }
html[data-view="compact"] h1 { font-size: clamp(36px, 4.2vw, 60px); }
html[data-view="compact"] .eyebrow { display: none; }

/* ---------- Compact grid ---------- */

#groups.is-compact {
    --cg: 10px;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 22px calc(var(--cg) * 2.4);
    padding: 24px 0 clamp(40px, 7vh, 72px);
    border-bottom: 1px solid var(--border);
}
.cgroup { width: calc(var(--n) * var(--cw, 128px) + (var(--n) - 1) * var(--cg)); max-width: 100%; }
.cg-head {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin: 0 0 8px;
    padding: 4px 0;
    background: color-mix(in oklab, var(--bg) 82%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-weight: 400;
    color: var(--faint);
    border-bottom: 1px solid var(--border);
}
.cg-head b { font: 400 19px/1 var(--font-serif); color: var(--text); letter-spacing: -.01em; }
.cg-head b.word { font-style: italic; color: var(--muted); }
.cg-list { display: grid; grid-template-columns: repeat(auto-fill, var(--cw, 128px)); gap: var(--cg); }

.ccard {
    --c: #2a302c;
    position: relative;
    display: grid;
    gap: 5px;
    padding: 4px 4px 7px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--c) 7%, var(--surface));
    isolation: isolate;
    transition: border-color .3s var(--ease), background-color .3s var(--ease), transform .45s var(--ease);
}
/* Colour edge from the cover. */
.ccard::after {
    content: "";
    position: absolute;
    left: 10px; right: 10px; bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--c), transparent);
    opacity: .7;
}
.ccard:hover, .ccard:focus-within { border-color: var(--border-strong); background: color-mix(in oklab, var(--c) 14%, var(--surface)); transform: translateY(-2px); }
.ccard:target { border-color: color-mix(in oklab, var(--accent) 60%, transparent); }
.cc-media { position: relative; aspect-ratio: 3 / 2; border-radius: 7px; overflow: hidden; background: var(--c); }
.cc-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cc-fan img { opacity: 0; }
.ccard:hover .cc-fan img[src], .ccard:focus-within .cc-fan img[src] { animation: cc-peek 4.8s var(--ease) infinite; }
.ccard .cc-fan img:nth-child(1) { animation-delay: .9s !important; }
.ccard .cc-fan img:nth-child(2) { animation-delay: 2.1s !important; }
.ccard .cc-fan img:nth-child(3) { animation-delay: 3.3s !important; }
@keyframes cc-peek { 0% { opacity: 0; } 6% { opacity: 1; } 24% { opacity: 1; } 32% { opacity: 0; } 100% { opacity: 0; } }
.cc-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, .55), transparent 45%); opacity: 0; transition: opacity .3s; }
.ccard:hover .cc-media::after, .ccard:focus-within .cc-media::after { opacity: 1; }

.cc-modes {
    position: absolute;
    z-index: 4;
    left: 4px; right: 4px; bottom: 4px;
    display: flex;
    justify-content: center;
    gap: 3px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .25s, transform .35s var(--ease);
}
.ccard:hover .cc-modes, .ccard:focus-within .cc-modes { opacity: 1; transform: none; }
.cc-modes a {
    width: 25px; height: 25px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: rgba(11, 13, 12, .7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .14);
    color: var(--text);
}
.cc-modes a:hover { background: var(--text); color: var(--bg); }
.cc-modes a[data-last] { border-color: color-mix(in oklab, var(--accent) 70%, transparent); color: var(--accent); }
.cc-modes a[data-last]:hover { color: var(--bg); }
.cc-modes svg { width: 13px; height: 13px; }

.cc-body { padding: 0 3px; display: grid; gap: 1px; }
.cc-t { margin: 0; font: 400 16px/1.1 var(--font-serif); letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-link::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: 11px; }
.cc-link:focus-visible { outline: none; }
.ccard:has(.cc-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.cc-k { margin: 0; color: var(--faint); font-size: 10px; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-k b { color: var(--muted); font-weight: 400; }
.cc-k i { font-style: normal; }
@media (max-width: 640px) { .cc-k i { display: none; } }

/* ---------- Map ---------- */

#groups.is-map { padding: 22px 0 clamp(40px, 7vh, 72px); border-bottom: 1px solid var(--border); }
.hm-map {
    position: relative;
    height: clamp(440px, 76vh, 820px);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(70% 80% at 60% 40%, rgba(64, 140, 160, .10), transparent 70%),
        radial-gradient(60% 70% at 20% 90%, rgba(123, 191, 106, .06), transparent 70%),
        #090b0b;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}
.hm-svg, .hm-ov { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hm-svg { cursor: grab; }
.hm-svg:active { cursor: grabbing; }
.hm-ov { pointer-events: none; }
.hm-grat { fill: none; stroke: rgba(255, 255, 255, .045); stroke-width: .6; vector-effect: non-scaling-stroke; }
.hm-land path { fill: #141917; stroke: rgba(233, 237, 233, .16); stroke-width: .55; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.hm-land path.is-visited { fill: #18211a; stroke: rgba(155, 224, 122, .28); }
.hm-leaders line { stroke: rgba(233, 237, 233, .35); stroke-width: 1; }
.hm-anchors circle { fill: var(--text); opacity: .7; }
.hm-route { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 4 5; opacity: .75; }
.hm-dots circle {
    pointer-events: auto;
    cursor: pointer;
    fill: var(--accent);
    stroke: #090b0b;
    stroke-width: 2;
    transition: r .2s var(--ease);
}
.hm-dots circle.is-hot { fill: #fff; }

.hm-pins { position: absolute; inset: 0; pointer-events: none; }
.hm-pin {
    --c: #2a302c;
    --r: 26px;
    position: absolute;
    left: 0; top: 0;
    width: calc(var(--r) * 2);
    height: calc(var(--r) * 2);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--c);
    box-shadow: 0 0 0 2px #090b0b, 0 0 0 4px var(--c), 0 10px 26px -8px rgba(0, 0, 0, .9);
    cursor: pointer;
    pointer-events: auto;
    will-change: transform;
    transition: box-shadow .25s var(--ease);
}
.hm-pin img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; transition: transform .35s var(--ease); }
.hm-pin:hover img, .hm-pin.is-active img { transform: scale(1.08); }
.hm-pin:hover, .hm-pin:focus-visible, .hm-pin.is-active {
    z-index: 3;
    outline: none;
    box-shadow: 0 0 0 2px #090b0b, 0 0 0 4px var(--accent), 0 0 30px -2px color-mix(in oklab, var(--c) 80%, transparent);
}
.hm-pin.is-dim { opacity: .45; }
.hm-n {
    position: absolute;
    right: -6px; top: -6px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font: 500 11px/22px var(--font-mono);
    box-shadow: 0 0 0 2px #090b0b;
}
.hm-lbl {
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(11, 13, 12, .82);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    color: var(--text);
    font: 400 15px/1.2 var(--font-serif);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}
.hm-pin:hover .hm-lbl, .hm-pin:focus-visible .hm-lbl, .hm-pin.is-active .hm-lbl, .hm-map.show-labels .hm-lbl { opacity: 1; }

.hm-ctrl {
    position: absolute;
    left: 14px; top: 14px;
    z-index: 6;
    display: grid;
    gap: 4px;
}
.hm-ctrl button {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(11, 13, 12, .75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--muted);
    cursor: pointer;
}
.hm-ctrl button:hover { color: var(--text); border-color: var(--border-strong); }
.hm-ctrl svg { width: 17px; height: 17px; }
.hm-hint { position: absolute; right: 16px; bottom: 12px; z-index: 6; margin: 0; color: var(--faint); font-size: 11px; pointer-events: none; }
.hm-load { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--faint); }
.hm-load[hidden] { display: none; }

/* Preview card */
.hm-pv {
    --c: #2a302c;
    position: absolute;
    z-index: 8;
    top: 14px; right: 14px;
    width: min(360px, calc(100% - 28px));
    max-height: calc(100% - 28px);
    overflow: auto;
    display: grid;
    gap: 12px;
    padding: 10px 10px 14px;
    border-radius: 18px;
    border: 1px solid var(--border-strong);
    background: color-mix(in oklab, var(--c) 10%, rgba(14, 17, 16, .92));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .9);
    animation: pv-in .35s var(--ease);
}
.hm-pv[hidden] { display: none; }
@keyframes pv-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.pv-media-link { display: block; }
.pv-media { position: relative; aspect-ratio: 16 / 10; border-radius: 12px; overflow: hidden; background: var(--c); }
.pv-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pv-media figcaption {
    position: absolute; left: 8px; bottom: 8px; right: 8px;
    color: #fff; font-size: 11px; text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pv-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.pv-strip a { aspect-ratio: 1; border-radius: 7px; overflow: hidden; background: var(--c); outline-offset: 1px; }
.pv-strip img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .75; transition: opacity .2s, transform .3s var(--ease); }
.pv-strip a:hover img, .pv-strip a:focus-visible img, .pv-strip a.is-hot img { opacity: 1; transform: scale(1.06); }
.pv-body { display: grid; gap: 6px; padding: 0 4px; }
.pv-k { margin: 0; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pv-k .acc { color: var(--accent); }
.pv-t { margin: 0; font: 400 34px/.98 var(--font-serif); letter-spacing: -.01em; }
.pv-t em { color: var(--muted); }
.pv-sub { margin: 0; color: var(--muted); font-size: 14px; }
.pv-places { margin: 0; color: var(--faint); font-size: 11px; line-height: 1.7; }
.pv-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.pv-actions .al-open { height: 38px; padding: 0 15px; font-size: 13px; }
.pv-actions .al-modes a { width: 34px; height: 34px; }
.pv-close {
    position: absolute;
    top: 16px; right: 16px;
    z-index: 2;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 50%;
    background: rgba(11, 13, 12, .7);
    color: var(--text);
    cursor: pointer;
}
.hm-pv:not(.is-pinned) .pv-close { display: none; }
@media (pointer: coarse) { .pv-close { width: 40px; height: 40px; } }   /* finger-sized */

/* Albums without coordinates */
.hm-tray { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.hm-tray[hidden] { display: none; }
.hm-tray > span { color: var(--faint); }
.hm-tray button {
    --c: #2a302c;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 16px 0 5px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: color-mix(in oklab, var(--c) 8%, var(--surface));
    color: var(--text);
    font: 400 18px var(--font-serif);
    cursor: pointer;
}
.hm-tray button:hover, .hm-tray button[aria-pressed="true"] { border-color: var(--border-strong); }
.hm-tray img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.hm-tray small { font: 400 11px var(--font-mono); color: var(--faint); }

@media (max-width: 700px) {
    .views { margin-left: 0; }
    .views button { padding: 0 12px 0 10px; }
    .hm-map { height: min(68vh, 560px); border-radius: 16px; }
    .hm-pin { --r: 21px; }
    .hm-n { min-width: 19px; height: 19px; line-height: 19px; font-size: 10px; right: -5px; top: -5px; }
    .hm-hint { display: none; }
    /* Preview becomes a bottom sheet. */
    .hm-pv {
        position: fixed;
        top: auto; left: 0; right: 0; bottom: 0;
        width: auto;
        max-height: 72vh;
        border-radius: 20px 20px 0 0;
        padding: 10px 12px calc(16px + env(safe-area-inset-bottom));
        animation-name: pv-up;
    }
    @keyframes pv-up { from { transform: translateY(40px); opacity: 0; } }
    .hm-pv::before { content: ""; justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); }
    .pv-close { top: 22px; right: 20px; }
    .pv-t { font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
    .ccard .cc-fan img { animation: none !important; }
    .hm-pv { animation: none; }
}

/* Touch screens: the mode sheet a tap on a Compact tile opens (hub.js openPick) */
.mpick { position: fixed; inset: 0; z-index: 90; }
.mp-back { position: absolute; inset: 0; background: rgba(5, 7, 6, .6); opacity: 0; transition: opacity .3s var(--ease); }
.mpick.open .mp-back { opacity: 1; }
.mp-panel {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: grid;
    gap: 12px;
    padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    border: 1px solid var(--border);
    background: #121614;
    box-shadow: 0 -30px 80px -30px rgba(0, 0, 0, .8);
    transform: translateY(100%);
    transition: transform .38s var(--ease);
}
.mpick.open .mp-panel { transform: none; }
.mp-grip { justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .2); }
.mp-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.mp-head img { width: 64px; height: 42px; border-radius: 8px; object-fit: cover; background: #222; }
.mp-t { margin: 0; font: 400 24px/1.05 var(--font-serif); }
.mp-t em { color: var(--muted); }
.mp-k { margin: 3px 0 0; font-size: 11px; color: var(--faint); }
.mp-x { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); background: none; color: var(--muted); cursor: pointer; }
.mp-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.mp-l { margin: 4px 2px 0; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.mp-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mp-modes a {
    display: grid;
    grid-template-columns: 22px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .03);
    color: var(--text);
    text-decoration: none;
}
.mp-modes a:active { background: rgba(255, 255, 255, .08); }
.mp-modes a[data-last] { border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
.mp-modes a[data-last] svg, .mp-modes a[data-last] b { color: var(--accent); }
.mp-modes svg { width: 22px; height: 22px; }
.mp-modes b { display: block; font-weight: 500; font-size: 15px; }
.mp-modes small { display: block; margin-top: 2px; font-size: 11.5px; line-height: 1.3; color: var(--faint); }
@media (prefers-reduced-motion: reduce) { .mp-back, .mp-panel { transition: none; } }
