/*
  Waf Visual page layouts. Only how pages arrange components: no colours, no component looks.
  Reads tokens.css; the components it places are in components.css.
*/

/* The content area fills the screen below the header, so the footer doesn't start on screen and jump down once the
   catalog has loaded and the page is drawn. */
#app { min-height: calc(100vh - var(--head-h)); min-height: calc(100svh - var(--head-h)); }
/* Every page: the content column, and the space between its sections. */
.page { padding-top: var(--s-8); display: flex; flex-direction: column; gap: var(--s-16); }
.page-head { display: flex; flex-direction: column; gap: var(--s-3); }
.page-head .lead { color: var(--c-ink-muted); }
@media (max-width: 640px) { .page { padding-top: var(--s-4); gap: var(--s-12); } }

/* ---------------------------------------------------------------- home */
/* The hero: the promise and the main action on the left, a demo film playing on the right. */
.home-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: var(--s-12); align-items: center; padding-top: var(--s-8); }
.home-hero__text { display: flex; flex-direction: column; gap: var(--s-5); }
.home-hero__film { justify-self: center; width: min(100%, 380px); }
@media (max-width: 900px) {
  .home-hero { grid-template-columns: minmax(0, 1fr); gap: var(--s-8); padding-top: var(--s-4); }
}

.home-hero .display { font-size: clamp(36px, 1.8rem + 3vw, 64px); }
.home-hero__text .btn-row { margin-top: var(--s-2); }
/* How it works: three numbered cards in a row; one column on a phone. */
.steps-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.steps-row .card { gap: var(--s-2); }
.steps-row .row__n { margin-bottom: var(--s-2); }
@media (max-width: 760px) { .steps-row { grid-template-columns: minmax(0, 1fr); } }
/* The Lab band: a card with the pitch on the left and one style in four tools on the right. */
.home-lab { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s-8); align-items: center; padding: var(--s-8); border-radius: var(--r-xl); }
.home-lab__text { display: flex; flex-direction: column; gap: var(--s-3); align-items: flex-start; }
.home-lab__text h2 { font: var(--t-heading); letter-spacing: var(--track-heading); }
@media (max-width: 900px) { .home-lab { grid-template-columns: minmax(0, 1fr); padding: var(--s-5); gap: var(--s-5); } }

/* ---------------------------------------------------------------- all styles */
.browse-head { display: flex; flex-direction: column; gap: var(--s-5); }
.filters { display: flex; flex-direction: column; gap: var(--s-3); }
/* The bar above the list: (phone: the Filter button,) the count, clear, and the sort dropdown on the right. */
.browse-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.browse-bar [data-count] { margin-right: auto; }
.browse-bar__filter { display: none; }
.browse-bar__n { min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; border-radius: var(--r-full); background: var(--c-accent); color: var(--c-on-accent); font: var(--t-caption); font-variant-numeric: tabular-nums; }
.active-filters { display: none; }
#filter-sheet { gap: var(--s-6); }
@media (max-width: 640px) {
  .filters, .browse-bar__clear { display: none; }
  .browse-bar { flex-wrap: nowrap; }
  .browse-bar__filter { display: inline-flex; flex: none; }
  .browse-bar [data-count] { order: 3; flex: none; margin: 0 0 0 auto; }
  .browse-bar .select { flex: 1 1 auto; }
  .browse-bar .select select { width: 100%; padding: 0 30px 0 32px; }
  .browse-bar .select > .ic:first-of-type { left: 11px; }
  .browse-bar .select > .ic:last-of-type { right: 10px; }
  .active-filters:not(:empty) { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: calc(var(--s-6) * -1 + var(--s-3)) calc(var(--gutter) * -1) 0; padding: 2px var(--gutter); }
  .active-filters::-webkit-scrollbar { display: none; }
  .active-filters .chip { flex: none; background: var(--c-accent-tint); color: var(--c-accent-ink); }
}

/* ---------------------------------------------------------------- style page (#/style/N) */
/* One focus at the top: the film on the left at its own shape, and beside it the style's name, what it's good for
   and the one main action. Then the form, then similar styles. Below 900px it's one column: name,
   film, the rest. A landscape film (the showreel) widens the film's column while it plays. */
.style-page { display: flex; flex-direction: column; gap: var(--s-16); }
.sp-hero { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "media head" "media act"; gap: var(--s-6) var(--s-12); align-items: start; }
.sp-hero.is-wide { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.sp-hero__head { grid-area: head; }
.sp-hero__media { grid-area: media; }
.sp-hero__act { grid-area: act; display: flex; flex-direction: column; gap: var(--s-6); max-width: 520px; }
.sp-hero .player__stage { height: auto; width: 100%; max-width: none; align-self: stretch; aspect-ratio: var(--ar, 9 / 16); }
.sp-facts { display: flex; flex-direction: column; gap: var(--s-4); }
.sp-facts dt { display: flex; align-items: center; gap: 6px; font: var(--t-small-strong); color: var(--c-ink-muted); }
.sp-facts dd { margin-top: 2px; }
@media (max-width: 900px) {
  .sp-hero, .sp-hero.is-wide { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "head" "media" "act"; gap: var(--s-6); }
  .sp-hero__media { width: min(100%, 420px); justify-self: center; }
  .sp-hero.is-wide .sp-hero__media { width: 100%; }
  .sp-hero__act { max-width: none; }
  .sp-hero__act > .stack { order: -1; } /* the main action right under the film */
}
@media (max-width: 760px) {
  .sp-hero__media, .sp-hero.is-wide .sp-hero__media { width: 100%; }
  .sp-hero .player__stage { width: auto; }
}

/* The prompt form: the fields on the left, the filled prompt on the right (it stays in view while you type). */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s-8); align-items: start; }
.gen__form { display: flex; flex-direction: column; gap: var(--s-6); }
/* Format, length, narration and colours fold into one row that says what they're set to. */
.gen__more { border-radius: var(--r-lg); overflow: hidden; }
.gen__more > summary .ic { margin-left: 0; }
.gen__sum { margin-left: auto; font: var(--t-small); color: var(--c-ink-muted); text-align: right; }
.gen__more .disclosure__body { gap: var(--s-6); padding-top: var(--s-2); }
.gen__out { position: sticky; top: calc(var(--head-h) + var(--s-4)); display: flex; flex-direction: column; gap: var(--s-3); }
.gen__out .prompt pre { max-height: calc(100vh - var(--head-h) - 160px); overflow-y: auto; }
@media (max-width: 1000px) {
  .gen { grid-template-columns: minmax(0, 1fr); }
  .gen__out { position: static; }
  .gen__out .prompt pre { max-height: 480px; }
}

/* ---------------------------------------------------------------- guide and other long text */
.doc-page { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; }

/* Similar styles are always four: one row of four above phone width, two by two on a phone. */
@media (min-width: 641px) { .style-page__more .cards--styles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------------------------------------------------------------- not found */
.nf { padding: var(--s-12) 0; }

/* ---------------------------------------------------------------- Lab (#/lab/...) */
/* The Lab's own menu sits above its page, closer to it than the page's sections are to each other. */
.lab-nav { margin-bottom: calc(var(--s-6) - var(--s-16)); border-bottom: 1px solid var(--c-fill-strong); }
.page:has(> .lab-nav) { padding-top: var(--s-4); }
@media (max-width: 640px) { .lab-nav { margin-bottom: calc(var(--s-5) - var(--s-12)); } }
.lab-head .display { max-width: 18ch; }
@media (max-width: 640px) {
  .lab-nav .tab .ic { display: none; }
  .stats .stat b { font: var(--t-heading); white-space: nowrap; }
}

/* The wall of film stills under the Lab's title: three rows sliding slowly, fading in once loaded. */
.lab-wall { display: grid; grid-template-rows: repeat(3, 76px); gap: var(--s-2); margin-top: calc(var(--s-8) - var(--s-16)); overflow: hidden; border-radius: var(--r-xl); opacity: 0; transition: opacity var(--dur-slow) var(--ease-out); }
.lab-wall.is-ready { opacity: 1; }
.lab-wall__row { display: flex; gap: var(--s-2); width: max-content; animation: lab-slide 140s linear infinite; }
.lab-wall__row:nth-child(2) { animation-direction: reverse; animation-duration: 170s; }
.lab-wall img { height: 100%; width: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-md); background: var(--c-stage); }
@keyframes lab-slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .lab-wall__row { animation: none; } }
@media (max-width: 640px) { .lab-wall { grid-template-rows: repeat(3, 52px); margin-top: calc(var(--s-6) - var(--s-12)); } }
.lab-wall + .stats { margin-top: calc(var(--s-6) - var(--s-16)); }

/* Card grids: landscape films and face-off cards; the rounds. */
.cards--lab { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: var(--s-8) var(--s-5); }
@media (max-width: 640px) {
  .cards--lab { grid-template-columns: minmax(0, 1fr); }
  .cards--archive { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--s-3); }
  .cards--archive .film-card__meta .counts { display: none; }
}
.cards--rounds { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: var(--s-3); }
.round-card { color: var(--c-ink); transition: background var(--dur-fast) var(--ease-out); }
.round-card:hover { background: var(--c-fill-strong); }
.round-card .small { flex: 1; }
/* A face-off card's picture: the four tools' stills in a 2 x 2 mosaic filling the card's 16:9 frame. */
.film-card__media--quad .mosaic { position: absolute; inset: 0; grid-template-rows: repeat(2, minmax(0, 1fr)); border-radius: 0; }
.film-card__media--quad .mosaic figure { aspect-ratio: auto; }
.film-card__media--quad .film-card__n { top: 50%; left: 50%; transform: translate(-50%, -50%); }

/* One style: its facts as cards, then a section per round. */
.lab-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: var(--s-3); margin-top: calc(var(--s-8) - var(--s-16)); }
.lab-facts .kicker { display: inline-flex; align-items: center; gap: 6px; }
.lab-facts .card--star .kicker { color: var(--c-star-ink); }

/* Tool against tool: the films in a grid on one transport, then a verdict card for each. Landscape films go two
   across (three when there are five or six, so none sits alone), vertical ones up to four; one column on a phone. */
.compare { display: flex; flex-direction: column; gap: var(--s-5); }
.compare__films { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.compare__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4) var(--s-3); }
.compare__grid[data-n="5"], .compare__grid[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compare__grid--tall { grid-template-columns: repeat(auto-fit, minmax(160px, 260px)); justify-content: start; }
.compare__tile { margin: 0; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.compare__stage { position: relative; aspect-ratio: var(--ar); border-radius: var(--r-lg); overflow: hidden; background: var(--c-stage); transition: box-shadow var(--dur-fast) var(--ease-out); }
.compare__stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.compare__tile.is-solo .compare__stage { box-shadow: 0 0 0 3px var(--c-accent); }
.compare__cap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.compare__acts { display: inline-flex; align-items: center; gap: var(--s-1); }
.compare__acts .btn[aria-pressed="true"] { background: var(--c-accent-tint); color: var(--c-accent-ink); }
.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: var(--s-3); }
/* Verdicts line up with the films: three across for five or six, four for four, so none sits alone. */
.verdicts[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.verdicts[data-n="5"], .verdicts[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .verdicts[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .verdicts[data-n] { grid-template-columns: minmax(0, 1fr); } }
.verdict { gap: var(--s-2); }
.verdict__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.verdict__score { font: var(--t-body-strong); color: var(--c-ink); }
.verdict__notes { display: flex; flex-direction: column; gap: var(--s-3); flex: 1; }
.verdict__notes dt { display: flex; align-items: center; gap: 6px; font: var(--t-small-strong); color: var(--c-ink-muted); }
.verdict__notes dd { font: var(--t-small); }
.verdict .btn--text { align-self: flex-start; margin-left: calc(var(--s-3) * -1); }
/* A round with one film: the film beside its verdict. */
.compare--one { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; }
.compare--one .compare__grid { grid-template-columns: minmax(0, 1fr); }
.compare--one .compare__grid--tall { grid-template-columns: minmax(0, 340px); justify-content: center; }
.compare--one .verdicts { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 900px) { .compare--one { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .compare__grid, .compare__grid[data-n="5"], .compare__grid[data-n="6"] { grid-template-columns: minmax(0, 1fr); }
  .compare__grid--tall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* One film: the film and its frame strip beside its numbers and notes; one column below 1000px. */
.film-page { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s-10); align-items: start; margin-top: calc(var(--s-6) - var(--s-16)); }
.film-page--tall { grid-template-columns: minmax(0, 420px) minmax(0, 1fr); }
.film-page__media { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.film-page__stage { position: relative; aspect-ratio: var(--ar); max-height: 78vh; border-radius: var(--r-xl); overflow: hidden; background: var(--c-stage); }
.film-page__stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.film-page__side { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.film-page__side .notice p { margin-top: 2px; }
.stats--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats--2 .stat { padding: var(--s-4); }
.stats--2 .stat b { font: var(--t-title); }
.strip { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.strip button { aspect-ratio: var(--ar); background-repeat: no-repeat; background-size: 800% 100%; border-radius: var(--r-sm); opacity: 0.85; transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.strip button:hover { opacity: 1; transform: translateY(-2px); }
.film-page--tall .strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
pre.brief { font: var(--t-mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; overflow-y: auto; }
@media (max-width: 1000px) {
  .film-page, .film-page--tall { grid-template-columns: minmax(0, 1fr); gap: var(--s-8); }
  .film-page--tall .film-page__media { width: min(100%, 420px); justify-self: center; }
}
