/* Canvas mode */
:root {
    --bg: #0b0d0c;
    --text: #e9ede9;
    --muted: #97a299;
    --faint: #808a83; /* ≥ 4.5:1 on the dark background (WCAG AA for small text) */
    --accent: #9be07a;
    --accent-ink: #0b130a;
    --border: rgba(255, 255, 255, .08);
    --border-strong: rgba(255, 255, 255, .16);
    --glass: rgba(15, 18, 16, .62);
    --ease: cubic-bezier(.2, .7, .2, 1);
    --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;
    --gutter: clamp(14px, 2.6vw, 28px);
    color-scheme: dark;
}
@property --tint { syntax: '<color>'; inherits: true; initial-value: #0b0d0c; }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; 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; }
.mono { font-family: var(--font-mono); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Plane ---------- */
.plane {
    position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab;
    user-select: none; -webkit-user-select: none;
    background:
        radial-gradient(1100px 760px at 12% -12%, rgba(123, 191, 106, .10), transparent 60%),
        radial-gradient(1000px 700px at 108% 112%, rgba(64, 140, 160, .10), transparent 60%),
        var(--bg);
}
.plane.dragging { cursor: grabbing; }
@media (hover: hover) and (pointer: fine) { .plane.custom, .plane.custom .tile { cursor: none; } }

.tile {
    position: absolute; left: 0; top: 0; display: block; will-change: transform, opacity;
    -webkit-user-drag: none; -webkit-tap-highlight-color: transparent; outline: none; color: inherit; text-decoration: none;
}
/* The photo you arrived with (from another mode or a link): outlined, with a hint that it opens large */
.tile.is-target .inner { box-shadow: 0 0 0 2px var(--accent), 0 0 44px -6px var(--accent); }
.tile .target-hint {
    position: absolute; left: 50%; top: 12px; z-index: 3; transform: translateX(-50%);
    padding: 7px 14px; border-radius: 999px; white-space: nowrap; pointer-events: none;
    background: rgba(11, 13, 12, .78); border: 1px solid color-mix(in oklab, var(--accent) 45%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    font: 500 11px/1.2 var(--font-mono); letter-spacing: .06em; color: var(--text);
    animation: target-hint 7s var(--ease) forwards;
}
@keyframes target-hint {
    0% { opacity: 0; transform: translate(-50%, -6px); }
    8%, 85% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .tile .target-hint { animation: none; } }
.tile .inner {
    position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: var(--r, 14px);
    background: #1a1f1c;
    box-shadow: 0 26px 50px -30px rgba(0, 0, 0, .9), 0 0 0 1px rgba(255, 255, 255, .05);
    transition: transform .6s var(--ease), box-shadow .6s var(--ease);
}
.tile img {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
    opacity: 0; filter: blur(14px); transform: scale(1.08); -webkit-user-drag: none; pointer-events: none;
    transition: opacity .7s var(--ease), filter .9s var(--ease), transform 1.1s var(--ease);
}
.tile img.ok { opacity: 1; filter: none; transform: none; }
/* Until its photo has loaded, a tile shimmers over its colour (the photo's average), like the skeletons elsewhere */
.tile .inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .12) 50%, rgba(255, 255, 255, 0) 70%) no-repeat;
    background-size: 200% 100%;
    background-position: 150% 0;
    animation: skel-shimmer 1.5s linear .3s infinite; /* after 300 ms, like brand.css */
    pointer-events: none;
}
.tile .inner:has(> img.ok)::before { content: none; }
.tile .shade { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; }
.tile .cap {
    position: absolute; left: 0; right: 0; bottom: 0; padding: 34px 12px 10px; display: flex; flex-direction: column; gap: 3px;
    background: linear-gradient(transparent, rgba(5, 7, 6, .82)); opacity: 0; transform: translateY(8px); pointer-events: none;
    transition: opacity .4s var(--ease), transform .5s var(--ease);
}
.tile .cap b { font: 500 13px/1.25 var(--font-sans); letter-spacing: -.005em; }
.tile .cap i { font: 400 10.5px/1.3 var(--font-mono); font-style: normal; color: #b9c3bb; text-transform: uppercase; letter-spacing: .06em; }
@media (hover: hover) {
    .plane:not(.dragging) .tile:hover .inner {
        transform: translateY(-6px) scale(1.03);
        box-shadow: 0 44px 70px -30px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 255, 255, .16), 0 0 60px -16px var(--glow, transparent);
    }
    .plane:not(.dragging) .tile:hover .cap { opacity: 1; transform: none; }
}
.tile:focus-visible .inner { box-shadow: 0 0 0 2px var(--accent), 0 26px 50px -30px rgba(0, 0, 0, .9); }

.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 2;
    background: radial-gradient(ellipse 78% 74% at 50% 50%, transparent 52%, rgba(8, 10, 9, .5) 82%, rgba(8, 10, 9, .86)); }
.grain { position: fixed; inset: 0; pointer-events: none; z-index: 3; opacity: .07; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

/* ---------- Glass UI ---------- */
.glass {
    background: var(--glass); border: 1px solid var(--border);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
    box-shadow: 0 20px 40px -24px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.top {
    position: fixed; z-index: 10; left: 0; right: 0; top: 0; pointer-events: none;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    /* Same offsets as the shared nav bar (nav.css). */
    padding: calc(var(--gnav-top, 20px) + env(safe-area-inset-top)) calc(var(--gnav-x, 32px) + env(safe-area-inset-right)) 0 calc(var(--gnav-x, 32px) + env(safe-area-inset-left));
}
.top > * { pointer-events: auto; }
.actions { display: flex; align-items: center; gap: 8px; margin-left: auto; pointer-events: auto; }
.count { font: 400 12px/1 var(--font-mono); color: var(--muted); padding: 11px 14px; border-radius: 999px; letter-spacing: .02em; }
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; transition: border-color .3s var(--ease), background .3s var(--ease), transform .3s var(--ease); }
.btn:hover { border-color: var(--border-strong); background: rgba(30, 36, 32, .7); }
.btn:active { transform: scale(.96); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn:focus-visible, .v-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.mini { position: fixed; z-index: 10; right: var(--gutter); bottom: max(var(--gutter), env(safe-area-inset-bottom)); padding: 10px; border-radius: 16px; }
.mini canvas { display: block; border-radius: 7px; cursor: crosshair; background: rgba(255, 255, 255, .025); touch-action: none; }
.mini .meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; font: 400 10.5px/1 var(--font-mono); color: var(--faint); letter-spacing: .03em; }
.mini .meta b { font-weight: 400; color: var(--muted); }

.hint {
    position: fixed; z-index: 10; left: 50%; bottom: max(var(--gutter), env(safe-area-inset-bottom));
    transform: translate(-50%, 10px); opacity: 0; pointer-events: none;
    display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 999px;
    font: 400 12px/1 var(--font-mono); color: var(--text); letter-spacing: .02em; white-space: nowrap;
    transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.hint.show { opacity: 1; transform: translate(-50%, 0); }
.hint .faint { color: var(--faint); }
.hint .hand { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); animation: nudge 1.8s var(--ease) infinite; }
.hint .hand svg { width: 13px; height: 13px; }
@keyframes nudge { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(5px); } }

/* ---------- Intro ---------- */
.intro { position: fixed; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none; text-align: center; padding: 24px;
    background: radial-gradient(closest-side, rgba(11, 13, 12, .78), rgba(11, 13, 12, .35) 70%, transparent);
    animation: introOut 1s var(--ease) 2.5s forwards; }
.intro.gone { animation: introOut .5s var(--ease) forwards; }
.intro .kicker { font: 400 11.5px/1 var(--font-mono); color: var(--muted); letter-spacing: .16em; text-transform: uppercase; margin: 0 0 18px; }
.intro h1 { margin: 0; font: 400 clamp(46px, 8.4vw, 132px)/.92 var(--font-serif); letter-spacing: -.02em; }
.intro h1 em { color: var(--accent); }
.intro h1 span { display: inline-block; opacity: 0; filter: blur(12px); transform: translateY(.35em); animation: wordIn 1.1s var(--ease) forwards; }
.intro .sub { font: 400 12px/1 var(--font-mono); color: var(--faint); margin: 22px 0 0; letter-spacing: .06em; }
@keyframes wordIn { to { opacity: 1; filter: none; transform: none; } }
@keyframes introOut { to { opacity: 0; visibility: hidden; } }

/* ---------- Cursor ---------- */
.cursor { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; opacity: 0; transition: opacity .3s; }
.cursor.on { opacity: 1; }
.cursor .ring {
    position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid rgba(233, 237, 233, .5); display: grid; place-items: center;
    font: 500 10.5px/1 var(--font-mono); letter-spacing: .1em; color: transparent;
    transition: left .4s var(--ease), top .4s var(--ease), width .4s var(--ease), height .4s var(--ease), background .4s var(--ease), border-color .4s var(--ease), color .3s;
}
.cursor .dot { position: absolute; left: -2px; top: -2px; width: 4px; height: 4px; border-radius: 50%; background: var(--text); transition: opacity .3s; }
.cursor.view .ring { left: -38px; top: -38px; width: 76px; height: 76px; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cursor.drag .ring { left: -28px; top: -28px; width: 56px; height: 56px; background: rgba(233, 237, 233, .1); border-color: rgba(233, 237, 233, .7); color: var(--text); }
.cursor.view .dot, .cursor.drag .dot { opacity: 0; }

/* ---------- Viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 50; touch-action: none; user-select: none; -webkit-user-select: none; }
.viewer[hidden] { display: none; }
.v-back {
    position: absolute; inset: 0; opacity: 0;
    background:
        radial-gradient(ellipse 80% 70% at 50% 42%, color-mix(in oklab, var(--tint) 42%, transparent), transparent 74%),
        rgba(9, 11, 10, .86);
    -webkit-backdrop-filter: blur(28px) saturate(1.15); backdrop-filter: blur(28px) saturate(1.15);
    transition: opacity .6s var(--ease), --tint 1s var(--ease);
}
.viewer.open .v-back { opacity: 1; }
.v-glow { position: absolute; object-fit: cover; pointer-events: none; opacity: 0; filter: blur(70px) saturate(1.8); transform: scale(1.12); transition: opacity 1.1s var(--ease); }
.viewer.open .v-glow.on { opacity: .5; }
.v-img {
    position: absolute; object-fit: cover; border-radius: 10px; transform-origin: 0 0; will-change: transform;
    box-shadow: 0 60px 120px -50px rgba(0, 0, 0, .95), 0 0 0 1px rgba(255, 255, 255, .06);
    -webkit-user-drag: none; cursor: zoom-out;
}
.v-ui { opacity: 0; transform: translateY(10px); transition: opacity .5s var(--ease), transform .6s var(--ease); }
.viewer.open .v-ui { opacity: 1; transform: none; transition-delay: .22s; }
.v-top { position: absolute; top: max(var(--gutter), env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.v-pos { display: flex; align-items: center; gap: 14px; font: 400 12px/1 var(--font-mono); color: var(--muted); letter-spacing: .04em; }
.v-pos .bar { width: 120px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.v-pos .bar i { display: block; height: 100%; background: var(--accent); transition: width .6s var(--ease); }
.v-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 46px; min-width: 46px; padding: 0 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 500; transition: border-color .3s var(--ease), background .3s var(--ease), transform .3s var(--ease); }
.v-btn:hover { border-color: var(--border-strong); background: rgba(30, 36, 32, .75); }
.v-btn:active { transform: scale(.94); }
.v-btn svg { width: 18px; height: 18px; }
.v-btn kbd { font: 400 10.5px/1 var(--font-mono); color: var(--faint); border: 1px solid var(--border); border-radius: 5px; padding: 3px 5px; }
.v-cap { position: absolute; left: clamp(16px, 7vw, 110px); bottom: max(32px, env(safe-area-inset-bottom)); max-width: min(62vw, 760px); pointer-events: none; }
.v-meta { display: flex; gap: 12px; align-items: center; font: 400 11px/1 var(--font-mono); color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.v-meta .acc { color: var(--accent); }
.v-title { margin: 12px 0 10px; font: 400 clamp(40px, 5.4vw, 84px)/.95 var(--font-serif); letter-spacing: -.015em; }
.v-place { font: 400 12px/1.3 var(--font-mono); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.v-cap.swap > * { animation: capIn .8s var(--ease) both; }
.v-cap.swap > :nth-child(2) { animation-delay: .06s; }
.v-cap.swap > :nth-child(3) { animation-delay: .12s; }
@keyframes capIn { from { opacity: 0; transform: translateY(14px); filter: blur(8px); } }
.v-nav { position: absolute; right: clamp(16px, 7vw, 110px); bottom: max(34px, env(safe-area-inset-bottom)); display: flex; gap: 8px; }
.v-help { font: 400 11px/1 var(--font-mono); color: var(--faint); letter-spacing: .04em; }

@media (max-width: 900px) {
    .mini { padding: 7px; border-radius: 13px; }
    .mini .meta { display: none; }
    .hint { bottom: max(var(--gutter), env(safe-area-inset-bottom)); left: var(--gutter); transform: translate(0, 10px); }
    .hint.show { transform: none; }
}
/* Keep the top-right buttons compact so they don't meet the shared mode switcher (nav.css). */
@media (max-width: 1100px) {
    .btn span, .count { display: none; }
    .btn { width: 40px; padding: 0; justify-content: center; height: 40px; }
}
@media (max-width: 640px) {
    .v-pos .bar { width: 64px; }
    .v-help, .v-btn kbd { display: none; }
    .v-close span { display: none; }
    .v-cap { left: 16px; right: 120px; max-width: none; bottom: max(28px, env(safe-area-inset-bottom)); }
    .v-title { font-size: 38px; }
    .v-nav { right: 16px; bottom: max(28px, env(safe-area-inset-bottom)); gap: 6px; }
    .v-nav .v-btn { height: 44px; min-width: 44px; padding: 0; }
}
.shot .tile img { transition: none; }
@media (prefers-reduced-motion: reduce) {
    .intro h1 span { animation-duration: .01s; }
    .hint .hand { animation: none; }
    .tile img { transition: opacity .3s; filter: none; transform: none; }
}

/* Touch screens: the frosted glass (backdrop blur over the moving plane, re-blurred every frame), the film grain blended
   over everything and the tiles' skew (03-canvas.js) made dragging stutter on phones (high pixel density, 90-120 Hz):
   there the panels are plain and nearly opaque, and there is no grain. Desktop keeps the full look. */
@media (pointer: coarse) {
    .glass, .tile .target-hint, .v-back, .gnav-pill, .gnav-brand .brand-mark {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .glass, .gnav-pill, .gnav-brand .brand-mark { background: rgba(14, 17, 15, .9); }
    .grain { display: none; }
}
