/*
Concept 01 "Frame and index"
Design Read: a director's site for festival programmers and producers, with an index/editorial language,
native CSS, one grotesk with real Cyrillic, stills at true ratio on paper-white.
Dials: DESIGN_VARIANCE 5 / MOTION_INTENSITY 2 / VISUAL_DENSITY 3
Direction:
- Ground #F4F4F1, the cold paper of the winter cemetery frames in Duality; ink #161616; secondary #5C5C5C.
- One accent, #8F2029, sampled from the lit red vestments in duality-04; only the current nav item and the hovered year.
- Onest 400/500 for everything, wordmark included: a grotesk drawn with Cyrillic from the start.
- First screen is one uncropped frame at full bleed, no text on it; the work list is a typographic index with hairlines.
- Motion only in the index: row hover lays three frames out on a stage to the right (desktop, hover devices).
*/

/* Onest is a variable font: one file per subset serves 400 and 500. SIL OFL 1.1, see /fonts/OFL-NOTICE.txt */
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/fonts/onest-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/fonts/onest-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Onest"; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url("/fonts/onest-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --paper: #F4F4F1;
  --ink: #161616;
  --second: #5C5C5C;
  --accent: #8F2029;
  --rule: #D9D9D4;
  /* one content column: every section starts at --margin and ends at --margin + --colw */
  --margin: 9vw;
  --colw: min(63vw, 820px);       /* fits the RU index without overflow; prose about 80 characters a line */
  --g: 24px;                       /* gutter */
  --k: 120px;                      /* key column: years ("2019 - 2022" fits on one line), labels */
  --l2: calc(var(--k) + var(--g)); /* line 2: titles, festival names, education, contact values */
  --s: calc(var(--colw) * .44);   /* line 3: type column, TV meta, credits column 2, bio text */
  --gap: 128px;                    /* the one gap between sections, home and film pages */
  --fs-s: 15px;                    /* type scale: 15 / 18 (17 on phones) */
  --fs: 18px;
  --right: 32px;                   /* right page gutter: header end, hover stage end */
  --head: 49px;                    /* header height: 12 + 27 + 10 */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Onest", system-ui, sans-serif;
  font-weight: 400;
  font-size: var(--fs);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.index, .fest, .rows, .sheet, .sel, .credits-tv .m, .cap, .pk-cap { font-variant-numeric: tabular-nums; }
h1, h2, h3 { text-wrap: balance; }
p, dd, li { text-wrap: pretty; }

picture { display: contents; }
/* with picture as contents, <source> would become a grid item in Chrome and push the img one cell over (bio, 12.11) */
picture > source { display: none; }
img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.prose a, .rows dd a, .links a, .mat-lines a, .back a, .foot a, .sel .w a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: #868681; }
.prose a:hover, .rows dd a:hover, .links a:hover, .mat-lines a:hover, .back a:hover, .foot a:hover, .sel .w a:hover { text-decoration-color: currentColor; }

h1, h2, h3 { font-size: inherit; font-weight: 500; line-height: inherit; margin: 0; }

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

/* header: same column as the content, wordmark on the left edge, language switch on the right edge */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 24px;
  margin: 0 var(--right) 0 var(--margin);
  padding: 12px 0 10px;
}
.brand { font-weight: 400; margin: 0 auto 0 0; }
.mark { font-weight: 500; }
.role { color: var(--second); margin-left: 10px; }
.nav { display: flex; gap: 24px; }
.nav a[aria-current] { color: var(--accent); }
.lang { margin: 0 0 0 12px; color: var(--second); }
.lang span { color: var(--ink); }

/* lead frame */
.lead { margin: 0; }
.lead img { width: 100%; }

/* home mosaic (variant B, chosen 12.11): justified rows inside the page lines, every frame in its own ratio,
   nothing cropped. A tile grows by its ratio (--ar from build.py), so all frames in a row share one height.
   Row ends are <i class="br br-d|br-m"> from images.json mosaic.rows; margins instead of row-gap so a break
   line adds no extra gap. Desktop: lead + the narrowest frame | four; phones: 1 | 2 | 2 | 1. */
.mosaic { display: flex; flex-wrap: wrap; column-gap: 12px; margin: 0 var(--right) 0 var(--margin); }
.mosaic .tile { display: flex; flex-direction: column; flex: var(--ar) 1 0%; min-width: 0; margin-bottom: 18px; }
.mosaic .tile:hover, .mosaic .tile:focus-visible { text-decoration: none; }
.mosaic .im { display: block; aspect-ratio: var(--ar); overflow: hidden; }
.mosaic .br { flex: 0 0 100%; height: 0; }
.mosaic .br-m:not(.br-d) { display: none; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; transform: scale(1); transform-origin: 50% 50%; transition: transform 1100ms cubic-bezier(0.16, 1, 0.3, 1); will-change: transform; }
.mosaic .tile:hover img, .mosaic .tile:focus-visible img { transform: scale(1.045); }
.mosaic .tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mosaic .cap { display: block; color: var(--second); font-size: var(--fs-s); line-height: 1.4; padding: 8px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 300ms ease; }
/* narrow tiles: year on its own line instead of an ellipsis */
@media (max-width: 1199px) {
  .mosaic .cap .c { display: none; }
  .mosaic .cap .y { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .mosaic img, .mosaic .cap { transition: none; }
  .mosaic .tile:hover img, .mosaic .tile:focus-visible img { transform: none; }
}
.mosaic .tile:hover .cap, .mosaic .tile:focus-visible .cap { color: var(--ink); }

/* column */
.col { margin-left: var(--margin); width: var(--colw); }
.latest { font-weight: 500; margin: 28px 0 0; max-width: 72ch; }

/* selected festivals under the mosaic: hairline rows, festival + year | section | film */
.selected { margin-top: 36px; }
.selected > h2 { font-weight: 400; color: var(--second); font-size: var(--fs-s); margin-bottom: 8px; }
.sel { list-style: none; margin: 0; padding: 0; }
/* same lines as the index below: year on the key column, festival on line 2, film on the format line */
.sel li {
  display: grid; grid-template-columns: var(--k) calc(var(--colw) * .52 - var(--l2) - var(--g)) 1fr; column-gap: var(--g);
  padding: 10px 0 11px; border-top: 1px solid var(--rule);
}
.sel li:last-child { border-bottom: 1px solid var(--rule); }
.sel .y { color: var(--second); }
.sel .s { display: block; color: var(--second); font-size: var(--fs-s); line-height: 1.4; margin-top: 2px; }

.block { margin-top: var(--gap); }
.block > h2 { margin-bottom: var(--g); }
h3 { margin: 64px 0 var(--g); }

.alt { display: block; color: var(--second); font-weight: 400; }

/* index: year | title, other-language title, best festival line | format and runtime | role */
.index { width: 100%; border-collapse: collapse; table-layout: fixed; }
.index th { text-align: left; font-weight: 400; }
.index thead th { color: var(--second); padding: 0 var(--g) 10px 0; }
.index td, .index tbody th { padding: 16px var(--g) 18px 0; vertical-align: top; border-top: 1px solid var(--rule); }
.index th:last-child, .index td:last-child { padding-right: 0; }
.index tbody tr:last-child :is(td, th) { border-bottom: 1px solid var(--rule); }
.index .year { width: var(--l2); }
.index .title { width: calc(var(--colw) * .52 - var(--l2)); }
.index .role { width: 6.5em; }                     /* "screenwriter," */
.index td, .index th { hyphens: auto; overflow-wrap: break-word; } /* narrow viewports: hyphenate long RU words instead of overflowing */
.index .title a { font-weight: 500; }
.index .kind, .index .role { color: var(--second); }
.index .note { display: block; color: var(--second); font-size: var(--fs-s); line-height: 1.4; margin-top: 6px; }

/* licensing page: five-column variant of the index (title | year | runtime | type | subtitles), plain list of formats */
.index.lic .title { width: 34%; }
.index.lic .year { width: 5em; }
.index.lic .rt { width: 7em; }
.index.lic .kind { width: 9.5em; }
.index.lic .subs { width: auto; }
.index.lic .rt, .index.lic .subs { color: var(--second); }
.index.lic .who { display: block; color: var(--second); font-weight: 400; }
.lic-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.lic-list li { padding: 10px 0 11px; border-bottom: 1px solid var(--rule); }
.lic-terms { margin-top: 24px; max-width: 72ch; }

/* hovered row: title underline, year in accent; no backgrounds, no transforms on the row */
@media (hover: hover) {
  .index tbody tr:hover .title > a, .index tbody tr:focus-within .title > a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
  .index tbody tr:hover .year, .index tbody tr:focus-within .year { color: var(--accent); }
}

/* hover stage: a column right of the index spanning its full height; inside it a sticky box of fixed height
   (the tallest set) stays in view next to whichever row is hovered. Each row has its own set (1 large + 2 small
   + caption), set N shows while row N is hovered: build.py appends one rule per film row to dist/site.css.
   In: opacity and 10px rise, 320ms, staggered 70ms. Out: fade 180ms, no movement. */
.stage { display: none; }
@media (min-width: 1200px) and (hover: hover) {
  #films { position: relative; }
  .stage {
    display: block; position: absolute; top: 0; bottom: 0; left: calc(100% + 48px);
    width: min(480px, calc(100vw - var(--margin) - var(--colw) - 48px - var(--right)));
    pointer-events: none;
  }
  .stage-in { position: sticky; top: calc(var(--head) + 24px); display: grid; }
  .peek { grid-area: 1 / 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; align-content: start; }
  .peek > span { display: block; opacity: 0; transform: translateY(10px); transition: opacity 180ms linear, transform 0s linear 180ms; }
  .peek img { width: 100%; height: auto; }
  .pk-a, .pk-cap { grid-column: 1 / -1; }
  .pk-cap { color: var(--second); font-size: var(--fs-s); line-height: 1.4; margin-top: -2px; }
  /* stagger: the show rule (one selector per row, generated by build.py stage_css) delays each frame by --d */
  .peek > span { --d: 0ms; }
  .peek > .pk-b { --d: 70ms; }
  .peek > .pk-c { --d: 140ms; }
  .peek > .pk-cap { --d: 210ms; }
}
@media (prefers-reduced-motion: reduce) {
  .peek > span { transition: none !important; transform: none !important; }
}

/* television: title on line 2 (under the film titles), meta on line 3 (under the type column), a "+" on the
   right edge. Each row is a <details>: the description slides open (height 360ms) where the browser can
   animate to auto (interpolate-size), elsewhere it opens at once. */
.credits-tv { list-style: none; margin: 0; padding: 0; }
.credits-tv li { border-top: 1px solid var(--rule); }
.credits-tv li:last-child { border-bottom: 1px solid var(--rule); }
.credits-tv summary, .credits-tv .tv-row {
  display: grid; grid-template-columns: calc(52% - var(--g)) 1fr 1.5em; column-gap: var(--g);
  padding: 16px 0 18px;
}
.credits-tv summary { list-style: none; cursor: pointer; }
.credits-tv summary::-webkit-details-marker { display: none; }
.credits-tv summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.credits-tv .t { grid-column: 1; font-weight: 500; }
.credits-tv .m { grid-column: 2; color: var(--second); }
.credits-tv .pm { grid-column: 3; justify-self: end; color: var(--second); font-size: 1.35em; line-height: 1.1; }
.credits-tv .pm::before { content: "+"; }
.credits-tv details[open] .pm::before { content: "\2212"; }
@media (hover: hover) {
  .credits-tv summary:hover .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
  .credits-tv summary:hover .pm { color: var(--ink); }
}
.tv-more { padding: 0 calc(1.5em + var(--g)) 24px 0; max-width: 46em; }
.tv-more p { margin: 0 0 12px; }
.tv-more p:last-child { margin-bottom: 0; }
.tv-more .k { font-weight: 500; }
.tv-more .facts { color: var(--second); font-size: var(--fs-s); line-height: 1.5; margin-top: 16px; }
@supports (interpolate-size: allow-keywords) {
  .credits-tv details { interpolate-size: allow-keywords; }
  .credits-tv details::details-content {
    height: 0; overflow: clip;
    transition: height 360ms var(--ease), content-visibility 360ms allow-discrete;
  }
  .credits-tv details[open]::details-content { height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .credits-tv details::details-content { transition: none !important; }
}

/* info: portrait from the left edge to line 3, text from line 3 to the right edge */
.bio { display: grid; grid-template-columns: calc(var(--s) - var(--g)) 1fr; column-gap: var(--g); align-items: start; }
.portrait { width: 100%; }
/* first line of the bio sits on the portrait's top edge: Onest cap top is 0.375em below a 1.5 line box */
.bio-text { margin-top: -0.375em; }
.bio-text p { margin: 0 0 1em; }
.bio-text p:last-child { margin-bottom: 0; }

.rows { display: grid; grid-template-columns: var(--k) 1fr; column-gap: var(--g); row-gap: 10px; margin: 0; }
.rows dt { color: var(--second); }
.rows dt, .fest dt { white-space: nowrap; }
.rows dd { margin: 0; }

.foot { margin-top: var(--gap); padding: 0 0 40px; color: var(--second); font-size: var(--fs-s); line-height: 1.6; }
.foot p { margin: 0; }

/* film page */
.film-head { margin-top: 40px; }
.film-head h1 { font-size: clamp(32px, 3.2vw, 44px); line-height: 1.05; letter-spacing: -0.01em; }
.film-head h1 .alt { font-size: var(--fs); line-height: 1.5; letter-spacing: 0; margin-top: 10px; }
.tech { color: var(--second); margin: 16px 0 0; }
/* tech sheet: pairs in two columns, label in grey on the key column */
.sheet { display: grid; grid-template-columns: 1fr 1fr; column-gap: var(--g); margin: 32px 0 0; border-top: 1px solid var(--rule); }
.sheet div { display: grid; grid-template-columns: var(--k) 1fr; column-gap: var(--g); padding: 8px 0 9px; border-bottom: 1px solid var(--rule); }
.sheet dt { color: var(--second); }
.sheet dd { margin: 0; }
.trailer { margin: 32px 0 0; width: 50%; }
.trailer a { display: block; }
.trailer a:hover, .trailer a:focus-visible { text-decoration: none; }
.trailer .cap { display: block; color: var(--second); font-size: var(--fs-s); padding-top: 6px; }
.trailer a:hover .cap, .trailer a:focus-visible .cap { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.logline { font-weight: 500; margin: 40px 0 0; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.credit-list { display: grid; grid-template-columns: calc(var(--s) - var(--g)) 1fr; column-gap: var(--g); row-gap: 14px; margin: 0; }
.credit-list dt { color: var(--second); }
.credit-list dd { margin: 0; }
.fest { display: grid; grid-template-columns: var(--k) 1fr; column-gap: var(--g); row-gap: 14px; margin: 0; }
.fest dd { margin: 0; }
.fest .s { color: var(--second); display: inline-block; } /* keeps "Non-Competitive Section" whole */
.fest .award { display: block; }
.links, .back { margin: 0 0 8px; }
.fest-more { color: var(--second); font-size: var(--fs-s); margin: 28px 0 8px; }
.fest-tail { font-size: var(--fs-s); color: var(--second); row-gap: 6px; line-height: 1.45; }
.fest-tail .s { color: inherit; }
.links:last-child, .back:last-child { margin-bottom: 0; }
.stills { display: grid; grid-template-columns: 1fr 1fr; gap: var(--g); align-items: start; }
.stills .wide { grid-column: 1 / -1; }
.materials { display: grid; grid-template-columns: 320px 1fr; column-gap: var(--g); align-items: start; }
.materials > .mat-lines:first-child { grid-column: 1 / -1; }
.mat-lines p { margin: 0 0 8px; }
.mat-lines .mail { margin-top: 20px; color: var(--second); }
.stills figure, .poster { margin: 0; }
.poster img { width: 320px; }
.poster-top { margin-top: 40px; }

/* 1000-1199: no hover stage (it needs 1200), so the column takes the free right side; keeps "documentary" whole */
@media (min-width: 1000px) and (max-width: 1199px) {
  :root { --colw: min(80vw, 820px); }
}

@media (max-width: 999px) {
  :root { --margin: 24px; --colw: calc(100vw - 48px); --gap: 104px; --right: 24px; }
}

@media (max-width: 720px) {
  :root { --margin: 16px; --colw: calc(100vw - 32px); --gap: 80px; --g: 12px; --k: 58px; --fs: 17px; --right: 16px; }
  /* line 1: name with the language switch pinned right; role under it at full width; then sections */
  .top { position: relative; gap: 4px 20px; padding: 14px 0 12px; }
  .brand { flex-basis: 100%; }
  .role { margin-left: 0; display: block; }
  .nav { gap: 4px 20px; margin-top: 6px; flex-wrap: wrap; }
  .nav a, .lang a, .lang span { display: inline-block; min-width: 24px; min-height: 24px; text-align: center; }
  .lang { position: absolute; top: 14px; right: 0; margin: 0; }
  .latest { margin-top: 20px; }
  .sel li { grid-template-columns: var(--k) 1fr; row-gap: 4px; }
  .sel .w { grid-column: 2; }
  .mosaic { column-gap: 8px; }
  .mosaic .tile { margin-bottom: 16px; }
  .mosaic .cap { padding-top: 6px; white-space: normal; }
  .mosaic .br.br-m { display: block; }
  .mosaic .br-d:not(.br-m) { display: none; }

  .index { table-layout: auto; }
  .index thead { display: none; }
  .index, .index tbody { display: block; }
  .index tr { display: grid; grid-template-columns: var(--k) 1fr; column-gap: var(--g); border-top: 1px solid var(--rule); padding: 14px 0 16px; }
  .index tbody tr:last-child { border-bottom: 1px solid var(--rule); }
  .index :is(td, tbody th), .index tbody tr:last-child :is(td, th) { display: block; padding: 0; border: 0; width: auto; }
  .index .year { grid-row: 1 / span 3; width: auto; }
  .index .title, .index .role { width: auto; }
  .index .kind, .index .role { grid-column: 2; }
  .index .kind { margin-top: 6px; }
  .index.lic tr { grid-template-columns: 1fr 1fr; }
  .index.lic :is(td, tbody th) { grid-column: auto; }
  .index.lic .title { grid-column: 1 / -1; margin-bottom: 6px; }
  .index.lic .year, .index.lic .rt { grid-row: auto; margin-top: 0; }
  .index.lic .kind { grid-column: 1 / -1; margin-top: 0; }
  .index.lic .subs { grid-column: 1 / -1; }

  .credits-tv summary, .credits-tv .tv-row { grid-template-columns: 1fr 1.5em; row-gap: 4px; padding: 14px 0 16px; }
  .credits-tv .t, .credits-tv .m { grid-column: 1; }
  .credits-tv .pm { grid-column: 2; grid-row: 1; }
  .tv-more { padding-right: 0; padding-bottom: 20px; }
  .bio { grid-template-columns: 1fr; row-gap: 24px; }
  .portrait { width: 200px; }
  .bio-text { margin-top: 0; }
  .rows { grid-template-columns: 1fr; row-gap: 2px; }
  .rows dd { margin-bottom: 12px; }
  .credit-list { grid-template-columns: 1fr; row-gap: 10px; }
  .poster img { width: 220px; }
  .sheet { grid-template-columns: 1fr; }
  .sheet div { grid-template-columns: 7.5em 1fr; }
  .trailer { width: 100%; }
  .stills { grid-template-columns: 1fr; }
  .materials { grid-template-columns: 1fr; row-gap: 20px; }
}

/* print: the index and pages as plain documents, no stage, no navigation chrome */
@media print {
  body { background: #fff; font-size: 11pt; }
  .skip, .nav, .lang, .stage, .mosaic .cap { display: none; }
  .block { margin-top: 28px; }
  .mosaic { column-gap: 4px; }
  .mosaic .tile { margin-bottom: 4px; }
  .col { width: auto; margin: 0 var(--margin); }
  a { text-decoration: none; }
  .credits-tv details::details-content { height: auto; content-visibility: visible; }
}

/* generated by build.py (stage_css): one selector per film row */
@media (min-width: 1200px) and (hover: hover) {
  #films:has(tbody tr:nth-child(1):is(:hover, :focus-within)) .peek:nth-child(1) > span,
  #films:has(tbody tr:nth-child(2):is(:hover, :focus-within)) .peek:nth-child(2) > span,
  #films:has(tbody tr:nth-child(3):is(:hover, :focus-within)) .peek:nth-child(3) > span,
  #films:has(tbody tr:nth-child(4):is(:hover, :focus-within)) .peek:nth-child(4) > span,
  #films:has(tbody tr:nth-child(5):is(:hover, :focus-within)) .peek:nth-child(5) > span,
  #films:has(tbody tr:nth-child(6):is(:hover, :focus-within)) .peek:nth-child(6) > span {
    opacity: 1; transform: none;
    transition: opacity 320ms var(--ease) var(--d), transform 320ms var(--ease) var(--d);
  }
}
