:root {
  --paper: #f4f3ef;
  --ink: #141414;
  --muted: #5f5e5a;      /* 6.1:1 on --paper */
  --line: #d6d4cd;
  --tile: #e7e5df;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --gutter: 16px;
  --header-h: 56px;
}

@media (min-width: 768px) {
  :root { --gutter: 32px; --header-h: 64px; }
}
@media (min-width: 1200px) {
  :root { --gutter: 48px; }
}

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

/* Rows and cards set their own display, which would otherwise override the hidden attribute used by the filters. */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.label {
  font: 400 12px/1.4 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

.skip {
  position: absolute; left: var(--gutter); top: -100px;
  background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 100;
}
.skip:focus { top: 8px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.wordmark { font: 400 22px/1 var(--serif); text-decoration: none; }
.site-header ul { display: flex; gap: 20px; }
.site-header nav a { font-size: 14px; text-decoration: none; }
.site-header nav a:hover { text-decoration: underline; }

/* Intro */
.intro {
  min-height: calc(62svh - var(--header-h));
  display: flex; flex-direction: column; justify-content: flex-end; gap: 20px;
  padding: 48px var(--gutter) 28px;
  border-bottom: 1px solid var(--line);
}
.intro h1 {
  font: 400 clamp(44px, 10.5vw, 132px)/0.95 var(--serif);
  letter-spacing: -0.015em;
  max-width: 13ch;
}
.intro h1 em { font-style: italic; }
.intro-meta {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 24px; color: var(--muted);
}
.intro-meta a { text-decoration: none; }

/* Section shell */
.work, .about, .contact { padding: 56px var(--gutter); }
@media (min-width: 768px) {
  .work, .about, .contact { padding-top: 88px; padding-bottom: 88px; }
}

.section-head {
  display: flex; flex-direction: column; gap: 20px;
  margin-bottom: 28px;
}
@media (min-width: 900px) {
  .section-head { flex-direction: row; justify-content: space-between; align-items: baseline; }
}
.count { color: var(--muted); margin-left: 6px; }

.controls {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 28px;
}
.filters, .views { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; }
.filters button, .views button {
  font: 400 12px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); padding: 6px 0; min-height: 32px;
}
.filters button[aria-pressed="true"], .views button[aria-pressed="true"] {
  color: var(--ink); text-decoration: underline; text-underline-offset: 0.35em;
}
.filters button:hover, .views button:hover { color: var(--ink); }

/* Index view */
.index-head { display: none; }
.index-list { border-top: 1px solid var(--ink); }
.row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  grid-template-areas:
    "num title year"
    ".   meta  meta";
  gap: 2px 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.row .num { grid-area: num; font: 400 12px/1.9 var(--mono); color: var(--muted); }
.row .title { grid-area: title; font: 400 24px/1.1 var(--serif); }
.row .title small { display: block; font: 400 13px/1.4 var(--sans); color: var(--muted); margin-top: 4px; }
.row .role, .row .prod { font-size: 14px; color: var(--muted); }
.row .meta { grid-area: meta; display: flex; flex-direction: column; }
.row .year { grid-area: year; font: 400 12px/1.9 var(--mono); color: var(--muted); text-align: right; }
.row .play-tag { display: inline-block; margin-left: 8px; font: 400 11px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle; border: 1px solid currentColor; padding: 4px 6px 3px; }

.row-button {
  display: contents;
}
.row.is-playable { cursor: pointer; }
.row.is-playable:hover .title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.15em; }

@media (min-width: 900px) {
  .index-head, .row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.2fr) 64px;
    grid-template-areas: "num title role prod year";
    column-gap: 24px;
    align-items: baseline;
  }
  .index-head { padding: 0 0 10px; }
  .index-head span:last-child { text-align: right; }
  .row { padding: 18px 0; transition: padding 0.2s ease; }
  .row .meta { display: contents; }
  .row .role { grid-area: role; color: var(--ink); }
  .row .prod { grid-area: prod; }
  .row .title { font-size: 28px; }
  .row:hover { padding-left: 8px; }
}

/* Hover preview (desktop index only) */
.hover-preview {
  position: fixed; left: 0; top: 0; z-index: 15;
  width: 220px; pointer-events: none;
  opacity: 0; transition: opacity 0.15s ease;
  will-change: transform;
}
.hover-preview.is-visible { opacity: 1; }
.hover-preview img { width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.18); }
@media (hover: none), (max-width: 899px) { .hover-preview { display: none; } }

/* Grid view */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 12px;
}
@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 44px 24px; } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card { display: flex; flex-direction: column; gap: 10px; }
.card.is-wide { grid-column: 1 / -1; }
@media (min-width: 768px) { .card.is-wide { grid-column: span 2; } }

.card-media {
  position: relative; display: block; width: 100%;
  aspect-ratio: 2 / 3; overflow: hidden; background: var(--tile);
}
.card.is-wide .card-media { aspect-ratio: 16 / 9; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card:hover .card-media img { transform: scale(1.02); }

.card-media.is-blank {
  display: flex; align-items: flex-end; padding: 14px;
  font: 400 clamp(26px, 4vw, 40px)/1 var(--serif);
}
.card-media.is-blank .label { position: absolute; top: 14px; left: 14px; color: var(--muted); }

.play {
  position: absolute; left: 14px; bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--paper); color: var(--ink);
  font: 400 12px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 9px 12px 8px;
}
.play::before { content: ""; width: 0; height: 0; border-left: 8px solid currentColor; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

.card-cap { display: grid; gap: 2px; }
.card-cap .t { font: 400 20px/1.15 var(--serif); }
.card-cap .r { font-size: 13px; color: var(--muted); }

/* About */
.about { border-top: 1px solid var(--line); }
.about > h2 { margin-bottom: 28px; }
.about-body { display: grid; gap: 32px; }
.portrait { margin: 0; max-width: 520px; }
.portrait img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: grayscale(1); }
.bio { display: grid; gap: 18px; max-width: 60ch; font-size: 17px; }
.bio .lede { font: 400 clamp(28px, 4vw, 42px)/1.1 var(--serif); }
.links { display: grid; margin-top: 12px; border-top: 1px solid var(--ink); }
.links a {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 14px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.links a:hover { text-decoration: underline; }

@media (min-width: 900px) {
  .about-body { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; align-items: start; }
  .bio { padding-top: 4px; }
}

/* Contact */
.contact {
  border-top: 1px solid var(--line); padding-bottom: 96px;
  /* Tall enough that the nav's Contact link can scroll it to the top of the screen. */
  min-height: calc(100svh - var(--header-h) - 80px);
}
.contact > h2 { margin-bottom: 28px; }
.contact-line { color: var(--muted); margin-bottom: 8px; }
.email {
  font: 400 clamp(30px, 7.5vw, 96px)/1.05 var(--serif);
  text-decoration: none; overflow-wrap: anywhere;
  border-bottom: 1px solid var(--ink);
}
.email:hover { font-style: italic; }
.email-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 16px 24px; }
.copy {
  border: 1px solid var(--ink); padding: 10px 14px 9px; min-height: 40px;
}
.copy:hover { background: var(--ink); color: var(--paper); }
.copy-status:empty { display: none; }

/* Footer */
.site-footer {
  display: flex; flex-wrap: wrap; gap: 8px 24px;
  padding: 20px var(--gutter) 28px;
  border-top: 1px solid var(--line);
}
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* Video player */
.player {
  width: 100%; max-width: none; height: 100%; max-height: none;
  margin: 0; padding: var(--gutter);
  border: 0; background: #0d0d0d; color: #f4f3ef;
  display: none; flex-direction: column; justify-content: center; gap: 16px;
}
.player[open] { display: flex; }
.player::backdrop { background: #0d0d0d; }
.player-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; width: 100%; max-width: 1280px; margin: 0 auto; }
.player .close { color: #f4f3ef; padding: 8px 0; min-height: 40px; }
.player .close:focus-visible { outline-color: #f4f3ef; }
.player-frame { width: 100%; max-width: 1280px; margin: 0 auto; aspect-ratio: 16 / 9; max-height: calc(100svh - 120px); background: #000; }
.player-frame iframe, .player-frame video { width: 100%; height: 100%; border: 0; display: block; }

.noscript { padding: 0 var(--gutter) 40px; }

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

.row-link { font: inherit; text-align: left; line-height: inherit; }
.grid { grid-auto-flow: dense; }
button.card-media { cursor: pointer; }
.player-bar #player-title { margin-right: auto; }
.player-ext { color: #f4f3ef; text-decoration: none; }
.player-ext:hover { text-decoration: underline; }
@media (min-width: 768px) { .intro { min-height: calc(80svh - var(--header-h)); } }
