/* =========================================================================
   Daniel Gov — photography showcase
   A neutral dark ground and no accent colour, so the only colour on screen
   comes from the photographs. Mobile first.

   Motion: html.motion-on (set in the page head unless the visitor asked for
   reduced motion) allows the opening animation; html.motion-js (set by
   motion.js) switches on the scroll-driven layouts. Without either, the page
   is complete and still. Everything that moves uses transform or opacity.
   ========================================================================= */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 62% 100%;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --color-ground: #171717;          /* neutral-900 */
  --color-raised: #262626;          /* neutral-800 */
  --color-text: #f5f5f5;            /* neutral-100: 16.44:1 on ground */
  --color-text-muted: #a3a3a3;      /* neutral-400: 7.11:1 on ground */
  --color-control-border: #737373;  /* neutral-500: 3.78:1 on ground */
  --color-hairline: #2e2e2e;
  --color-error: #fca5a5;           /* red-300: 9.45:1 on ground */
  --color-white: #ffffff;
  --color-shade: rgb(10 10 10 / 0.6);
  --color-viewer-ground: #0a0a0a;
  --color-viewer-button: rgb(23 23 23 / 0.72);
  --color-header: rgb(23 23 23 / 0.86);

  --font-sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1.0625rem;
  --text-lg: 1.3125rem;
  --text-xl: 1.75rem;
  --text-name: clamp(2.75rem, 12vw, 6rem);
  --text-hero: clamp(3.75rem, 19vw, 14rem);
  --text-marquee: clamp(4.5rem, 18vw, 15rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  --gutter: var(--space-4);
  --header-h: 56px;

  --radius-control: 6px;
  --radius-round: 9999px;

  --dur-fast: 150ms;
  --dur-base: 220ms;
  --dur-slow: 280ms;
  --dur-fade: 400ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);   /* long, soft landings for reveals */

  --color-caption: #d4d4d4;         /* neutral-300: at least 6:1 on the tinted ground */
}

@media (min-width: 700px) {
  :root { --gutter: var(--space-8); }
}
@media (min-width: 1024px) {
  :root { --gutter: var(--space-10); --header-h: 64px; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--color-ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--color-ground);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-stretch: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

[hidden] { display: none !important; }

img { display: block; max-width: 100%; height: auto; }
picture { display: contents; }

h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--color-control-border);
  transition: text-decoration-color var(--dur-fast) var(--ease-out);
}
a:hover { text-decoration-color: var(--color-text); }

/* Two-tone focus ring: white with a dark edge, visible on any photo or on the ground */
:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--color-ground);
}

.icon { width: 1.25em; height: 1.25em; flex: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 60;
  padding: var(--space-3) var(--space-4);
  background: var(--color-text);
  color: var(--color-ground);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-control);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

[data-magnetic] { display: inline-flex; transition: transform 0.6s var(--ease-expo); }

/* ---------- Header: floats over the page, gains a background once you scroll ---------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 calc(var(--gutter) - var(--space-2)) 0 var(--gutter);
  transition: transform 0.45s var(--ease-in-out), background-color 0.3s linear;
}
.site-header.is-scrolled { background: var(--color-header); }
.site-header.is-hidden { transform: translateY(-100%); }

.brand {
  align-items: center;
  min-height: 44px;
  font-size: 1.25rem;
  font-weight: 600;
  font-stretch: 75%;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav ul { display: flex; align-items: center; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-2);
  text-decoration: none;
  white-space: nowrap;
}
.site-nav a:hover { text-decoration-line: underline; }
.site-nav a[aria-current="page"] {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--color-text);
}
.nav-ig span { display: none; }
@media (min-width: 700px) {
  .site-nav ul { gap: var(--space-2); }
  .nav-ig span { display: inline; }
}

/* ---------- Letters that rise into place (home title, contact title) ---------- */
.split .word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.split .ch { display: inline-block; }
.motion-on .split .ch { animation: rise 1.1s var(--ease-expo) both; animation-delay: calc(var(--i) * 40ms + 200ms); }
@keyframes rise { from { transform: translateY(108%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================================
   Home
   ========================================================================= */

/* ---------- The ground takes on the colour of the photo you're looking at ----------
   motion.js sets --ambient to the dominant colour of the photo nearest the middle of
   the screen; the ground is a dark mix of it, so photos sit in their own light. */
@supports (color: color-mix(in oklab, red, blue)) {
  :root { --ground-now: color-mix(in oklab, var(--ambient, #262626) 24%, #0e0e0e); }
  .motion-js, .motion-js body { background-color: var(--ground-now); transition: background-color 1.6s var(--ease-in-out); }
  .motion-js .site-header.is-scrolled { background: color-mix(in oklab, var(--ground-now) 86%, transparent); }
}

/* ---------- Hero: full screen from the first moment ---------- */
.hero { position: relative; height: 100svh; overflow: hidden; }
.hero-frame { position: absolute; inset: 0; overflow: hidden; background: var(--c, var(--color-raised)); }
.hero-move { position: absolute; inset: 0; }
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--focus-phone, 50% 50%);
}
@media (min-width: 700px) { .hero-img { object-position: var(--focus-wide, 50% 50%); } }
.hero-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgb(10 10 10 / 0.35), transparent 22%),
    linear-gradient(to top, var(--color-shade), transparent 45%);
  pointer-events: none;
}
.hero-copy {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--space-12) + env(safe-area-inset-bottom));
  z-index: 2;
}
.hero-title {
  font-size: var(--text-hero);
  font-weight: 700;
  font-stretch: 62%;
  line-height: 0.84;
  letter-spacing: -0.02em;
}
.hero-cue {
  position: absolute;
  right: calc(var(--gutter) - 12px);
  bottom: calc(var(--space-10) + env(safe-area-inset-bottom));
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 56px;
}
.hero-cue-line { position: relative; display: block; width: 1px; height: 40px; overflow: hidden; background: rgb(245 245 245 / 0.3); }
.hero-cue-line::after { content: ""; position: absolute; inset: 0; background: var(--color-text); transform: translateY(-100%); }
.motion-on .hero-cue-line::after { animation: cue 2.4s var(--ease-in-out) 1.6s infinite; }
@keyframes cue { 0% { transform: translateY(-100%); } 50% { transform: translateY(0); } 100% { transform: translateY(100%); } }

/* the photo fades up from its own colour; no scaling, so the first scroll is calm */
.motion-on .hero-move { animation: fade-in 1.4s var(--ease-out) both; }
.motion-on .hero-cue { animation: fade-in 1s var(--ease-out) 1.2s backwards; }
.motion-js .hero-move, .motion-js .hero-copy { will-change: transform; }

/* ---------- The showcase: full-screen photos, one after another ---------- */
.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* the long strip must not widen the column */
  gap: 12svh;
  padding: 12svh 0 16svh;
}
.block { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12svh; }

.shot { margin: 0; }
.shot-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--r);
  cursor: zoom-in;
}
/* the top and bottom edges of full-width photos melt into the ground */
.shot-mask {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
}
.shot-move { position: absolute; inset: -5% 0; display: block; }   /* taller than the frame: room to drift */
.shot-img { width: 100%; height: 100%; object-fit: cover; }
.shot-cap {
  margin-top: var(--space-3);
  padding: 0 var(--gutter);
  color: var(--color-caption);
  font-size: var(--text-sm);
}

@media (min-width: 700px) {
  .work, .block { gap: 18svh; }
  /* landscapes: the full width of the screen, never taller than it */
  .block-wide .shot-frame { aspect-ratio: auto; height: min(calc(100vw / var(--r)), 100svh); }
  /* portraits: the full height of the screen, centred, with a soft glow of their own colour */
  .block-single, .block-pair { justify-content: center; }
  .block-single .shot-frame { width: min(calc(92svh * var(--r)), calc(100vw - 2 * var(--gutter))); }
  .block-pair { grid-template-columns: auto auto; column-gap: 1.5vw; align-items: start; }
  .block-pair .shot-frame { width: min(calc(88svh * var(--r)), 46vw); }
  .block-single .shot-mask, .block-pair .shot-mask { -webkit-mask-image: none; mask-image: none; background: var(--c, var(--color-raised)); }
  .block-single .shot-frame, .block-pair .shot-frame {
    box-shadow: 0 2.5rem 9rem -2rem color-mix(in srgb, var(--c, #000) 55%, transparent);
  }
  .block-single .shot-cap, .block-pair .shot-cap { padding: 0; }
}

/* entering: the photo fades in and settles from a slight zoom */
.motion-js .shot-frame { opacity: 0; transition: opacity 1.4s var(--ease-out); }
.motion-js .shot-img { transform: scale(1.08); transition: transform 2.2s var(--ease-expo); }
.motion-js .shot-cap { opacity: 0; transition: opacity 1s var(--ease-out) 0.5s; }
.motion-js .shot.is-in .shot-frame, .motion-js .shot.is-in .shot-cap { opacity: 1; }
.motion-js .shot.is-in .shot-img { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .motion-js .shot.is-in .shot-frame:hover .shot-img { transform: scale(1.03); transition-duration: 1.2s; }
}
.motion-js .shot-move { will-change: transform; }

/* ---------- Sideways strip: scrolling down moves the row sideways ---------- */
.strip { position: relative; margin-block: 6svh; }
.strip-sticky { position: relative; }
.strip-track {
  display: flex;
  gap: var(--space-4);
  padding: 0 var(--gutter);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.strip-item {
  position: relative;
  display: block;
  flex: none;
  height: 62svh;
  aspect-ratio: var(--r);
  overflow: hidden;
  background: var(--c, var(--color-raised));
  scroll-snap-align: center;
  cursor: zoom-in;
}
.strip-move { position: absolute; inset: 0 -5%; display: block; }
.strip-img { width: 100%; height: 100%; object-fit: cover; }
.strip-progress { display: none; }
@media (min-width: 700px) {
  .strip-item { height: 76svh; }
  .strip-track { gap: 2vw; }
}
/* --travel is shorter than the row, so the row moves a little faster than you scroll */
.motion-js .strip { height: calc(var(--travel, 0px) + 100svh); margin-block: 0; }
.motion-js .strip-sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}
.motion-js .strip-track { overflow: visible; scroll-snap-type: none; will-change: transform; }
.motion-js .strip-move { will-change: transform; }
.motion-js .strip-progress {
  display: block;
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(var(--space-10) + env(safe-area-inset-bottom));
  height: 2px;
  background: rgb(245 245 245 / 0.14);
}
.strip-progress span { display: block; height: 100%; background: var(--color-text); transform: scaleX(0); transform-origin: left; }

/* ---------- Full-screen moment: the photo holds the screen while it slowly settles ---------- */
.feature { position: relative; margin-block: 6svh; }
.feature-sticky { position: relative; display: grid; align-content: center; }
.feature-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: var(--r);
  max-height: 100svh;
  cursor: zoom-in;
}
.feature-mask {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
}
.feature-img { width: 100%; height: 100%; object-fit: cover; }
.feature-cap { padding: var(--space-3) var(--gutter) 0; color: var(--color-caption); font-size: var(--text-sm); }
@media (min-width: 700px) {
  .feature-frame { height: 100svh; aspect-ratio: auto; }
  .feature-mask { -webkit-mask-image: none; mask-image: none; background: var(--c, var(--color-raised)); }
}
.motion-js .feature { height: 150svh; margin-block: 0; }
@media (min-width: 700px) { .motion-js .feature { height: 180svh; } }
.motion-js .feature-sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.motion-js .feature-img { transform: scale(1.12); will-change: transform; }
.motion-js .feature-cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  opacity: 0;
}

/* ---------- Ending: a moving line and the invitation ---------- */
.outro { padding: 14svh 0 10svh; overflow: hidden; }
.marquee { overflow: hidden; }
.marquee-track { display: flex; width: max-content; }
.marquee-group { display: flex; align-items: center; flex: none; }
.marquee-group span:not(.marquee-dot) {
  padding: 0 0.22em;
  font-size: var(--text-marquee);
  font-weight: 700;
  font-stretch: 62%;
  line-height: 1;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.marquee-dot {
  flex: none;
  width: calc(var(--text-marquee) * 0.16);
  height: calc(var(--text-marquee) * 0.16);
  border: 2px solid currentColor;
  border-radius: var(--radius-round);
}
.motion-js .marquee-track { will-change: transform; }
.outro-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-16) var(--gutter) 0;
}
.outro-title { font-size: var(--text-xl); font-stretch: 75%; color: var(--color-text-muted); }
.outro-cta {
  align-items: center;
  justify-content: center;
  width: clamp(9rem, 20vw, 12rem);
  aspect-ratio: 1;
  border-radius: var(--radius-round);
  background: var(--color-text);
  color: var(--color-ground);
  font-size: var(--text-lg);
  font-weight: 600;
  text-decoration: none;
}
.outro-cta:hover { background: var(--color-white); }

/* ---------- Plain pages (contact, 404) ---------- */
.page {
  display: grid;
  gap: var(--space-4);
  max-width: 44rem;
  padding: calc(var(--header-h) + var(--space-12)) var(--gutter) var(--space-16);
}
.page-title {
  margin-bottom: var(--space-4);
  font-size: var(--text-name);
  font-weight: 700;
  font-stretch: 62%;
  line-height: 0.9;
  letter-spacing: -0.015em;
}
.lede { max-width: 32rem; color: var(--color-text-muted); font-size: var(--text-lg); line-height: 1.45; }
.page p a { padding-block: var(--space-1); }
.motion-on .page .lede, .motion-on .page > p, .motion-on .contact-form { animation: fade-up 1s var(--ease-expo) 0.5s both; }

/* ---------- Contact form ---------- */
html:not(.js) .contact-form { display: none; }
.contact-form { display: grid; gap: var(--space-6); margin-top: var(--space-6); }
.form-note { color: var(--color-text-muted); font-size: var(--text-sm); }
.field label { display: block; margin-bottom: var(--space-2); font-weight: 600; }
.field input,
.field textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  font: inherit;
  color: var(--color-text);
  background: var(--color-raised);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-control);
}
.field textarea { min-height: 10rem; resize: vertical; }
.field.is-invalid input,
.field.is-invalid textarea { border-color: var(--color-error); }
.field-error {
  display: none;
  align-items: flex-start;
  gap: var(--space-2);
  margin-top: var(--space-2);
  color: var(--color-error);
  font-size: var(--text-sm);
}
.field.is-invalid .field-error { display: flex; }
.field-error .icon { margin-top: 0.1em; }
.form-actions { display: grid; gap: var(--space-3); justify-items: start; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--space-6);
  font: inherit;
  font-weight: 600;
  color: var(--color-ground);
  background: var(--color-text);
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.button:hover { background: var(--color-white); }
.button:active { transform: scale(0.98); }
.button[aria-disabled="true"] { opacity: 0.7; cursor: progress; }
.form-status:empty { display: none; }
.form-status.is-error { color: var(--color-error); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-6);
  padding: var(--space-6) var(--gutter) var(--space-10);
  border-top: 1px solid var(--color-hairline);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}
.site-footer a { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; color: var(--color-text); }
.site-footer p { flex-basis: 100%; }
@media (min-width: 700px) { .site-footer p { flex-basis: auto; margin-left: auto; } }

/* ---------- Custom cursor (mouse only; added by motion.js) ---------- */
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor [data-photo] { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }
.cursor { position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none; transition: opacity 0.3s linear; }
.cursor.is-hidden, .viewer-open .cursor { opacity: 0; }
.viewer-open.has-cursor, .viewer-open.has-cursor * { cursor: auto; }
.cursor-dot, .cursor-ring, .cursor-label { position: absolute; left: 0; top: 0; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: var(--color-white); transition: opacity 0.2s linear; }
.cursor-ring {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgb(255 255 255 / 0.55);
  border-radius: 50%;
  transition: background-color 0.3s linear, border-color 0.3s linear;
}
.cursor-label {
  width: 80px;
  margin: -0.7em 0 0 -40px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-ground);
  opacity: 0;
  transition: opacity 0.2s linear;
}
.cursor.is-view .cursor-ring { background: var(--color-text); border-color: transparent; }
.cursor.is-view .cursor-label { opacity: 1; }
.cursor.is-view .cursor-dot { opacity: 0; }
.cursor.is-link .cursor-ring { border-color: var(--color-white); }

/* =========================================================================
   Photo viewer
   ========================================================================= */
html:has(.viewer[open]), html.viewer-open { overflow: hidden; }

.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  color: var(--color-text);
  background: transparent;
  overscroll-behavior: contain;
  --bar-h: calc(6.25rem + env(safe-area-inset-bottom));
  --slide-gap: 24px;
}
.viewer::backdrop { background: transparent; }
.viewer-bg { position: absolute; inset: 0; background: var(--color-viewer-ground); }
.viewer.is-closing { opacity: 0; transition: opacity 150ms linear; }

.viewer-stage {
  position: absolute;
  inset: calc(3.5rem + env(safe-area-inset-top)) 0 var(--bar-h) 0;
  touch-action: pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
}
.viewer.is-zoomed .viewer-stage { touch-action: auto; }
.viewer-track { position: absolute; inset: 0; }
.viewer-slide { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; }
.viewer-slide[data-pos="prev"] { transform: translate3d(calc(-100% - var(--slide-gap)), 0, 0); }
.viewer-slide[data-pos="next"] { transform: translate3d(calc(100% + var(--slide-gap)), 0, 0); }
.viewer-frame { position: relative; background: var(--c, var(--color-raised)); transform-origin: center; }
.viewer-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; -webkit-user-drag: none; }
.viewer-frame .viewer-sharp { opacity: 0; transition: opacity 150ms linear; }
.viewer-frame.is-sharp .viewer-sharp { opacity: 1; }
.viewer-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-4);
  padding: var(--space-6);
  text-align: center;
  background: var(--color-viewer-ground);
}
.viewer-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 max(var(--space-4), env(safe-area-inset-right)) env(safe-area-inset-bottom) max(var(--space-4), env(safe-area-inset-left));
}
.viewer-caption {
  flex: 1;
  display: grid;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.viewer-counter { color: var(--color-text); }
.viewer-exposure { opacity: 0.8; }
.viewer-caption span:empty { display: none; }
.viewer-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 0;
  color: var(--color-text);
  background: var(--color-viewer-button);
  border: 1px solid var(--color-control-border);
  border-radius: var(--radius-round);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}
.viewer-btn svg { width: 22px; height: 22px; }
.viewer-btn:hover { background: var(--color-raised); }
.viewer-btn[aria-disabled="true"] { opacity: 0.35; cursor: default; }
.viewer-close { position: absolute; z-index: 2; top: max(var(--space-2), env(safe-area-inset-top)); right: max(var(--space-3), env(safe-area-inset-right)); }
@media (min-width: 1024px) {
  .viewer { --bar-h: 4.5rem; --slide-gap: 112px; }
  .viewer-stage { inset: var(--space-6) 5.5rem var(--bar-h); }
  .viewer-prev, .viewer-next { position: fixed; top: 50%; margin-top: -24px; }
  .viewer-prev { left: var(--space-6); }
  .viewer-next { right: var(--space-6); }
  .viewer-close { top: var(--space-6); right: var(--space-6); }
  .viewer-caption { grid-auto-flow: column; justify-content: center; gap: var(--space-6); }
}

/* ---------- Reduced motion: no animation at all ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-base: 0ms; --dur-slow: 0ms; --dur-fade: 0ms; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Smooth page-to-page cross-fade where supported */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(root) { animation-duration: 200ms; }
}
