/* Building page: white page, blue text. Plain page scroll, nothing is pinned or captured.
   Three sections one under the other: the hero film, the card stack (it moves by itself), projects + closing toggles. */

/* ---------- stages 1 and 2: one pinned stage ----------
   With JS the wrapper (.tx) is as tall as the scroll it needs and its stage sticks to the screen while the scroll position drives the film, the pixels and
   the stack resolves in. Layers, bottom to top: the stack, the film, the pixel canvas, the sound button. Without JS or with reduced motion the film
   and the stack are just two plain screens one under the other. */
.tx { position: relative; }
.tx__stage { position: relative; background: var(--bg); }
.tx.is-live .tx__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.tx.is-live .vc, .tx.is-live .hero { position: absolute; inset: 0; height: auto; min-height: 0; }
.tx.is-live .vc { z-index: 1; pointer-events: none; }   /* the stack is simply there under the film from the start; the dust clears off it */
.tx.is-live .hero { z-index: 2; }
.tx__px { display: none; position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; pointer-events: none; }
.tx.is-live .sound { z-index: 5; }
.tx:not(.is-live) .sound { display: none; }

/* ---------- 1. hero film ---------- */
.hero { position: relative; height: 100vh; height: 100svh; display: grid; place-items: center; overflow: hidden; background: var(--bg); }
.hero > * { grid-area: 1 / 1; }
.film__poster, .film__poster img, .hero video { width: 100%; height: 100%; object-fit: cover; }
.hero video { opacity: 0; transition: opacity var(--dur-slow) var(--ease); }
.hero video.is-on { opacity: 1; }

/* sound button: glass button in my colours, sits in the corner of the film and scrolls away with it */
.sound { position: absolute; z-index: 6; right: max(var(--gutter), env(safe-area-inset-right)); bottom: calc(var(--space-6) + env(safe-area-inset-bottom)); align-self: end; justify-self: end;
  width: 48px; height: 48px; display: grid; place-items: center; padding: 0; cursor: pointer; border-radius: 50%; color: var(--ink);
  background: color-mix(in srgb, var(--bg) 60%, transparent); border: 1px solid color-mix(in srgb, var(--ink) 35%, transparent); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  transition: transform var(--dur-fast); }
.sound:hover { transform: scale(1.08); }
.sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sound .icon-on { display: none; }
.sound.is-sound .icon-on { display: block; }
.sound.is-sound .icon-off { display: none; }

/* ---------- 2. card stack ----------
   Left side of the screen: "EVO / LVE" top left, position bars, title + duration, series label bottom left, then the stack.
   The stack moves top to bottom by itself. The right side is empty on purpose. */
.vc { --vc-w: clamp(150px, min(calc((100svh - var(--nav-height)) * 0.31 * 16 / 9), 30vw), 520px); --vc-text-w: clamp(130px, 12vw, 210px); --vc-x: calc(var(--gutter) + 46px);
  position: relative; height: 100vh; height: 100svh; min-height: 540px; overflow: hidden; background: var(--bg); }

/* the word: heavy wide capitals (from the BWV sketch), black over blue, one sharp cut through it (type brief: a strong base plus one custom detail) */
.reel__evolve { position: absolute; z-index: 5; margin: 0; left: var(--gutter); top: calc(var(--nav-height) + var(--space-4)); display: grid; pointer-events: none;
  font-family: var(--font-title); font-weight: 800; text-transform: uppercase; font-size: clamp(3rem, 4.9vw, 5.6rem); line-height: 0.84; letter-spacing: -0.03em; }
.reel__evolve span:first-child { color: var(--black); }
.reel__evolve span:last-child { color: var(--electric); }
.reel__evolve::after { content: ""; position: absolute; left: -8%; right: -8%; top: 49%; height: 0.075em; background: var(--bg); transform: rotate(-10deg); }

.vc__bars { position: absolute; left: calc(var(--gutter) - 8px); top: calc(50% + var(--nav-height) / 2); transform: translateY(-50%); z-index: 4; list-style: none; margin: 0; padding: 12px 16px 12px 8px; display: grid; gap: 4px; }   /* the padding makes the strip easier to tap */
.vc__bars button { display: block; width: 26px; height: 18px; padding: 0; border: 0; background: none; cursor: pointer; position: relative; }
.vc__bars button::after { content: ""; position: absolute; left: 0; top: 50%; height: 3px; width: 14px; margin-top: -1.5px; border-radius: 2px; background: var(--ink); opacity: 0.28;
  transition: width var(--dur-med) var(--ease), opacity var(--dur-med) var(--ease); }
.vc__bars button[aria-current="true"]::after { width: 26px; opacity: 1; }
.vc__bars button:hover::after { opacity: 0.65; }
.vc__bars button[aria-current="true"]:hover::after { opacity: 1; }
.vc__bars button:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }

/* quiet title: light weight, softened */
.vc__text { position: absolute; z-index: 4; left: var(--vc-x); width: var(--vc-text-w); top: calc(50% + var(--nav-height) / 2); transform: translateY(-50%); display: grid; gap: var(--space-2); color: var(--ink); pointer-events: none; }
.vc__title { margin: 0; font-family: var(--font-title); font-weight: 400; font-size: clamp(0.85rem, 1.05vw, 1.05rem); line-height: 1.45; letter-spacing: 0; opacity: 0.8; overflow-wrap: anywhere; }
.vc__dur { margin: 0; font-family: var(--font-body); font-weight: 400; font-size: var(--text-sm); opacity: 0.55; }

/* series label: bottom left, on the left side of the videos */
.vc__series { position: absolute; z-index: 4; left: var(--vc-x); bottom: var(--space-6); width: var(--vc-text-w); display: grid; gap: var(--space-2); color: var(--ink); pointer-events: none; }

.panel-label, .panel-sub { margin: 0; font-family: var(--font-title); font-size: var(--text-label); letter-spacing: var(--tracking-label); text-transform: uppercase; }
.panel-label { font-weight: var(--weight-title); }
.panel-sub { font-weight: 500; opacity: 0.7; }

.vc__stack { position: absolute; z-index: 3; list-style: none; margin: 0; padding: 0; left: calc(var(--vc-x) + var(--vc-text-w) + var(--space-6)); top: var(--nav-height); bottom: 0; width: var(--vc-w); overflow: hidden; }
/* drag: the mouse drags the stack. Touch is never captured anywhere (no touch-action rules): a swipe is a plain page scroll and the scroll position moves the stack. */
.vc__stack { user-select: none; -webkit-user-select: none; cursor: grab; }   /* no touch-action here: a finger on the stack scrolls the page as normal */
.vc.is-dragging, .vc.is-dragging * { cursor: grabbing !important; }
.vc.is-dragging .card__play { opacity: 0; }
.vc.is-dragging .card__bar { transform: scaleX(0); }
.vc__item { position: absolute; left: 0; top: 50%; width: 100%; margin-top: calc(var(--vc-w) * 9 / 16 / -2); will-change: transform, opacity; }
.vc__item .card { width: 100%; }
.vc__reserved { position: absolute; right: 0; top: var(--nav-height); bottom: 0; width: 40%; pointer-events: none; }

/* ---------- the video cards: flat (no glow), with a YouTube style hover and press ----------
   Hover or keyboard focus: a thin YouTube red bar draws across the bottom, a red play button fades in over a light dim. Press: the button darkens a touch and sits in. No bounce. */
.card--clip, .card--clip:hover, .card--clip:focus-visible { box-shadow: none; }
.card--clip { cursor: pointer; transition: none; }
.card--clip video, .card--clip .card__still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card--clip video { opacity: 0; }
.card--clip.is-live video { opacity: 1; }
.card--clip .card__still { z-index: 1; transition: opacity var(--dur-med) var(--ease); }
.card--clip.is-live .card__still { opacity: 0; }
.card--clip::after { content: ""; position: absolute; inset: 0; z-index: 2; background: var(--black); opacity: 0; pointer-events: none; transition: opacity var(--dur-med) var(--ease); }
.card__bar { position: absolute; z-index: 4; left: 0; right: 0; bottom: 0; height: 4px; background: var(--yt-red); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; transition: transform 480ms var(--ease); }
.card__play { position: absolute; z-index: 4; left: 50%; top: 50%; width: clamp(44px, 16%, 84px); aspect-ratio: 17 / 12; opacity: 0; transform: translate(-50%, -50%) scale(0.92); pointer-events: none;
  transition: opacity var(--dur-med) var(--ease), transform var(--dur-med) var(--ease); }
.card__play svg { display: block; width: 100%; height: 100%; }
.card__play rect { fill: var(--yt-red); transition: fill var(--dur-fast) var(--ease); }
.card__play path { fill: var(--white); }
.card--clip:focus-visible, .card--clip:active { outline: none; }
.card--clip:focus-visible::after, .card--clip:active::after { opacity: 0.16; }
.card--clip:focus-visible .card__bar, .card--clip:active .card__bar { transform: scaleX(1); }
.card--clip:focus-visible .card__play, .card--clip:active .card__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card--clip:active::after { opacity: 0.26; }
.card--clip:active .card__play { transform: translate(-50%, -50%) scale(0.95); }
.card--clip:active .card__play rect { fill: var(--yt-red-press); }
@media (hover: hover) {
  .card--clip:hover::after { opacity: 0.16; }
  .card--clip:hover .card__bar { transform: scaleX(1); }
  .card--clip:hover .card__play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  .card--clip:active:hover::after { opacity: 0.26; }
  .card--clip:active:hover .card__play { transform: translate(-50%, -50%) scale(0.95); }
}
/* pixel dissolve (same technique as the Learning page: average the picture down to one colour per block, scale it up with smoothing off).
   Cards away from the centre are blocky, and they resolve to the sharp video as they reach the centre. */
.card__px { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; pointer-events: none; transition: opacity var(--dur-med) var(--ease); }
/* duration badge: kept clear of the rounded corner and of the red bar */
.card__badge { position: absolute; z-index: 3; right: var(--space-3); bottom: var(--space-3); padding: 1px var(--space-2); border-radius: 6px; pointer-events: none;
  background: color-mix(in srgb, var(--black) 78%, transparent); color: var(--white);
  font-family: var(--font-body); font-weight: 600; font-size: var(--text-sm); line-height: 1.5; letter-spacing: 0.02em; }

/* no soft glow on any card on this page */
body[data-chapter="building"] .card--poster, body[data-chapter="building"] .card--poster:hover, body[data-chapter="building"] .card--thumb:hover { box-shadow: none; }
/* keyboard focus: a plain YouTube red ring (a ring, not a glow) */
body[data-chapter="building"] .card--clip:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--yt-red); }

/* ---------- 3. horizontal section ----------
   Without JS or with reduced motion it is a plain row you can swipe. With JS the section is as tall as the sideways distance and its stage sticks
   to the screen while you scroll down the page: scroll position moves the cards sideways (1 px of page scroll = 1 px sideways). Nothing captures the wheel. */
.hs { position: relative; background: var(--bg); }
.hs__sticky { height: 100vh; height: 100svh; display: flex; align-items: center; overflow-x: auto; }
.hs.is-live .hs__sticky { position: sticky; top: 0; overflow: hidden; }
.hs__track { list-style: none; margin: 0; padding: 0 var(--gutter); display: flex; align-items: center; gap: 3vw; width: max-content; will-change: transform; }
.hs__track > li { flex: none; }
.hs__track > li:not(.hs__label) { width: min(44vw, 680px); }
.hs__label { width: clamp(110px, 12vw, 200px); }
/* the two toggle bars close the row */
.hs__track > li.hs__close { width: min(78vw, 560px); display: grid; gap: var(--space-4); padding-right: var(--gutter); }
/* ---------- 4. reserved space for the projects detail and the two toggles ---------- */
.after { min-height: 70vh; min-height: 70svh; background: var(--bg); }

/* ---------- projects: category pills on the left (the old side tab bar's pills, reused: small, tilted a touch, uneven), the open category's projects beside them. Right half empty. ---------- */
.fin { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-7); align-items: start; padding: calc(var(--nav-height) + var(--space-7)) var(--gutter) var(--space-7); background: var(--bg); }
.fin__left { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: calc(var(--space-7) + var(--space-5)); row-gap: var(--space-6); align-items: start; }
.pbars { display: grid; gap: 22px; justify-items: start; padding: var(--space-3) var(--space-4) 0 0; }
.pbars button { --r: -2.2deg; --dx: 0px; cursor: pointer; border: 0; padding: 10px 20px; border-radius: 999px; background: var(--navy); color: var(--white);
  font-family: var(--font-title); font-weight: var(--weight-title); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; line-height: 1.2;
  opacity: 0.72; transform: translateX(var(--dx)) rotate(var(--r)); transform-origin: 0 50%; box-shadow: 0 6px 14px -8px color-mix(in srgb, var(--black) 70%, transparent);
  transition: transform var(--dur-med) var(--ease), opacity var(--dur-fast); }
.pbars button:nth-child(2) { --r: 1.6deg; --dx: 10px; }
.pbars button:nth-child(3) { --r: -1.1deg; --dx: 4px; }
.pbars button:nth-child(4) { --r: 2.4deg; --dx: 14px; }
.pbars button:hover { opacity: 1; }
.pbars button[aria-current="true"] { opacity: 1; transform: translateX(calc(var(--dx) + 6px)) rotate(0deg); }
.pbars button:focus-visible { outline: 2px solid var(--glow); outline-offset: 2px; }
.catpanel { display: grid; gap: var(--space-1); }
.catpanel[hidden] { display: none; }
.catpanel .cat__line { margin-top: var(--space-5); }
.cat__line { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--space-5); max-width: 560px; }
.card--proj { width: 100%; aspect-ratio: 16 / 9; padding: 0; border: 0; font: inherit; text-align: left; color: var(--white); cursor: pointer; background: var(--navy); transition: transform var(--dur-med) var(--ease); }
.card--proj img { object-fit: contain; object-position: center; }   /* whole thumbnail always visible: 16:9 slides fill the card, tall ones (jarvis, cloat, swiggy) sit centred on the navy */
.card--proj:hover, .card--proj:focus-visible { transform: translateY(-4px); }
.card--proj:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }
.card--proj .card__info { padding: var(--space-3) var(--space-4); }
.card--proj .card__title { font-size: clamp(0.72rem, 0.95vw, 0.9rem); line-height: 1.25; letter-spacing: 0.04em; }
.card--soon { cursor: default; display: grid; place-items: center; background: linear-gradient(155deg, color-mix(in srgb, var(--navy) 62%, var(--pale)), color-mix(in srgb, var(--navy) 88%, var(--black))); }
.card--soon:hover { transform: none; }
.card__soon { font-family: var(--font-body); font-size: clamp(0.6rem, 0.75vw, 0.75rem); letter-spacing: 0.06em; opacity: 0.85; }
@media (max-width: 800px) { .fin { grid-template-columns: 1fr; } .fin__left { grid-template-columns: 1fr; } .pbars { grid-auto-flow: column; justify-content: start; overflow-x: auto; padding-bottom: var(--space-2); } }

/* ---------- the end of the page: the two buttons, the sheet placeholder, the line to Sharing ---------- */
.end { display: grid; gap: var(--space-7); justify-items: center; padding: var(--space-6) var(--gutter) calc(var(--space-7) * 1.5); background: var(--bg); }
/* the illustration and the buttons: Vaibhav's own wide 4:3 version (assets/img/building-sticker.jpg), shown whole, never stretched or cropped, never above its real 1600px.
   Phones: stacked (picture, buttons, line to Sharing). Wider than 800px: picture on the left, buttons and line on the right, sized so it all fits on one screen.
   Its pale backdrop is multiplied into the page and feathered on all four edges so no rectangle shows. */
.end__block { width: 100%; display: grid; gap: var(--space-4); justify-items: center; }
.end__art { display: block; width: 100%; max-width: 1600px; height: auto; aspect-ratio: 4 / 3; object-fit: contain; mix-blend-mode: multiply;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent), linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent), linear-gradient(to bottom, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect; }
.end__side { width: 100%; display: grid; gap: var(--space-6); justify-items: center; }
.end__toggles { width: min(100%, 560px); display: grid; gap: var(--space-4); }
.sheet { width: 100%; min-height: 0; }
.end__line { margin: 0; max-width: 22ch; text-align: center; font-family: var(--font-title); font-weight: var(--weight-title); font-size: clamp(1.5rem, 3.4vw, 2.6rem); line-height: 1.15; }
.end__line a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--electric); transition: color var(--dur-fast); }
.end__line a:hover { color: var(--electric); }
@media (min-width: 801px) {
  .end__block { width: min(100%, 1100px); grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: center; gap: var(--space-7); }
  .end__art { width: min(100%, calc((100svh - var(--nav-height) - var(--space-6) * 2) * 4 / 3)); justify-self: end; }
}

/* small jump toggle beside the stack: the same pill, pointing down to the end of the page */
.vc__jump { position: absolute; z-index: 4; left: calc(var(--vc-x) + var(--vc-text-w) + var(--space-6) + var(--vc-w) + var(--space-5)); bottom: var(--space-6);
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--navy); color: var(--white); text-decoration: none;
  font-family: var(--font-title); font-weight: var(--weight-title); font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; transform: rotate(-2deg); transition: transform var(--dur-med) var(--ease); }
.vc__jump:hover { transform: rotate(0deg) translateY(-2px); }
.vc__jump svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 800px) { .vc__jump { left: auto; right: var(--gutter); bottom: var(--space-4); } }

/* ---------- projects + closing toggles (older versions, kept; plain, polish comes later) ---------- */
.tail { padding: var(--space-7) var(--gutter) calc(var(--space-7) * 1.5); display: grid; gap: var(--space-7); background: var(--bg); }
.tail__group { display: grid; gap: var(--space-3); }
.tail__cards { list-style: none; margin: var(--space-2) 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--space-5); }
.slot { aspect-ratio: 16 / 9; border-radius: var(--radius-card); border: 1.5px dashed color-mix(in srgb, var(--ink) 35%, transparent); background: color-mix(in srgb, var(--ink) 5%, transparent); }
.card--project { aspect-ratio: 16 / 9; cursor: default; background: linear-gradient(155deg, color-mix(in srgb, var(--navy) 62%, var(--pale)), color-mix(in srgb, var(--navy) 88%, var(--black))); }
.card--project::before { display: none; }
.card--project .card__title { font-weight: var(--weight-title); }
.tail__close { width: min(100%, 560px); justify-self: center; display: grid; gap: var(--space-4); margin-top: var(--space-6); }

/* closing toggles */
.toggle { display: block; text-align: center; text-decoration: none; padding: var(--space-5) var(--space-6); border-radius: 999px;
  font-family: var(--font-title); font-weight: var(--weight-title); font-size: var(--text-base); letter-spacing: 0.04em;
  color: var(--ink); border: 1.5px solid color-mix(in srgb, var(--ink) 55%, transparent); transition: background var(--dur-fast), color var(--dur-fast), transform var(--dur-fast); }
.toggle:hover { background: color-mix(in srgb, var(--ink) 12%, transparent); transform: translateY(-2px); }
.toggle--main { background: var(--ink); color: var(--bg); border-color: var(--ink); font-size: clamp(1rem, 1.35vw, 1.25rem); }
.toggle--main:hover { background: var(--ink); opacity: 0.92; }

/* nav: no glow on the active tab here, just a plain line */
body[data-chapter="building"] .nav__link[aria-current="page"] { text-shadow: none; }
body[data-chapter="building"] .nav__link[aria-current="page"]::after { box-shadow: none; background: var(--ink); }

/* vision page */
.vision { min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: var(--space-6); padding: calc(var(--nav-height) + var(--space-6)) var(--gutter) var(--space-7); text-align: center; }
.vision h1 { font-size: var(--text-title); font-weight: var(--weight-display); max-width: 18ch; }
.vision .toggle { min-width: 14rem; }

/* side tab bar: taken off the page (markup is commented out in building.html). Style kept for when its frame is decided. */
.reel__tabs { position: fixed; z-index: 6; right: 0; top: 50%; transform: translateY(-50%); display: grid; gap: 6px; justify-items: end; }
.reel__tabs button { --r: -1.6deg; cursor: pointer; border: 0; padding: 7px 14px 7px 12px; border-radius: 8px 0 0 8px; background: var(--navy); color: var(--white);
  font-family: var(--font-title); font-weight: var(--weight-title); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; line-height: 1.2;
  opacity: 0.78; transform: rotate(var(--r)); transform-origin: 100% 50%; transition: transform var(--dur-med) var(--ease), opacity var(--dur-fast); }
.reel__tabs button:nth-child(even) { --r: 1.4deg; }
.reel__tabs button:hover { opacity: 1; }
.reel__tabs button[aria-current="true"] { opacity: 1; transform: translateX(-6px) rotate(0deg); }

/* ---------- phones and small tablets ---------- */
@media (max-width: 800px) {
  .vc { --vc-w: min(calc((100vw - var(--vc-x) - var(--gutter)) * 0.9), calc((100svh - var(--nav-height) - 20.5rem) * 0.8)); --vc-x: calc(var(--gutter) + 36px); min-height: 640px; }
  .vc__bars { top: calc(var(--nav-height) + 7rem + (100% - var(--nav-height) - 18.5rem) / 2); }
  .vc__stack { left: var(--vc-x); top: calc(var(--nav-height) + 7rem); bottom: 11.5rem; }
  .vc__text { left: var(--vc-x); right: var(--gutter); width: auto; top: auto; bottom: 4.6rem; transform: none; gap: var(--space-1); }
  .vc__series { left: var(--vc-x); right: var(--gutter); width: auto; bottom: var(--space-4); grid-auto-flow: column; justify-content: start; gap: var(--space-3); }
  .reel__evolve { font-size: clamp(2.6rem, 14vw, 4rem); }
  .tail__cards { grid-template-columns: 1fr; }
}
/* portrait phones: the film is 16:9, so show the whole frame instead of cropping it */
@media (max-width: 700px) and (orientation: portrait) {
  .hero video, .film__poster, .film__poster img { height: auto; aspect-ratio: 16 / 9; align-self: center; }
}

/* ---------- the project view: covers the page, its files are small tilted cards (the 3D effect from the sketch) that scroll like the stack:
   the card in the centre zone is the highlighted one. Click a card to see that file big in a panel; the cross closes the panel, then the view. ---------- */
.pv { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto minmax(0, 1fr); background: var(--bg); color: var(--ink); opacity: 0; transition: opacity 220ms var(--ease); }
.pv.is-open { opacity: 1; }
.pv__dust { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; pointer-events: none; }
.pv[hidden], .pf[hidden] { display: none; }
.pv__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-4) var(--gutter); }
.pv__title { margin: 0; font-family: var(--font-title); font-weight: var(--weight-title); font-size: clamp(1.1rem, 2vw, 1.6rem); }
.pv__close, .pf__close { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; cursor: pointer; border-radius: 50%; color: var(--ink); background: transparent; border: 1.5px solid color-mix(in srgb, var(--ink) 40%, transparent); transition: background var(--dur-fast); }
.pv__close:hover, .pf__close:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.pv__close svg, .pf__close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pv__scroll { overflow-y: auto; overscroll-behavior: contain; }
.pv__cards { list-style: none; margin: 0; padding: 50vh 0; display: grid; justify-items: center; gap: var(--space-7); }
.pv__cards li { display: grid; }
.pv__card { display: block; width: auto; padding: 0; border: 0; background: none; cursor: pointer; transform: perspective(1000px) rotateY(var(--ry, -16deg)) rotateX(var(--rx, 0deg)) scale(var(--s, 0.9)); will-change: transform; }
.pv__card img { display: block; width: auto; height: auto; max-height: 84svh; max-width: 92vw; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--ink) 16%, transparent); background: var(--pale); }
.pv__card.is-centre img { outline: 3px solid var(--electric); outline-offset: 3px; }
.pv__card:focus-visible img { outline: 3px solid var(--glow); outline-offset: 3px; }
.pf { position: absolute; inset: 0; z-index: 3; display: grid; justify-items: center; align-items: start; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-7) var(--space-5); background: color-mix(in srgb, var(--bg) 95%, transparent); animation: pfIn 260ms var(--ease) both; }
@keyframes pfIn { from { opacity: 0; } to { opacity: 1; } }
.pf__close { position: absolute; top: var(--space-4); right: var(--gutter); }
.pf__img { width: min(100%, 1100px); height: auto; border-radius: 12px; }   /* reading width; the panel scrolls if the page is taller than the screen */
@media (prefers-reduced-motion: reduce) { .pv { transition: none; } .pf { animation: none; } }
