:root {
  /* Colors */
  /* Black with grain: cream text and titles. "ink" is the text colour,
     "paper" the page colour, "rule" the hairlines between things */
  --color-ink: #f4efe6;
  --color-rule: rgba(244, 239, 230, .16);
  --color-paper: #000000;
  --color-ash: #8f8a84;
  --color-accent: #f6b3c6;
  --color-title: #f4efe6; /* script titles: name, logo, category titles, marquee */
  --color-plate: #151515;

  /* Type, kept to a small system: the handwritten script only for the name,
     Outfit for display titles, Space Mono for all reading and labels, and Inter
     for the navigation (shared with the About page) */
  --font-script: 'Mrs Saint Delafield', cursive;
  --font-sans: 'Space Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --font-display: 'Outfit', 'Helvetica Neue', Arial, sans-serif;
  --font-nav: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --text-body: 15px;
  --leading-body: 1.55;
  --text-subheading: 16px;
  --leading-subheading: 1.45;
  --text-label: 12px;
  --tracking-label: .12em;

  /* Spacing & layout */
  --spacing-16: 16px;
  --spacing-19: 19px;
  --spacing-28: 28px;
  --spacing-32: 32px;
  --spacing-96: 96px;
  --page-max-width: 1200px;
  --plate-max-width: 720px;

  /* Radius: square, printed-matter corners */
  --radius-frame: 2px;
}

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

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

/* Film grain over the black, fixed behind the page: fine light specks that
   flicker like projected film. The layer is oversized and jumps to a new
   offset several times a second, so the noise pattern keeps changing. */
body::before {
  content: '';
  position: fixed;
  inset: -50%;
  z-index: -1;
  pointer-events: none;
  animation: grain .8s steps(1) infinite;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.65' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 .22 0 0 0 -.09'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  12%  { transform: translate(-7%, 4%); }
  25%  { transform: translate(5%, -8%); }
  37%  { transform: translate(-3%, 9%); }
  50%  { transform: translate(9%, 2%); }
  62%  { transform: translate(-8%, -5%); }
  75%  { transform: translate(3%, 7%); }
  87%  { transform: translate(-5%, -2%); }
}

a { color: inherit; text-decoration: none; }

/* Small capitalised labels: years, categories, buttons, hints */
.label,
.pill,
.caption__meta,
.category__no,
.category__empty,
.intro__hint,
.intro__scroll,
.footer,
.cursor__label,
.plate__empty {
  font-size: var(--text-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* Top bar: wordmark left, two text links right — nothing else.
   Floats over everything; a soft shadow keeps it readable over images and video */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: 68px;
  padding: 0 var(--spacing-16);
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .6);
}

.topbar__nav { display: flex; gap: 28px; }

/* Same as the About page: small clean capitals for the logo and the links */
.wordmark,
.nav-link {
  font-family: var(--font-nav);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: var(--color-ink);
}
.nav-link:hover,
.index-link:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
@media (max-width: 520px) {
  .topbar__nav { gap: 14px; }
  .wordmark, .nav-link { font-size: 11px; }
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 var(--spacing-16);
  border: 1px solid var(--color-ink);
  border-radius: var(--radius-frame);
  background: var(--color-paper);
  color: var(--color-ink);
  cursor: pointer;
  text-shadow: none;
  transition: background-color .2s, color .2s;
}
.pill:hover { background: var(--color-ink); color: var(--color-paper); }
.pill:focus-visible, .plate__play:focus-visible {
  outline: 1px solid var(--color-ink);
  outline-offset: 3px;
}

/* Intro: full-screen poster — slanted script name over a tracklist,
   with the image trail underneath */
.intro {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  display: grid;
  place-items: center;
  touch-action: pan-y;
}

/* Its own stacking layer, so the trail always stays under the name */
.intro__trail { position: absolute; inset: 0; z-index: 0; }

.trail-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 260px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-frame);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.intro__poster {
  position: relative;
  z-index: 1;
  width: 100%;
  display: grid;
  justify-items: center;
  transform: rotate(-7deg);
  pointer-events: none;
}

.intro__name {
  /* Generous padding so the mask below never clips the script's swashes;
     the negative margin cancels it out in the layout */
  margin: -.35em 0;
  padding: .35em .4em;
  font-family: var(--font-script);
  font-size: clamp(72px, 15vw, 280px);
  font-weight: 400;
  line-height: 1.1;
  color: var(--color-title);
  white-space: nowrap;

  /* The name is written in on load: a soft-edged mask sweeps along the
     baseline from left to right, like a pen moving across the page */
  -webkit-mask-image: linear-gradient(90deg, #000 40%, transparent 50%);
  mask-image: linear-gradient(90deg, #000 40%, transparent 50%);
  -webkit-mask-size: 250% 100%;
  mask-size: 250% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
  animation: write 3s cubic-bezier(.45, .05, .55, .95) .3s forwards;
}
@keyframes write {
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}
/* The scribble version of the name: no mask sweep, each SVG stroke draws
   itself in turn instead (--d delay, --t duration, set per path) */
.intro__name--scribble {
  margin: 0 0 .12em;
  padding: 0;
  font-size: clamp(72px, 15vw, 280px);
  line-height: 0;
  -webkit-mask-image: none;
  mask-image: none;
  animation: none;
}
.scribble { width: 4.6em; height: auto; overflow: visible; }
.scribble path {
  fill: none;
  stroke: var(--color-title);
  stroke-width: 2.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: scribble var(--t) ease-in-out calc(.3s + var(--d)) forwards;
}
@keyframes scribble { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .scribble path { animation: none; stroke-dashoffset: 0; }
}

.intro__list {
  margin: -.2em 0 0;
  padding: 0;
  list-style: none;
  width: min(620px, 84vw);
  columns: 2;
  column-gap: var(--spacing-32);
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--color-ink);
  opacity: 0;
  animation: fade-in 1s ease 3s forwards; /* once the name is written */
}
.intro__list li { break-inside: avoid; }
.intro__list span { color: var(--color-accent); }
.intro__list sup { font-size: .75em; margin-left: .2em; color: var(--color-ash); }

/* Letters write themselves in on load */
.split-line { display: inline-block; vertical-align: top; }
.split-char {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transform: translateY(.15em);
  animation: ink-in .9s cubic-bezier(.2, .8, .2, 1) forwards;
  animation-delay: calc(var(--i) * 55ms + 150ms);
}
@keyframes ink-in { to { opacity: 1; filter: none; transform: none; } }

.intro__hint,
.intro__scroll {
  position: absolute;
  z-index: 1;
  bottom: var(--spacing-32);
  margin: 0;
  color: var(--color-ash);
  opacity: 0;
  animation: fade-in 1s ease 1.2s forwards;
}
.intro__hint { left: var(--spacing-16); }
.intro__scroll { right: var(--spacing-16); }.intro__hint-touch { display: none; }
@media (hover: none) {
  .intro__hint-mouse { display: none; }
  .intro__hint-touch { display: inline; }
}
@keyframes fade-in { to { opacity: 1; } }

/* Scrolling title band: heavy lowercase sans, tightly set, with bled-ink edges
   like a photocopied print (the #bleed filter in index.html blurs the letters,
   roughens them with noise and cuts them back to solid black) */
.marquee {
  margin: var(--spacing-96) calc(50% - 50vw) 0;
  overflow: hidden;
  white-space: nowrap;
  font-family: 'Outfit', var(--font-sans);
  font-size: clamp(56px, 9vw, 150px);
  font-weight: 600;
  letter-spacing: -.055em;
  line-height: 1.15;
  text-transform: lowercase;
}
.marquee__track {
  display: inline-block;
  padding: .1em 0;
  filter: url(#bleed);
  will-change: transform;
  animation: marquee 40s linear infinite;
}
.marquee__track span { padding-right: .5em; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* Scroll reveals (motion.js adds .is-in) */
.reveal {
  opacity: 0;
  transform: translateY(48px);
  transition: opacity 1s ease, transform 1.2s cubic-bezier(.2, .8, .2, 1);
}
.reveal.is-in { opacity: 1; transform: none; }

.plate.reveal {
  opacity: 1;
  transform: none;
  clip-path: inset(12% 8% round var(--radius-frame));
  transition: clip-path 1.4s cubic-bezier(.2, .8, .2, 1);
}
.plate.reveal > video,
.plate.reveal > img {
  transform: scale(1.25);
  transition: transform 1.8s cubic-bezier(.2, .8, .2, 1);
}
.plate.reveal.is-in { clip-path: inset(0 round var(--radius-frame)); }
.plate.reveal.is-in > video,
.plate.reveal.is-in > img { transform: none; }

/* Custom cursor (mouse only) */
.cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--color-ink);
  box-shadow: 0 2px 16px rgba(0, 0, 0, .35);
  pointer-events: none;
  display: grid;
  place-items: center;
  transition: width .35s cubic-bezier(.2, .8, .2, 1), height .35s cubic-bezier(.2, .8, .2, 1), margin .35s cubic-bezier(.2, .8, .2, 1), opacity .3s;
  opacity: 0;
}
.cursor.is-visible { opacity: 1; }
.cursor.is-link { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
.cursor.is-play { width: 88px; height: 88px; margin: -44px 0 0 -44px; }
.cursor__label {
  font-size: 11px;
  color: var(--color-paper);
  opacity: 0;
  transition: opacity .2s;
}
.cursor.is-play .cursor__label { opacity: 1; }
html.has-cursor, html.has-cursor * { cursor: none !important; }
html.has-cursor .plate__play { opacity: 0; }

/* Sections */
main {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-32);
}

.section {
  padding-top: var(--spacing-96);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.section--hero { padding-top: var(--spacing-32); }

/* Cinematic video plate: a plain, crisp rectangle */
.plate {
  position: relative;
  width: 100%;
  max-width: var(--plate-max-width);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--color-plate);
}

.plate video,
.plate img,
.plate iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: 0;
}
.plate img[hidden] { display: none; }

/* Every film the same size, centred within the page margins,
   with its caption tucked under on the left */
.film {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--spacing-32);
}
.film .plate { grid-column: 2 / span 10; max-width: none; }
.film .caption {
  grid-column: 2 / span 10;
  margin: 18px 0 0;
  max-width: none;
  text-align: left;
}

/* Credit line under each film, like the end of a film's credits:
   number and title on the left, category and year on the right, over a
   hairline; the short description sits underneath in grey */
.credit {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--color-rule);
  font-size: var(--text-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.credit__no { margin-right: .9em; color: var(--color-accent); }
.credit__meta { color: var(--color-ash); }
.credit__desc {
  margin: 10px 0 0;
  max-width: 60ch;
  font-size: 14px;
  color: var(--color-ash);
}

.plate__play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: opacity .3s;
}
.plate__play svg { width: 16px; height: 16px; fill: currentColor; }
.plate.is-playing .plate__play { opacity: 0; }
.plate.is-playing:hover .plate__play { opacity: 1; }

.plate__empty {
  position: absolute;
  inset: auto 0 var(--spacing-16) 0;
  text-align: center;
  color: var(--color-ash);
}

/* Caption: its own paragraph, with a smaller capitalised credit line */
.caption {
  max-width: 34ch;
  margin: var(--spacing-32) 0 0;
  text-align: center;
  font-size: var(--text-subheading);
  line-height: var(--leading-subheading);
}
.caption__meta {
  display: block;
  margin-top: 10px;
  font-style: normal;
  color: var(--color-ash);
}

/* Cycling manifesto */
.manifesto {
  display: grid;
  grid-template-columns: 1fr minmax(auto, 600px) 1fr;
  align-items: center;
  gap: var(--spacing-32);
}

.manifesto__thumb {
  justify-self: end;
  width: 140px;
  aspect-ratio: 7 / 4;
  border-radius: var(--radius-frame);
  overflow: hidden;
  background: var(--color-plate);
}
.manifesto__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity .4s;
}
.manifesto__thumb img:not([src]) { visibility: hidden; }

.manifesto__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  /* The block sits in the middle, but every line starts at the same left edge */
  justify-self: center;
  text-align: left;
  font-size: var(--text-subheading);
  line-height: var(--leading-subheading);
}
.manifesto__list li {
  color: var(--color-ash);
  transition: color .5s;
}
.manifesto__list li.is-active { color: var(--color-ink); }

/* Categories: a numbered index between two hairlines, like the contents
   page of a book, then one block per category with a numbered title */
.categories {
  margin-top: var(--spacing-96);
  padding: 20px 0;
  border-top: 1px solid var(--color-rule);
  border-bottom: 1px solid var(--color-rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px 36px;
}
.index-link {
  font-size: var(--text-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.index-link span { margin-right: .7em; color: var(--color-accent); }

.category {
  padding-top: var(--spacing-96);
  scroll-margin-top: 68px;
  text-align: center;
}

.category__no {
  margin: 0;
  color: var(--color-accent);
}

/* Category titles in the scrolling band's typeface, but quieter: a lighter
   weight, smaller and set with air, with only a hint of printed ink at the
   edges (the #bleed-soft filter in index.html) — a title card, not a banner */
.category__title {
  margin: 6px 0 calc(var(--spacing-32) + 8px);
  padding: .1em 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 5vw, 76px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -.035em;
  text-transform: lowercase;
  color: var(--color-title);
  filter: url(#bleed-soft);
}

.category .film:first-of-type { padding-top: 0; }

.category__empty {
  margin: var(--spacing-32) 0 0;
  color: var(--color-ash);
}

/* Photography: a three-column masonry of stills, each at its own proportions */
.photo-grid {
  max-width: 1000px;
  margin: 0 auto;
  columns: 3;
  column-gap: 16px;
  text-align: left;
}
.photo { margin: 0 0 16px; break-inside: avoid; }
.photo img { display: block; width: 100%; height: auto; }
.photo figcaption { display: block; margin-top: 8px; }
@media (max-width: 720px) {
  .photo-grid { columns: 2; column-gap: 10px; }
  .photo { margin-bottom: 10px; }
}

/* Contact */
.contact { padding-bottom: var(--spacing-96); gap: var(--spacing-32); }
.contact .caption { margin-top: 0; }

.footer {
  display: flex;
  justify-content: space-between;
  padding: var(--spacing-32) var(--spacing-16);
  color: var(--color-ash);
}

@media (max-width: 720px) {
  main { padding: 0 var(--spacing-16); }
  .section { padding-top: 64px; }
  .section--hero { padding-top: var(--spacing-16); }
  .manifesto { grid-template-columns: 1fr; justify-items: center; }
  .manifesto__thumb { justify-self: center; }
  .manifesto__spacer { display: none; }
  .topbar { background: var(--color-paper); } /* so scrolled content doesn't run under it */
  .film { grid-template-columns: 1fr; row-gap: var(--spacing-16); }
  .film .plate,
  .film .caption { grid-column: 1; }
  .film .caption { margin-top: 0; }
  .intro__list { columns: 1; width: 78vw; font-size: 10px; }
}

@media (max-width: 720px) {
  .trail-img { width: 160px; }
  .intro__scroll { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
  body::before { animation: none; }  .split-char { animation: none; opacity: 1; filter: none; transform: none; }
  .intro__name { animation: none; -webkit-mask-image: none; mask-image: none; }  .intro__hint, .intro__scroll, .intro__list { animation: none; opacity: 1; }
  .marquee__track { animation: none; }
  .reveal, .plate.reveal { opacity: 1; transform: none; clip-path: none; }
  .plate.reveal > video, .plate.reveal > img { transform: none; }
}
