/*
  Aperture: photographer portfolio for Ines Varga.
  1. Tokens, base type and browser surfaces (selection, caret, scrollbar, focus).
  2. The roll in three modes: native horizontal swipe (default, mobile, no JS),
     pinned scroll-driven track (html.is-reel), contact sheet (html[data-view="index"]).
  3. About, contact form states, footer, lightbox dialog and view transitions.
  4. Components (search "Components"): listbox, notices, confirmation dialog, tooltip,
     text button. All drawn from the tokens below; nothing is left to the browser.
*/

/* ---------- 1. Tokens ---------- */
@property --p {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  /* palette: darkroom black, paper white, one safelight red */
  --black: #0c0b0a;
  --film: #1b1917;          /* film base, a step up from the darkroom */
  --paper: #efece6;
  --red: #e23b2e;
  --red-ink: #b3261b;       /* the same red, darkened for small text on paper */
  --muted-on-black: #a5a199;
  --muted-on-paper: #56524d;
  --rule-on-black: #2d2a27;
  --rule-on-paper: #cfcbc2;

  /* type */
  --display: "Bodoni Moda", "Bodoni 72", Didot, serif;
  --text: "Work Sans", "Helvetica Neue", Arial, sans-serif;

  /* space */
  --gutter: clamp(1.125rem, 4.5vw, 4.5rem);
  --head: 4rem;
  --s-1: 0.5rem;
  --s-2: 0.75rem;
  --s-3: 1rem;
  --s-4: 1.5rem;
  --s-5: 2.5rem;
  --s-6: 4rem;
  --s-7: 7rem;
  --s-8: 10rem;

  /* shape: prints and negatives have square corners */
  --radius: 0;
  --radius-hole: 1.5px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* sprocket holes (data URIs cannot read custom properties: colours repeat the tokens) */
  --holes-paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8'%3E%3Crect x='3.5' y='0' width='7' height='8' rx='1.5' fill='%23efece6'/%3E%3C/svg%3E");
  --holes-black-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='5' height='10'%3E%3Crect x='0' y='2.5' width='5' height='5' rx='1' fill='%230c0b0a'/%3E%3C/svg%3E");
  --holes-black: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9' height='4'%3E%3Crect x='2' y='0' width='5' height='4' rx='1' fill='%230c0b0a'/%3E%3C/svg%3E");
  /* red grease-pencil box drawn round a frame on the contact sheet */
  --grease: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M4 5C30 2 68 4 97 3c2 28-1 64 1 93-28 3-64-1-94 2C2 70 5 32 3 3' fill='none' stroke='%23e23b2e' stroke-width='3' stroke-linecap='round' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E");

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--black);
  scrollbar-color: #4a4641 var(--black);
  scrollbar-width: thin;
  scrollbar-gutter: stable;
  -webkit-text-size-adjust: 100%;
}

/* Safari and older Chromium: the same scrollbar, drawn by hand */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
    background: var(--black);
  }

  ::-webkit-scrollbar-thumb {
    background: #4a4641;
    border: 2px solid var(--black);
  }
}

html.has-lightbox {
  overflow: hidden;
}

body {
  margin: 0;
  background: var(--black);
  color: var(--paper);
  font: 400 1rem/1.6 var(--text);
  accent-color: var(--red);
  caret-color: var(--red);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--red);
  color: var(--black);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

h1,
h2,
h3,
p,
figure,
dl,
dd,
ol,
ul,
fieldset {
  margin: 0;
  padding: 0;
}

ol,
ul {
  list-style: none;
}

[hidden] {
  display: none !important;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 400;
  text-wrap: balance;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: square;
}

.skip {
  position: fixed;
  left: var(--gutter);
  top: 0.75rem;
  z-index: 60;
  padding: 0.75rem 1rem;
  background: var(--paper);
  color: var(--black);
  transform: translateY(-200%);
}

.skip:focus {
  transform: none;
}

/* ---------- Header ---------- */
.head {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--head);
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  background: var(--black);
}

.head__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.75rem;
  font: 500 1.1875rem/1 var(--display);
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
}

/* the safelight: the one red lamp that stays on */
.safelight {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--red);
}

.head__nav {
  display: flex;
  align-items: center;
  gap: clamp(0.25rem, 1.6vw, 1.5rem);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.head__nav a,
.viewswitch button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 0.5rem;
  text-decoration: none;
  letter-spacing: inherit;
  text-transform: inherit;
  font-weight: inherit;
  color: var(--muted-on-black);
  transition: color 0.2s;
}

.head__nav a:hover,
.viewswitch button:hover {
  color: var(--paper);
}

.viewswitch {
  display: flex;
  margin-right: clamp(0rem, 1vw, 1rem);
}

.viewswitch button {
  position: relative;
}

.viewswitch button::after {
  content: "";
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.6rem;
  height: 1px;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}

.viewswitch button[aria-pressed="true"] {
  color: var(--paper);
}

.viewswitch button[aria-pressed="true"]::after {
  transform: scaleX(1);
}

/* ---------- 2. The roll: default mode is a native horizontal scroller ---------- */
.reel {
  position: relative;
  background: var(--black);
  --muted: var(--muted-on-black);
  --foot: 5.75rem;
  /* one unit = 1% of the hanging height between header and film strip */
  --u: calc((max(100svh, 38.75rem) - var(--head) - 1rem - var(--foot)) / 100);
}

.pin {
  position: relative;
  z-index: 1;
  height: 100svh;
  min-height: 38.75rem;
  background: var(--black);
}

.stage {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.stage::-webkit-scrollbar {
  display: none;
}

.track {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: max-content;
  height: 100%;
  padding: calc(var(--head) + 1rem) var(--gutter) 0;
}

/* title panel */
.intro {
  flex: none;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
  height: calc(86 * var(--u));
  margin-right: clamp(2rem, 6vw, 6rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  scroll-snap-align: start;
}

/* the name is the composition of the first screen: it is set as tall as the wall allows */
.intro h1 {
  font-size: clamp(4.25rem, min(13.2vw, calc(31 * var(--u))), 13.5rem);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: -0.03em;
  padding-top: calc(2 * var(--u));
  margin-left: -0.03em;
}

.intro h1 span {
  display: block;
  padding-left: 0.62em;
}

.intro__text p {
  max-width: 34ch;
  font-size: 1.125rem;
  line-height: 1.5;
  text-wrap: balance;
}

/* edge data, the way it is printed along the rebate of a negative */
.intro__text .intro__edge {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  max-width: none;
  margin-top: var(--s-3);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.intro__edge span + span {
  margin-left: 0.875rem;
  padding-left: 0.875rem;
  border-left: 1px solid var(--rule-on-black);
}

.intro__text--sheet {
  display: none;
}

.intro__text .intro__hint {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: var(--s-4);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
}

.intro__hint .icon {
  color: var(--red);
}

/* frames hang at their own height (--y) and size (--h), in units of --u */
.frame {
  flex: none;
  margin-left: var(--gap);
  margin-top: calc(var(--y) * var(--u));
  scroll-snap-align: center;
}

.frame__open {
  position: relative;
  display: block;
  cursor: zoom-in;
}

.frame__img {
  width: min(78vw, calc(var(--h) * var(--u) * var(--ar)));
  height: auto;
  background: var(--film);
}

.frame__caption {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.75rem;
  row-gap: 0.125rem;
  /* never let a long title widen the frame */
  width: 0;
  min-width: 100%;
  margin-top: 0.75rem;
}

.frame__no {
  grid-row: 1 / span 2;
  padding-top: 0.3rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
  transition: color 0.2s;
}

.frame__title {
  font: italic 400 1.1875rem/1.25 var(--display);
  text-wrap: balance;
}

.frame__place {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.frame:hover .frame__no,
.frame:focus-within .frame__no {
  color: var(--red);
}

.strip-break {
  display: none;
}

/* end panel */
.outro {
  flex: none;
  width: min(100vw - 2 * var(--gutter), 30rem);
  margin-left: clamp(3rem, 10vw, 10rem);
  margin-top: calc(18 * var(--u));
  scroll-snap-align: center;
}

.outro__title {
  font: italic 400 clamp(2.75rem, 5.6vw, 5.25rem)/0.98 var(--display);
  letter-spacing: -0.015em;
  margin-bottom: var(--s-4);
}

.outro li {
  border-top: 1px solid var(--rule-on-black);
}

.outro li:last-child {
  border-bottom: 1px solid var(--rule-on-black);
}

.outro a,
.outro button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 3.25rem;
  text-align: left;
  text-decoration: none;
  transition: padding-left 0.4s var(--ease), color 0.2s;
}

.outro a:hover,
.outro button:hover {
  padding-left: 0.75rem;
  color: var(--red);
}

/* ---------- Film strip progress ---------- */
.strip ol {
  position: relative;
  display: flex;
  gap: 3px;
  padding: 9px 5px;
  background:
    var(--holes-black) 0 2.5px / 9px 4px repeat-x,
    var(--holes-black) 0 calc(100% - 2.5px) / 9px 4px repeat-x,
    var(--film);
}

/* the playhead: the only moving red on the page */
.strip ol::after {
  content: "";
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: calc(5px + var(--p) * (100% - 10px));
  width: 2px;
  margin-left: -1px;
  background: var(--red);
  pointer-events: none;
}

.strip li {
  flex: 1 1 0;
  min-width: 0;
}

.strip a,
.strip button {
  display: block;
  width: 100%;
}

.strip img {
  width: 100%;
  height: 30px;
  object-fit: cover;
  opacity: 0.36;
  transition: opacity 0.3s;
}

.strip a:hover img,
.strip button:hover img,
.strip [aria-current="true"] img {
  opacity: 1;
}

.strip :focus-visible {
  outline-offset: 2px;
}

.strip--reel {
  position: absolute;
  left: 50%;
  bottom: 1.375rem;
  z-index: 2;
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.strip--reel ol {
  width: min(100vw - 2 * var(--gutter) - 4.5rem, 42.5rem);
}

.strip__count {
  width: 3.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
  white-space: nowrap;
}

.proof {
  display: none;
}

/* ---------- Pinned mode: vertical scroll drives the track (set by script.js) ---------- */
html.is-reel .pin {
  position: sticky;
  top: 0;
}

html.is-reel .stage {
  overflow: clip;
}

html.is-reel .track {
  transform: translate3d(calc(var(--p) * var(--travel, 0) * -1px), 0, 0);
  will-change: transform;
}

/* each frame drifts a little against the track: positive --d runs ahead, negative lags */
html.is-reel .frame > figure {
  transform: translate3d(calc(var(--d) * (1 - 2 * var(--p)) * 1vw), 0, 0);
  will-change: transform;
}

@keyframes roll {
  from { --p: 0; }
  to { --p: 1; }
}

@supports (animation-timeline: view()) {
  html.is-reel .reel {
    view-timeline: --roll block;
    animation: roll linear both;
    animation-timeline: --roll;
    /* the track arrives before the pin lets go, so the last frame gets a beat of stillness */
    animation-range: contain 0% contain calc(100% - var(--hold, 0) * 1px);
  }
}

/* running order behind the pinned stage (print and full-page captures) */
html.is-reel .proof {
  position: absolute;
  inset: max(100svh, 38.75rem) 0 0 0;
  display: grid;
  grid-auto-rows: 1fr;
  padding-inline: var(--gutter);
}

.proof li {
  display: flex;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding-inline: 8vw;
  overflow: hidden;
}

.proof li:nth-child(even) {
  flex-direction: row-reverse;
  text-align: right;
}

.proof img {
  width: auto;
  height: min(17.5rem, 70%);
  flex: none;
}

.proof p {
  display: grid;
  gap: 0.375rem;
}

.proof__no,
.proof__place {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.proof__title {
  font: italic 400 clamp(2rem, 3.4vw, 3rem)/1.1 var(--display);
}

/* ---------- Index mode: the contact sheet ---------- */
html[data-view="index"] .reel {
  background: var(--paper);
  color: var(--black);
  --muted: var(--muted-on-paper);
}

html[data-view="index"] .pin {
  position: relative;
  height: auto;
  min-height: 0;
  background: none;
}

html[data-view="index"] .stage {
  height: auto;
  overflow: visible;
}

html[data-view="index"] .track {
  container-type: inline-size;
  width: auto;
  max-width: 96rem;
  height: auto;
  margin-inline: auto;
  flex-wrap: wrap;
  row-gap: var(--s-5);
  padding: calc(var(--head) + var(--s-6)) var(--gutter) var(--s-7);
  transform: none;
}

html[data-view="index"] .intro {
  width: 100%;
  height: auto;
  margin: 0 0 var(--s-3);
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s-3) var(--s-6);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--black);
}

html[data-view="index"] .intro {
  max-width: none;
  justify-content: space-between;
}

html[data-view="index"] .intro h1 {
  font-size: clamp(3.25rem, 8.4vw, 7.5rem);
  line-height: 0.9;
  padding: 0;
}

html[data-view="index"] .intro h1 span {
  display: inline;
  padding: 0;
}

html[data-view="index"] .intro__text--reel {
  display: none;
}

html[data-view="index"] .intro__text--sheet {
  display: block;
}

html[data-view="index"] .intro__text--sheet {
  width: min(100%, 26rem);
}

html[data-view="index"] .intro__text p {
  max-width: 46ch;
  font-size: 0.9375rem;
}

/* mark-up control: ring one series in grease pencil */
.sheetfilter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--s-3);
  margin-top: var(--s-2);
}

.sheetfilter__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.intro__text .sheetfilter__status {
  flex-basis: 100%;
  min-height: 1.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--red-ink);
}

html[data-view="index"] .frame__img {
  transition: opacity 0.4s var(--ease);
}

html[data-view="index"].has-marks .frame:not(.is-marked) .frame__img {
  opacity: 0.26;
}

html[data-view="index"].has-marks .frame:not(.is-marked) .frame__title {
  color: var(--muted);
}

html[data-view="index"] .frame.is-marked .frame__open::after {
  clip-path: inset(-6px -6px -6px 0);
}

html[data-view="index"] .frame.is-marked .frame__no {
  color: var(--red-ink);
}

html[data-view="index"] .outro,
html[data-view="index"] .strip--reel,
html[data-view="index"] .proof {
  display: none;
}

/* strips of film: frames butt together, every frame the same height */
html[data-view="index"] .frame {
  margin: 0;
}

html[data-view="index"] .frame > figure {
  transform: none;
}

html[data-view="index"] .frame__open {
  padding: 30px 4px;
  background:
    var(--holes-paper) 0 5px / 14px 8px repeat-x,
    var(--holes-paper) 0 calc(100% - 5px) / 14px 8px repeat-x,
    var(--black);
}

html[data-view="index"] .frame__img {
  width: auto;
  height: var(--sh);
  max-width: none;
}

/* edge markings: the frame number and its half-frame twin */
html[data-view="index"] .frame__open::before {
  content: attr(data-no) "\2003\2003\2003" attr(data-no) "A";
  position: absolute;
  left: 9px;
  top: 17px;
  font: 500 0.5625rem/1 var(--text);
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
  white-space: pre;
}

/* hover or focus marks the frame in grease pencil */
html[data-view="index"] .frame__open::after {
  content: "";
  position: absolute;
  inset: 20px -4px;
  background: var(--grease) center / 100% 100% no-repeat;
  clip-path: inset(-6px 100% -6px 0);
  transition: clip-path 0.5s var(--ease);
  pointer-events: none;
}

html[data-view="index"] .frame__open:hover::after,
html[data-view="index"] .frame__open:focus-visible::after {
  clip-path: inset(-6px -6px -6px 0);
}

html[data-view="index"] .frame__open:focus-visible {
  outline-color: var(--red-ink);
  outline-offset: 2px;
}

html[data-view="index"] .frame__caption {
  padding-inline: 4px;
  margin-top: 0.625rem;
  column-gap: 0.5rem;
}

html[data-view="index"] .frame__title {
  font-size: 1rem;
}

html[data-view="index"] .frame__place {
  font-size: 0.6875rem;
}

html[data-view="index"] .frame:hover .frame__no,
html[data-view="index"] .frame:focus-within .frame__no {
  color: var(--red-ink);
}

html[data-view="index"] .strip-break {
  flex-basis: 100%;
  height: 0;
}

/* narrow sheets: short strips, each one justified to the full width */
@media (max-width: 62.49rem) {
  html[data-view="index"] .strip-break--narrow {
    display: block;
  }

  html[data-view="index"] .frame {
    flex: var(--ar) 1 8px;
    min-width: 0;
  }

  html[data-view="index"] .frame__img {
    width: 100%;
    height: auto;
  }
}

@media (min-width: 62.5rem) {
  /* three strips: five, five and four frames, cut to the same height */
  html[data-view="index"] .strip-break--wide {
    display: block;
  }

  html[data-view="index"] .frame {
    --sh: calc((100cqw - 2.5rem - 2px) / 4.8334);
  }

  /* shorter strips run out to the sheet edge as unexposed leader */
  html[data-view="index"] .frame:is(:has(+ .strip-break--wide), :has(+ .outro)) {
    flex: 1 1 auto;
  }

  html[data-view="index"] .frame:is(:has(+ .strip-break--wide), :has(+ .outro)) > figure {
    position: relative;
  }

  html[data-view="index"] .frame:is(:has(+ .strip-break--wide), :has(+ .outro)) .frame__open {
    width: fit-content;
  }

  html[data-view="index"] .frame:is(:has(+ .strip-break--wide), :has(+ .outro)) > figure::after {
    content: "Safety film";
    position: absolute;
    top: 0;
    right: 0;
    left: calc(var(--sh) * var(--ar) + 8px);
    height: calc(var(--sh) + 60px);
    padding-top: 17px;
    text-indent: 12px;
    overflow: hidden;
    font: 500 0.5625rem/1 var(--text);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted-on-black);
    background:
      var(--holes-paper) 0 5px / 14px 8px repeat-x,
      var(--holes-paper) 0 calc(100% - 5px) / 14px 8px repeat-x,
      var(--black);
  }
}

/* ---------- 3. About ---------- */
.about {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--s-4);
  align-items: start;
  padding: var(--s-8) var(--gutter);
  scroll-margin-top: var(--head);
  --muted: var(--muted-on-black);
}

.about__portrait {
  grid-column: 1 / span 4;
  position: sticky;
  top: calc(var(--head) + var(--s-4));
}

.about__portrait img {
  width: 100%;
  height: auto;
  background: var(--film);
}

.about__portrait figcaption {
  margin-top: 0.75rem;
  text-wrap: balance;
  font-size: 0.8125rem;
  color: var(--muted);
}

.about__body {
  grid-column: 6 / span 7;
}

.about h2,
.contact h2 {
  font-size: clamp(2.75rem, 5.4vw, 5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  max-width: 15ch;
  margin-bottom: var(--s-5);
}

.about__body > p {
  max-width: 62ch;
  font-size: 1.0625rem;
  line-height: 1.65;
  text-wrap: pretty;
}

.about__body > p + p {
  margin-top: 1.1em;
}

.facts {
  margin-top: var(--s-6);
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--rule, var(--rule-on-black));
}

.facts > div {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: var(--s-3);
  padding-block: 0.875rem;
  border-top: 1px solid var(--rule, var(--rule-on-black));
}

.facts dt {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 0.2em;
}

.facts a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-block: -0.75rem;
}

/* ---------- Contact ---------- */
.contact {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--s-4);
  align-items: start;
  padding: var(--s-7) var(--gutter);
  background: var(--paper);
  color: var(--black);
  color-scheme: light;
  scroll-margin-top: var(--head);
  --muted: var(--muted-on-paper);
  --rule: var(--rule-on-paper);
}

.contact ::selection {
  color: var(--paper);
}

.contact :focus-visible {
  outline-color: var(--red-ink);
}

.contact__intro {
  grid-column: 1 / span 5;
}

.contact__intro > p {
  max-width: 38ch;
  font-size: 1.0625rem;
}

.contact .facts > div {
  grid-template-columns: 6.5rem minmax(0, 1fr);
}

.contact__form {
  grid-column: 7 / span 6;
}

.enquiry {
  display: grid;
  gap: var(--s-4);
}

.field {
  display: grid;
  gap: 0.375rem;
  border: 0;
  min-width: 0;
}

.field[hidden] {
  display: none;
}

.field label,
.field legend,
.field__label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.field legend {
  padding: 0;
  margin-bottom: 0.625rem;
}

.field__opt {
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-left: 0.375rem;
}

.field input[type="text"],
.field input[type="email"],
.field textarea {
  width: 100%;
  font: 400 1.0625rem/1.5 var(--text);
  color: var(--black);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--black);
  border-radius: var(--radius);
  padding: 0.5rem 0 0.625rem;
  min-height: 2.875rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

/* no native resize grip: the box grows with the text (script.js covers older browsers) */
.field textarea {
  display: block;
  resize: none;
  min-height: 7rem;
  field-sizing: content;
  overflow: hidden;
}

/* autofill keeps the paper, not the browser's yellow or blue */
.field input:-webkit-autofill,
.field input:-webkit-autofill:focus,
.field textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--black);
  caret-color: var(--red-ink);
  box-shadow: 0 0 0 100vmax var(--paper) inset;
  transition: background-color 9999s;
}

.field input::-webkit-search-cancel-button,
.field input::-webkit-contacts-auto-fill-button,
.field input::-webkit-credentials-auto-fill-button {
  display: none;
}

.field ::placeholder {
  color: var(--muted);
  opacity: 1;
}

.field input:hover,
.field textarea:hover {
  box-shadow: 0 1px 0 var(--black);
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 0;
  border-color: var(--red-ink);
  box-shadow: 0 1px 0 var(--red-ink);
}

.enquiry .field [aria-invalid="true"] {
  border-color: var(--red-ink);
}

.field__error {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--red-ink);
}

.field__error:empty {
  display: none;
}

.choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice label {
  position: relative;
  font: inherit;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}

.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.choice span {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  border: 1px solid var(--black);
  transition: background-color 0.2s, color 0.2s;
}

.choice label:hover span {
  background: color-mix(in srgb, var(--black) 8%, transparent);
}

.choice input:checked + span {
  background: var(--black);
  color: var(--paper);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--red-ink);
  outline-offset: 3px;
}

.choice input:disabled {
  cursor: not-allowed;
}

.choice input:disabled + span {
  border-style: dashed;
  border-color: var(--muted);
  color: var(--muted);
  background: none;
}

.enquiry__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  margin-top: var(--s-2);
}

.enquiry__actions .button {
  margin-top: 0;
}

.button {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.25rem;
  padding: 0 1.25rem 0 1.5rem;
  margin-top: var(--s-2);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--black);
  color: var(--paper);
  border: 1px solid var(--black);
  transition: background-color 0.25s, border-color 0.25s, color 0.25s;
}

.button .icon {
  transition: transform 0.4s var(--ease);
}

.button:hover:not(:disabled) {
  background: var(--red);
  border-color: var(--red);
  color: var(--black);
}

.button:hover:not(:disabled) .icon {
  transform: translateX(4px);
}

.button:disabled {
  cursor: progress;
}

/* loading: the arrow steps aside and an exposure line runs along the foot of the button */
.button[data-state="loading"] {
  position: relative;
}

.button[data-state="loading"] .icon {
  visibility: hidden;
}

.button[data-state="loading"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 2px;
  background: var(--paper);
  transform-origin: left;
  animation: expose 1.25s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes expose {
  0% { transform: scaleX(0); opacity: 1; }
  70% { transform: scaleX(1); opacity: 1; }
  100% { transform: scaleX(1); opacity: 0; }
}

.button--quiet {
  background: transparent;
  color: var(--black);
  padding-inline: 1.5rem;
}

.enquiry__fail {
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  border: 1px solid var(--red-ink);
  color: var(--red-ink);
}

.enquiry__fail[hidden] {
  display: none;
}

.enquiry__done {
  padding-top: var(--s-2);
}

.enquiry__done:focus {
  outline: 0;
}

.enquiry__done h3 {
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-style: italic;
  line-height: 1.1;
  margin-bottom: var(--s-3);
}

.enquiry__done p {
  max-width: 44ch;
  font-size: 1.0625rem;
  margin-bottom: var(--s-4);
}

@media (prefers-reduced-motion: no-preference) {
  .enquiry__done:not([hidden]) {
    animation: develop 0.9s var(--ease) both;
  }
}

/* the confirmation comes up like a print in the tray */
@keyframes develop {
  from { opacity: 0; filter: blur(6px); }
  to { opacity: 1; filter: blur(0); }
}

/* ---------- Footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-2) var(--s-5);
  padding: var(--s-7) var(--gutter) 4.5rem;
  font-size: 0.8125rem;
  color: var(--muted-on-black);
}

.foot .foot__end {
  flex-basis: 100%;
  display: block;
  padding-bottom: var(--s-5);
  margin-bottom: var(--s-3);
  border-bottom: 1px solid var(--rule-on-black);
  font: italic 400 clamp(2rem, 4.8vw, 4.25rem)/1.02 var(--display);
  letter-spacing: -0.015em;
  color: var(--paper);
  text-wrap: balance;
}

.foot__end span {
  color: var(--muted-on-black);
}

.foot ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--s-4);
}

.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  text-decoration: none;
  transition: color 0.2s;
}

.foot p {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
}

.foot a:hover {
  color: var(--paper);
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--black);
  color: var(--paper);
  overflow: hidden;
  --muted: var(--muted-on-black);
}

.lightbox:focus {
  outline: 0;
}

.lightbox::backdrop {
  background: var(--black);
}

.lightbox[open] {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr) 19rem 5.5rem;
  grid-template-rows: var(--head) minmax(0, 1fr) 5.5rem;
  grid-template-areas:
    "bar bar bar bar"
    "prev view cap next"
    "strip strip strip strip";
}

/* browsers without view transitions get a plain fade */
html.no-vt .lightbox[open] {
  animation: fade 0.3s ease-out both;
}

@keyframes fade {
  from { opacity: 0; }
}

.lightbox__bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--gutter);
}

.lightbox__count {
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.lightbox__count span {
  color: var(--paper);
}

.lightbox__close {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-height: 2.75rem;
  padding-left: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.lightbox__close:hover {
  color: var(--red);
}

.lightbox__nav {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  align-self: center;
  justify-self: center;
  border: 1px solid var(--rule-on-black);
  border-radius: 50%;
  transition: border-color 0.2s, color 0.2s, transform 0.4s var(--ease), opacity 0.2s;
}

.lightbox__nav--prev {
  grid-area: prev;
}

.lightbox__nav--next {
  grid-area: next;
}

.lightbox__nav:hover:not(:disabled) {
  border-color: var(--paper);
}

.lightbox__nav--prev:hover:not(:disabled) {
  transform: translateX(-3px);
}

.lightbox__nav--next:hover:not(:disabled) {
  transform: translateX(3px);
}

.lightbox__nav:disabled {
  opacity: 0.28;
  cursor: default;
}

.lightbox__view {
  grid-area: view;
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: var(--s-1) var(--s-4) var(--s-3);
  cursor: zoom-out;
}

/* script.js sizes the image to the largest fit; these are the no-script bounds */
.lightbox__view img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: var(--film);
  cursor: default;
}

.lightbox__caption {
  grid-area: cap;
  align-self: end;
  padding: 0 0 var(--s-3) var(--s-3);
}

.lightbox__caption h2 {
  font-size: clamp(1.625rem, 2.4vw, 2.125rem);
  font-style: italic;
  line-height: 1.12;
}

.lightbox__place {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.lightbox .facts {
  margin-top: var(--s-4);
  font-size: 0.875rem;
}

.lightbox .facts > div {
  grid-template-columns: 4.75rem minmax(0, 1fr);
  padding-block: 0.625rem;
}

.lightbox .facts dd {
  text-wrap: balance;
}

.lightbox__actions {
  display: grid;
  justify-items: start;
  margin-top: var(--s-2);
}

.lightbox__enquire {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}

.lightbox__enquire .icon {
  transition: transform 0.4s var(--ease);
}

.lightbox__enquire:hover {
  color: var(--red);
}

.lightbox__enquire:hover .icon {
  transform: translateX(4px);
}

.strip--lightbox {
  grid-area: strip;
  align-self: center;
  justify-self: center;
}

.strip--lightbox ol {
  width: min(100vw - 2 * var(--gutter), 42.5rem);
}

/* a taller target than the 30px thumbnail */
.strip--lightbox button {
  position: relative;
}

.strip--lightbox button::before {
  content: "";
  position: absolute;
  inset: -0.75rem 0;
}

/* ==========================================================================
   Components
   A themed kit built from the tokens at the top of this file. Nothing here is
   a browser default: reuse these when you add controls to the template.
     .pick        listbox (custom select)      .notice   toast / notice
     .confirm     confirmation dialog          [data-tip] tooltip
     .textbutton  quiet inline action
   ========================================================================== */

/* ---------- Listbox: a short length of film that unspools under the field ---------- */
.pick {
  position: relative;
}

.pick__button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  min-height: 2.875rem;
  padding: 0.5rem 0 0.625rem;
  font: 400 1.0625rem/1.5 var(--text);
  text-align: left;
  border-bottom: 1px solid currentColor;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.pick__button:hover {
  box-shadow: 0 1px 0 currentColor;
}

.pick__button:focus-visible,
.pick__button[aria-expanded="true"] {
  outline: 0;
  border-color: var(--red-ink);
  box-shadow: 0 1px 0 var(--red-ink);
}

.pick__button .icon {
  transition: transform 0.4s var(--ease);
}

.pick__button[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.pick__value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick__pop {
  position: absolute;
  z-index: 30;
  left: 0;
  top: calc(100% + 0.5rem);
  width: max(100%, 17.5rem);
  max-width: calc(100vw - 2 * var(--gutter));
  padding: 6px 13px;
  color: var(--paper);
  color-scheme: dark;
  /* sprocket holes down both edges of the strip */
  background:
    var(--holes-black-v) 4px 0 / 5px 10px repeat-y,
    var(--holes-black-v) calc(100% - 4px) 0 / 5px 10px repeat-y,
    var(--film);
  box-shadow: 0 1.25rem 2.5rem -0.75rem rgb(12 11 10 / 0.55);
  scroll-margin: calc(var(--head) + 1rem) 0 1rem;
}

.pick[data-drop="up"] .pick__pop {
  top: auto;
  bottom: calc(100% + 0.5rem);
}

.pick__list {
  max-height: min(19.5rem, 46svh);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #5a554f var(--film);
}

.pick__list [role="option"] {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  padding: 0.375rem 0.625rem;
  font-size: 0.9375rem;
  line-height: 1.25;
  cursor: pointer;
  border-top: 1px solid var(--black);
}

.pick__list [role="option"]:first-child {
  border-top: 0;
}

.pick__list img {
  flex: none;
  width: 48px;
  height: 32px;
  object-fit: cover;
  opacity: 0.55;
}

.pick__no {
  flex: none;
  width: 1.25rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  color: var(--muted-on-black);
}

.pick--frames .pick__name {
  font: italic 400 1.0625rem/1.2 var(--display);
}

.pick__meta {
  margin-left: auto;
  padding-left: var(--s-3);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted-on-black);
}

/* the chosen option carries the safelight; text-only lists keep a slot for it */
.pick__list [role="option"]::before {
  content: "";
  flex: none;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
}

.pick__list [aria-selected="true"]::before {
  background: var(--red);
}

.pick__list [aria-selected="true"] img {
  opacity: 1;
}

/* the highlighted option turns to paper, like a frame held up to the light */
.pick__list .is-active {
  background: var(--paper);
  color: var(--black);
}

.pick__list .is-active img {
  opacity: 1;
}

.pick__list .is-active :is(.pick__no, .pick__meta) {
  color: var(--muted-on-paper);
}

.pick__list .is-active[aria-selected="true"]::before {
  background: var(--red-ink);
}

/* compact variant that sits inline with a label */
.pick--inline {
  width: min(100%, 13.5rem);
}

.pick--inline .pick__button {
  min-height: 2.75rem;
  padding-block: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

@media (prefers-reduced-motion: no-preference) {
  .pick__pop:not([hidden]) {
    animation: unspool 0.38s var(--ease) both;
  }
}

@keyframes unspool {
  from { clip-path: inset(0 0 100% 0); opacity: 0.4; }
  to { clip-path: inset(0 0 -3rem 0); opacity: 1; }
}

.pick[data-drop="up"] .pick__pop:not([hidden]) {
  animation-name: unspool-up;
}

@keyframes unspool-up {
  from { clip-path: inset(100% 0 0 0); opacity: 0.4; }
  to { clip-path: inset(-3rem 0 0 0); opacity: 1; }
}

/* ---------- Notices: a paper slip that develops above the film strip ---------- */
.notices {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 6rem;
  translate: -50% 0;
  display: grid;
  gap: var(--s-1);
  justify-items: center;
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
  pointer-events: none;
}

/* inside the lightbox the slip hangs under the top bar, clear of the controls */
.lightbox .notices {
  top: calc(var(--head) + 0.25rem);
  bottom: auto;
}

.notice {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0.25rem 0.25rem 1rem;
  background: var(--paper);
  color: var(--black);
  color-scheme: light;
  border: 1px solid var(--black);
  box-shadow: 0 1rem 2.25rem -0.5rem rgb(12 11 10 / 0.6);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
  pointer-events: auto;
}

.notice::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--red);
}

.notice p {
  padding-block: 0.5rem;
  text-wrap: balance;
}

.notice--error {
  border-color: var(--red-ink);
  color: var(--red-ink);
}

.notice__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  color: var(--black);
  transition: color 0.2s;
}

.notice__close:hover {
  color: var(--red-ink);
}

.notice__close:focus-visible {
  outline-color: var(--red-ink);
  outline-offset: -4px;
}

.notice__close .icon {
  width: 1rem;
  height: 1rem;
}

@media (prefers-reduced-motion: no-preference) {
  .notice {
    animation: develop 0.7s var(--ease) both;
  }

  .notice.is-leaving {
    animation: fade 0.2s ease-in reverse both;
  }
}

/* ---------- Confirmation dialog: a work print under the safelight ---------- */
.confirm {
  width: min(31rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 3.25rem clamp(1.25rem, 5vw, 2.25rem) clamp(1.25rem, 5vw, 2rem);
  border: 0;
  color: var(--black);
  color-scheme: light;
  /* the film rebate along the top edge, as on the contact sheet */
  background:
    var(--holes-paper) 0 6px / 14px 8px repeat-x,
    linear-gradient(var(--black), var(--black)) 0 0 / 100% 20px no-repeat,
    var(--paper);
  box-shadow: 0 2rem 4rem -1rem rgb(0 0 0 / 0.7);
  overflow: auto;
}

/* the room goes dark and only the red lamp is left on */
.confirm::backdrop {
  background: rgb(46 14 10 / 0.9);
  background: color-mix(in srgb, #0c0b0a 80%, #e23b2e);
  opacity: 0.93;
}

.confirm h2 {
  font-size: clamp(1.875rem, 4.4vw, 2.5rem);
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: var(--s-2);
}

.confirm p {
  max-width: 40ch;
  font-size: 1rem;
  text-wrap: pretty;
}

.confirm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

.confirm__actions .button {
  margin-top: 0;
  padding-inline: 1.5rem;
}

.confirm :focus-visible {
  outline-color: var(--red-ink);
}

@media (prefers-reduced-motion: no-preference) {
  .confirm[open] {
    animation: develop 0.55s var(--ease) both;
  }

  .confirm[open]::backdrop {
    animation: lamp 0.4s ease-out both;
  }

  .confirm.is-closing,
  .confirm.is-closing::backdrop {
    animation: fade 0.18s ease-in reverse both;
  }
}

@keyframes lamp {
  from { opacity: 0; }
  to { opacity: 0.93; }
}

/* ---------- Text button: a quiet inline action ---------- */
.textbutton {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  transition: color 0.2s;
}

.textbutton:hover {
  color: var(--red-ink);
}

.facts .textbutton {
  margin-block: -0.75rem;
  margin-left: var(--s-2);
}

/* ---------- Tooltip: a caption slip, on hover and on keyboard focus ---------- */
@media (min-width: 56.25rem) {
  [data-tip] {
    position: relative;
  }

  [data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: calc(100% + 0.875rem);
    translate: -50% 0.25rem;
    padding: 0.375rem 0.625rem;
    background: var(--paper);
    color: var(--black);
    font: 500 0.6875rem/1.2 var(--text);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, translate 0.35s var(--ease);
  }

  [data-tip][data-tip-align="start"]::after {
    left: 0;
    translate: 0 0.25rem;
  }

  [data-tip][data-tip-align="end"]::after {
    left: auto;
    right: 0;
    translate: 0 0.25rem;
  }

  [data-tip]:hover::after,
  [data-tip]:focus-visible::after {
    opacity: 1;
    translate: -50% 0;
  }

  [data-tip][data-tip-align]:hover::after,
  [data-tip][data-tip-align]:focus-visible::after {
    translate: 0 0;
  }

  [data-tip]:disabled::after {
    display: none;
  }
}

/* ---------- View transitions ---------- */
/* clicked photo -> lightbox image share the name "shot"; the Index toggle names every frame */
html.vt-frames .frame__img {
  view-transition-name: var(--vt);
}

::view-transition-group(*) {
  animation-duration: 0.65s;
  animation-timing-function: var(--ease);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.4s;
  animation-timing-function: ease-out;
}

/* stepping inside the lightbox: the frame advances like a slide change (--dir is 1 or -1),
   and the caption swaps without two titles ever sitting on top of each other */
html.vt-step .lightbox__view {
  view-transition-name: lb-view;
}

html.vt-step .lightbox__caption {
  view-transition-name: lb-caption;
}

::view-transition-old(lb-view),
::view-transition-new(lb-view),
::view-transition-old(lb-caption),
::view-transition-new(lb-caption) {
  mix-blend-mode: normal;
}

::view-transition-old(lb-view) {
  animation: step-out 0.18s ease-in both;
}

::view-transition-new(lb-view) {
  animation: step-in 0.5s var(--ease) 0.16s both;
}

::view-transition-old(lb-caption) {
  animation: step-fade 0.16s ease-in both reverse;
}

::view-transition-new(lb-caption) {
  animation: step-fade 0.35s ease-out 0.2s both;
}

@keyframes step-out {
  to { opacity: 0; transform: translateX(calc(var(--dir, 1) * -1.5rem)); }
}

@keyframes step-in {
  from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 2.5rem)); }
}

@keyframes step-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 56.24rem) {
  :root {
    --head: 3.5rem;
  }

  .head__brand {
    font-size: 1.0625rem;
  }

  .head__nav {
    gap: 0;
    font-size: 0.75rem;
    margin-right: -0.5rem;
  }

  .viewswitch {
    margin-right: 0.25rem;
  }

  /* the roll: native swipe, one frame at a time */
  .reel {
    --foot: 6.5rem;
  }

  .stage {
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
  }

  .intro {
    margin-right: 0;
  }

  .intro h1 {
    font-size: min(19vw, calc(31 * var(--u)));
    padding-top: calc(6 * var(--u));
  }

  .notices {
    bottom: 7.5rem;
  }

  .enquiry__actions .button {
    flex: 1 1 100%;
  }

  .facts .textbutton {
    display: flex;
    margin: 0;
  }

  html[data-view="index"] .intro {
    display: block;
  }

  html[data-view="index"] .intro__text {
    margin-top: var(--s-3);
  }

  .frame {
    --gap: 11vw;
  }

  .intro + .frame {
    margin-left: 11vw;
  }

  .strip--reel {
    left: var(--gutter);
    right: var(--gutter);
    bottom: 3.25rem;
    translate: none;
    gap: var(--s-2);
  }

  .strip--reel ol {
    flex: 1;
    width: auto;
  }

  /* too small to tap: on phones the strip only reports progress */
  .strip--reel a {
    pointer-events: none;
  }

  .strip img {
    height: 22px;
  }

  .strip__count {
    width: auto;
  }

  html[data-view="index"] .track {
    padding-top: calc(var(--head) + var(--s-5));
    padding-bottom: var(--s-6);
    row-gap: var(--s-4);
  }

  html[data-view="index"] .frame__open {
    padding-block: 24px;
    background-size: 12px 7px, 12px 7px, auto;
    background-position: 0 4px, 0 calc(100% - 4px), 0 0;
  }

  html[data-view="index"] .frame__open::before {
    top: 13px;
    left: 7px;
    font-size: 0.5rem;
  }

  html[data-view="index"] .frame__open::after {
    inset-block: 15px;
  }

  html[data-view="index"] .frame__title {
    font-size: 0.9375rem;
  }

  html[data-view="index"] .frame__no {
    display: none;
  }

  html[data-view="index"] .frame__caption {
    grid-template-columns: 1fr;
  }

  .about,
  .contact {
    display: block;
    padding-block: var(--s-7);
  }

  .about__portrait {
    position: static;
    width: min(100%, 26rem);
    margin-bottom: var(--s-6);
  }

  .contact__intro {
    margin-bottom: var(--s-6);
  }

  .facts > div {
    grid-template-columns: 1fr;
    gap: 0.125rem;
  }

  .contact .facts > div {
    grid-template-columns: 1fr;
  }

  .button {
    justify-self: stretch;
    justify-content: space-between;
  }

  .foot {
    display: block;
    padding-bottom: 4.5rem;
  }

  /* lightbox: photo, caption, then the controls within reach of a thumb */
  .lightbox[open] {
    grid-template-columns: 4rem minmax(0, 1fr) 4rem;
    grid-template-rows: var(--head) minmax(0, 1fr) auto 5rem;
    grid-template-areas:
      "bar bar bar"
      "view view view"
      "cap cap cap"
      "prev strip next";
  }

  .lightbox__view {
    margin: var(--s-1) var(--gutter) var(--s-3);
  }

  .lightbox__caption {
    padding: 0 var(--gutter) var(--s-2);
  }

  .lightbox .facts {
    display: none;
  }

  .lightbox__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--s-4);
    margin-top: var(--s-1);
  }

  .lightbox__nav {
    width: 2.75rem;
    height: 2.75rem;
  }

  .strip--lightbox {
    justify-self: stretch;
  }

  .strip--lightbox ol {
    width: auto;
  }
}

/* phones: one frame at a time, so each hangs near the middle of the wall (nudged up or
   down by its drift) and the first photograph already shows beside the title */
@media (max-width: 40rem) {
  .intro {
    width: calc(100vw - var(--gutter) - 24vw);
  }

  .intro h1 {
    font-size: min(25.5vw, calc(19 * var(--u)));
  }

  .intro h1 span {
    padding-left: 0.2em;
  }

  .intro__edge span:nth-child(3) {
    display: none;
  }

  .frame {
    position: relative;
    top: calc(var(--d) * 1.6 * var(--u));
    align-self: center;
    margin-top: 0;
    margin-bottom: var(--foot);
  }

  .outro {
    align-self: center;
    margin-top: 0;
    margin-bottom: var(--foot);
  }

  html[data-view="index"] .frame {
    position: static;
    align-self: auto;
    margin: 0;
  }
}

@media (max-width: 23.75rem) {
  .head__brand {
    font-size: 1rem;
    gap: 0.4rem;
  }

  .head__nav {
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    margin-right: -0.3rem;
  }

  .head__nav a,
  .viewswitch button {
    min-width: 2.75rem;
    justify-content: center;
    padding-inline: 0.3rem;
  }

  .viewswitch button::after {
    left: 0.3rem;
    right: 0.3rem;
  }
}

@media print {
  .head,
  .strip,
  .skip {
    display: none;
  }
}
