/* Raena Lannom: the whole look of the site.

   Two typefaces: Instrument Serif, a tall editorial serif, for her name and everything you read;
   Courier Prime, an American typewriter face, only for the small labels (the menu, counts, frame numbers, Shoot
   titles), like the edge print on a roll of film. Black on white, except a Shoot's page, which takes its Shoot colour
   (lib/colour.js) through --bg, --ink, --dim and --placeholder on <html>.
   Every photograph keeps its own shape (--ar on its frame, set from its size), so nothing is ever trimmed.
   Pages fade into each other where the browser can (Chrome, Edge, Safari 18.2+). The pages:
     .scatter           Home: the Home photo and Home's Shoots floating over the page, a Photo filling the screen under the pointer
     .opening           Home's Opening: every Photo filling the screen in turn, the last shrinking into its place
     .works             Works: every Shoot as its Cover, under its number and title
     .viewer, .shoot    a Shoot: one photograph at a time, its Counter (2/5) in the header
     .text-page         About, Privacy and the small pages
   Breakpoints: 640px (photos start to sit side by side) and 1040px (the full desktop layout). */

:root {
  --bg: #ffffff;
  --ink: #000000;
  --dim: #767676;  /* quiet text: the lightest grey that still reads on white */
  --line: color-mix(in srgb, var(--ink) 28%, transparent);
  --placeholder: #f2f2f2;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: "Courier Prime", "Courier New", Courier, ui-monospace, monospace;
  --text: 19px;    /* what you read */
  --small: 13px;   /* the labels */
  --edge: 20px;    /* the header's left and right margin */
  --inset: 20px;   /* the content's left and right margin */
  --head: 0px;     /* the fixed header's height, where it is fixed */
  --bar: 60px;     /* the header's height where it is not fixed */
  --top: 24px;     /* from the header to the first thing on every page */
  --gap: 20px;     /* the gutter between photographs */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: light;
}
@media (min-width: 640px) { :root { --edge: 32px; --inset: 32px; --gap: 32px; } }
@media (min-width: 1040px) { :root { --text: 21px; --small: 14px; --edge: 56px; --inset: 56px; --gap: 56px; --head: 64px; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head) + 16px); background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--text);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3 { font: inherit; margin: 0 0 1em; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
img { display: block; max-width: 100%; height: auto; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* the typewriter labels; a Shoot's title (.shoot-title, wherever it shows) is set like the Shoot number beside it,
   but in Raena's own case */
.label, .shoot-title, .header, .skip-link, .contact-list__label {
  font-family: var(--mono);
  font-size: var(--small);
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.shoot-title { text-transform: none; }

a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; text-decoration-color: var(--line); transition: text-decoration-color 0.15s ease-out; }
a:hover { text-decoration-color: currentColor; }
/* a link that stands on its own draws its underline from the left under the pointer */
.draw {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.35s var(--ease), color 0.15s ease-out;
}
.draw:hover, .draw:focus-visible { background-size: 100% 1px; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; z-index: 30; top: 8px; left: 8px; padding: 10px 14px;
  background: var(--ink); color: var(--bg); text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* ---------- header: her name on the left, the three tabs together on the right ---------- */
.header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas: "name nav aside";
  align-items: center;
  column-gap: 1.4em;
  position: relative; z-index: 20;
  min-height: var(--bar);
  padding: 8px var(--edge);
  background: var(--bg);
}
.header a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; transition: color 0.15s ease-out; }
/* no underline in the menu: the open tab stays black, the other tabs go grey and come back under the pointer */
.header:has([aria-current="page"]) :is(.header__nav, .header__aside) a:not([aria-current="page"]) { color: var(--dim); }
.header:has([aria-current="page"]) :is(.header__nav, .header__aside) a:not([aria-current="page"]):hover { color: var(--ink); }
.header__name {
  grid-area: name; justify-self: start;
  font-family: var(--serif); font-size: 24px; letter-spacing: 0; text-transform: none; text-decoration: none;
}
.header__nav, .header__aside { display: flex; column-gap: 1.4em; }
.header__nav { grid-area: nav; }
.header__aside { grid-area: aside; }

@media (min-width: 1040px) {
  .header {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--head);
    padding-block: 0;
  }
  .header__name { font-size: 26px; }
}

/* every page starts --top under the header, keeps --inset from the sides and, with no footer, ends with the same space under its last line */
main { display: block; padding: calc(var(--head) + var(--top)) var(--inset) 72px; }

/* ---------- a Photo at its own shape (photo() in src/_includes/photo.njk): a frame shaped like the Photo (--ar),
   on the placeholder ground while it loads; the page's own class places it ---------- */
.photo { display: block; overflow: hidden; aspect-ratio: var(--ar); background: var(--placeholder); }
.photo img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Home: the Scatter ----------
   Each Photo carries two places from lib/scatter.js, in hundredths of the Scatter's width: --nx, --ny, --nw in one
   narrow column, one Photo under another; and --x, --y, --w on the wide sheet, which is --h hundredths tall.
   Percentage margins count from the width, so every place scales with the page. The wide sheet fills the screen
   under the header, and each Photo starts at its place on it: across as dealt, and down at the same share of the
   room the screen leaves under it as of the room the dealt sheet left, so it starts on the screen whatever its shape.
   From there every Photo diffuses on its own: assets/home.js moves the link by `translate`, anywhere on the sheet,
   over the other Photos; in the narrow column only a little about its place. The link itself lets the pointer
   through, so only the Photo you see (.scatter__float) answers it. */
.scatter { display: flow-root; max-width: calc(2000px - 2 * var(--inset)); margin-inline: auto; }
.scatter__photo {
  position: relative;
  display: block;
  width: calc(var(--nw) * 1%);
  margin: calc(var(--ny) * 1%) 0 0 calc(var(--nx) * 1%);
  text-decoration: none;
  pointer-events: none;
  will-change: translate;
}
.scatter__float { display: block; pointer-events: auto; }
.scatter__label { display: block; margin-top: 8px; color: var(--dim); transition: color 0.15s ease-out; }
.scatter__photo:hover .scatter__label { color: var(--ink); }
.scatter__full { display: none; }

/* on the wide sheet the Photos float free of words: a Frame label shows only with its Photo filling the screen */
@media (min-width: 1040px), (min-width: 900px) and (orientation: landscape) {
  /* under the sheet, room for the Frame label of a Photo at its foot (8px over a 14px line), so nothing scrolls */
  main:has(> .scatter) { --under: 32px; padding-bottom: var(--under); }
  .scatter {
    position: relative;
    container-type: size;
    height: max(320px, calc(100svh - max(var(--head), var(--bar)) - var(--top) - var(--under)));
  }
  .scatter__photo {
    /* its height on the sheet, and the room above and below it on the dealt sheet and on the screen */
    --ph: calc(var(--w) * 1cqw / var(--r));
    position: absolute; left: calc(var(--x) * 1%);
    top: max(0px, calc(var(--y) / max(0.01, var(--h) - var(--w) / var(--r)) * (100cqh - var(--ph))));
    width: calc(var(--w) * 1%);
    margin: 0;
  }
  .scatter__label { position: absolute; top: 100%; left: 0; white-space: nowrap; pointer-events: none; opacity: 0; }
  .scatter__photo:hover .scatter__label { opacity: 1; }
}

/* Under a mouse, the Photo under the pointer holds still (assets/home.js) and becomes the page's ground: larger than the screen,
   drifting once from -pan to +pan (--px, --py from lib/scatter.js) and resting there. The ground is the Photo's next sibling
   (inside the floating link it would float with it, fixed or not). The Photo, its Frame label and the menu stay on
   top, in white over a dark Photo and black over a light one; everything else goes under. The ground lets the
   pointer through (pointer-events: none), so it stays exactly while the pointer is on the Photo, and a click still
   opens the Shoot. A touch screen goes straight to the Shoot. */
.scatter__title { display: none; }
@media (hover: hover) and (pointer: fine) {
  .scatter__full {
    position: fixed; z-index: 15; inset: 0;
    overflow: hidden;
    background: var(--placeholder);
    pointer-events: none;
  }
  /* it fades in, and goes the moment the pointer leaves: a fade out would keep it shown a little longer, and a
     pointer back on the Photo by then would find the pan where it stopped instead of starting it over */
  .scatter__photo:hover + .scatter__full { display: block; opacity: 1; transition: opacity 0.2s var(--ease); }
  @starting-style { .scatter__photo:hover + .scatter__full { opacity: 0; } }
  /* One sweep onto the Focus, then it rests there; every new hover starts it over (the ground comes back from
     display: none, which restarts its animation). The Photo covers the screen (--dw by --dh, past its edges), enlarged --z times
     about the middle; moving it by --room-x across or --room-y down at most keeps its edges out of sight. It ends
     with the Focus (--cx, --cy, fractions of the Photo) as near the middle as that allows, and starts --px
     hundredths of the screen's width and --py of its height away (lib/scatter.js). */
  .scatter__pan {
    --dw: max(100vw, 100vh * var(--r));
    --dh: max(100vw / var(--r), 100vh);
    --room-x: calc(var(--dw) / 2 - 50vw / var(--z));
    --room-y: calc(var(--dh) / 2 - 50vh / var(--z));
    --end-x: clamp(-1 * var(--room-x), (0.5 - var(--cx)) * var(--dw), var(--room-x));
    --end-y: clamp(-1 * var(--room-y), (0.5 - var(--cy)) * var(--dh), var(--room-y));
    --start-x: clamp(-1 * var(--room-x), var(--end-x) + var(--px) * 1vw, var(--room-x));
    --start-y: clamp(-1 * var(--room-y), var(--end-y) + var(--py) * 1vh, var(--room-y));
    position: absolute; inset: 0;
    animation: scatter-pan 5s ease-in-out both;
  }
  /* the whole Photo at its cover size, centred, not cropped to the screen: the pan moves the rest of it into view,
     and only the ground's own edges (overflow: hidden) trim it */
  .scatter__pan img {
    position: absolute; top: calc(50% - var(--dh) / 2); left: calc(50% - var(--dw) / 2);
    width: var(--dw); max-width: none; height: var(--dh);
  }

  .scatter__photo:hover { z-index: 16; }
  .scatter__photo:hover .scatter__title { display: inline; margin-left: 1.2em; }
  :root:has(.scatter__photo:hover) .header { background: transparent; }
  :root:has(.scatter__photo--dark:hover) { --ink: #ffffff; --dim: rgb(255 255 255 / 0.72); --line: rgb(255 255 255 / 0.4); }
  :root:has(.scatter__photo--light:hover) { --ink: #000000; --dim: rgb(0 0 0 / 0.6); }
}
@keyframes scatter-pan {
  from { transform: scale(var(--z)) translate(var(--start-x), var(--start-y)); }
  to { transform: scale(var(--z)) translate(var(--end-x), var(--end-y)); }
}

/* ---------- Home's Opening (assets/opening.js, played by assets/home.js) ----------
   When the site is opened, the script in Home's <head> marks the page (data-opening) and the stage covers it from the
   first paint, over the header too. Every Photo fills the screen in turn, cut to the next without a fade; the last
   shrinks into its place, the stage's clip shrinking with it to show the Scatter around it. Her name stands in the
   middle all along, in the type of the header and in white over every Photo (on the white while they arrive it
   does not show yet); with the shrink it glides into the header, taking its colour, where the header's own takes
   over. Should home.js never start, both stand down by themselves. */
.opening, .opening__name { display: none; }
:root[data-opening] .opening {
  display: block;
  position: fixed; z-index: 40; inset: 0;
  overflow: hidden;
  background: var(--bg);
  animation: opening-failsafe 0s 8s forwards;
}
:root[data-opening] .opening__name {
  display: block;
  position: fixed; z-index: 41; top: 50%; left: 50%; translate: -50% -50%;
  font-family: var(--serif); font-size: clamp(56px, 9vw, 160px); line-height: 1; letter-spacing: 0; white-space: nowrap;
  color: #ffffff;
  pointer-events: none;
  animation: opening-failsafe 0s 8s forwards;
}
:root[data-opening] :is(.opening, .opening__name)[data-playing] { animation: none; }
.opening img { position: absolute; max-width: none; object-fit: cover; visibility: hidden; }
.opening img.is-on { visibility: visible; }
@keyframes opening-failsafe { to { visibility: hidden; } }

/* ---------- Works: every Shoot as its Cover ----------
   One column of the page per Shoot, at the Cover's own shape, under a hairline with its number and title. The whole
   tile opens the Shoot. The first row's hairlines already rule the page off from the header, so Works starts nearer
   it than the other pages. */
main:has(> .works) { --top: 8px; }
.works { --cols: 2; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 24px 12px; align-items: start; max-width: calc(2000px - 2 * var(--inset)); margin-inline: auto; }
.works__shoot { display: block; text-decoration: none; }
.works__head { display: flex; align-items: baseline; column-gap: 0.8em; margin-bottom: 4px; padding-top: 6px; border-top: 1px solid var(--line); }
.works__title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.works__cover img { transition: transform 0.7s var(--ease); }
.works__shoot:hover .works__cover img { transform: scale(1.03); }

@media (min-width: 640px) {
  .works { --cols: 3; gap: 32px 16px; }
}
@media (min-width: 1040px) {
  .works { --cols: 4; gap: 40px 24px; }
}

/* ---------- a Shoot ---------- */
.shoot__head { max-width: 30em; margin-inline: auto; text-align: center; }
.shoot__head h1 { margin-bottom: 0; }
.shoot__note { margin-top: 0.8em; }
.shoot__head .visually-hidden + .shoot__note { margin-top: 0; }
/* a Shoot's page fits the screen: the Viewer takes the height the header, a title or Note and the shoot links leave
   (never under half the screen, so a long Note scrolls rather than shrinking the Photo to nothing) */
body:has(> main > .shoot) { display: flex; flex-direction: column; min-height: 100svh; }
main:has(> .shoot) { flex: 1 0 auto; display: flex; flex-direction: column; min-height: 0; padding-bottom: 8px; }
.shoot { flex: 1 0 auto; display: flex; flex-direction: column; }
/* the Viewer: one Photo at a time, whole and as large as that space allows.
   Its stage keeps the shape of the Shoot's tallest Photo (--tall), so stepping through never moves the page.
   Each slide follows its hidden radio button; the one whose button is on shows. Its left and right halves step back
   and on. */
.viewer { position: relative; flex: 1 1 0; min-height: 50svh; container-type: size; }
.viewer__slide { display: none; }
.viewer--single .viewer__slide, .viewer__button:checked + .viewer__slide { display: flex; flex-direction: column; height: 100%; }
.viewer__stage {
  display: flex; align-items: center; justify-content: center;
  position: relative; flex: none;
  height: min(100cqh - var(--count), 100cqw / var(--tall));
}
.viewer__half { position: absolute; inset-block: 0; width: 50%; cursor: pointer; -webkit-tap-highlight-color: transparent; user-select: none; }
.viewer__half--prev { left: 0; }
.viewer__half--next { right: 0; }
.viewer__stage img { width: auto; height: auto; max-width: 100%; max-height: 100%; background: var(--placeholder); }
.viewer__button:focus-visible + .viewer__slide .viewer__stage img { outline: 1px solid var(--ink); outline-offset: 4px; }
/* the Counter: above the Photo on a phone, where the menu fills the header (--count, its line and margin, comes off
   the stage); from 640px in the middle of the header itself, which is --bar tall above the page (and fixed, --head
   tall, from 1040px) */
.viewer { --count: calc(var(--small) * 1.5 + 8px); }
.viewer__count { flex: none; margin: 0 0 8px; }
/* on a phone the Photo sits at the top, straight under the Counter, with the shoot links at the foot of the screen;
   from 640px it is centred in the space between */
@media (max-width: 639.98px) {
  .viewer__stage { align-items: flex-start; }
}
@media (min-width: 640px) {
  .viewer__slide { justify-content: center; }
  .viewer { --count: 0px; }
  .viewer__count {
    position: absolute; z-index: 21; top: calc(-1 * (var(--top) + var(--bar))); left: 50%; translate: -50% 0;
    display: flex; align-items: center; height: var(--bar); margin: 0;
  }
}
@media (min-width: 1040px) {
  .viewer__count { position: fixed; top: 0; height: var(--head); }
}
.shoot__head:not(.visually-hidden) { margin-top: 24px; }
.shoot__nav {
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "newer all older";
  gap: 16px; align-items: center;
  margin-top: 12px;
}
.shoot__nav a { display: inline-flex; align-items: center; text-decoration: none; min-height: 44px; padding-block: 10px; column-gap: 0.8em; }
.shoot__arrow { flex: none; color: var(--dim); transition: color 0.15s ease-out, translate 0.3s var(--ease); }
.shoot__nav a:is(:hover, :focus-visible) .shoot__arrow { color: var(--ink); }
.shoot__newer:is(:hover, :focus-visible) .shoot__arrow { translate: -4px 0; }
.shoot__older:is(:hover, :focus-visible) .shoot__arrow { translate: 4px 0; }
.shoot__nav a:is(:hover, :focus-visible) .draw { background-size: 100% 1px; }
.shoot__newer { grid-area: newer; justify-self: start; }
.shoot__older { grid-area: older; justify-self: end; text-align: right; justify-content: flex-end; }
.shoot__all { grid-area: all; justify-self: center; }

/* ---------- text pages: About, Privacy, the missing page ---------- */
.text-page .prose, .about__text { max-width: 28em; }
.text-page h1 { font-size: clamp(40px, 5vw, 64px); line-height: 1; margin-bottom: 0.5em; }
.text-page h2 { margin-top: 2em; }
/* a link that stands alone on its line is a full-size target */
.prose p > a:only-child { display: inline-flex; min-height: 44px; align-items: center; }

/* About reads larger than the rest: the bio is the page */
.about { display: grid; gap: 24px; font-size: calc(var(--text) + 5px); line-height: 1.25; }
.about .contact-list { margin-top: 0.8em; font-size: var(--text); }
/* how to reach her: one line each, the label on the left and the address flush right */
.contact-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 2ch; }
/* a full-size target where a finger taps it; under a mouse the lines sit close */
.contact-list a { display: inline-flex; align-items: center; min-height: 30px; min-width: 0; overflow-wrap: anywhere; text-align: right; }
/* a long address wraps under itself; its label keeps its one line */
.contact-list__label { flex: none; }
@media (pointer: coarse) { .contact-list a { min-height: 44px; } }
/* the words and the headshot share one column, so the addresses end where the photo does */
.about__text, .about__photo { width: min(100%, 440px); }
@media (min-width: 1040px) {
  /* the words and the headshot under them share one column at the page's right edge; the rest stays empty */
  .about { grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 28px var(--gap); align-items: start; }
  .about__text, .about__photo { grid-column: 8 / span 5; width: 100%; }
}

/* ---------- moving between pages: the old page fades into the new one ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.35s; animation-timing-function: ease-out; }
/* where the header is fixed it stays put and only the page under it fades */
@media (min-width: 1040px) { .header { view-transition-name: header; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .works__shoot:hover .works__cover img { transform: none; }
  @view-transition { navigation: none; }
  .scatter__pan { animation: none; transform: scale(var(--z)) translate(var(--end-x), var(--end-y)); }
}
