/* Colours are pulled from the cassette logo. */
:root {
  --bg: #0e0e11;
  --surface: #17171c;
  --line: #2a2a31;
  --text: #f2f0eb;
  --muted: #9b99a3;
  --teal: #4fb7b3;
  --yellow: #fbd46a;
  --coral: #f0624a;
  --accent: var(--coral);
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1400px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img, video { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.05; margin: 0; }
.muted { color: var(--muted); }

/* Small spaced capitals: labels above headings, details, form labels. */
.kicker { margin: 0 0 12px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

/* ---------- Header ---------- */
.site-header {
  /* Fixed rather than sticky so it takes no room at the top of the page while hidden. */
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  /* Inner edges line up with the page content, even on very wide screens. */
  padding: 14px max(var(--gutter), (100% - var(--max)) / 2 + var(--gutter));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  transition: background .3s, border-color .3s;
}
/* At the top of the page the header melts into the intro (toggled in main.js). */
.site-header.at-top { background: transparent; backdrop-filter: none; border-bottom-color: transparent; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; font-weight: 600; font-size: 21px; letter-spacing: .01em; line-height: 1; white-space: nowrap; }
/* Hidden while the large name in the intro is on screen (see main.js). */
.brand { transition: opacity .3s, transform .3s; }
.brand.tucked { opacity: 0; transform: translateY(-6px); pointer-events: none; }
/* The nav hides with the name at the top of the page, then both slide in once you scroll. */
.nav { transition: opacity .3s, transform .3s; }
.site-header.at-top .nav { opacity: 0; transform: translateY(-6px); pointer-events: none; }
/* Nav uses the small-caps label type; the section you're in lights up (see main.js). */
.nav { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 32px); font: 500 12px var(--sans); letter-spacing: .16em; text-transform: uppercase; }
.nav a { padding: 6px 0; text-decoration: none; color: var(--muted); transition: color .2s; white-space: nowrap; }
.nav a:hover, .nav a.current { color: var(--text); }
.nav .nav-cta { color: var(--text); border: 1px solid var(--line); padding: 10px 18px; border-radius: 999px; transition: color .2s, border-color .2s, background .2s; }
.nav .nav-cta:hover, .nav .nav-cta.current { color: var(--bg); background: var(--text); border-color: var(--text); }
@media (max-width: 640px) {
  .nav a:not(.nav-cta) { display: none; }
  .nav { letter-spacing: .1em; }
  .nav .nav-cta { padding: 9px 14px; }
  .brand { gap: 10px; font-size: 19px; }
  .brand img { width: 51px; height: auto; }
}
@media (max-width: 360px) {
  .nav { letter-spacing: .06em; }
  .nav .nav-cta { padding: 8px 11px; }
  .brand { font-size: 17px; }
  .brand img { width: 42px; }
}

/* ---------- Intro ---------- */
.intro { max-width: var(--max); margin: 0 auto; padding: clamp(24px, 5vw, 64px) var(--gutter) clamp(40px, 6vw, 80px); }
/* Name + logo above the tagline: this is a personal site, so who it is comes first. */
.identity { display: flex; align-items: center; gap: clamp(14px, 2vw, 22px); margin-bottom: clamp(28px, 4vw, 52px); }
.identity img { width: clamp(72px, 7vw, 93px); height: auto; }
.identity p { margin: 0; line-height: 1.1; }
.identity-name { font-weight: 600; font-size: clamp(26px, 3vw, 38px); letter-spacing: .005em; }
.identity-role { margin-top: 6px !important; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
/* Sized so the longest option ("Sound for documentaries.", ~8.7em) always fits on one line. */
.intro h1 { font-size: clamp(28px, 9.6vw, 140px); letter-spacing: -.02em; white-space: nowrap; }
.intro h1 .mobile-break { display: none; }
/* On phones, split onto two lines so the words can be bigger ("documentaries." alone is ~5.6em). */
@media (max-width: 640px) {
  .intro h1 { font-size: clamp(40px, 14.5vw, 88px); }
  .intro h1 .mobile-break { display: inline; }
}
.intro h1 em { color: var(--yellow); }
.rotator { display: inline-block; white-space: nowrap; }
.rotator em { display: inline-block; transition: opacity .35s ease, transform .35s ease, filter .35s ease; }
.rotator em.out { opacity: 0; transform: translateY(-.25em); filter: blur(4px); }
.rotator em.pre { opacity: 0; transform: translateY(.25em); filter: blur(4px); transition: none; }
.lede { font-size: clamp(18px, 2vw, 22px); color: var(--muted); max-width: 36ch; margin: 0; }
.lede b { font-weight: 400; color: var(--text); }
/* Three-colour rule borrowed from the cassette logo. */
.stripe { display: flex; width: 72px; height: 4px; margin: clamp(24px, 3vw, 32px) 0 20px; border-radius: 2px; overflow: hidden; }
.stripe span { flex: 1; }
.stripe span:nth-child(1) { background: var(--teal); }
.stripe span:nth-child(2) { background: var(--yellow); }
.stripe span:nth-child(3) { background: var(--coral); }

/* ---------- Featured shows ---------- */
/* Follows straight on from the intro, with no heading, so the first trailer sits high on the page. */
.shows { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter) clamp(64px, 10vw, 140px); }
.show-feature { transition: opacity .22s ease, transform .22s ease; }
.show-feature.swapping { opacity: 0; transform: translateY(10px); }
.show-media {
  position: relative; display: block; width: 100%; padding: 0; border: 0; cursor: pointer;
  aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; background: var(--surface);
}
.show-media img, .show-media video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scale(var(--zoom, 1)); transition: transform 1.2s cubic-bezier(.2,.7,.2,1), opacity .6s;
}
.show-media:hover img, .show-media:hover video { transform: scale(calc(var(--zoom, 1) * 1.03)); }
.show-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.65), transparent 55%);
}
.play {
  position: absolute; left: clamp(16px, 3vw, 40px); bottom: clamp(16px, 3vw, 40px); z-index: 1;
  display: inline-flex; align-items: center; gap: 14px;
  font: 500 13px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #fff;
}
.play-icon {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); transition: transform .3s;
}
.play-icon::before { content: ""; margin-left: 4px; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff; }
.show-media:hover .play-icon { transform: scale(1.1); }

/* Details, title, pips, summary: the same order as the intro at the top of the page. */
.show-info { margin-top: clamp(24px, 3vw, 36px); max-width: 62ch; }
.show-info h3 { font-size: clamp(36px, 5.5vw, 72px); }
.show-meta {
  display: flex; flex-wrap: wrap; margin: 0 0 12px; padding: 0; list-style: none;
  font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.show-meta li + li::before { content: "·"; margin: 0 .7em; }
.show-info .stripe { margin: 20px 0 16px; }
.show-blurb { margin: 0; color: var(--muted); font-size: 18px; }

/* Carousel of the other long-form pieces; choosing one moves it into the lead spot. */
.carousel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: clamp(56px, 7vw, 96px) 0 18px; }
.carousel-head .kicker { margin: 0; }
.carousel-arrows { display: flex; gap: 10px; }
.carousel {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(240px, calc((100% - 48px) / 4), 360px); gap: 16px;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
/* With more than four pieces, two rows: newest top-left, then down, then across. */
.carousel.two-rows { grid-template-rows: auto auto; row-gap: 28px; }
.carousel li { scroll-snap-align: start; }
.show-card { display: block; width: 100%; padding: 0; background: none; border: 0; color: inherit; text-align: left; cursor: pointer; }
.show-card-media { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px; background: var(--surface); }
.show-card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(var(--zoom, 1)); transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.show-card:hover .show-card-media img, .show-card:focus-visible .show-card-media img { transform: scale(calc(var(--zoom, 1) * 1.04)); }
.show-card-title { display: block; margin-top: 12px; font: 400 clamp(20px, 1.8vw, 24px)/1.15 var(--serif); transition: color .2s; }
.show-card:hover .show-card-title { color: var(--yellow); }
@media (max-width: 640px) { .carousel { grid-auto-columns: 72%; } .carousel.two-rows { grid-template-rows: none; } }

/* ---------- Archive ---------- */
.archive, .about { max-width: var(--max); margin: 0 auto; padding: clamp(56px, 8vw, 110px) var(--gutter); border-top: 1px solid var(--line); }
.archive h2, .about h2 { font-size: clamp(36px, 5vw, 60px); }
.archive .stripe { margin-bottom: 28px; }

/* Pill buttons (clearly clickable) with the small-caps label type; the active one fills in. */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 32px; }
.filters button {
  padding: 9px 16px; background: none; border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  font: 500 12px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
  transition: color .2s, border-color .2s, background .2s;
}
.filters button:hover { color: var(--text); border-color: var(--muted); }
.filters button[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
/* "Featured" (the curated set) stands apart; everything else groups together. */
.filters button[data-f="Featured"] { margin-right: clamp(16px, 3vw, 32px); }
/* Phones: Featured on its own line, then the four roles in two tidy pairs. */
@media (max-width: 640px) {
  .filters { display: grid; grid-template-columns: auto auto; justify-content: start; justify-items: stretch; }
  .filters button { text-align: center; white-space: nowrap; padding: 9px 12px; letter-spacing: .1em; }
  .filters button[data-f="Featured"] { grid-column: 1 / -1; justify-self: start; margin: 0 0 6px; }
}
@media (max-width: 360px) {
  .filters button { padding: 8px 10px; font-size: 11px; letter-spacing: .06em; }
}

.grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
/* Newly loaded tiles rise in, one after another. */
.grid li.enter { animation: tile-in .5s cubic-bezier(.2,.7,.2,1) var(--delay, 0ms) both; }
@keyframes tile-in { from { opacity: 0; transform: translateY(16px); } }
.grid { transition: opacity .18s ease; }
.grid.leaving { opacity: 0; }
.tile {
  position: relative; display: block; width: 100%; padding: 0; border: 0; border-radius: 4px; cursor: pointer;
  aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); color: #fff; text-align: left;
}
/* --zoom (from projects.json) pushes letterbox bars out of frame on older frame-grab thumbnails. */
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(var(--zoom, 1)); transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .4s; }

/* Hover label: client in small caps, spot title in the serif, then the pips (same pattern as the shows). */
.tile-label {
  position: absolute; inset: auto 0 0 0; padding: 48px 16px 14px;
  background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,.35) 60%, transparent);
  opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s cubic-bezier(.2,.7,.2,1);
}
.tile-client { display: block; margin-bottom: 4px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.tile-label strong { display: block; font: 400 clamp(20px, 1.8vw, 24px)/1.1 var(--serif); }
.tile-pips {
  display: block; width: 28px; height: 3px; margin-top: 10px; border-radius: 2px;
  background: linear-gradient(90deg, var(--teal) 0 33.3%, var(--yellow) 33.3% 66.6%, var(--coral) 66.6%);
}
.tile-play {
  position: absolute; right: 14px; bottom: 14px; display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%; background: var(--accent);
  opacity: 0; transform: scale(.8); transition: opacity .3s, transform .3s cubic-bezier(.2,.7,.2,1);
}
.tile-play::before { content: ""; margin-left: 3px; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent #fff; }

.tile:hover img, .tile:focus-visible img { transform: scale(calc(var(--zoom, 1) * 1.04)); }
.tile:hover .tile-label, .tile:focus-visible .tile-label { opacity: 1; transform: none; }
.tile:hover .tile-play, .tile:focus-visible .tile-play { opacity: 1; transform: none; }
/* Touch screens have no hover, so the label always shows (the play button stays hidden to keep it calm). */
@media (hover: none) { .tile-label { opacity: 1; transform: none; } }

.button {
  display: inline-block; font: 600 15px var(--sans); color: var(--bg); background: var(--text);
  border: 1px solid var(--text); border-radius: 999px; padding: 13px 26px; cursor: pointer; transition: background .2s, color .2s;
}
.button:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.ghost { display: block; margin: 32px auto 0; background: none; color: var(--text); border-color: var(--line); }
.button.ghost:hover { border-color: var(--text); background: none; color: var(--text); }

/* ---------- About ---------- */
.about-body { max-width: 62ch; margin: 0; font-size: clamp(18px, 1.8vw, 21px); color: var(--muted); }
.about-body b, .contact-lede b { font-weight: 400; color: var(--text); }

/* ---------- Contact ---------- */
.contact {
  max-width: var(--max); margin: 0 auto; padding: clamp(64px, 10vw, 140px) var(--gutter);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px clamp(32px, 6vw, 96px);
  border-top: 1px solid var(--line);
}
.contact h2 { font-size: clamp(44px, 7vw, 96px); }
.contact-lede { margin: 0 0 28px; font-size: clamp(18px, 1.8vw, 21px); color: var(--muted); max-width: 36ch; }
.email-link { font-size: 18px; color: var(--yellow); text-decoration: none; border-bottom: 1px solid currentColor; }
.contact-form { display: grid; gap: 18px; align-content: start; }
.contact-form label { display: grid; gap: 8px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.contact-form input, .contact-form textarea {
  font: 16px var(--sans); letter-spacing: normal; text-transform: none; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; resize: vertical;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--teal); }
.contact-form .button { justify-self: start; }
.hp { position: absolute; left: -9999px; }
.form-status { margin: 0; min-height: 1.6em; font-size: 14px; }
.form-status.ok { color: var(--teal); }
.form-status.err { color: var(--coral); }
@media (max-width: 800px) { .contact { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
/* Closes the page the way it opens: name block, then the small print. */
.site-footer {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) var(--gutter) 32px; border-top: 1px solid var(--line);
}
.site-footer a { text-decoration: none; color: var(--muted); transition: color .2s; }
.site-footer a:hover { color: var(--text); }
.footer-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 28px 48px; }
.footer-brand { display: flex; align-items: center; gap: 16px; }
.footer-brand p { margin: 0; line-height: 1.1; }
.footer-name { font-weight: 600; font-size: 24px; }
.footer-brand .kicker { margin-top: 6px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 12px clamp(16px, 2.5vw, 32px); font-size: 15px; }

.footer-base { margin-top: clamp(28px, 4vw, 44px); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .footer-base { flex-direction: column; } }

/* ---------- Video player ---------- */
.player {
  width: min(1200px, 100vw - 2 * var(--gutter)); max-width: none; padding: 0;
  background: transparent; border: 0; color: var(--text); overflow: visible;
}
.player[open] { animation: player-in .35s cubic-bezier(.2,.7,.2,1); }
.player[open]::backdrop { animation: fade-in .35s ease; }
@keyframes player-in { from { opacity: 0; transform: translateY(12px) scale(.985); } }
@keyframes fade-in { from { opacity: 0; } }
.player::backdrop { background: rgba(5,5,7,.94); backdrop-filter: blur(8px); }
.player-frame { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 6px; background: #000; }
.player video { display: block; width: 100%; height: 100%; }
.player-still { width: 100%; height: 100%; object-fit: cover; transform: scale(var(--zoom, 1)); }

/* Same pattern as the shows: details, title, pips. */
.player-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 32px; margin-top: 22px; }
.player-kicker { margin-bottom: 8px; }
.player-kicker:empty { display: none; }
.player-title { font-size: clamp(26px, 3.2vw, 44px); }
.player .stripe { margin: 16px 0 0; }
.player-actions { display: flex; align-items: center; gap: 10px; }
.player-step, .player-close, .round-btn {
  display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  font: 18px/1 var(--sans); color: var(--text); background: none; border: 1px solid var(--line);
  cursor: pointer; transition: border-color .2s, opacity .2s;
}
.player-step:hover:not(:disabled), .player-close:hover, .round-btn:hover:not(:disabled) { border-color: var(--text); }
.player-step:disabled, .round-btn:disabled { opacity: .3; cursor: default; }
.player-cta { margin-left: 8px; text-decoration: none; }
.player-close { position: absolute; top: -58px; right: 0; font-size: 24px; }

/* Only appears during local preview, when a data file has a typo. */
.data-error {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 100; margin: 0; padding: 16px 18px;
  background: #2a1512; border: 1px solid var(--coral); border-radius: 6px;
  font: 13px/1.5 ui-monospace, Menlo, monospace; color: var(--text); white-space: pre-wrap;
}

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