/* Richard Jerwood portfolio: dark, cinematic, big type. */
:root {
  --bg: #0a0a0b;
  --surface: #151517;
  --line: #2a2a2e;
  --text: #f2efea;
  --muted: #a19d96;
  --accent: #ff5a1f;
  --display: "Anton", "Impact", "Arial Narrow", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --pad: clamp(1.25rem, 4vw, 4rem);
  --max: 1440px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
/* Subtle film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  z-index: 50;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img { display: block; max-width: 100%; }
a { color: inherit; }
a:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #000; padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: 1rem; }

.kicker {
  margin: 0;
  font: 600 .8125rem/1.2 var(--body);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 1.1rem var(--pad);
  background: rgba(10,10,11,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark { font: 400 1.35rem/1 var(--display); letter-spacing: .04em; text-transform: uppercase; text-decoration: none; }
.topbar nav { display: flex; gap: clamp(1rem, 3vw, 2.25rem); }
.topbar nav a {
  font: 600 .8125rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none; color: var(--muted); padding: .75rem 0;
}
.topbar nav a:hover { color: var(--text); }

/* Hero */
.hero {
  max-width: var(--max); margin: 0 auto;
  min-height: calc(100vh - 64px);
  padding: clamp(4rem, 12vh, 9rem) var(--pad) clamp(3rem, 8vh, 6rem);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 1.75rem;
}
.hero { position: relative; isolation: isolate; }
.hero > *:not(.hero-motion) { position: relative; z-index: 1; }
.hero-motion {
  position: absolute; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  /* opacity and edge fade are handled in motion.js */
}
.hero-title {
  margin: 0;
  font: 400 clamp(4rem, 13.5vw, 13rem)/.86 var(--display);
  text-transform: uppercase;
  letter-spacing: -.01em;
  text-wrap: balance;
}
.hero-intro { margin: 0; max-width: 38rem; font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--muted); }
.btn {
  align-self: flex-start;
  display: inline-flex; align-items: center; min-height: 48px;
  padding: 0 1.6rem;
  background: var(--accent); color: #0a0a0b;
  font: 600 .875rem/1 var(--body); letter-spacing: .14em; text-transform: uppercase;
  text-decoration: none;
}
.btn:hover { background: var(--text); }

/* Sections */
.section-head, .about, .work { max-width: var(--max); margin-left: auto; margin-right: auto; }
.work { padding: clamp(3rem, 8vw, 7rem) var(--pad); border-top: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: clamp(2rem, 5vw, 4rem); }
.section-title {
  margin: 0;
  font: 400 clamp(3rem, 8vw, 7.5rem)/.9 var(--display);
  text-transform: uppercase;
}
.count { margin: 0; color: var(--muted); font-weight: 500; }

/* Work grid */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(2rem, 4vw, 3.5rem) clamp(1.25rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
}
.card-link { display: block; text-decoration: none; }
.frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); }
.frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2,.7,.2,1), filter .8s; filter: saturate(.85); }
.card-link:hover .frame img { transform: scale(1.04); filter: saturate(1.05); }
.card-text { display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; align-items: baseline; padding-top: 1.1rem; }
.card-num { font: 600 .8125rem/1 var(--body); color: var(--accent); letter-spacing: .1em; }
.card-title {
  margin: 0;
  font: 400 clamp(2rem, 3.6vw, 3.25rem)/.95 var(--display);
  text-transform: uppercase;
  transition: color .3s;
}
.card-link:hover .card-title { color: var(--accent); }
.card-meta { grid-column: 2; margin: .45rem 0 0; color: var(--muted); font-size: .95rem; }

.placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(135deg, transparent 0 22px, rgba(255,255,255,.025) 22px 23px),
    var(--surface);
  border: 1px dashed var(--line);
}
.placeholder span { font: 600 .75rem/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* About */
.about { padding: clamp(3rem, 8vw, 7rem) var(--pad); border-top: 1px solid var(--line); display: grid; gap: 2rem; }
.about-text { margin: 0; max-width: 52rem; font-size: clamp(1.2rem, 2.2vw, 1.75rem); line-height: 1.45; }
.disciplines { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.disciplines li { border: 1px solid var(--line); padding: .5rem 1rem; font-size: .9rem; color: var(--muted); }

/* Project page */
.project { max-width: var(--max); margin: 0 auto; padding: clamp(2.5rem, 7vw, 6rem) var(--pad) 0; }
.back { display: inline-block; margin-bottom: 2rem; color: var(--muted); text-decoration: none; font-weight: 500; padding: .5rem 0; }
.back:hover { color: var(--text); }
.project-title {
  margin: 0 0 2rem;
  font: 400 clamp(3.5rem, 11vw, 11rem)/.86 var(--display);
  text-transform: uppercase;
  text-wrap: balance;
}
.facts { margin: 0 0 2rem; display: flex; flex-wrap: wrap; gap: 1.25rem 3.5rem; }
.facts dt { font: 600 .75rem/1 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: .5rem; }
.facts dd { margin: 0; font-weight: 500; }
.project-summary { margin: 0 0 clamp(2.5rem, 5vw, 4rem); max-width: 46rem; font-size: clamp(1.15rem, 2vw, 1.5rem); line-height: 1.45; }
.player { aspect-ratio: 16 / 9; background: #000; margin: 0 calc(var(--pad) * -1); }
@media (min-width: 900px) { .player { margin: 0; } }
.player iframe, .player img { width: 100%; height: 100%; border: 0; object-fit: cover; }
.project-body { max-width: 44rem; margin: clamp(2.5rem, 6vw, 5rem) 0; color: #d9d5cf; }
.project-body p { margin: 0 0 1.2em; }
.project-body h2, .project-body h3 { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 2rem; line-height: 1; margin: 2em 0 .6em; color: var(--text); }
.gallery { list-style: none; margin: 0 0 clamp(3rem, 6vw, 5rem); padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.gallery img { width: 100%; height: auto; }
.next {
  display: block; text-decoration: none;
  border-top: 1px solid var(--line);
  padding: clamp(3rem, 7vw, 6rem) 0;
}
.next .kicker { display: block; margin-bottom: 1rem; }
.next-title { font: 400 clamp(3rem, 9vw, 8rem)/.9 var(--display); text-transform: uppercase; transition: color .3s; }
.next:hover .next-title { color: var(--accent); }

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  padding: clamp(2.5rem, 5vw, 4rem) var(--pad) 2rem;
  max-width: var(--max); margin: 0 auto;
}
.footer-kicker { margin: 0 0 1rem; font: 600 .8125rem/1.2 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.footer-email {
  display: inline-block;
  font: 400 clamp(1.6rem, 4vw, 3.5rem)/1 var(--display);
  text-transform: uppercase;
  text-decoration: none;
  word-break: break-word;
}
.footer-email:hover { color: var(--accent); }
.footer-meta { margin-top: clamp(1.5rem, 3vw, 2.5rem); display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; color: var(--muted); font-size: .9rem; }
.footer-meta a { text-decoration: none; padding: .25rem 0; }
.footer-meta a:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ---------- Photography: photo field ---------- */
.photo-page { max-width: none; }
.photo-head {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--pad) clamp(1.5rem, 3vw, 2.5rem);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem 3rem;
}
.photo-intro { margin: 0; max-width: 32rem; color: var(--muted); }
.photo-hint { display: block; margin-top: .4rem; font: 600 .75rem/1.2 var(--body); letter-spacing: .18em; text-transform: uppercase; color: var(--accent); }

.field {
  position: relative;
  height: calc(100vh - 64px);
  min-height: 480px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  cursor: crosshair;
  touch-action: none;
}
.plane { position: absolute; left: 0; top: 0; will-change: transform; }
.ph { position: absolute; left: 0; top: 0; margin: 0; will-change: transform; }
.ph-frame {
  display: block; width: 100%; height: 100%;
  padding: 0; border: 0; background: var(--surface);
  overflow: hidden; cursor: zoom-in;
  transition: opacity .5s, filter .5s;
  will-change: transform;
  backface-visibility: hidden;
}
.ph-frame img {
  width: 100%; height: 100%; object-fit: cover;
  transform: scale(1.12); will-change: transform;
}
.ph figcaption {
  position: absolute; left: 0; top: calc(100% + .5rem);
  font-size: .8rem; color: var(--muted);
  opacity: 0; transform: translateY(-4px);
  transition: opacity .4s, transform .4s;
  white-space: nowrap; pointer-events: none;
}
/* hover: bring one forward, dim the rest */
.plane:has(.ph:hover) .ph-frame { opacity: .38; filter: grayscale(.6); }
.plane .ph:hover .ph-frame, .ph-frame:focus-visible { opacity: 1; filter: none; }
.ph:hover figcaption, .ph-frame:focus-visible + figcaption { opacity: 1; transform: none; }

/* Reduced motion: a plain scrolling grid */
.field.is-static { height: auto; overflow: visible; cursor: auto; touch-action: auto; padding: 1.5rem var(--pad) 3rem; }
.field.is-static .plane { position: static; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); width: auto !important; height: auto !important; }
.field.is-static .ph { position: relative; width: auto !important; height: auto !important; aspect-ratio: 3 / 2; transform: none !important; }
.field.is-static .ph figcaption { position: static; opacity: 1; transform: none; margin-top: .5rem; white-space: normal; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(6,6,7,.94);
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem;
  padding: clamp(1rem, 4vw, 3rem);
}
.lightbox[hidden] { display: none; }
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 1rem; max-height: 100%; min-width: 0; }
.lb-figure img { max-width: 100%; max-height: calc(100vh - 9rem); object-fit: contain; }
.lb-figure figcaption { color: var(--muted); font-size: .95rem; text-align: center; }
.lightbox button {
  width: 48px; height: 48px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); color: var(--text); cursor: pointer;
}
.lightbox button:hover { border-color: var(--accent); color: var(--accent); }
.lightbox svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lb-close { position: absolute; top: clamp(1rem, 3vw, 2rem); right: clamp(1rem, 3vw, 2rem); }
body.lb-open { overflow: hidden; }
@media (max-width: 640px) {
  .lightbox { grid-template-columns: 1fr; }
  .lb-prev, .lb-next { position: absolute; bottom: 1.25rem; }
  .lb-prev { left: 1.25rem; } .lb-next { right: 1.25rem; }
}

/* ---------- Headline words with video through the letters ---------- */
.mw { position: relative; display: inline-block; }
.mw.is-video { color: transparent; }
.mw canvas { position: absolute; pointer-events: none; }
.mw-probe { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.mw-src { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- Photography page: fixed full-screen view ---------- */
body.page-photo { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.page-photo main { flex: 1; min-height: 0; display: flex; }
body.page-photo .footer { display: none; }
body.page-photo .photo-page { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; }
body.page-photo .photo-head { width: 100%; padding-top: clamp(1rem, 2.5vw, 1.75rem); padding-bottom: clamp(1rem, 2.5vw, 1.75rem); align-items: center; }
body.page-photo .photo-head .section-title { font-size: clamp(2.25rem, 5vw, 4.5rem); }
body.page-photo .field { flex: 1; height: auto; min-height: 0; border-bottom: 0; }
body.page-photo .photo-contact { display: block; margin: .45rem 0 0; letter-spacing: .12em; }
.photo-contact { display: none; margin-left: .6rem; color: var(--muted); text-decoration: none; }
.photo-contact:hover { color: var(--text); }
/* reduced motion: let the static grid scroll inside the view */
body.page-photo .field.is-static { overflow-y: auto; }
