/* Shared static stylesheet. Exactly two text sizes: small and large. */
@font-face {
  font-family: Aareal;
  src: url('../assets/fonts/ABCAreal-Regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Aareal;
  src: url('../assets/fonts/ABCAreal-RegularItalic.woff2') format('woff2');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
:root {
  --small: 14px;
  --large: 36px;
  --text: #e8e6df;
  --background: #0c0c0c;
  --line: #30302c;
  --blank: #ccc;
  /* Match the TV’s visible chassis; reserve space for the Home header/footer. */
  --site-width: min(72vw, 1180px, calc((100dvh - 222px) * 1550 / 1554));
  font-family: Aareal, Arial, sans-serif;
  font-synthesis: none;
  color: var(--text);
  background: var(--background);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-size: var(--small);
  line-height: 1.65;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button, input, textarea, select { font: inherit; color: inherit; }
small, time, h2, h3, h4, h5, h6, sup, sub { font-size: var(--small); }
h1, .identity > span { font-size: var(--large); line-height: 1.15; }
h1, .identity > span, .filmography-heading { text-transform: uppercase; }
h1, h2, h3, h4, h5, h6, strong, b { font-weight: 400; }
h1, h2, p, figure { margin: 0; }
img { display: block; max-width: 100%; }
svg { flex-shrink: 0; }
[hidden] { display: none !important; }
a:focus-visible, button:focus-visible {
  outline: 1px solid var(--text);
  outline-offset: 5px;
}
.shell {
  width: var(--site-width);
  max-width: calc(100vw - 32px);
  margin-inline: auto;
}
.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;
}
.skip-link {
  position: fixed;
  top: 8px;
  left: 20px;
  padding: 8px 14px;
  background: var(--background);
  transform: translateY(-160%);
  z-index: 10;
}
.skip-link:focus { transform: none; }

/* The same three navigation items on every page. */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 12px 24px;
  padding-block: 32px 48px;
}
.main-nav { display: flex; align-items: center; gap: 12px; padding-top: 5px; }
.main-nav a, .languages a { padding-block: 3px; }
.main-nav a[aria-current], .languages a[aria-current] {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.identity { display: flex; flex-direction: column; text-align: right; }
.identity > span { letter-spacing: 0; }
.identity:hover { text-decoration: none; }
.languages { grid-column: 2; justify-self: end; display: flex; gap: 9px; }

/* Home: the main row is the viewport space left after the header and Contact. */
.home {
  height: 100dvh;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.home .site-header { padding-bottom: 20px; }
.home main {
  min-height: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* The visible chassis spans roughly x=198…1748 in the 1989px PNG.
   Keep its original image/screen coordinates inside a shared-width outer rail. */
.tv-reel {
  position: relative;
  isolation: isolate;
  overflow: clip;
  width: 100%;
  aspect-ratio: 1550 / 1554;
}
.tv-image {
  position: absolute;
  top: 0;
  left: calc(-198 / 1550 * 100%);
  width: calc(1989 / 1550 * 100%);
  aspect-ratio: 1989 / 1554;
}
.tv-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: auto;
  pointer-events: none;
}
.tv-screen {
  position: absolute;
  left: 17%;
  top: 14%;
  width: 64%;
  height: 61.5%;
  overflow: hidden;
  border-radius: 7% / 9%;
  /* Transparent at rest: the original opening shows the page's soft black. */
}
.reel-poster, .reel-motion {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* The screen itself is the accessible playback button; no fake controls or text. */
.reel-control {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  cursor: pointer;
}
.reel-control:focus-visible { outline-offset: -6px; }

/* Direct email link: no panel, tooltip or JavaScript. */
.site-footer { display: flex; justify-content: center; margin-top: 72px; padding-block: 18px; }
.home .site-footer { margin-top: 0; padding-block: 10px; }
.contact-link { display: flex; align-items: center; justify-content: center; min-height: 44px; }
.contact-link:hover, .contact-link:focus-visible { text-decoration: underline; text-underline-offset: 4px; }

/* Project index: one 16:9 still per project within the shared shell. */
.page-heading { margin-block: 12px 48px; }
.project-row { margin-bottom: 80px; }
.project-row:last-child { margin-bottom: 0; }
.project-row h2 { margin-bottom: 24px; }
.project-row > .media-block:hover { opacity: .9; }
.media-block { display: block; position: relative; aspect-ratio: 16 / 9; background: var(--blank); overflow: hidden; }
.media-block img, .media-block iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
/* Hide the element until its file loads; an absent file leaves only the grey block. */
img[data-fallback] { visibility: hidden; }
img[data-fallback].is-loaded { visibility: visible; }

/* About portrait only; project covers, Home and detail media stay in colour. */
.image-bw-hover {
  filter: grayscale(100%);
  transition: filter 220ms ease;
}
.image-bw-hover:focus-visible,
.about-bio:focus-within .image-bw-hover { filter: grayscale(0%); }
@media (hover: hover) and (pointer: fine) {
  .image-bw-hover:hover,
  a:hover > .image-bw-hover { filter: grayscale(0%); }
}
@media (prefers-reduced-motion: reduce) {
  .image-bw-hover { transition: none; }
}

/* Existing project detail structure. */
.project-detail { width: 100%; }
.project-hero.has-media { aspect-ratio: auto; background: transparent; }
.project-hero.has-media img, .project-reel { display: block; width: 100%; height: auto; }
.detail-topline { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.project-info { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; margin-top: 40px; }
dl { margin-top: 24px; }
dl > div { display: flex; gap: 24px; margin-top: 8px; }
dd { margin: 0; }
.project-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; margin-top: 48px; }
.project-gallery img { width: 100%; height: auto; }
.project-pagination { display: flex; justify-content: space-between; gap: 30px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.project-pagination a { display: flex; flex-direction: column; gap: 8px; max-width: 45%; }
.project-pagination a:last-child { text-align: right; }

/* About and writings use the small size for all body text and metadata. */
.about-page { margin-top: 12px; }
.about-page h1 { margin-bottom: 40px; }
.about-bio { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.about-bio img { width: 100%; height: auto; }
.about-bio a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.about-copy p {margin: 0;}

.about-copy p + p {
  margin-top: 1.5rem;
}
.filmography-section { margin-top: 40px; }
.filmography-heading { font-size: var(--large); line-height: 1.15; }
.filmography-category { margin-top: 28px; }
.filmography-category h3 { margin: 0 0 14px; }
.filmography { list-style: none; padding: 0; margin: 0; }
.filmography li { margin-bottom: 14px; }
.filmography-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) minmax(0, .65fr); column-gap: 24px; align-items: start; }
.filmography em { font-style: italic; }
.writing-list { padding: 0; margin: 0; list-style: none; }
.writing-row { display: flex; justify-content: space-between; gap: 30px; padding-block: 18px; border-bottom: 1px solid var(--line); }
.writing-row > span { flex-shrink: 0; }
.writing-article { max-width: 660px; margin: 12px auto 0; }
.writing-article header { margin-top: 40px; }
.writing-article h1 { margin-bottom: 24px; }
.prose { margin-top: 40px; line-height: 1.8; overflow-wrap: anywhere; }
.prose p { margin-bottom: 24px; }
.source-text p { white-space: pre-line; }
.prose h2, .prose h3 { margin-block: 36px 24px; }
.prose a { text-decoration: underline; text-underline-offset: 4px; }
.prose blockquote { margin: 24px 0; padding-left: 20px; border-left: 1px solid var(--line); }

@media (max-width: 850px) {
  .project-info { gap: 30px; }
}
@media (max-width: 600px) {
  :root { --large: 28px; --site-width: calc(100vw - 32px); }
  .site-header { padding-top: 20px; gap: 12px; }
  .identity { grid-column: 1 / -1; grid-row: 1; justify-self: end; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; gap: 6px; }
  .languages { grid-column: 1 / -1; grid-row: 3; }
  .home .site-header { padding-bottom: 12px; }
  .project-info, .project-gallery { grid-template-columns: 1fr; }
  .about-bio { grid-template-columns: 1fr; }
  .filmography-row { grid-template-columns: 1fr; row-gap: 8px; }
  .filmography li { margin-bottom: 28px; }
  .project-row { margin-bottom: 56px; }
  .project-info { gap: 24px; margin-top: 28px; }
  .writing-row { flex-direction: column; gap: 8px; }
  .page-heading { margin-bottom: 36px; }
}
/* Short landscape windows need a compact header to preserve the shared TV rail. */
@media (max-height: 650px) and (min-width: 601px) {
  :root { --site-width: min(72vw, 1180px, calc((100dvh - 150px) * 1550 / 1554)); }
  .site-header { padding-block: 0 28px; gap: 0; }
  .identity { grid-column: 1 / -1; grid-row: 1; justify-self: end; }
  .main-nav { grid-column: 1; grid-row: 2; gap: 8px; }
  .languages { grid-column: 2; grid-row: 2; align-self: end; }
  .home .site-header { padding-bottom: 8px; }
  .home .site-footer { padding-block: 0; }
  .project-info { grid-template-columns: 1fr; gap: 24px; }
}
