/* Blue-Up Photographe
   Palette and proportions come from the wordmark: night navy, cream ink,
   the gold of the ladder. Everything vertical is a multiple of --bl. */

@font-face {
  font-family: 'EB Garamond';
  src: url('/fonts/eb-garamond-roman.woff2') format('woff2');
  font-weight: 400 600; font-style: normal; font-display: swap;
}
:root {
  --nuit:    #0b1330;   /* the ground */
  --encre:   #172458;   /* the navy of the wordmark */
  --lune:    #f6f1e8;   /* cream ink */
  --echelle: #f49f1a;   /* the ladder */

  --bl: 8px;                 /* baseline */
  --lh: calc(var(--bl) * 3); /* 24px leading */
  --margin: calc(var(--bl) * 6);
  --maxw: 1240px;
  --rail: 60px;
  --peek: 92px;      /* how much of the next film shows at the edge */

  --serif: 'EB Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

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

html { background: var(--nuit); color-scheme: dark; -webkit-text-size-adjust: 100%; }

/* One light source, high and centred, the way the moon sits above the wordmark.
   Fixed, so it reads as the room the films hang in rather than a band that
   scrolls past. */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    /* the moon, high and slightly left of centre, as in the wordmark */
    radial-gradient(58% 42% at 44% -4%, rgb(74 104 186 / .58), transparent 66%),
    /* the glow it throws across the upper half */
    radial-gradient(130% 70% at 50% 2%,  rgb(41 62 134 / .68), transparent 62%),
    /* ground haze, so the page sits on something */
    radial-gradient(90% 40% at 50% 100%, rgb(26 40 96 / .55), transparent 72%);
}
/* corners fall away, which is what makes the centre read as lit */
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(118% 88% at 50% 32%, transparent 38%, rgb(4 8 26 / .72));
}

body {
  margin: 0;
  background: transparent;   /* the light in body::before has to come through */
  color: var(--lune);
  font-family: var(--serif);
  font-size: 17px;
  line-height: var(--lh);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sprite { position: absolute; width: 0; height: 0; }

.skip {
  position: absolute; left: var(--margin); top: calc(var(--bl) * -8); z-index: 20;
  padding: calc(var(--bl) * 1.5) calc(var(--bl) * 2);
  background: var(--echelle); color: var(--nuit); text-decoration: none;
  transition: top 160ms var(--ease);
}
.skip:focus { top: var(--bl); }

:where(a, button, [tabindex]):focus-visible {
  outline: 1px solid var(--echelle);
  outline-offset: 3px;
}

/* ---- Page grid: the ladder holds its own column ------------------------- */

.page {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: max(var(--margin), env(safe-area-inset-left)) max(var(--margin), env(safe-area-inset-right));
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  column-gap: calc(var(--bl) * 5);
}
.masthead, #films, .contact { grid-column: 2; min-width: 0; }

/* ---- The ladder --------------------------------------------------------- */

.ladder {
  grid-column: 1; grid-row: 1 / -1;
  position: sticky; top: calc(50vh - 66px);
  width: var(--rail); height: 132px;
  align-self: start;
  /* absent over the masthead; it arrives with the work */
  opacity: var(--ladder-op, 0);
  transition: opacity 500ms var(--ease);
}
.ladder-rails { position: absolute; inset: 0; }
.stile {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: rgb(246 241 232 / .34);
}
.stile-l { left: 6px; }
.stile-r { right: 6px; }

/* Gold fills the stiles as you move through the films. */
.climb {
  position: absolute; left: 6px; right: 6px; top: 0;
  height: var(--climb, 0px);
  border-left: 1px solid var(--echelle);
  border-right: 1px solid var(--echelle);
  margin-inline: -1px; padding-inline: 1px;
  opacity: .85;
}

.rung {
  position: absolute; left: 0; width: 100%; height: calc(var(--bl) * 5.5);
  margin: 0; padding: 0; border: 0; background: none;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  display: grid; place-items: center;
}
.rung::before {
  content: ''; display: block; width: 48px; height: 1px;
  background: rgb(246 241 232 / .42);
  transition: width 420ms var(--ease), background-color 420ms var(--ease), height 220ms var(--ease);
}
/* Each rung's line sits at its own centre, so these offsets put the four lines at
   0, 44, 88 and 132 — the caps of the rail and two evenly spaced between. The
   44px pitch matches the button height, so the hit areas tile without overlapping. */
.rung:nth-of-type(1) { top: -22px; }
.rung:nth-of-type(2) { top: 22px; }
.rung:nth-of-type(3) { top: 66px; }
.rung:nth-of-type(4) { top: 110px; }
.rung:hover::before { background: rgb(246 241 232 / .78); }
.rung[aria-current='true']::before { background: var(--echelle); height: 2px; }

/* ---- Masthead ----------------------------------------------------------- */

.masthead {
  padding-block: calc(var(--bl) * 12) calc(var(--bl) * 11);
}
.logo {
  display: block; width: 236px;
  margin: 0 0 calc(var(--bl) * 6);
  font-size: inherit; font-weight: inherit; line-height: 0;
}
.logo img { display: block; width: 100%; height: auto; }
.lede {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(30px, 4.6vw, 54px);
  line-height: 1.18;
  letter-spacing: -.016em;
  font-weight: 400;
  color: var(--lune);
  text-wrap: balance;
}

/* ---- Films -------------------------------------------------------------- */

#films { display: grid; row-gap: calc(var(--bl) * 15); }

.label {
  display: flex; align-items: center; gap: calc(var(--bl) * 2);
  margin: 0 0 calc(var(--bl) * 1.5);
  font-weight: 500;
}
.name {
  font-size: 15px; line-height: var(--lh);
  text-transform: uppercase; letter-spacing: .22em;
  color: rgb(246 241 232 / .82);
}
/* a leader line, the way an index runs a title out to its page number */
.rule { flex: 1 1 auto; height: 1px; background: rgb(246 241 232 / .16); }
.dur {
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  font-variant-numeric: tabular-nums;
  color: rgb(246 241 232 / .46);
}

.frame {
  position: relative;
  aspect-ratio: var(--ar);
  background: var(--encre);
  overflow: hidden;
  outline: 1px solid rgb(246 241 232 / .10);
  outline-offset: -1px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 32px 64px -40px rgb(0 0 0 / .85);
  transition: outline-color 360ms var(--ease);
}
.frame:hover { outline-color: rgb(246 241 232 / .22); }
.slide.pressed video, .slide.pressed .still { transform: scale(.995); transition: transform 120ms ease-out; }
.reel {
  position: absolute; inset: 0;
  display: flex;
  will-change: transform;
  transition: transform 640ms var(--ease);   /* the offset is set from JS */
}
.slide { position: relative; flex: 0 0 100%; height: 100%; }

.still, .slide video {
  position: absolute; inset: 0;
  display: block; width: 100%; height: 100%; object-fit: cover;
}
.slide video {
  opacity: 0;
  transition: opacity 620ms var(--ease);
  background: transparent;
}
.slide.rolling video { opacity: 1; }
.slide video::-webkit-media-controls { display: none !important; }

.scrim {
  position: absolute; inset: auto 0 0 0; height: calc(var(--bl) * 11);
  background: linear-gradient(to top, rgb(11 19 48 / .55), transparent);
  opacity: 0; transition: opacity 320ms var(--ease);
  pointer-events: none;
}
.frame:hover .scrim, .frame:focus-within .scrim, .slide.sound .scrim { opacity: 1; }

.bar { position: absolute; inset: auto 0 0 0; }

.btns {
  display: flex; align-items: center;
  padding: 0 calc(var(--bl) * 2) calc(var(--bl) * 6);   /* clears the scrub track below */
}
/* one piece of glass, not two buttons */
.pill {
  display: flex; align-items: center;
  border: 1px solid rgb(246 241 232 / .22);
  border-radius: 999px;
  /* A heavier, less saturated base, so the glass reads as the same dark glass
     over a night sky and over a sunlit hillside. */
  background: rgb(8 13 34 / .56);
  -webkit-backdrop-filter: blur(22px) saturate(105%);
  backdrop-filter: blur(22px) saturate(105%);
  overflow: hidden;
  transition: border-color 260ms var(--ease);
}
.frame:hover .pill, .frame:focus-within .pill { border-color: rgb(246 241 232 / .34); }

.ctl {
  width: 44px; height: 44px; padding: 0; flex: none;
  display: grid; place-items: center;
  border: 0; background: none;
  color: rgb(246 241 232 / .88); cursor: pointer;
  transition: transform 180ms var(--ease), color 200ms var(--ease),
              background-color 200ms var(--ease);
}
.ctl svg { width: 19px; height: 19px; }
.ctl + .ctl { box-shadow: inset 1px 0 0 rgb(246 241 232 / .16); }
.ctl:hover { color: var(--lune); background: rgb(246 241 232 / .08); }
.ctl:active { transform: scale(.92); }
.slide.sound .ctl.sound { color: var(--echelle); }

.time {
  margin-left: auto;
  font-family: var(--mono); font-size: 12px; line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em; color: rgb(246 241 232 / .78);
  opacity: 0; transition: opacity 320ms var(--ease);
  pointer-events: none;
}
.frame:hover .time, .frame:focus-within .time, .slide.sound .time { opacity: 1; }

/* A hairline that thickens when you reach for it. */
.scrub {
  position: absolute; inset: auto 0 0 0; height: calc(var(--bl) * 5);
  display: flex; align-items: flex-end;
  cursor: pointer; touch-action: none;
}
.scrub i {
  display: block; width: 100%; height: 3px;
  background: rgb(246 241 232 / .22);
  transition: height 220ms var(--ease), background-color 220ms var(--ease);
}
.scrub i::after {
  content: ''; display: block; height: 100%;
  width: calc(var(--p, 0) * 100%);
  background: var(--echelle);
}
.frame:hover .scrub i, .scrub:focus-visible i, .slide.sound .scrub i { height: 6px; }
.scrub:focus-visible { outline: none; }
.scrub:focus-visible i { background: rgb(246 241 232 / .45); }

/* The next film, showing at the edge. It is the control — there is deliberately
   no button that could be mistaken for the transport pill below it. */
.peek {
  position: absolute; top: 0; bottom: calc(var(--bl) * 5);
  width: var(--peek); padding: 0; border: 0;
  background: none; cursor: pointer; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: width 420ms var(--ease), opacity 320ms var(--ease);
  z-index: 3;
}
.peek img {
  position: absolute; top: -6%; left: -18%;
  width: 136%; height: 112%;
  object-fit: cover;
  filter: blur(11px) saturate(1.12) brightness(.78);
  transition: filter 420ms var(--ease);
}
.peek::after {                       /* a seam of light where the two films meet */
  content: ''; position: absolute; top: 0; bottom: 0; width: 1px;
  background: linear-gradient(to bottom, transparent, rgb(246 241 232 / .34), transparent);
}
.peek .chev {
  position: absolute; top: 50%; left: 50%;
  width: 22px; height: 22px; margin: -11px 0 0 -11px;
  color: var(--lune); opacity: .8;
  transition: transform 420ms var(--ease), opacity 320ms var(--ease);
  filter: drop-shadow(0 1px 3px rgb(4 8 26 / .7));
}

.peek.to-1 { right: 0; -webkit-mask-image: linear-gradient(to right, transparent, #000 44%); mask-image: linear-gradient(to right, transparent, #000 44%); }
.peek.to-1::after { left: 0; }
.peek.to-0 { left: 0;  -webkit-mask-image: linear-gradient(to left,  transparent, #000 44%); mask-image: linear-gradient(to left,  transparent, #000 44%); }
.peek.to-0::after { right: 0; }

.peek:hover { width: calc(var(--peek) + 22px); }
.peek:hover img { filter: blur(7px) saturate(1.15) brightness(.92); }
.peek:hover .chev { opacity: 1; }
.peek.to-1:hover .chev { transform: translateX(3px); }
.peek.to-0:hover .chev { transform: translateX(-3px); }
.peek:focus-visible { outline: 1px solid var(--echelle); outline-offset: -2px; }

/* only the peek pointing where you can actually go is shown */
.frame[data-slide="0"] .peek.to-0,
.frame[data-slide="1"] .peek.to-1 { opacity: 0; pointer-events: none; width: 0; }

/* The transport moves out from under the peek rather than hiding behind it. */
.frame.multi[data-slide="0"] .btns { padding-right: calc(var(--peek) + var(--bl) * 2); }
.frame.multi[data-slide="1"] .btns { padding-left: calc(var(--peek) + var(--bl) * 3); }

/* --- which of the two you are on, in the ladder's own language --- */
.pips { display: flex; align-items: center; gap: 6px; flex: none; }
.pip {
  width: 22px; height: 24px; padding: 0; border: 0; background: none;
  cursor: pointer; display: grid; place-items: center;
}
.pip::before {
  content: ''; display: block; width: 16px; height: 1px;
  background: rgb(246 241 232 / .34);
  transition: background-color 360ms var(--ease), height 220ms var(--ease);
}
.pip:hover::before { background: rgb(246 241 232 / .7); }
.pip[aria-selected="true"]::before { background: var(--echelle); height: 2px; }

/* ---- Contact ------------------------------------------------------------ */

.contact {
  display: flex; flex-wrap: wrap; column-gap: calc(var(--bl) * 7); row-gap: var(--bl);
  padding-block: calc(var(--bl) * 15) calc(var(--bl) * 12);
  font-size: 18px; line-height: var(--lh);
}
.contact a {
  position: relative;
  display: inline-block;
  color: rgb(246 241 232 / .86);
  text-decoration: none;
  padding-bottom: 3px;
  border-bottom: 1px solid rgb(246 241 232 / .18);
  transition: color 240ms var(--ease), border-color 240ms var(--ease);
}
.contact a::after { content: ''; position: absolute; inset: -10px -6px; }
.contact a:hover { color: var(--lune); border-color: var(--echelle); }

/* ---- Entrances ---------------------------------------------------------- */

.reveal { opacity: 0; transform: translate3d(0, 18px, 0); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity 760ms var(--ease), transform 760ms var(--ease);
}
.reveal.in.logo { transition-delay: 60ms; }
.reveal.in.lede { transition-delay: 210ms; }
.ladder .stile { transform: scaleY(0); transform-origin: top; }
.ladder.drawn .stile { transform: scaleY(1); transition: transform 620ms var(--ease); }
.ladder .rung::before { transform: scaleX(0); }
.ladder.drawn .rung::before { transform: scaleX(1); transition: transform 460ms var(--ease) var(--d, 0ms), width 420ms var(--ease), background-color 420ms var(--ease); }
.ladder .rung:nth-of-type(1) { --d: 340ms; }
.ladder .rung:nth-of-type(2) { --d: 420ms; }
.ladder .rung:nth-of-type(3) { --d: 500ms; }
.ladder .rung:nth-of-type(4) { --d: 580ms; }

/* ---- Narrow ------------------------------------------------------------- */

@media (max-width: 860px) {
  :root { --margin: calc(var(--bl) * 3); --peek: 54px; }
  .peek { bottom: calc(var(--bl) * 6); }
  .page { grid-template-columns: minmax(0, 1fr); }
  .ladder { display: none; }
  .masthead, #films, .contact { grid-column: 1; }
  .masthead { padding-block: calc(var(--bl) * 10) calc(var(--bl) * 9); }
  .logo { width: 158px; margin-bottom: calc(var(--bl) * 4); }
  .lede { font-size: clamp(25px, 7vw, 32px); line-height: calc(var(--bl) * 5); max-width: 17ch; }
  #films { row-gap: calc(var(--bl) * 9); }
  .contact { padding-block: calc(var(--bl) * 10) calc(var(--bl) * 8); column-gap: calc(var(--bl) * 4); }
  /* a phone has little width to spare — the films take all of it */
  .btns { padding-bottom: calc(var(--bl) * 7); }
  .frame { margin-inline: calc(max(var(--margin), env(safe-area-inset-left)) * -1) calc(max(var(--margin), env(safe-area-inset-right)) * -1); box-shadow: none; }
  .scrub { height: calc(var(--bl) * 6); }
  .scrim { opacity: 1; }
  .time { opacity: .62; }
  .scrub i { height: 3px; }
}

/* ---- Preferences -------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .reel { transition: none; }
  .slide.pressed video, .slide.pressed .still { transform: none; }
  .slide video { transition: opacity 200ms linear; }
  .reveal { opacity: 0; transform: none; }
  .reveal.in { transition: opacity 320ms linear; }
  .ladder .stile, .ladder .rung::before { transform: none; }
  .ladder.drawn .stile, .ladder.drawn .rung::before { transition: none; }
  .ctl:active { transform: none; }
  * { scroll-behavior: auto !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .ctl { background: var(--encre); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  .label, .contact a { color: var(--lune); }
  .stile { background: rgb(246 241 232 / .5); }
  .frame { outline-color: rgb(246 241 232 / .4); }
}
