/* Colors: light theme by default; content.js SITE.theme = "dark" or "night" switches them */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #777777;
  --tile-bg: #eeeeee;      /* behind images while they load */
  --placeholder: #f2f2f2;  /* empty photo / poster frames */
  --line: #cccccc;         /* underline of text links */
  --accent: currentColor;  /* underline of the active menu item */
  --nav-active: currentColor;  /* text color of the active menu item (currentColor = unchanged) */
  --nav-hover: var(--muted);   /* menu item under the mouse */
  --link-hover: var(--text);   /* text links under the mouse */
  --gutter: 32px;
  --gap: 18px;
  --max: 1400px;
  --font: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --tile-bg: #161616;
  --placeholder: #151515;
  --line: #444444;
  color-scheme: dark;
}

/* Night: black with a slight blue depth. Details stay off-white ("night")
   or take a warm brass touch ("night-brass"), so the images keep their own colors */
:root[data-theme="night"],
:root[data-theme="night-brass"] {
  --bg: #0a0d14;
  --text: #e6e8ee;
  --muted: #8a90a0;
  --tile-bg: #121725;
  --placeholder: #11151f;
  --line: #3a4152;
  --accent: #e6e8ee;
  --nav-hover: #8a90a0;
  --link-hover: #8a90a0;
  color-scheme: dark;
}
/* Brass details, on the blue-black ("night-brass") or the neutral black ("dark-brass") background:
   no underline under the active menu item, the item itself turns brass */
:root[data-theme="dark-brass"] {
  --bg: #0b0b0b;
  --text: #e8e8e8;
  --muted: #8a8a8a;
  --tile-bg: #161616;
  --placeholder: #151515;
  color-scheme: dark;
}
:root[data-theme="night-brass"],
:root[data-theme="dark-brass"] {
  --line: #5a4a2c;
  --accent: transparent;
  --nav-active: #c9a86a;
  --nav-hover: #e3c993;
  --link-hover: #e3c993;
}
/* White background + brass: a darker brass, so it stays readable on white */
:root[data-theme="light-brass"] {
  --line: #e0d2b4;
  --accent: transparent;
  --nav-active: #9a7638;
  --nav-hover: #b8924f;
  --link-hover: #9a7638;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

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

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px var(--gutter) 16px;  /* small bottom: the sticky header covers less of the videos when scrolling */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand { line-height: 1.35; }
.brand-name { font-size: 18px; letter-spacing: 0.02em; text-transform: lowercase; }
.brand-titles { font-size: 11px; letter-spacing: 0.04em; color: var(--muted); text-transform: lowercase; }

.nav { display: flex; gap: 34px; font-size: 14px; letter-spacing: 0.06em; text-transform: lowercase; }
.nav a { position: relative; padding: 2px 0; transition: color .2s; }
.nav a:hover { color: var(--nav-hover); }
.nav a.active { color: var(--nav-active); }
.nav a.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -3px;
  height: 1px; background: var(--accent);
}

.menu-toggle {
  display: none;
  background: none; border: 0; padding: 6px; cursor: pointer;
  width: 34px; height: 34px;
}
.menu-toggle span { display: block; height: 1px; background: var(--text); margin: 6px 0; transition: transform .25s, opacity .25s; }

/* ---------- Project list ---------- */

main { max-width: var(--max); margin: 0 auto; padding: 18px var(--gutter) 60px; }  /* top padding keeps the gap under the header at the top of the page */

/* 6-column grid; each tile's position (--col / --row) is computed in site.js:
   full = 6 columns, big = 4 columns x 2 rows, small = 2 columns, half = 3 columns */
.grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--gap);
}

.tile {
  position: relative; display: block; overflow: hidden; background: var(--tile-bg);
  aspect-ratio: 16 / 9;
  grid-column: var(--col, 1 / -1);
  grid-row: var(--row, auto);
}
/* The big tile takes the height of the two small tiles stacked next to it */
.tile.big { aspect-ratio: auto; }

.tile img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 1.2s ease;
}

/* On hover: no veil, just a small title in the bottom-left corner, over the image or video */
.tile-info {
  position: absolute; left: 0; bottom: 0; z-index: 1;
  padding: 0 18px 16px;
  color: #fff;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity .45s ease;
  pointer-events: none;
}
.tile-title { font-size: 14px; letter-spacing: 0.01em; }
.tile-client { font-size: 11px; color: rgba(255, 255, 255, 0.82); margin-top: 2px; }
.tile.small .tile-info, .tile.third .tile-info { padding: 0 14px 12px; }
.tile.small .tile-title, .tile.third .tile-title { font-size: 13px; }

.tile:hover .tile-info, .tile:focus-visible .tile-info { opacity: 1; }
.tile:hover img { transform: scale(1.02); }

/* Tiles with a preview clip: the video fades in over the image */
.tile-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0;
  transition: opacity .5s ease;
  pointer-events: none;
}
.tile.playing .tile-video { opacity: 1; }
/* The YouTube player is laid out at twice the tile's size, then shrunk to fit: YouTube picks the
   stream quality from the player's size, so this gets a sharper stream (1080p / 4K instead of 360p / 720p).
   --zoom slightly enlarges it so its edges (title bar, logo, cinemascope bars) fall outside the tile. */
.tile-yt { overflow: hidden; background: #000; }
.tile-yt iframe {
  position: absolute; left: 50%; top: 50%;
  width: 200%; height: 200%; border: 0;
  transform: translate(-50%, -50%) scale(calc(var(--zoom, 1.2) / 2));
}

.empty { color: var(--muted); font-size: 14px; padding: 80px 0; text-align: center; }

/* ---------- Film posters (films page) ---------- */

.posters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px var(--gap);
}
.grid + .posters { margin-top: 60px; }

.poster { display: block; }
.poster-img { aspect-ratio: 3 / 4; overflow: hidden; background: var(--placeholder); }
.poster-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s ease; }
.poster:hover .poster-img img { transform: scale(1.02); }
.poster-blank {
  height: 100%; padding: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
}
.poster-blank strong { font-weight: 500; font-size: 15px; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1.4; }
.poster-blank span { margin-top: 10px; font-size: 11px; color: var(--muted); }
.poster-caption { padding-top: 10px; font-size: 14px; line-height: 1.5; }
.poster-caption .meta { font-size: 12px; color: var(--muted); }

/* ---------- Project page ---------- */

.player { position: relative; aspect-ratio: 16 / 9; background: #000; }
.player iframe, .player img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }

.project-meta { padding: 26px 0 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.project-meta h1 { font-size: 20px; font-weight: 400; margin: 0 0 6px; }
.project-meta .client { color: var(--muted); font-size: 14px; margin: 0; }
.project-meta .credits { font-size: 13px; line-height: 1.8; color: var(--muted); margin: 0; padding: 0; list-style: none; }
.project-meta .credits strong { color: var(--text); font-weight: 400; }

.stills { display: grid; gap: var(--gap); margin-top: 30px; }

.pager { display: flex; justify-content: space-between; font-size: 13px; margin-top: 50px; text-transform: lowercase; }
.pager a { color: var(--muted); transition: color .2s; }
.pager a:hover { color: var(--link-hover); }

/* ---------- Text pages ---------- */

.page-text { max-width: 640px; padding: 40px 0; font-size: 15px; line-height: 1.7; }
.page-text h1 { font-size: 20px; font-weight: 400; margin: 0 0 24px; }
.page-text p { margin: 0 0 18px; }
.page-text .muted { color: var(--muted); }
.contact-list { list-style: none; padding: 0; margin: 30px 0 0; }
.contact-list li { margin-bottom: 8px; }
.contact-list a { border-bottom: 1px solid var(--line); transition: border-color .2s; }
.contact-list a:hover { border-color: var(--link-hover); color: var(--link-hover); }

.text-link { border-bottom: 1px solid var(--line); transition: border-color .2s, color .2s; }
.text-link:hover { border-color: var(--link-hover); color: var(--link-hover); }

/* Read by search engines and screen readers, not shown on screen */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

.about {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 60px;
  align-items: start;
  padding-top: 40px;
}
.about-photo { aspect-ratio: 4 / 5; overflow: hidden; background: var(--placeholder); }
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.about-text { padding-top: 0; }
.about-text a { border-bottom: 1px solid var(--line); transition: border-color .2s; }
.about-text a:hover { border-color: var(--link-hover); color: var(--link-hover); }

/* ---------- Footer ---------- */

.site-footer {
  max-width: var(--max); margin: 0 auto;
  padding: 0 var(--gutter) 40px;
  font-size: 11px; color: var(--muted);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  text-transform: lowercase;
}
.site-footer a:hover { color: var(--link-hover); }
.site-footer .links { display: flex; gap: 18px; }

/* ---------- Page transitions: 0.3 s fade in on load, fade out before leaving (site.js) ----------
   Only the content fades: the header (name + menu) stays in place from one page to the next. */

/* "backwards" (not "both"): once the fade-in ends it releases opacity, so the fade-out can run */
main, .site-footer { animation: page-in .3s ease backwards; }
body.leaving main, body.leaving .site-footer { opacity: 0; transition: opacity .3s ease; }
@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Fade in ---------- */

.reveal { opacity: 0; transform: translateY(14px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Mobile ---------- */

@media (max-width: 860px) {
  :root { --gutter: 16px; --gap: 12px; }
  .site-header { padding: 22px var(--gutter) 12px; }
  main { padding-top: 8px; }
  .menu-toggle { display: block; }
  .nav {
    position: fixed; inset: 70px 0 0 0;
    background: var(--bg);
    flex-direction: column; gap: 22px;
    padding: 30px var(--gutter);
    font-size: 22px;
    opacity: 0; pointer-events: none;
    transition: opacity .25s;
  }
  .menu-open .nav { opacity: 1; pointer-events: auto; }
  .menu-open .menu-toggle span:first-child { transform: translateY(3.5px) rotate(45deg); }
  .menu-open .menu-toggle span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

  /* one column: every tile full width, in project order */
  .grid { grid-template-columns: 1fr; }
  /* no hover on touch: show the title under the image instead */
  .tile { overflow: visible; aspect-ratio: auto; background: none; grid-column: 1 / -1; grid-row: auto; }
  .tile img { aspect-ratio: 16 / 9; height: auto; }
  .tile-info,
  .tile.small .tile-info, .tile.third .tile-info { position: static; opacity: 1; color: inherit; text-shadow: none; padding: 8px 0 10px; }
  .tile-title, .tile.small .tile-title, .tile.third .tile-title { font-size: 14px; }
  .tile-client { font-size: 12px; color: var(--muted); }
  .tile-video { display: none; }

  .project-meta { grid-template-columns: 1fr; gap: 14px; }
  .posters { grid-template-columns: repeat(2, 1fr); gap: 28px var(--gap); }
  .about { grid-template-columns: 1fr; gap: 28px; padding-top: 10px; }
  .poster-caption { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  main, .site-footer { animation: none; }
  body.leaving main, body.leaving .site-footer { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .tile img { transition: none; }
}
