/* ==========================================================
   Barnaby Boulton — site styles
   Two rooms: dark (intro, film) and light (photo, about).
   ========================================================== */


:root {
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --max: 1440px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

.theme-dark {
  --bg: #0c0c0b;
  --fg: #e9e6df;
  --muted: #8d8981;
  --line: rgba(233, 230, 223, .14);
}

.theme-light {
  --bg: #f3f1ec;
  --fg: #151514;
  --muted: #6d6a64;
  --line: rgba(21, 21, 20, .14);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
  animation: fade-in .7s var(--ease) both;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }

/* Display type: wide, spaced capitals, like a title card */
.display {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .14em;
  line-height: 1.1;
  margin: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.6rem var(--pad);
  background: linear-gradient(var(--bg) 40%, transparent);
}

.site-header .name {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .9rem;
}

.site-nav { display: flex; gap: clamp(1.25rem, 3vw, 2.75rem); }

.site-nav a {
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .18em;
  color: var(--muted);
  transition: color .3s;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--fg); }

main { padding-top: 6.5rem; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ---------- Intro (reel) ---------- */

.intro {
  position: relative;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: #000;
  color: #f0ede6;
}

.intro video,
.intro .reel-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.intro::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(0,0,0,.15), rgba(0,0,0,.65) 85%),
    linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.45));
}

.intro-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.4rem;
  padding: var(--pad);
}

.intro h1 {
  font-size: clamp(1.9rem, 6vw, 5.25rem);
  letter-spacing: .2em;
  margin-right: -.2em; /* balance trailing letter-spacing */
}

.intro .roles {
  margin: 0;
  font-size: clamp(.85rem, 1.2vw, 1rem);
  text-transform: uppercase;
  letter-spacing: .3em;
  color: rgba(240, 237, 230, .75);
}

.enter {
  margin-top: 2.5rem;
  display: inline-block;
  padding: 1rem 3.2rem;
  border: 1px solid rgba(240, 237, 230, .6);
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .35em;
  text-indent: .35em;
  transition: background .4s var(--ease), color .4s var(--ease), border-color .4s;
}

.enter:hover,
.enter:focus-visible {
  background: #f0ede6;
  color: #0c0c0b;
  border-color: #f0ede6;
  outline: none;
}

@media (prefers-reduced-motion: reduce) {
  .intro video { display: none; }
}

/* ---------- Film index ---------- */

.posters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.25rem, 3vw, 3rem);
  padding-top: clamp(1rem, 4vh, 3rem);
  padding-bottom: 6rem;
}

.poster-card { display: block; }

.poster-card .frame {
  overflow: hidden;
  aspect-ratio: 2 / 3;
  background: #1a1a19;
}

.poster-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease), opacity .5s;
}

.posters:has(.poster-card:hover) .poster-card:not(:hover) img { opacity: .4; }
.posters .poster-card:hover img { transform: scale(1.025); }

/* ---------- Film detail ---------- */

.film-hero {
  position: relative;
  height: 82vh;
  min-height: 420px;
  margin-top: -6.5rem;
  overflow: hidden;
}

.film-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.film-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 45%, var(--bg));
}

.film-hero h1 {
  position: absolute;
  z-index: 2;
  left: var(--pad);
  right: var(--pad);
  bottom: clamp(1.5rem, 5vh, 3.5rem);
  font-size: clamp(2.2rem, 7vw, 6.5rem);
  letter-spacing: .16em;
}

.film-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
  padding-top: 3rem;
  padding-bottom: 5rem;
}

.film-intro .poster {
  width: 100%;
  max-width: 360px;
}

.logline {
  margin: 0 0 1.25rem;
  font-size: clamp(1.3rem, 2.2vw, 1.85rem);
  line-height: 1.35;
  font-weight: 300;
  max-width: 30ch;
}

.meta {
  margin: 0 0 3rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .95rem;
}

.film-details {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2.5rem;
  border-top: 1px solid var(--line);
  padding-top: 2rem;
}

.film-details h2 {
  font-size: .95rem;
  margin-bottom: 1.1rem;
  color: var(--muted);
}

.credits, .selections {
  margin: 0;
  padding: 0;
  list-style: none;
}

.credits div { margin-bottom: .9rem; }
.credits dt { color: var(--muted); }
.credits dd { margin: 0; }

.selections li { margin-bottom: .9rem; }
.selections span { display: block; color: var(--muted); }

.trailer {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  margin-bottom: clamp(3rem, 8vw, 6rem);
}

.trailer iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.stills {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(.75rem, 1.5vw, 1.5rem);
  padding-bottom: clamp(4rem, 10vw, 8rem);
}

.stills .wide { grid-column: 1 / -1; }


/* ---------- Photo ---------- */

.page-title {
  font-size: clamp(1.8rem, 4.5vw, 3.75rem);
  padding: clamp(1rem, 4vh, 2.5rem) 0 clamp(2rem, 5vh, 3.5rem);
}

.categories {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2.5vw, 2.5rem);
  padding-bottom: 6rem;
}

.category .frame {
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #ddd9d1;
}

.category img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}

.category:hover img { transform: scale(1.03); }

.category h2 {
  margin-top: 1.3rem;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
}

.photo-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
}

.photo-tabs { display: flex; gap: clamp(1rem, 2.5vw, 2rem); }

.photo-tabs a {
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .9rem;
  color: var(--muted);
  padding-bottom: .3rem;
  border-bottom: 1px solid transparent;
  transition: color .3s, border-color .3s;
}

.photo-tabs a:hover { color: var(--fg); }
.photo-tabs a[aria-current="page"] { color: var(--fg); border-color: var(--fg); }

.gallery {
  columns: 3;
  column-gap: clamp(.5rem, 1vw, .85rem);
  padding-bottom: 6rem;
}

.gallery a {
  display: block;
  break-inside: avoid;
  margin-bottom: clamp(.5rem, 1vw, .85rem);
  background: #ddd9d1;
}

.gallery img { width: 100%; transition: opacity .3s; }
.gallery a:hover img { opacity: .85; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(243, 241, 236, .98);
  padding: clamp(1rem, 4vw, 3.5rem);
}

.lightbox.open { display: flex; animation: fade-in .3s ease both; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: var(--fg);
  font: inherit;
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .9rem;
  cursor: pointer;
  padding: 1rem;
}

.lightbox .lb-close { top: .75rem; right: calc(var(--pad) - 1rem); }
.lightbox .lb-prev { left: calc(var(--pad) - 1rem); top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: calc(var(--pad) - 1rem); top: 50%; transform: translateY(-50%); }

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 560px);
  justify-content: center;
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
  min-height: calc(100vh - 6.5rem);
  padding-bottom: 4rem;
}

.about img { width: 100%; max-width: 300px; }

.about h1 { font-size: clamp(1.8rem, 4vw, 3.5rem); margin-bottom: 2rem; }

.about .bio p {
  margin: 0 0 1rem;
  font-size: clamp(1.1rem, 1.6vw, 1.35rem);
  font-weight: 300;
  max-width: 34ch;
}

.contact {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 1.1rem;
}

.contact div span {
  display: block;
  color: var(--muted);
  font-size: .95rem;
}

.contact a { border-bottom: 1px solid var(--line); transition: border-color .3s; }
.contact a:hover { border-color: var(--fg); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .posters { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .film-intro { grid-template-columns: 1fr; }
  .film-intro .poster { max-width: 260px; }
  .categories { grid-template-columns: 1fr; max-width: 520px; margin: 0 auto; }
  .gallery { columns: 2; }
}

@media (max-width: 600px) {
  .about { grid-template-columns: 1fr; justify-content: stretch; min-height: 0; }
  .about img { max-width: 220px; }
  body { font-size: 16px; }
  .site-header { flex-direction: column; gap: .8rem; padding-top: 1.2rem; }
  main { padding-top: 7.5rem; }
  .film-hero { margin-top: -7.5rem; height: 70vh; }
  .film-details { grid-auto-flow: row; }
  .stills { grid-template-columns: 1fr; }
  .gallery { columns: 1; }
  .photo-tabs { flex-wrap: wrap; }
}

/* Trailer placeholder (remove once a real embed is in) */

.trailer-placeholder span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(1rem, 2vw, 1.4rem); color: var(--muted);
}
.trailer-placeholder { border: 1px solid var(--line); background: transparent; }

/* Film titles, matched to each poster */
.film-hero .title-image { line-height: 0; }
.film-hero .title-image img {
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 24px rgba(0, 0, 0, .55));
}

.film-hero .title-skylight {
  font-family: "Jost", "Futura", "Avenir Next", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .42em;
  line-height: 1;
  margin-right: -.42em;
  color: #e4f2ff;
  text-shadow: 0 0 .25em rgba(120, 190, 255, .55), 0 0 .8em rgba(80, 150, 230, .35);
}


/* ---------- Photo landing: full-screen category panels ---------- */

.panels {
  display: flex;
  gap: 3px;
  height: 100vh;
  height: 100svh;
  padding-top: 4.75rem;
}

.panel {
  position: relative;
  flex: 1 1 0;
  overflow: hidden;
  background: #1a1a19;
  transition: flex-grow .9s var(--ease);
}

.panel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 25%;
  transition: transform 1.4s var(--ease), filter .7s var(--ease);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 55%, rgba(0, 0, 0, .55));
  pointer-events: none;
}

.panel h2 {
  position: absolute;
  z-index: 2;
  left: clamp(1.25rem, 3vw, 2.75rem);
  bottom: clamp(1.25rem, 4vh, 2.75rem);
  color: #f3f1ec;
  font-size: clamp(1.4rem, 2.8vw, 2.75rem);
  letter-spacing: .14em;
  right: clamp(1.25rem, 3vw, 2.75rem);
}

.panels:has(.panel:hover) .panel:not(:hover) img { filter: brightness(.55) grayscale(.4); }
.panel:hover { flex-grow: 1.5; }
.panel:hover img { transform: scale(1.03); }

/* Layout follows the window shape, not just its width:
   landscape windows get three tall columns; portrait windows
   (phones, upright tablets, narrow windows) get full-width panels
   close to the photos' own 4:5 shape, and the page scrolls. */
@media (max-aspect-ratio: 6/5) {
  .panels { flex-direction: column; height: auto; }
  .panel { flex: none; width: 100%; aspect-ratio: 4 / 5; max-height: 85vh; max-height: 85svh; }
  .panel:hover { flex-grow: 0; }
  .panels:has(.panel:hover) .panel:not(:hover) img { filter: none; }
}

@media (max-width: 600px) {
  .panels { padding-top: 7.5rem; }
}

/* Lightbox arrows */
.lightbox .lb-prev, .lightbox .lb-next { line-height: 0; opacity: .7; transition: opacity .2s; }
.lightbox .lb-prev:hover, .lightbox .lb-next:hover { opacity: 1; }
.lightbox .lb-prev svg, .lightbox .lb-next svg { display: block; }

/* Photo landing: titles centred across the bottom */
.panel h2 {
  left: 1rem;
  right: 1rem;
  text-align: center;
  font-size: clamp(.95rem, 1.5vw, 1.5rem);
  letter-spacing: .22em;
  margin-right: -.22em; /* balance trailing letter-spacing */
  text-shadow: 0 1px 18px rgba(0, 0, 0, .35);
}

/* Hidden from view, still read by screen readers and search engines */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* About: Instagram / IMDb links */
.contact .links { display: flex; gap: 1.75rem; }
.contact .links { align-items: center; gap: 1.25rem; }
.contact .links a { border: 0; line-height: 0; color: var(--muted); transition: color .3s; }
.contact .links a:hover { color: var(--fg); }

/* Video clips in galleries and the viewer */
.gallery video { display: block; width: 100%; height: auto; }
.lightbox video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.lightbox [hidden] { display: none; }

/* Gallery in reading order (set up by js/lightbox.js) */
.gallery.rows { columns: auto; display: flex; align-items: flex-start; gap: clamp(.5rem, 1vw, .85rem); }
.gallery.rows .gallery-col { flex: 1 1 0; min-width: 0; }

/* ---------- Ink transition between dark and light pages (js/transition.js) ---------- */
/* arriving: hold the previous page's colour until the ink takes over */
html.ink-in body { animation: none; }
html.ink-incoming body::after {
  content: ""; position: fixed; inset: 0; z-index: 9998; background: #0c0c0b;
}
html.ink-incoming[data-ink-from="light"] body::after { background: #f3f1ec; }
/* leaving: the old page quietly fades out under the spreading ink */
body.ink-leaving > *:not(.transition-canvas) { opacity: 0; transition: opacity .3s ease; }
/* Enter: the welcome reel fades to black before the Film page fades up */
body.enter-leaving .intro { opacity: 0; transition: opacity .45s ease; }
/* Switching photo category: the menus stay and the photos crossfade.
   The native page crossfade is on site-wide here, but js/transition.js skips
   it for every navigation except a category switch. */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .55s; animation-timing-function: ease; }
html.tab-in body { animation: none; }
/* browsers without the crossfade: photos fade out, then the new set fades in once ready */
body.tab-leaving .gallery { opacity: 0; transition: opacity .25s ease; }
html.tab-fade .gallery { opacity: 0; }
html.tab-fade.tab-ready .gallery { opacity: 1; transition: opacity .5s var(--ease); }

/* ---------- Title card: poster → film page, and a dip back (js/transition.js) ---------- */
/* Both pages run the same timeline; the arriving page joins it part-way
   through (a negative delay), so the card carries straight across. */
@keyframes card-black { 0% { opacity: 0; } 25%, 72% { opacity: 1; } 100% { opacity: 0; } }
@keyframes card-title {
  0%, 22% { opacity: 0; transform: scale(.985); }
  42%, 62% { opacity: 1; }
  78% { opacity: 0; }
  100% { opacity: 0; transform: scale(1.015); }
}
@keyframes film-dip { 0% { opacity: 0; } 40%, 55% { opacity: 1; } 100% { opacity: 0; } }

.card-black,
html.card-in body::before {
  content: ""; position: fixed; inset: 0; z-index: 9990; pointer-events: none;
  background: #0c0c0b; animation: card-black 1.6s linear both;
}
.card-stage.film-hero {
  position: fixed; inset: 0; z-index: 9991; height: auto; min-height: 0; margin: 0;
  overflow: visible; display: grid; place-items: center; pointer-events: none;
}
.card-stage.film-hero::after { display: none; }
.card-stage.film-hero h1 { position: static; margin: 0; animation: card-title 1.6s linear both; }
/* arriving: the page's own title is the card until the card has faded */
html.card-in body { animation: none; }
html.card-in body::before { animation-delay: var(--card-delay, 0ms); }
html.card-in .film-hero h1 {
  position: fixed; inset: 0; z-index: 9991; margin: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  animation: card-title 1.6s linear both; animation-delay: var(--card-delay, 0ms);
}

/* back to the Film page: a short dip to black */
.dip-black,
html.dip-in body::before {
  content: ""; position: fixed; inset: 0; z-index: 9990; pointer-events: none;
  background: #0c0c0b; animation: film-dip 1.2s linear both;
}
html.dip-in body { animation: none; }
html.dip-in body::before { animation-delay: var(--dip-delay, 0ms); }
