/* Layout: a gallery wall. Full-width 16:9 frames alternate with pairs of half frames,
   separated by a thin gap; type stays small and out of the way of the images. */
:root {
  /* Fonts: Cinemate (self-hosted, assets/fonts) for titles and labels; Jost (Google Fonts) for text. */
  --font-display: "Cinemate", "Jost", "Helvetica Neue", Arial, sans-serif;
  --font-sans: "Jost", "Helvetica Neue", Helvetica, Arial, sans-serif;

  --bg: #000000;
  --fg: #ecebe7;
  --muted: #8a8984;
  --line: #262624;
  --frame: #0d0d0c;
  --scrim: rgba(0, 0, 0, 0.55);

  --gap: 10px;
  --gutter: 28px;
  --text: 15px;
  --small: 12.5px;
  color-scheme: dark;
}
/* Graphite: a deep warm grey, softer than pure black (preview option). */
:root[data-bg="graphite"] {
  --bg: #171615;
  --fg: #eceae5;
  --muted: #8f8c86;
  --line: #2c2b28;
  --frame: #1f1e1c;
}

@font-face {
  font-family: "Cinemate";
  src: url("fonts/Cinemate.woff2") format("woff2"), url("fonts/Cinemate.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 var(--text)/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.muted { color: var(--muted); }
.wrap {
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* ---------- header ---------- */
.top {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 10px 32px; padding-block: 26px 24px;
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.brand-name { font: 400 18px var(--font-display); letter-spacing: .06em; }
.brand-role { font-size: 20px; color: var(--fg); opacity: .72; }
.nav { display: flex; flex-wrap: wrap; gap: 6px 26px; font: 13px var(--font-display); letter-spacing: .08em; }
.nav a { color: var(--muted); transition: color .2s; }
.nav a:hover, .nav a[aria-current] { color: var(--fg); }
/* EN / PT switch: the current language bright, the other one muted. */
.lang { margin: 0; display: flex; gap: 10px; font: 12px var(--font-display); letter-spacing: .1em; }
.lang a { color: var(--muted); transition: color .2s; }
.lang a:hover, .lang a[aria-current] { color: var(--fg); }
.lang a + a::before { content: "/"; margin-right: 10px; color: var(--line); }

/* ---------- mosaic ---------- */
.mosaic { display: grid; gap: var(--gap); padding-bottom: 72px; }
.row { display: grid; gap: var(--gap); }
.row--pair { grid-template-columns: 1fr 1fr; }
/* One large frame with two small ones stacked beside it; .row--flip puts the large one on the right. */
.row--trio { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.row--flip { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.row--flip .tile--big { order: 2; }
.stack { display: grid; gap: var(--gap); min-width: 0; }
/* The large frame takes the height of the two stacked small ones. */
.tile--big .tile-media { position: absolute; inset: 0; aspect-ratio: auto; }
.tile { position: relative; display: block; overflow: hidden; background: var(--frame); }
.tile-media { position: relative; display: block; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; }
.tile-media img, .tile-media video { width: 100%; height: 100%; object-fit: cover; }
.tile-media video { position: absolute; inset: 0; opacity: 0; transition: opacity .6s; }
.tile--video.is-playing video { opacity: 1; }
.tile-empty {
  display: grid; place-items: center; height: 100%;
  font: var(--small) var(--font-display); color: var(--muted); letter-spacing: .04em;
}
.tile-cap {
  position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; align-items: end; gap: 16px;
  padding: 48px 20px 16px; color: #fff;
  background: linear-gradient(to top, var(--scrim), transparent);
  opacity: 0; transition: opacity .35s;
}
.tile:hover .tile-cap, .tile:focus-visible .tile-cap { opacity: 1; }
.tile-title { font: 400 15px var(--font-display); letter-spacing: .06em; }
.tile-sub { font-weight: 400; opacity: .8; }
.tile-cat { font: 12px var(--font-display); text-transform: uppercase; letter-spacing: .08em; opacity: .85; }

/* Touch screens have no hover: show captions under the image instead. */
@media (hover: none) {
  .tile { background: transparent; }
  .tile-cap { position: static; opacity: 1; color: var(--fg); background: none; padding: 8px 0 4px; }
  .tile-cat { color: var(--muted); }
}

/* ---------- project ---------- */
.project { padding-bottom: 64px; }
.proj-head { padding-block: 28px 26px; max-width: 60ch; }
.proj-cat { margin: 0 0 10px; font: 12px var(--font-display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.proj-cat a:hover { color: var(--fg); }
.proj-head h1 { margin: 0; font: 400 clamp(28px, 4.2vw, 46px)/1.15 var(--font-display); letter-spacing: .03em; text-wrap: balance; }
.proj-sub { margin: 8px 0 0; font: 16px var(--font-display); letter-spacing: .06em; color: var(--muted); }
.proj-dir { margin: 14px 0 0; color: var(--muted); }

/* View films list / next film, between the titles and the film. */
.film-nav {
  display: flex; justify-content: space-between; gap: 16px; padding-block: 12px;
  border-top: 1px solid var(--line); margin-bottom: 18px;
  font: 12px var(--font-display); text-transform: uppercase; letter-spacing: .1em;
}
.film-nav a { color: var(--muted); transition: color .2s; }
.film-nav a:hover { color: var(--fg); }
.film-nav a:last-child { color: var(--fg); }

.player { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: var(--bg); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player--link { display: block; overflow: hidden; color: #fff; }
.player--link img { width: 100%; height: 100%; object-fit: cover; opacity: .75; transition: opacity .3s; }
.player--link:hover img { opacity: .6; }
.play { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; font: 14px var(--font-display); letter-spacing: .08em; }
.play-icon { width: 64px; height: 64px; border: 1.5px solid #fff; border-radius: 50%; position: relative; }
.play-icon::after {
  content: ""; position: absolute; left: 26px; top: 21px;
  border-left: 16px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent;
}
.player-note { position: absolute; left: 16px; bottom: 12px; font: 12px var(--font-sans); opacity: .75; }

.proj-body {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px 72px;
  padding-block: 44px 52px;
}
.proj-text { max-width: 62ch; min-width: 0; }
.proj-text p { margin: 0 0 1em; }
.todo { padding: 10px 14px; border: 1px dashed var(--muted); color: var(--muted); font-size: var(--small); }
h2 { margin: 0 0 14px; font: 12px var(--font-display); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 400; }
/* Technical details read like a camera report. */
.specs { margin: 28px 0 0; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; }
.specs div { display: grid; grid-template-columns: 9ch minmax(0, 1fr); gap: 16px; }
.specs dt { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; padding-top: 1px; }
.specs dd { margin: 0; }
.selections { margin-top: 32px; }
.selections ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.proj-links { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 20px; }
.proj-links a, .about-links a { border-bottom: 1px solid var(--line); }
.proj-links a:hover, .about-links a:hover { border-color: var(--fg); }

.credits { min-width: 0; }
.credits dl { margin: 0; display: grid; gap: 7px; font-size: 14px; }
.credits div { display: grid; grid-template-columns: minmax(0, 13ch) minmax(0, 1fr); gap: 18px; }
.credits dt { color: var(--muted); }
.credits dd { margin: 0; overflow-wrap: anywhere; }

/* Gallery: every frame the same 16:9 size. */
.stills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.still { margin: 0; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; background: var(--frame); }
.still img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- about ---------- */
.about {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px 64px; align-items: start;
  padding-block: 20px 80px;
}
.about-photo { margin: 0; }
.about-photo img { width: 100%; height: auto; }
.about-text { max-width: 58ch; }
.about-text h1 { margin: 0 0 22px; font: 400 clamp(22px, 2.8vw, 30px)/1.25 var(--font-display); letter-spacing: .04em; text-wrap: balance; }
.about-text p { margin: 0 0 1em; }
.about-links { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 28px !important; }
.about-contact { margin-top: 28px !important; }

/* ---------- footer ---------- */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px;
  padding-block: 28px 36px; border-top: 1px solid var(--line); font-size: var(--small);
}
.foot p { margin: 0; }
.foot a:hover { color: var(--muted); }
.bg-switch { display: flex; align-items: center; gap: 8px; flex-basis: 100%; color: var(--muted); }
.bg-switch button { font: inherit; color: var(--fg); background: none; border: 1px solid var(--line); padding: 3px 10px; cursor: pointer; }
.bg-switch button[aria-pressed="true"] { border-color: var(--fg); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  :root { --gutter: 16px; --gap: 8px; }
  .proj-body, .about { grid-template-columns: minmax(0, 1fr); }
  .stills { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credits div { grid-template-columns: minmax(0, 11ch) minmax(0, 1fr); }
}
@media (max-width: 560px) {
  /* Phones: the large tile full width, its two small tiles side by side underneath. */
  .row--trio, .stills { grid-template-columns: minmax(0, 1fr); }
  .row--flip .tile--big { order: 0; }
  .tile--big .tile-media { position: relative; aspect-ratio: 16 / 9; }
  .stack, .row--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile--small .tile-cap, .tile--half .tile-cap { flex-direction: column; align-items: start; gap: 0; }
  .tile--small .tile-title, .tile--half .tile-title { font-size: 12.5px; }
  .tile--small .tile-sub, .tile--half .tile-sub { display: none; }
  .tile--small .tile-cat, .tile--half .tile-cat { font-size: 10px; }
  /* Header: name and language switch on one line, the menu below. */
  .top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
  .nav { grid-column: 1 / -1; grid-row: 2; gap: 6px 18px; }
  .brand { flex-direction: column; }
  .brand-role { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
