:root {
  --black: #090909;
  --black-2: #120808;
  /* Accent colour (text, lines, logos, borders, ash): red by default, switchable with the colour dots */
  --accent-rgb: 188 28 28;
  --red: rgb(var(--accent-rgb));
  --red-deep: #7a0d0d;
  --red-bright: #d62626;
  --display: "Cinzel", "Felix Titling", Georgia, serif;
  --body: "IM Fell English", Georgia, serif;
  --gothic: "UnifrakturMaguntia", "Old English Text MT", serif;
  --gutter: clamp(16px, 4vw, 48px);
  --logo-size: clamp(18px, 4.6vw, 58px);   /* P H J PHOTOGRAPHY: the same size as the section titles (Projects) */
  --bar-h: max(8.4vh, calc(var(--logo-size) * 1.7));   /* height of the black bar at the top (and the header that sits in it): tall enough for the name, its rule and the long J */
  --menu-size: min(40px, 5vh);     /* size of the aperture menu button */
  --menu-label-size: clamp(7px, 1vh, 9px);   /* the MENU letters (about one letter wide) */
  --edge: var(--gutter);   /* how far the menu emblem sits from the page edge: in line with the main photo's sides */
}

:root { color-scheme: dark; }   /* a dark site: browsers keep its colours as they are instead of applying their own dark mode */

/* Photos can't be saved the easy way: no long-press "Save image" menu on phones, no dragging a photo off the page,
   and no selecting it (right-click saving is blocked in script.js). Screenshots are still possible. */
img { -webkit-touch-callout: none; -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

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

html { scroll-behavior: smooth; scrollbar-gutter: stable; } /* stops the page shifting when the photo viewer locks scrolling */

/* Scrollbar: a thin, square orange bar on black, on the page and inside the project galleries alike
   (a gallery scrolls in its .gallery-scroll box: the dialog's own scrollbar won't take this style) */
html::-webkit-scrollbar, .gallery-scroll::-webkit-scrollbar { width: 6px; }
html::-webkit-scrollbar-track, .gallery-scroll::-webkit-scrollbar-track { background: var(--black); }
html::-webkit-scrollbar-thumb, .gallery-scroll::-webkit-scrollbar-thumb { background: rgb(var(--accent-rgb)); border-radius: 0; border-block: 3px solid var(--black); }
html::-webkit-scrollbar-button, .gallery-scroll::-webkit-scrollbar-button { display: none; }
@supports not selector(::-webkit-scrollbar) { html, .gallery-scroll { scrollbar-width: thin; scrollbar-color: rgb(var(--accent-rgb)) var(--black); } }
/* Phones: no scrollbar at all, on the page or in the galleries (the page still scrolls by touch) */
@media (max-width: 720px) {
  html, .gallery-scroll { scrollbar-width: none; }
  html::-webkit-scrollbar, .gallery-scroll::-webkit-scrollbar { display: none; }
}

body {
  margin: 0;
  background: var(--black);
  color: var(--red);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: inherit; }

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

#embers {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
/* While the menu is open, the ash drifts over it (the menu is z-index 20, the header 30) */
.menu-open #embers { z-index: 25; }
@media (max-width: 720px) { .gallery #embers { display: none; } }   /* no drifting ash inside the galleries on phones */

/* Black bar across the very top of the page */
.top-bar { height: var(--bar-h); background: var(--black); display: flex; align-items: center; justify-content: center; }

/* Colour themes picked with the dots on the first page */
html[data-theme="white"]  { --accent-rgb: 236 236 236; --red-bright: #ffffff; }
html[data-theme="yellow"] { --accent-rgb: 222 128 20;  --red-bright: #f59a2a; }   /* sunset orange, sampled from the main photo */

/* ---------- Header & menu ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  /* Emblem left, name centred, menu right */
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--bar-h); /* matches .top-bar so the logo and menu sit centred in it */
  padding: 0 var(--edge); /* 1cm closer to the edges than the page gutter (in line with the photo on phones) */
  z-index: 30;
  mix-blend-mode: normal;
  pointer-events: none; /* let clicks reach the name in the bar underneath */
}
.site-header > * { pointer-events: auto; }

.logo {
  font-family: var(--gothic);
  font-size: clamp(30px, 4vw, 44px);
  color: var(--red);
  text-decoration: none;
  letter-spacing: 0.02em;
  text-shadow: 0 0 18px rgb(var(--accent-rgb) / 0.35);
}
.top-bar .logo {
  position: relative;
  display: inline-block;
  line-height: 1;
  color: var(--red);
  text-shadow: none;
  font-family: var(--display);
  font-size: var(--logo-size);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* Hairline rule under the name, running about an inch past the text on each side.
   With line-height 1, Cinzel's baseline sits ~0.78em from the top, so this is ~0.2em below it. */
.top-bar .logo::after {
  content: "";
  position: absolute;
  top: 0.98em;
  left: -1in; right: -1in;
  height: 1px;
  transform: scaleY(0.5); /* half a pixel: thinner than the 1px it replaced */
  transform-origin: left;   /* the opening draws it from left to right */
  background: currentColor;
}
/* The J: stretched downwards so its tail drops well through the rule */
.top-bar .j-mark { position: relative; z-index: 1; display: inline-block; margin-right: 0.3em; }
.top-bar .j-mark.in-name { margin-right: 0; }   /* the J inside "Johnston" sits closed up to the rest of the word */ /* extra space before PHOTOGRAPHY */
/* Stretch from the top of the capitals (0.105em below the box top in Cinzel at line-height 1), so the J's top lines up with P and H */
.top-bar .j { display: inline-block; transform: scaleY(1.25); transform-origin: 50% 0.105em; }
/* Break the rule either side of the J by painting the bar colour over it behind the letter */
.top-bar .j-mark::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(0.98em - 2px);
  left: -0.18em; right: -0.18em;
  height: 5px;
  background: var(--black);   /* matches the bar so it reads as a gap in the rule */
}
/* The name starts in line with the main photo's left side; its rule runs from there to just short of the menu emblem,
   whose right side lines up with the photo's right side */
.top-bar { justify-content: flex-start; padding: 0 calc(var(--edge) + var(--menu-label-size) + 6px + var(--menu-size) + 12px) 0 var(--edge); }   /* the rule stops 12px short of the menu emblem */
.top-bar .logo { flex: 1; }
.top-bar .logo::after { left: 0; right: 0; }
/* Desktop: the rule runs on under the menu emblem (which sits higher in the taller bar) to line up with the photo's right side */
@media (min-width: 721px) {
  .top-bar .logo::after { right: calc(-1 * (var(--menu-label-size) + 6px + var(--menu-size) + 12px)); }
}
/* Opening: the whole page fades in from black together (script.js takes the intro class off when the fade is done).
   With reduced motion the page simply appears. */
@media (prefers-reduced-motion: no-preference) {
  /* Held at black until script.js adds intro-go, once the hero photo and fonts are ready */
  html.intro body { animation: page-fade 1.4s ease both; animation-play-state: paused; }
  html.intro-go body { animation-play-state: running; }
}
@keyframes page-fade { from { opacity: 0; } to { opacity: 1; } }
html.intro-lock { overflow: hidden; }


/* Back-to-top arrow, at the bottom of the page-dots column.
   Hidden at the very top; fades in once the page is scrolled (with the dots). */
.to-top {
  display: block;
  margin-top: 6px;
  width: min(24px, 3.5vh); aspect-ratio: 1;
  color: var(--red);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: color .3s, opacity .4s, transform .4s, visibility .4s;
}
.to-top svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.scrolled:not(.menu-open) .to-top { opacity: 1; visibility: visible; transform: none; }

/* Menu button: the aperture emblem, same size as the one on the left */
.menu-toggle {
  grid-column: 3;
  justify-self: end;
  display: block;
  width: var(--menu-size); aspect-ratio: 1;
  background: none; border: 0; padding: 0;
  color: var(--red);
  cursor: pointer;
  transition: color .3s;
}
.menu-toggle { position: relative; }
.menu-toggle svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 3; }
/* The opening between the aperture blades, filled orange (menu button and loading screen); script.js sizes it with the blades */
.aperture-hole { fill: var(--red); stroke: none; }
/* Page dots: a vertical column centred under the menu emblem, just below the top bar.
   Black dots with a thin red rim so they show on both the red and the dark sections. */
.page-dots {
  position: absolute;
  top: calc(var(--bar-h) / 2 + var(--menu-size) / 2 + 6px);   /* 6px below the menu emblem (the MENU label is hidden by then) */
  right: calc(var(--edge) + var(--menu-label-size) + 6px + var(--menu-size) / 2);   /* centred under the emblem, which sits inside the MENU letters */
  transform: translateX(50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .4s, visibility .4s;
}
.scrolled:not(.menu-open) .page-dots { opacity: 1; visibility: visible; }
/* Only the +, the dots and the arrow catch taps; the gaps between them let taps through to the page underneath */
.page-dots, .page-dots-list { pointer-events: none; }
.page-dots .dots-toggle, .page-dots a { pointer-events: auto; }

/* +/- toggle at the top of the column; the dots and arrow below it start hidden */
.dots-toggle {
  display: block;
  width: 16px; height: 16px;
  background: none; border: 0; padding: 0;
  color: var(--red);
  cursor: pointer;
  transition: color .3s;
}
.dots-toggle svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
/* The vertical stroke folds away to turn the + into a - */
.dots-toggle-v { transform-box: fill-box; transform-origin: center; transition: transform .35s ease; }
.dots-open .dots-toggle-v { transform: scaleY(0); }

.page-dots-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .35s, visibility .35s, transform .35s;
}
.dots-open .page-dots-list { opacity: 1; visibility: visible; transform: none; }
.page-dots a[data-section] {
  display: block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 1px var(--red);
  transition: transform .35s ease, background-color .35s, box-shadow .35s;
}
.page-dots a[data-section].current { transform: scale(2); }
/* Over the first page the dots are red with a black rim */
.dots-red .page-dots a[data-section] { background: var(--red); box-shadow: 0 0 0 1px #000; }

@media (max-width: 720px) { .dots-toggle, .page-dots-list { display: none; } }   /* no +/- dropdown under the menu button on phones */

/* Thin black outline on the menu emblem, its label and the back-to-top arrow while over the first page's photo */
.menu-on-photo:not(.menu-open) .menu-toggle,
.arrow-on-photo:not(.menu-open) .to-top,
.toggle-on-photo:not(.menu-open) .dots-toggle { filter: drop-shadow(0.5px 0 0 #000) drop-shadow(-0.5px 0 0 #000) drop-shadow(0 0.5px 0 #000) drop-shadow(0 -0.5px 0 #000); }

/* "MENU" label centred in the gap between the emblem and the bottom of the top bar */
/* MENU runs down the right side of the emblem, letter under letter, spread over the emblem's full height;
   its right edge lines up with the main photo's right side (the emblem moves in by the letters' width) */
.menu-toggle { margin-right: calc(var(--menu-label-size) + 6px); }
.menu-label {
  position: absolute;
  left: calc(100% + 6px);
  top: 0; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;   /* M at the top edge, U at the bottom */
  font-family: var(--display);
  font-size: var(--menu-label-size);
  line-height: .75;   /* close to the capitals' height, so the letters' tops and bottoms sit on the emblem's edges */
  text-transform: uppercase;
  white-space: nowrap;
  color: currentColor;
  transition: opacity .4s;
}
/* The label only shows at the very top of the page; it fades out once you scroll */
.scrolled .menu-label { opacity: 0; }

.menu {
  position: fixed; inset: 0;
  background: rgba(9, 9, 9, 0.97);
  z-index: 20;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity .5s, visibility .5s;
}
.menu-open .menu { opacity: 1; visibility: visible; }
.menu ul { list-style: none; margin: 0; padding: 0; text-align: center; }
.menu a {
  font-family: var(--display);
  font-size: clamp(40px, 9vw, 96px);
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.15;
  display: inline-block;
  position: relative;
  transition: color .3s;
}
.menu a:hover, .menu a:focus-visible { color: var(--red-bright); }
/* Underline: the hovered word gets a thin red line that draws in from left to right, like the project titles.
   Line box 1.15em with the baseline ~0.87em from the top, so the line sits just under the letters. */
.menu a::after {
  content: "";
  position: absolute;
  left: -0.12em; right: -0.12em;
  top: 0.95em;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s ease;
}
.menu a:hover::after,
.menu a:focus-visible::after { transform: scaleX(1); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  /* The photo gives up whatever extra height the taller top bar needs (a little off its top and bottom), so it ends where it did before */
  min-height: calc(100vh - (var(--bar-h) - 8.4vh));
  min-height: calc(100svh - (var(--bar-h) - 8.4vh));
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--gutter); /* equal top and bottom so the headline sits centred on the photo */
  overflow: hidden;
}

/* Switched off: with the photo inset to the gutters this grey haze showed at its sides; the page black shows there instead */
.hero-bg { display: none; }
.hero-bg {
  position: absolute; inset: -5%;
  background:
    radial-gradient(ellipse 40% 50% at 50% 30%, rgba(40, 40, 40, 0.75), transparent 70%),
    radial-gradient(ellipse 30% 60% at 25% 60%, rgba(22, 22, 22, 0.8), transparent 70%),
    radial-gradient(ellipse 35% 55% at 78% 55%, rgba(30, 30, 30, 0.7), transparent 70%),
    linear-gradient(180deg, #141414, #0b0b0b 70%, var(--black));
  filter: blur(18px);
  animation: breathe 12s ease-in-out infinite alternate;
}
.hero-bg::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
  opacity: .5;
}
@keyframes breathe {
  from { transform: scale(1); }
  to   { transform: scale(1.08) translateY(-2%); }
}

/* Photo layer: the black & white photo at full strength, covering the dark background */
.hero-photo {
  position: absolute; inset: 0 var(--gutter);   /* sides in line with the rule below it */
  z-index: 6;   /* above the ash canvas (z-index 5), so the ash doesn't drift over the main photo */
  background: url("images/web/hero.jpg") 40% center / cover no-repeat;   /* 2000px copy (265 KB) of the full-resolution original, images/web/1.jpg; 40% keeps the car and the sun in frame on phones */
}

/* The animated layers sit on a box the exact size and position of the drawn photo (same "cover" maths as the background),
   so percentages inside it are percentages of the photo. Photo is 2643 x 1762 (3:2). */
.hero-photo { container-type: size; overflow: hidden; }
/* Until script.js has the photo decoded (hero-wait, then hero-ready), the photo and its live layers stay hidden,
   so the sun and shimmer never show over an empty frame. Then they fade in together. */
.hero-photo, .hero-stage { transition: opacity .6s ease; }
html.hero-wait:not(.hero-ready) .hero-photo,
html.hero-wait:not(.hero-ready) .hero-stage { opacity: 0; }
.hero-stage {
  --w: max(100cqw, 150cqh);   /* cover: whichever of width or height needs the bigger photo */
  --px: .4; --py: .5;         /* same as background-position */
  position: absolute;
  width: var(--w); aspect-ratio: 3 / 2;
  left: calc((100cqw - var(--w)) * var(--px));
  top: calc((100cqh - var(--w) / 1.5) * var(--py));
  pointer-events: none;
}
.hero-stage > div { position: absolute; mix-blend-mode: screen; }
/* Rain: fine streaks over the sky only, from the top of the photo down to the horizon (48.4%), fading out just above it.
   Drawn by script.js; .hero-stage > canvas is not caught by the div rules below. */
.hero-rain {
  position: absolute; left: 0; top: 0; width: 100%; height: 48.4%;
  mix-blend-mode: multiply;   /* dark streaks that deepen the sky behind them */
  -webkit-mask: linear-gradient(#000 75%, transparent);
          mask: linear-gradient(#000 75%, transparent);
}
/* Splashes: tiny rings where drops land on the water, over the bottom third of the photo only (fading in at its top edge) */
.hero-splash {
  position: absolute; left: 0; top: 66.7%; width: 100%; height: 33.3%;
  mix-blend-mode: screen;
  -webkit-mask: linear-gradient(transparent, #000 8%);
          mask: linear-gradient(transparent, #000 8%);
}
/* Sun: centre 52.5% / 44.5% of the photo */
.sun-glow, .sun-halo { left: 52.5%; top: 44.5%; aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; }
.sun-glow {
  width: 7%;
  background: radial-gradient(circle, rgb(255 244 205 / .9) 0 22%, rgb(255 200 100 / .55) 38%, rgb(255 150 40 / 0) 70%);
  animation: sun-pulse 6.3s ease-in-out infinite;
}
.sun-halo {
  width: 34%;
  background: radial-gradient(circle, rgb(255 170 60 / .32), rgb(255 140 30 / .12) 35%, rgb(255 120 20 / 0) 70%);
  animation: sun-halo 8.9s ease-in-out infinite;
}
/* Uneven steps and different lengths for the glow and the halo, so the sun flickers and swells rather than pulsing evenly */
@keyframes sun-pulse {
  0%   { opacity: .45; scale: .92; }
  9%   { opacity: .9;  scale: 1.06; }
  16%  { opacity: .6;  scale: .97; }
  28%  { opacity: 1;   scale: 1.16; }
  35%  { opacity: .7;  scale: 1.02; }
  41%  { opacity: .95; scale: 1.1; }
  55%  { opacity: .5;  scale: .94; }
  63%  { opacity: .85; scale: 1.08; }
  70%  { opacity: .65; scale: 1; }
  82%  { opacity: 1;   scale: 1.18; }
  91%  { opacity: .6;  scale: .98; }
  100% { opacity: .45; scale: .92; }
}
@keyframes sun-halo {
  0%   { opacity: .45; scale: .93; }
  14%  { opacity: .85; scale: 1.04; }
  27%  { opacity: .6;  scale: .98; }
  43%  { opacity: 1;   scale: 1.09; }
  58%  { opacity: .55; scale: .95; }
  71%  { opacity: .9;  scale: 1.06; }
  86%  { opacity: .65; scale: 1; }
  100% { opacity: .45; scale: .93; }
}
/* Reflection: copies of the photo's reflection, rippled by the SVG filter and brightened. Two bands, so the tyre
   standing in the reflection (y 53.5-58.5%) stays still: one between the horizon and the tyre, one below the tyre.
   --l/--t/--w/--h are the band's left, top, width and height as fractions of the photo. */
.reflect-below-tyre { --l: .505; --t: .598; --w: .045; --h: .20; }   /* starts just under the tyre's own dark reflection */
.reflect-tyre       { --l: .497; --t: .536; --w: .053; --h: .054; }   /* from the top of the tyre down: nothing shimmers above it */
/* The glints around the tyre are masked by reflection-mask-tight.png (made from the photo): clear over the tyre and other
   dark shapes, so only the lit water behind and beside it sparkles. The mask covers x 47.48-57.97%, y 46.48-79.97% of the photo
   and is placed in the band's own box from its --l/--t/--w/--h. */
.sun-reflection, .sun-glints {
  left: calc(var(--l) * 100%); top: calc(var(--t) * 100%);
  width: calc(var(--w) * 100%); height: calc(var(--h) * 100%);
}
.sun-reflection {
  mix-blend-mode: normal;
  background: url("images/web/hero.jpg") no-repeat;
  background-size: calc(100% / var(--w)) calc(100% / var(--h));
  background-position: calc(var(--l) / (1 - var(--w)) * 100%) calc(var(--t) / (1 - var(--h)) * 100%);
  filter: url(#hero-shimmer) brightness(1.15);
  animation: reflect-glow 4.5s ease-in-out infinite alternate;
}
/* Further down the water the shimmer fades out: the lower band's ripple and glints are masked by a top-to-bottom fade as well */
.sun-reflection.reflect-below-tyre, .sun-glints.reflect-below-tyre {
  -webkit-mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 40%, transparent 100%), linear-gradient(#000, rgb(0 0 0 / .55) 40%, transparent);
  -webkit-mask-composite: source-in;
          mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 40%, transparent 100%), linear-gradient(#000, rgb(0 0 0 / .55) 40%, transparent);
          mask-composite: intersect;
}
/* Around the tyre: glints only, blended with colour-dodge so they brighten the lit water behind and beside it
   but leave the dark tyre itself untouched (dodge can't lighten black) */
.sun-glints.reflect-tyre {
  mix-blend-mode: color-dodge;
  --rl: .47484; --rt: .46481; --rw: .10481; --rh: .33485;
  --lit-water-tight: url("images/web/reflection-mask-tight.png")
    calc((var(--rl) - var(--l)) / (var(--w) - var(--rw)) * 100%) calc((var(--rt) - var(--t)) / (var(--h) - var(--rh)) * 100%)
    / calc(var(--rw) / var(--w) * 100%) calc(var(--rh) / var(--h) * 100%) no-repeat;
  /* plus a soft fade at both sides, keeping the sparkle to a narrow column like the reflection itself */
  -webkit-mask: var(--lit-water-tight), linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
  -webkit-mask-composite: source-in;
          mask: var(--lit-water-tight), linear-gradient(90deg, transparent, #000 30%, #000 70%, transparent);
          mask-composite: intersect;
}
@keyframes reflect-glow { from { filter: url(#hero-shimmer) brightness(1); } to { filter: url(#hero-shimmer) brightness(1.35); } }
/* Glints: thin bright lines drifting down the reflection at two speeds, so they flicker where they cross */
.sun-glints {
  background:
    repeating-linear-gradient(180deg, rgb(255 225 150 / 0) 0 7px, rgb(255 225 150 / .55) 8px, rgb(255 225 150 / 0) 10px),
    repeating-linear-gradient(180deg, rgb(255 205 120 / 0) 0 11px, rgb(255 205 120 / .4) 12px, rgb(255 205 120 / 0) 14px);
  opacity: .55;
  animation: glints 3.2s linear infinite, glint-flicker 1.7s ease-in-out infinite alternate;
}
@keyframes glints { to { background-position: 0 40px, 0 -28px; } }
@keyframes glint-flicker { from { opacity: .25; } to { opacity: .65; } }
@media (prefers-reduced-motion: reduce) {
  .hero-stage > div { animation: none; }
}

/* Phones: a square crop of the photo that trims the sky and water, framed on the car (with the person leaning out) and the sun.
   The window is ~34% of the photo's width and ~51% of its height: x 22.5-56.5%, y 27-78%; the person and the sun sit the same distance from each side. */
@media (max-width: 720px) {
  .hero { min-height: 0; aspect-ratio: auto; height: calc(100vw - var(--gutter) * 2); }   /* the photo stays square inside the gutters */
  .hero-photo { background-size: 294% auto; background-position: 35.5% 56%; }
  .hero-stage { --w: 294cqw; --px: .355; --py: .56; }
}

/* ---------- Introduction section (black background, red text, like the Projects page) ---------- */
.red-section {
  position: relative;
  background: var(--black);
  color: var(--red);
  padding: 120px var(--gutter) 40px;
  text-align: center;
  overflow: hidden;
}
.red-section > * { position: relative; }
/* Thin red line between the main photo and this section's photos, centred in the space above the grid */
.red-section { --intro-top: 120px; padding-top: var(--intro-top); }
.red-section::before {
  content: "";
  position: absolute;
  top: calc(var(--intro-top) / 2);
  left: var(--gutter); right: var(--gutter);
  height: 1px;
  background: rgb(var(--accent-rgb) / .5);   /* same thin red as the rule under the section titles */
}

/* Photo grid: a photo either side of the top photo and of the main photo */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 24px);
  align-items: center;
  width: 100%;   /* the full width between the gutters, matching the line above */
  margin: 0 auto 72px;
}
/* The flags are wider than their 3:2 frame: keep the person in view */
.photo-grid > [style*="grid-area: k"] img { object-position: 30% 50%; }
/* Computers: two rows of three, each row exactly the width of the page with the gaps counted in.
   Top: chimneys, the panorama, the dead tree; widths in proportion to their shapes (1.5 : 2.316 : 1.5) so all three
   stand the same height. Bottom: the bridge, the loch and the mosque, three equal 3:2 photos. */
@media (min-width: 721px) {
  .photo-grid { --g: clamp(12px, 2vw, 24px); display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--g); }
  .photo-grid > figure { flex: none; }
  .photo-grid > [style*="grid-area: e"] { order: 1; width: calc((100% - 2 * var(--g)) * 1.5 / 5.316); }
  .photo-grid > [style*="grid-area: h"] { order: 2; width: calc((100% - 2 * var(--g)) * 2.316 / 5.316); }
  .photo-grid > [style*="grid-area: f"] { display: none; }   /* the dead tree shows on phones only; the llamas take its place */
  .photo-grid > [style*="grid-area: l"] { display: block; order: 3; width: calc((100% - 2 * var(--g)) * 1.5 / 5.316); }
  .photo-grid > [style*="grid-area: d"] { display: none; }   /* the stone bridge shows on phones only; the flags take its place */
  .photo-grid > [style*="grid-area: k"] { display: block; order: 4; width: calc((100% - 2 * var(--g)) / 3); }
  .photo-grid > [style*="grid-area: g"] { order: 5; width: calc((100% - 2 * var(--g)) / 3); }
  .photo-grid > .portrait { order: 6; width: calc((100% - 2 * var(--g)) / 3); }
}
/* Photos sit above the drifting ash canvas (z-index 5), so the ash passes behind them */
.photo-grid figure { margin: 0; position: relative; z-index: 6; }



.portrait { grid-area: p; }
/* Every photo in the grid shares one shape so the rows line up */
.portrait-frame {
  aspect-ratio: 3 / 2;
  background: radial-gradient(circle at 45% 40%, #9a1414, #3a0505 55%, #0a0101);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 0;
}
.portrait-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Phones: the two nearly square film shots at the bottom of the grid keep (almost) their own shape: one shared frame
   between theirs, so they line up side by side with only a sliver trimmed from each */
@media (max-width: 720px) { .grid-photo.near-square .portrait-frame { aspect-ratio: 0.93; } }
/* The panorama keeps its own wide shape, so none of it is cut off */
.grid-photo.panorama .portrait-frame { aspect-ratio: 3103 / 1340; }
/* Wide photo under the list: the full width between the gutters, shown whole */
/* Thin line under it; Projects starts as far below it as Updates does below the line above it */
.wide-photo { position: relative; z-index: 6; margin: 72px 0 0; padding-bottom: 48px; border-bottom: 1px solid rgb(var(--accent-rgb) / .3); }
.wide-photo img { display: block; width: 100%; height: auto; }   /* each photo keeps its own shape (from its width and height) */
.wide-photo > * + * img, .wide-photo > img + img { margin-top: 12px; }   /* a second wide photo sits just under the first (its <picture> wrapper takes no space, so the gap goes on the photo) */
@media (min-width: 721px) { .wide-photo > * + * { display: none; } }   /* the second wide photo (the beach) is for phones only */
/* Off-screen animated photos pause (set in script.js), leaving the frames free for smooth scrolling */
.offscreen *, .offscreen *::before, .offscreen *::after { animation-play-state: paused !important; }
/* Project gallery: a full-screen grid of photos, opened from the project's title or photo */
.gallery {
  width: 100vw; height: 100vh;
  height: 100dvh;   /* the height actually visible: on phones 100vh runs on under the browser's own bars and cut off the bottom */
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  overflow: hidden;   /* the box inside does the scrolling */
  background: #000;
  color: #fff;
}
.gallery-scroll { height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-bottom: env(safe-area-inset-bottom); }   /* clear of a phone's home bar */
.gallery[open] { display: block; }
.gallery::backdrop { background: transparent; }
html:has(.gallery[open]) { overflow: hidden; scrollbar-gutter: auto; }   /* release the page's reserved scrollbar strip: it sat over the gallery's own bar and hid it */
/* The black bar at the top of a gallery. It is sticky with a negative top: as the photos scroll, the bar rides up until the
   title has gone off the top, then stays, showing just the subtitle and Close */
.gallery-head {
  /* The section-title size, but never so big that the longest name (MONTENEGRO, ~7.4x its letter height) reaches the
     centred dots: it must end in the left half of the page, short of the dots and a gap */
  --title-size: min(clamp(34px, 7.2vw, 84px), calc((50vw - var(--gutter) - 90px) / var(--name-len, 7.4)));
  /* When the emblems beside the names are shown again, use this instead so the name and emblem still clear the dots:
     --title-size: min(clamp(34px, 7.2vw, 84px), calc((50vw - var(--gutter) - 126px) / 8.28)); */
  position: sticky; top: calc(-1 * (var(--title-size) + 12px)); z-index: 7;   /* above the photos (6) and the ash (5) */
  display: flex; align-items: last baseline; justify-content: space-between;   /* Close sits on the subtitle's line */
  padding: 16px var(--gutter);
  background: #000;
  border-bottom: 1px solid rgb(var(--accent-rgb) / .3);
}
/* The gallery title matches the section titles (PROJECTS): same typeface, capitals, size and colour */
.gallery-head h2 { margin: 0; font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: var(--title-size); line-height: 1; color: var(--red); }
/* Close links: underlined italic "Close", like Expand / Close in the Introduction list */
.gallery-close, .gallery-top, .gallery-next, .gallery-back, .lightbox-close {
  background: none; border: 0; padding: 0;
  color: var(--red);
  font-family: var(--body); font-style: italic; font-size: 14px; line-height: 1;
  text-decoration: underline;
  cursor: pointer;
}
.gallery-close:hover, .gallery-top:hover, .gallery-next:hover, .gallery-back:hover, .lightbox-close:hover { color: #fff; }
.gallery-back.is-first { display: none; }   /* no Back on the first country */
.gallery-next.is-last { display: none; }   /* no Next on the last country */
/* Top and Back sit together at the right of the bar; Top fades in once the gallery has been scrolled down */
.gallery-actions { display: flex; align-items: baseline; gap: 18px; }
.gallery-top { opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility 0s .3s; }
.gallery.scrolled .gallery-top { opacity: 1; visibility: visible; transition: opacity .3s ease; }
/* Gallery layout: rows of one, two or three photos. No photo is cropped: in each row every photo's width is in
   proportion to its own shape (width / height, set in script.js), so all the photos in a row come out the same height. */
/* On computers, wide black margins either side of the photos (about 14% of the screen each side; the photos scale
   down to fit, never cropped). Phones keep the usual page gutter. */
.gallery-grid { display: flex; flex-direction: column; gap: 12px; padding: var(--gutter); }
@media (min-width: 721px) { .gallery-grid { padding-inline: max(var(--gutter), 14vw); } }
.gallery-row { display: flex; gap: 12px; }
@media (min-width: 721px) { .gallery-grid, .gallery-row { gap: 20px; } }   /* desktop: a little more space between the photos */
.gallery-item { display: block; flex: 1 1 0; min-width: 0; margin: 0; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery-item img { display: block; width: 100%; height: auto; }
/* A gallery photo stays invisible (so no alt text or broken-image icon shows) until it has loaded, then fades in */
.gallery-item img { opacity: 0; transition: opacity .4s ease; }
.gallery-item img.loaded { opacity: 1; }
picture { display: contents; }   /* the WebP wrapper around a gallery photo (added by tools/build-public.ps1) takes no space of its own */
/* A tall photo beside a stack of photos (the tower row). The stack's share is worked out from its photos (script.js), and the
   tall photo is given a little extra width for the gap inside the stack, so both sides come out exactly the same height. */
.gallery-stack { display: flex; flex-basis: 0; gap: 12px; min-width: 0; }   /* shares the row by its grow only, like a photo */
@media (max-width: 720px) {
  .tower-row, .phone-stack { flex-wrap: wrap; }
  /* phones: the first photo full width; the rest share the line below it (the tower's stack; a pair on the Bosnia page) */
  .tower-row > :first-child, .phone-stack > :first-child { flex-basis: 100%; }
}
@media (min-width: 721px) {
  .gallery-stack { flex-direction: column; gap: 20px; }
  .gallery-stack > .gallery-item { flex: none !important; }
  .tower-row > .gallery-item { flex-basis: calc(20px * var(--gaps, 1) * var(--r)); }   /* extra width for each gap inside the stack */
}
.gallery-item:focus { outline: none; }   /* no orange box on a photo when the full-screen view hands focus back to it */
/* Country title with its page dots and arrows beside it */
.gallery-title-row { display: flex; align-items: center; gap: clamp(18px, 3vw, 36px); }
/* The country's emblem in plain orange lines, as tall as the country name and just to its right. The line drawing is a
   mask filled with the accent colour, so it follows the colour scheme. Computers only. */
.gallery-flag {
  flex: none; height: var(--title-size); aspect-ratio: .88;
  background: var(--red);
  -webkit-mask: var(--flag) left center / contain no-repeat; mask: var(--flag) left center / contain no-repeat;
}
@media (max-width: 720px) { .gallery-flag { display: none; } }
.gallery-flag { display: none; }   /* hidden for now, kept for later: delete this line to show the emblems on computers */
/* The dots and arrows sit in the bar itself, level with the middle of the country name: centred across the page on
   computers, at the right-hand edge on phones. A little smaller than the Projects ones. */
.gallery-head .gallery-nav {
  position: absolute; top: calc(16px + var(--title-size) / 2);
  top: round(calc(16px + var(--title-size) / 2), 1px);   /* on a whole pixel too */
  left: 50%; transform: translate(-50%, -50%);
  margin-top: 0; gap: 14px;
}
.gallery-nav .projects-arrow { width: 14px; height: 14px; }
.gallery-nav .projects-dots { gap: 11px; }
.gallery-nav .projects-dots button { width: 6px; height: 6px; }   /* an even size, so the dots sit on whole pixels and their edges draw cleanly */
/* Phones: at the right-hand edge, a touch more compact, and the country names scaled just enough that the longest
   (MONTENEGRO, about 7.4 times its letter height wide) still clears them */
@media (max-width: 720px) {
  .gallery-head { --title-size: min(clamp(34px, 7.2vw, 84px), calc((100vw - 2 * var(--gutter) - 115px) / var(--name-len, 7.4))); }
  .gallery-head .gallery-nav { left: auto; right: var(--gutter); transform: translateY(-50%); gap: 8px; }
  .gallery-nav .projects-arrow { width: 12px; height: 12px; }
  .gallery-nav .projects-dots { gap: 8px; }
}
/* Country pages sit side by side; only the one in view sets the height, and they slide sideways between each other */
/* Above the ash (the sliding pages would otherwise sit under it), so the ash only drifts behind the photos */
.gallery-pages { position: relative; z-index: 6; display: flex; align-items: flex-start; overflow: hidden; transition: height .7s cubic-bezier(.65, 0, .35, 1); }
/* A section whose photos haven't been added yet */
.gallery-empty { margin: 48px 0; text-align: center; font-family: var(--body); font-style: italic; font-size: 18px; color: rgb(var(--accent-rgb) / .7); }
.gallery-page { flex: 0 0 100%; min-width: 0; transition: transform .7s cubic-bezier(.65, 0, .35, 1); }
.gallery-pages.instant, .gallery-pages.instant .gallery-page { transition: none; }
/* What the photos are of, under the gallery title in a smaller italic */
/* Photographers Notes: an underlined link on its own line under the subtitle (the bar wraps onto a new line for it) that
   drops the black bar down to reveal a few lines of notes about the country, and folds them away again */
/* The title and subtitle take the first lines; Photographers Notes then shares its line with Top and Back at the right */
.gallery-head { flex-wrap: wrap; }
.gallery-head .gallery-title { flex-basis: 100%; }
.gallery-notes-toggle { order: 1; margin-right: auto; }
.gallery-head .gallery-actions { order: 2; }
.gallery-notes { order: 3; }
.gallery-notes-toggle {
  text-align: left;
  margin-top: 10px; background: none; border: 0; padding: 0;
  color: var(--red); font-family: var(--body); font-style: italic; font-size: 15px; line-height: 1.2;
  text-decoration: underline; cursor: pointer;
}
.gallery-notes-toggle:hover { color: #fff; }
.gallery-notes-toggle:focus { outline: none; }
.gallery-notes { flex-basis: 100%; display: grid; grid-template-rows: 0fr; transition: grid-template-rows .5s cubic-bezier(.65, 0, .35, 1); }
.gallery-head.notes-open .gallery-notes { grid-template-rows: 1fr; }
.gallery-notes-inner {
  overflow: hidden; min-height: 0; max-width: 70ch;
  font-family: var(--body); font-size: 16px; line-height: 1.6; color: var(--red);
}
.gallery-notes-inner p { margin: 0; }
.gallery-notes-inner p:first-child { margin-top: 12px; }
.gallery-sub { margin: 8px 0 0; font-family: var(--body); font-style: italic; font-size: clamp(15px, 1.8vw, 20px); line-height: 1.3; color: var(--red); }
.gallery-close:focus, .gallery-top:focus, .gallery-next:focus, .gallery-back:focus, .lightbox-close:focus, .gallery-nav button:focus { outline: none; }   /* no box around Close when the view opens with it focused */

/* Full-size photo viewer */
.lightbox {
  width: 100vw; height: 100vh;
  height: 100dvh;   /* the height actually visible: on phones 100vh runs under the browser's bottom bar, so the loader sat too low */
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  overflow: hidden;            /* never shows its own scrollbar, even while things slide in and out */
  scrollbar-width: none;
  background: #000;
  cursor: zoom-out;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: transparent; } /* the dialog's own background fades in instead */
html:has(.lightbox[open]) { overflow: hidden; }
/* While a full-screen view is opening, open or closing, the page scrollbar is fully invisible
   (its space is kept, so the page doesn't shift sideways) */
html.lightbox-active::-webkit-scrollbar-thumb { background: transparent; }
@supports not selector(::-webkit-scrollbar) { html.lightbox-active { scrollbar-color: transparent transparent; } }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; will-change: transform; }
/* Loading-screen curtain: a full-screen black panel that starts above the screen */
.lightbox-curtain {
  position: absolute; inset: 0;
  z-index: 2;                       /* covers the photo and close button; the ash (z-index 5) drifts over it */
  background: #000;
  transform: translateY(-100%);
  visibility: hidden;
  pointer-events: none;
}
/* Aperture on the curtain, same size and look as the emblem on the first page */
.lightbox-loader {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.lightbox-loader svg {
  width: min(320px, 70vw);
  fill: none; stroke: var(--red); stroke-width: 2;
  filter: drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000);
}
.lightbox-close { position: absolute; top: 20px; right: 20px; }
.portrait-mark { font-family: var(--gothic); font-size: clamp(140px, 30vw, 260px); color: rgb(var(--accent-rgb) / .8); }

.tracklist {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  width: min(100%, 640px);
  text-align: left;
}
/* Desktop: as wide as the two middle photos above it (two of the four grid columns plus the gap between them) */
@media (min-width: 721px) {
  .tracklist { width: calc(50% - clamp(12px, 2vw, 24px) / 2); }
}
.tracklist li { cursor: pointer; }   /* the whole row opens and closes its text */
.tracklist li {
  display: grid;
  grid-template-columns: 48px 40px 1fr auto;
  align-items: center;
  column-gap: 12px;
  row-gap: 0;   /* the space above an opened text is its own margin instead, so it can slide shut with it */
  padding: 14px 0;
  border-top: 1px solid rgb(var(--accent-rgb) / .3);
  font-family: var(--display);
  text-transform: uppercase;
  font-size: clamp(14px, 2.2vw, 18px);
}
.tracklist li:last-child { border-bottom: 1px solid rgb(var(--accent-rgb) / .3); }
.tracklist .rule { height: 1px; background: currentColor; opacity: .6; }
.tracklist .expand {
  background: none; border: 0; padding: 0;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--body);
  font-style: italic;
  text-transform: none;
  font-size: 14px;
}
.tracklist .expand:hover { color: #fff; }
.track-detail {
  grid-column: 3 / -1;
  margin: 16px 0 6px;   /* 12px row gap + 4px, as before */
  font-family: var(--body);
  text-transform: none;
  font-size: 17px;
  line-height: 1.6;
}

.hero-seal { position: relative; z-index: 7; width: min(320px, 70vw); margin: 0; transform: translateY(-6vh); } /* nudged above centre; above the photo if shown again */
.hero-seal svg { stroke: var(--red); } /* same red as the top bar */
/* Thin black outline on every side of the red lines: four 1px shadows, one per direction */
.hero-seal svg { filter: drop-shadow(1px 0 0 #000) drop-shadow(-1px 0 0 #000) drop-shadow(0 1px 0 #000) drop-shadow(0 -1px 0 #000); }
.formats { margin: 0; }
.links { margin: 4px 0 0; font-size: 15px; }
/* Location and links sit at the bottom of the Get in touch section */
.track-detail p { margin: 0; }
.track-detail .formats { margin-top: 14px; }
.track-detail .links { margin-top: 4px; }

/* ---------- Dark sections ---------- */
.dark-section {
  position: relative;
  padding: 48px var(--gutter) 80px;   /* sections sit close together while scrolling */
  scroll-margin-top: calc(var(--bar-h) - 16px);   /* jumping from the menu still leaves the title clear of the top bar (bar + 32px above it) */
}
.section-title {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(34px, 7.2vw, 84px);
  line-height: 1;
  margin: 0 0 32px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgb(var(--accent-rgb) / .5);
}

/* Carousel */
.carousel { overflow: hidden; }
.carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  overflow-y: hidden;   /* never scroll vertically, or it catches the mouse wheel while scrolling the page */
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 24px;
  border-bottom: 1px solid rgb(var(--accent-rgb) / .3);
}
.carousel-track::-webkit-scrollbar { display: none; }
.card {
  flex: 0 0 clamp(220px, 28vw, 300px);
  scroll-snap-align: start;
}
.card-art {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  transition: filter .4s, border-color .4s, box-shadow .4s;   /* no titles under the boxes now, so no space below them */
  position: relative; z-index: 6;   /* above the ash canvas (z-index 5), so the ash drifts behind the update boxes */
}
.card:hover .card-art { filter: brightness(1.25); }
/* Update boxes with a thin red outline (same red as the other photo borders) */
.card-art.card-outline { background: #000; border: 1px solid rgb(var(--accent-rgb) / .5); }
/* Hovering a box lights its border with a soft glow, like the project photos */
.card:hover .card-art.card-outline { border-color: var(--red); box-shadow: 0 0 6px rgb(var(--accent-rgb) / .55), 0 0 16px rgb(var(--accent-rgb) / .25); }
/* Update detail view: hidden until a box is opened */
.card-art[role="button"] { cursor: pointer; }
.card-art[role="button"]:focus-visible { outline: 1px solid var(--red); outline-offset: 3px; }
.update-detail { display: none; }
.update-detail.is-open { display: block; }
/* Back button sits where the dots were, so the box stays at the same height on screen */
.update-back {
  display: flex; align-items: center; gap: 6px;
  height: 18px; margin-top: var(--proj-gap);
  background: none; border: 0; padding: 0;
  color: var(--red); cursor: pointer;
  font-family: var(--body); font-style: italic; font-size: 15px;
}
.update-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.update-back:hover span { text-decoration: underline; }
.update-detail-body {
  display: grid;
  grid-template-columns: clamp(220px, 28vw, 300px) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  padding: var(--proj-gap) 0 calc(var(--proj-gap) * 2 + 18px);
  border-bottom: 1px solid rgb(var(--accent-rgb) / .3);
}
.update-detail-box .card-art { width: 100%; }
.update-detail-text h3 {
  margin: 0;
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(28px, 4vw, 44px); line-height: 1.05;
}
.update-detail-text p:last-child { margin-bottom: 0; }

/* The aperture logo with a title and date, centred together in a black box */
.card-logo { flex-direction: column; text-align: center; padding: 8%; }
.card-logo svg { width: 45%; height: auto; fill: none; stroke: var(--red); stroke-width: 2; }
/* A small photo in place of the logo, with the same thin red border as the other photos.
   Its height matches the logo (45% wide, square): 45% x 1200/810 = 66.67% wide at the photo's 1200:810 shape,
   so the title and date line up with those in the logo box beside it. */
.card-logo .card-logo-photo { display: block; width: 66.667%; aspect-ratio: 1200 / 810; height: auto; object-fit: cover; border: 1px solid rgb(var(--accent-rgb) / .5); }
.card-logo-title { margin: 12px 0 0; font-family: var(--display); text-transform: uppercase; font-size: 14px; letter-spacing: .06em; line-height: 1.2; }
/* Every title gets the same two-line space (one-line titles centred in it), so the image, title and date
   sit at exactly the same heights in every box whatever the wording */
.card-logo-title { min-height: 2.4em; display: flex; align-items: center; justify-content: center; }
.card-logo-date { margin: 4px 0 0; font-style: italic; font-size: 14px; }
.card-art span, .release-art span {
  font-family: var(--display);
  font-size: clamp(32px, 4vw, 44px);
  color: rgba(255, 255, 255, .85);
}
.card h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 16px;
}

.art-1 { background: linear-gradient(170deg, #2b2b2b, #0c0c0c); }
.art-2 { background: radial-gradient(circle at 50% 40%, #e02a2a, #6a0606 70%); }
.art-3 { background: radial-gradient(circle at 50% 50%, #5a0808, #1a0202 75%); }
.art-4 { background: linear-gradient(200deg, #3a4a5a, #0d1418); }
.art-5 { background: linear-gradient(160deg, #8a1010, #160202); }
.art-6 { background: radial-gradient(circle at 30% 30%, #555, #111 70%); }



/* Projects carousel: one project per screen-width, the others sit to the right off screen.
   The track bleeds into the page gutter so the photo's red haze isn't clipped at its edges. */
.projects-track {
  --bleed: var(--gutter);
  display: flex;
  gap: calc(var(--bleed) * 2);
  margin: 0 calc(var(--bleed) * -1);
  padding: 0 var(--bleed);
  scroll-padding: 0 var(--bleed);
  /* Bottom rule like the Updates one, kept inside the gutters (the track itself bleeds into them) */
  background: linear-gradient(rgb(var(--accent-rgb) / .3), rgb(var(--accent-rgb) / .3)) var(--bleed) 100% / calc(100% - var(--bleed) * 2) 1px no-repeat;
  overflow-x: auto;
  overflow-y: hidden;   /* never scroll vertically, or it catches the mouse wheel while scrolling the page */
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  align-items: flex-start;
  transition: height .45s ease;   /* height follows the project being shown (set in script.js) */
}
.projects-track::-webkit-scrollbar { display: none; }
.projects-track > .release { flex: 0 0 100%; scroll-snap-align: start; }

/* Dots and arrows between the section title's rule and the first photo */
/* One spacing value for the Projects section: rule -> dots, dots -> photo, and photo -> text below it */
#projects, #updates { --proj-gap: 28px; padding-bottom: 40px; }
#updates .section-title { margin-bottom: 0; }
/* Updates: cards start one gap below the dots; the bottom rule sits as far below them as the title rule is above */
#updates .carousel-track { padding: var(--proj-gap) 0 calc(var(--proj-gap) * 2 + 18px); scroll-behavior: smooth; }
#projects .section-title { margin-bottom: 0; }
.projects-nav { display: flex; align-items: center; gap: 18px; margin-top: var(--proj-gap); }
.projects-track > .release { padding: var(--proj-gap) 0 calc(var(--proj-gap) * 2 + 18px); row-gap: var(--proj-gap); }
/* Bottom rule sits as far below the last line as the title rule is above the photo (gap + 18px controls + gap) */
.projects-track .release-info > :last-child { margin-bottom: 0; }
.projects-dots { display: flex; align-items: center; gap: 14px; }
.projects-dots button {
  width: 6px; height: 6px; padding: 0;
  border: 0; border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 1px var(--red);
  cursor: pointer;
  transition: transform .35s ease;
}
.projects-dots button.active { transform: scale(2); }
.projects-arrow {
  width: 18px; height: 18px; padding: 0;
  background: none; border: 0;
  color: var(--red);
  cursor: pointer;
  transition: opacity .3s;
}
.projects-arrow svg { display: block; width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.projects-arrow:disabled { opacity: .25; cursor: default; }

/* Projects / releases */
.release {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: clamp(24px, 5vw, 64px);
  padding: 48px 0;
  border-bottom: 1px solid rgb(var(--accent-rgb) / .3);
}
.release-art {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative; z-index: 6;   /* above the ash canvas (z-index 5), so the ash drifts behind the project photos */
}
/* A project box holding a real photo: same width, height follows the photo */
.release-art.release-photo { aspect-ratio: auto; display: block; align-self: start; }
.release-photo img { display: block; width: 100%; height: auto; border: 1px solid rgb(var(--accent-rgb) / .5); } /* same thin red as the rule under the section title */
/* Hovering the photo or the title lights the photo's border, together with the map outline */
.release-photo img { transition: border-color .45s ease, box-shadow .45s ease; }
.release:has(.release-heading:hover, .release-heading:focus-visible, .release-photo:hover, .release-photo:focus-visible) .release-photo img {
  border-color: var(--red);
  box-shadow: 0 0 6px rgb(var(--accent-rgb) / .55), 0 0 16px rgb(var(--accent-rgb) / .25);   /* the same glow as the Updates boxes */
}
.release-info h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}
.meta { margin: 6px 0 20px; font-style: italic; }
/* Hover underline on the project title and its lines: thin red, sweeps in from the left to just past the end */
.hover-line { position: relative; display: inline-block; }
.hover-line::after {
  content: "";
  position: absolute;
  left: -0.12em; right: -0.12em;
  bottom: -0.04em;
  height: 1px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .45s ease;
}
.release-heading, .release-photo { cursor: pointer; }
/* Hovering the title or the project photo underlines the title */
.release-heading:hover .hover-line::after,
.release-heading:focus-visible .hover-line::after,
.release:has(.release-photo:hover) .hover-line::after,
.release:has(.release-photo:focus-visible) .hover-line::after { transform: scaleX(1); }
.release-photo:focus-visible { outline: none; }
.release-heading:focus-visible { outline: none; }
/* Roman-numeral list: numerals sit flush with the text above */
.roman { list-style: none; padding-left: 0; margin: 0 0 20px; counter-reset: roman; }
.roman li { counter-increment: roman; font-style: italic; }   /* italic, like the date and category lines above */
.roman li::before { content: counter(roman, upper-roman) ". "; }
/* Country list with an outline map beside it; the map uses the same thin red line as the rule under the section title */
.list-with-map { display: flex; align-items: flex-start; gap: clamp(20px, 5vw, 48px); }
.list-with-map .roman { flex: 0 0 auto; margin-bottom: 0; }
.line-map-wrap { flex: 0 1 220px; min-width: 0; margin: 0; }
.line-map { display: block; width: 100%; height: auto; }
.line-map-wrap.line-map-tall { flex-basis: 176px; }   /* tall maps (South America, Scotland) are drawn 20% narrower */
.line-map-wrap.map-scotland { margin-top: -8px; }   /* nudged up a little: Shetland leaves empty sky at the top of this one */
.line-map path {
  fill: transparent;
  /* Solid equivalent of the title rule's 50% red on this dark background, so shared borders (drawn by both
     neighbouring countries) don't double up and look thicker than coastlines */
  stroke: color-mix(in srgb, var(--red) 50%, #090909);
  stroke-width: 1px;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: all;          /* the whole country area responds to the mouse, not just its thin outline */
  cursor: default;
  transition: fill .25s, stroke .25s;
}
/* Neighbouring countries drawn for context only: they don't react to the mouse */
.line-map path.map-context { pointer-events: none; }
/* Highlighted country (hovering it on the map or its name in the list) */
.line-map path.is-hot { fill: rgb(var(--accent-rgb) / .18); stroke: var(--red); }
/* Outer border glow (maps marked .glow-outline; layers built in script.js): hovering the project's title or photo lights up
   the outline around the whole map. A wide orange stroke of every shape sits underneath black-filled copies of the same
   shapes, so only the half of the stroke outside the map shows: the inner borders stay as they are. */
.line-map.glow-outline { overflow: visible; }
.line-map .map-outline path { vector-effect: non-scaling-stroke; pointer-events: none; transition: none; }
.line-map .outline-glow { filter: drop-shadow(0 0 4px var(--red)); opacity: 0; transition: opacity .45s ease; }
.line-map .outline-glow path { fill: none; stroke: var(--red); stroke-width: 4px; stroke-linejoin: round; }
.line-map .outline-cover path { fill: var(--black); stroke: none; }
.release:has(.release-heading:hover, .release-heading:focus-visible, .release-photo:hover, .release-photo:focus-visible) .outline-glow { opacity: 1; }
.map-label { min-height: 1.5em; margin-top: 6px; font-style: italic; font-size: 15px; text-align: center; }
.list-with-map .roman li { transition: color .25s; cursor: default; }   /* normal arrow pointer, not the text cursor */
.list-with-map .roman li.is-hot { color: var(--red-bright); }
.credits { margin: 0 0 16px; opacity: .85; }
.buy { margin: 0; }
.buy a:hover, .contacts a:hover, .links a:hover { color: var(--red-bright); }

/* Contacts */
.contacts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px;
}
.contacts h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  font-size: 18px;
  letter-spacing: .06em;
}
.contacts p { margin: 0; overflow-wrap: anywhere; }

.site-footer {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;   /* copyright notice on the left, in line with the page, the credit line under it */
  margin: 0 var(--gutter);   /* the rule above it runs gutter to gutter, like the other rules on the page */
  padding: 40px 0;
  border-top: 1px solid rgb(var(--accent-rgb) / .3);
  font-size: 14px;
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 1s ease, transform 1s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 720px) {
  /* Phones: the update text goes under the box, which keeps its usual width */
  .update-detail-body { grid-template-columns: 1fr; }
  .update-detail-box { width: clamp(220px, 28vw, 300px); }
  /* Line breaks that only apply on wider screens (e.g. the project category line) */
  .desktop-br { display: none; }
  /* Phones: menu emblem and its MENU label 20% smaller */
  /* --edge = the gutter, so the emblem's right side lines up with the photo's */
  :root { --menu-size: calc(min(40px, 5vh) * 0.8); --edge: var(--gutter); }
  :root { --menu-label-size: calc(clamp(7px, 1vh, 9px) * 0.8); }
  :root { --logo-size: 5.4vw; }
  .top-bar .logo-second { display: block; letter-spacing: 0.15em; }   /* phones: "Photography" on its own line under the name, spaced out to the width of the line above */
  .top-bar .logo::after { top: 1.98em; }   /* phones: the rule runs under "Photography", the second line */
  .top-bar .j { transform: scale(1.12, 0.85); }   /* phones: the J squashed a little so its tail doesn't hang so far below the line */
  .top-bar .j-mark::before { display: none; }   /* phones: the rule is under "Photography" now, so the gap beside the J would only paint over its letters */
  .red-section { --intro-top: 56px; }   /* phones: a shorter gap between the main photo and the photos below (the line stays centred in it) */   /* phones: as large as the name can be and still fit on one line beside MENU */
  .line-map-wrap.map-scotland { margin-top: -20px; margin-left: 14px; flex-basis: 156px; }   /* phones: the Scotland map a little smaller, nudged right and up close under the project details */   /* a touch smaller on phones so the name fits on one line beside MENU */
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "d d"
      "l k"
      "p p"
      "e f"
      "g g";   /* the bridge leads on phones, then the llamas and the flags; the loch closes the grid */
  }
  .photo-grid > [style*="grid-area: h"] { display: none; }   /* the panorama is for computers; phones show the llamas and flags instead */
  .photo-grid { margin-bottom: 36px; }   /* phones: the numerals table sits close under the photos */
  .wide-photo { margin-top: 36px; }       /* and the wide photo (with everything below it) comes up close under the table */
  .release { grid-template-columns: 1fr; }
  .contacts { grid-template-columns: 1fr; }
  .tracklist li { grid-template-columns: 36px 20px 1fr auto; column-gap: 8px; padding-right: 28px; }   /* keep Expand clear of the page-dots column at the right edge */
  .track-detail { grid-column: 1 / -1; margin-top: 12px; }   /* 8px row gap + 4px, as before (as a margin so it slides shut) */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-bg { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}


/* Colour scheme in the menu: a small label with the three colour dots under it, below Contact */
.menu { flex-direction: column; }
.menu-colours { margin-top: 2.4em; text-align: center; font-size: clamp(40px, 9vw, 96px); }   /* em = menu text size, so ~2 lines below Contact */
.menu-colours-label {
  margin: 0 0 14px;
  font-family: var(--display); text-transform: uppercase; letter-spacing: .12em;
  font-size: 13px;
}
.theme-dots { display: flex; align-items: center; justify-content: center; gap: 16px; }
.theme-dots button {
  width: 14px; height: 14px; padding: 0;
  border-radius: 50%;
  border: 1px solid #000;
  cursor: pointer;
  transition: transform .25s ease, box-shadow .25s ease;
}
.theme-dots button[data-theme="red"]    { background: rgb(188 28 28); }
.theme-dots button[data-theme="white"]  { background: rgb(236 236 236); }
.theme-dots button[data-theme="yellow"] { background: rgb(222 128 20); }
.theme-dots button:hover { transform: scale(1.2); }
/* The chosen colour is slightly larger with a thin ring around it */
.theme-dots button[aria-pressed="true"] { transform: scale(1.3); box-shadow: 0 0 0 2px #000, 0 0 0 3px currentColor; color: rgb(var(--accent-rgb)); }