/* Videos (/videos/): the big screen. Adds to site.css and stage.css; never redefines tokens or primitives.
   Desktop: the opening and the stage on the left, the programme on the right scrolling on its own, all in one view.
   Phones: the stage pinned under the header with the programme scrolling beneath it under the thumb. */

/* trip colours, used for the swatches and for the designed plate shown when a poster will not load */
.tone-savanna { --tone: #c99f52; --tone-2: #93a05a; --tone-3: #ead6a2; }
.tone-city    { --tone: #7fa3ad; --tone-2: #a3aeb4; --tone-3: #dfe2d8; }
.tone-desert  { --tone: #d3935c; --tone-2: #b46f45; --tone-3: #edd5a6; }
.tone-jungle  { --tone: #6ea69c; --tone-2: #9db86c; --tone-3: #d6dfb6; }
.tone-stone   { --tone: #a99d86; --tone-2: #8d8576; --tone-3: #e2dac4; }
.tone-dust    { --tone: #bba66f; --tone-2: #8f9b79; --tone-3: #e6dcb4; }

/* ------------------------------------------------------------------ layout */
.vd { --prog-w: clamp(330px, 29vw, 410px); --vd-top: clamp(16px, 3.4svh, 30px);
  display: grid; grid-template-columns: minmax(0, 1fr) var(--prog-w); grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: 'head prog' 'stage prog'; column-gap: clamp(24px, 2.8vw, 44px);
  height: 100svh; min-height: 600px; max-height: 1080px; padding-top: calc(var(--bar-h) + var(--vd-top)); padding-bottom: 20px; }
.vd-head { grid-area: head; padding-bottom: clamp(12px, 2svh, 18px); }
.vd-head h1 { font-size: clamp(2rem, 1.5rem + 1.3vw, 2.6rem); max-width: none; }
.vd-lede { margin-top: .35rem; max-width: 74ch; font-size: var(--step-0); line-height: 1.5; color: var(--text-soft); }
.vd-stage { grid-area: stage; align-self: start; min-width: 0; }
.vd-prog { grid-area: prog; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable;
  background: var(--cream); border-radius: var(--radius); padding: 18px 10px 22px 18px; }

/* the screen: 16:9, as large as the window allows with the opening and the caption still in view */
.vd-stage { width: min(100%, calc((100svh - var(--bar-h) - var(--vd-top) - 20px - var(--vd-chrome, 262px)) * 16 / 9)); }
.vd-stage .st-screen { aspect-ratio: 16 / 9; width: 100%; }
@media (min-height: 1080px) { .vd-stage { width: 100%; } }

/* ------------------------------------------------------------------ the film on the stage */
.vd-layer { background: var(--st-bg); }
.vd-film.yt { position: absolute; inset: 0; max-width: none; aspect-ratio: auto; border-radius: 0; margin: 0; background: transparent; overflow: hidden; }
.vd-link { position: absolute; inset: 0; display: block; }
.yt-link.vd-link img { transform: none; transition: opacity .45s var(--ease), filter .35s var(--ease); }
@media (hover: hover) and (pointer: fine) {
.yt-link.vd-link:hover img { transform: none; }
}
.yt-link.vd-link .vd-ground { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; filter: blur(26px) saturate(1.05) brightness(.42); opacity: 0; }
.vd-film.is-ground-ready .yt-link.vd-link .vd-ground { opacity: 1; }
.vd-poster { max-width: var(--poster-width, 480px); position: absolute; left: 50%; top: 50%; translate: -50% -50%; aspect-ratio: 16 / 9; width: min(100cqw, 600px); overflow: hidden;
  border-radius: 2px; box-shadow: 0 24px 46px -22px rgba(0, 0, 0, .75), 0 0 0 1px rgba(243, 236, 214, .06); }
.vd-poster.is-sd { max-width: var(--poster-width, 640px); width: min(100cqw, 820px); }
.vd-poster.is-maxres { max-width: var(--poster-width, 1280px); width: 100cqw; border-radius: 0; box-shadow: none; }
.vd-poster.is-photo { width: 100cqw; border-radius: 0; box-shadow: none; }
.yt-link.vd-link .vd-poster.is-photo img { object-fit: contain; }
.vd-poster.is-43 { aspect-ratio: 4 / 3; width: min(100cqw, 133.4cqh, 600px); }
.vd-poster.is-43.is-sd { width: min(100cqw, 133.4cqh, 820px); }
/* hqdefault and sddefault carry letterbox bars on 16:9 films: cover crops them off exactly */
.yt-link.vd-link .vd-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: brightness(.9) saturate(.95); }
.yt-link.vd-link .vd-poster.is-ready img { opacity: 1; }
@media (hover: hover) and (pointer: fine) {
.yt-link.vd-link:hover .vd-poster img { filter: none; }
}
.vd-film .yt-play { left: clamp(12px, 2.4cqw, 22px); bottom: clamp(12px, 2.4cqw, 22px); min-height: 50px; padding: 0 20px 0 14px; font-size: 16px; }
.vd-film .yt-play svg { width: 26px; height: 26px; }
.vd-link:focus-visible { outline: 3px solid var(--teal-2); outline-offset: -6px; border-radius: var(--radius-media); }
.vd-film iframe { z-index: 3; background: #000; }

/* the designed plate: the trip's colour, survey contours and the title, shown only when a poster will not load */
.vd-plate { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-start; gap: .2em; padding: 6% 24% 6% 6%; opacity: 0;
  color: var(--ink); text-align: left;
  background: url('/media/videos-ui/contours.svg') center / cover no-repeat,
    radial-gradient(90% 110% at 18% 12%, var(--tone-3), transparent 62%),
    radial-gradient(80% 90% at 88% 88%, color-mix(in srgb, var(--tone-2) 75%, transparent), transparent 70%),
    linear-gradient(140deg, color-mix(in srgb, var(--tone) 72%, #e9d9aa), color-mix(in srgb, var(--tone-2) 70%, #c8ad6d)); }
.vd-plate-place { font: 600 clamp(13px, 2.4cqw, 18px)/1.25 var(--sans); color: rgba(31, 20, 7, .75); }
.vd-plate-title { max-width: 22ch; font: 700 clamp(22px, 5.6cqw, 52px)/1.04 var(--display); }
.vd-film.is-poster-failed .vd-plate { opacity: 1; }
.vd-film.is-poster-failed .vd-poster, .vd-film.is-poster-failed .vd-ground { display: none; }

/* when a film ends: the next one offered clearly, never played by itself */
.vd-end { position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: start; gap: 14px; padding: 6% 8%;
  background: rgba(29, 20, 9, .92); color: var(--cream); }
.vd-end p { margin: 0; max-width: 34ch; font: 600 clamp(18px, 2.7cqw, 26px)/1.3 var(--display); }
.vd-end p span { color: var(--teal-2); }
.vd-end-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.vd-end .btn-quiet { color: var(--cream); border-color: rgba(243, 236, 214, .45); }
@media (hover: hover) and (pointer: fine) {
.vd-end .btn-quiet:hover { background: rgba(243, 236, 214, .08); color: var(--white); border-color: var(--cream); }
}
.vd-end .btn { min-height: 46px; }
.vd-end :focus-visible { outline-color: var(--teal-2); }

/* ------------------------------------------------------------------ under the screen: where, what, and what is next */
.vd-info { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 18px; align-items: start; padding-top: 8px; }
.vd-loc { width: 100px; }
.vd-loc:empty { display: none; }
.vd-text { min-width: 0; }
.vd-where { font-size: var(--step--1); font-weight: 600; line-height: 1.35; color: var(--link); }
.vd-title { margin-top: 2px; font-size: clamp(1.3rem, 1.05rem + .6vw, 1.6rem); line-height: 1.12; max-width: 34ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-line { margin-top: 5px; max-width: 60ch; line-height: 1.45; color: var(--text-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vd-line:empty { display: none; }
.vd-btns { display: flex; align-items: flex-start; gap: 8px; }
.vd-btns .vd-fs { display: none; }
/* desktop: full screen is a quiet control in the corner of the screen (the player has its own once a film is playing) */
.vd-fs-over { position: absolute; z-index: 7; top: 12px; right: 12px; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 14px 0 12px;
  border-radius: var(--radius-pill); background: rgba(31, 20, 7, .78); color: var(--cream); font: 600 14px/1 var(--sans);
  transition: background-color .2s var(--ease), transform .15s var(--ease); }
.vd-fs-over svg { width: 18px; height: 18px; color: var(--teal-2); }
@media (hover: hover) and (pointer: fine) {
.vd-fs-over:hover { background: var(--ink); }
}
.vd-fs-over:active { transform: scale(.97); }
.vd-fs-over:focus-visible { outline-color: var(--teal-2); }
.st-screen:has(.yt.is-playing) .vd-fs-over, .st-screen:has(.vd-end) .vd-fs-over { display: none; }
.vd-btns .btn { min-height: 46px; }
.vd-next { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 15.5rem; padding-block: .62em;
  white-space: normal; text-align: left; line-height: 1.3; }
.vd-next-k { font-weight: 700; color: var(--teal-2); }
.vd-next-t { font-weight: 600; }

/* the locator: a small north-up map in the antique map's ink, only for films whose place is certain */
.loc-map { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); box-shadow: 0 0 0 1px rgba(41, 30, 12, .35), 0 8px 16px -12px rgba(41, 30, 12, .8); }
.loc-sea { fill: #b9d1c8; }
.loc-grat { fill: none; stroke: var(--map-grid); stroke-opacity: .22; stroke-width: .5; }
.loc-wl { fill: none; stroke: var(--map-waterline); stroke-opacity: .32; stroke-width: 3.2; stroke-linejoin: round; stroke-linecap: round; }
.loc-land { fill: var(--map-land); }
.loc-coast { fill: none; stroke: var(--map-coast); stroke-width: .7; stroke-linejoin: round; stroke-linecap: round; }
.loc-area { fill: rgba(165, 86, 45, .14); stroke: #8a4524; stroke-width: .8; stroke-dasharray: 2.2 1.8; }
.loc-ring { fill: none; stroke: #1f1407; stroke-opacity: .55; stroke-width: .8; }
.loc-route { fill: none; stroke: #8a4524; stroke-width: 1.2; stroke-dasharray: .4 2.4; stroke-linecap: round; }
/* The stage locator carries the single route reveal; programme maps remain still. */
.vd-loc .loc-route { stroke-width: 1.6; }
.loc-dot { fill: #f3ecd6; stroke: #1f1407; stroke-width: 1; }
.loc-dot.is-end { fill: var(--teal-ink); stroke: #f3ecd6; stroke-width: 1.2; }

/* ------------------------------------------------------------------ the programme */
.vd-prog-h { font-size: var(--step-2); line-height: 1.15; padding-left: 8px; }
.pg-group + .pg-group, .vd-prog-h + .pg-group { margin-top: 18px; }
.pg-gh { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding-left: 8px; font-size: var(--step-1); line-height: 1.2; }
.pg-sw { flex: none; width: 11px; height: 11px; border-radius: 2px; background: var(--tone); box-shadow: 0 0 0 1.5px rgba(41, 30, 12, .5); }
.pg-list { display: grid; gap: 2px; margin: 0; }
.pg-row { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 14px; width: 100%; min-height: 44px; padding: 8px; border-radius: 6px;
  color: var(--ink); text-decoration: none; text-align: left; font: inherit; scroll-margin: 12px;
  transition: background-color .25s var(--ease), color .25s var(--ease); }
@media (hover: hover) and (pointer: fine) {
.pg-row:hover { background: rgba(41, 30, 12, .07); color: var(--ink); }
}
.pg-row:active { background: rgba(41, 30, 12, .12); }
.pg-row:focus-visible { outline: 3px solid var(--focus); outline-offset: -1px; border-radius: 6px; }
.pg-row.is-on { background: var(--ink); color: var(--cream); }
.pg-row.is-on:focus-visible { outline-color: var(--teal-2); outline-offset: 2px; }
.pg-thumb { position: relative; align-self: start; display: block; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-sm);
  background: linear-gradient(140deg, color-mix(in srgb, var(--tone) 72%, #e9d9aa), color-mix(in srgb, var(--tone-2) 70%, #c8ad6d)); }
.pg-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pg-thumb.is-failed img { display: none; }
.pg-thumb.is-failed { background: url('/media/videos-ui/contours.svg') center / cover no-repeat,
  linear-gradient(140deg, color-mix(in srgb, var(--tone) 72%, #e9d9aa), color-mix(in srgb, var(--tone-2) 70%, #c8ad6d)); }
.pg-now { position: absolute; left: 5px; bottom: 5px; display: none; padding: 4px 8px 3px; border-radius: var(--radius-pill); background: var(--teal); color: var(--ink);
  font: 700 11.5px/1 var(--sans); letter-spacing: .01em; }
.pg-row.is-on .pg-now { display: block; }
.pg-text { display: grid; gap: 1px; align-content: start; min-width: 0; }
.pg-title { font: 600 15.5px/1.28 var(--sans); }
.pg-place { font: 600 13px/1.35 var(--sans); color: var(--link); }
.pg-row.is-on .pg-place { color: var(--teal-2); }
.pg-line { margin-top: 1px; font-size: 13.5px; line-height: 1.4; color: #4a3a20; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pg-row.is-on .pg-line { color: rgba(243, 236, 214, .78); }

/* ------------------------------------------------------------------ between desktop and phone: one column */
@media (max-width: 959px) {
  .vd { display: block; height: auto; min-height: 0; max-height: none; padding-top: calc(var(--bar-h) + 26px); padding-bottom: 0; }
  .vd-stage { position: sticky; top: calc(var(--bar-h) - 8px); z-index: 20; width: auto; margin-inline: calc(-1 * var(--gutter)); background: var(--brown);
    color: var(--cream); box-shadow: var(--media-pin-shadow); }
  .vd-stage .st-screen { width: 100%; border-radius: 0; box-shadow: none; }
  .vd-stage .st-track { display: none; }
  .vd-info { grid-template-columns: auto minmax(0, 1fr); padding: 9px var(--gutter) 11px; gap: 8px 14px; }
  .vd-loc { width: 56px; align-self: center; }
  .vd-where { color: var(--teal-2); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .vd-title { color: var(--cream); font-size: 18px; line-height: 1.15; max-width: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .vd-line { display: none; }
  .vd-btns { grid-column: 1 / -1; }
  .vd-btns .vd-fs { display: inline-flex; }
  .vd-fs-over { display: none; }
  .vd-btns .btn { min-height: 44px; padding: .45em .9em; font-size: 16px; }
  .vd-fs { flex: none; background: transparent; color: var(--cream); border-color: rgba(243, 236, 214, .4); }
@media (hover: hover) and (pointer: fine) {
.vd-fs:hover { background: rgba(243, 236, 214, .08); color: var(--white); border-color: var(--cream); }
}
  .vd-next { flex: 1 1 auto; min-width: 0; max-width: none; display: block; white-space: nowrap; text-overflow: ellipsis; line-height: 1.6; background: var(--teal); border-color: var(--teal); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
.vd-next:hover { background: var(--teal-2); border-color: var(--teal-2); color: var(--ink); }
}
  .vd-next-k { color: var(--ink); }
  .vd-stage :focus-visible { outline-color: var(--teal-2); }
  .vd-prog { overflow: visible; margin-top: 14px; padding: 14px 8px 18px; }
  .pg-row { scroll-margin: 0; }
  .pg-title, .pg-place, .pg-line { font-size: 16px; }
}
@media (max-width: 959px) and (min-width: 600px) {
  .vd-stage .st-screen { width: min(100%, calc((100svh - var(--bar-h) - 150px) * 16 / 9)); margin-inline: auto; aspect-ratio: 16 / 9; }
  .vd-loc { width: 72px; }
  .vd-btns .vd-next { flex: 0 1 auto; }
}
@media (max-width: 599px) {
  .vd-head h1 { font-size: 1.9rem; }
  .vd-lede { font-size: 16px; line-height: 1.45; }
  .vd-head { padding-bottom: 16px; }
  .pg-row { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 7px; }
  .pg-title { font-size: 16px; }
  .pg-line { font-size: 16px; }
}

/* full screen: the film fills the window, with the title and the next film along the bottom */
.vd-stage.is-fullscreen .vd-info, .vd-stage:fullscreen .vd-info { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; padding: 10px clamp(14px, 3vw, 32px) 14px; color: var(--cream); }
.vd-stage.is-fullscreen .vd-loc, .vd-stage:fullscreen .vd-loc { width: 64px; }
.vd-stage.is-fullscreen .vd-title, .vd-stage:fullscreen .vd-title { color: var(--cream); font-size: clamp(18px, 2vw, 24px); }
.vd-stage.is-fullscreen .vd-where, .vd-stage:fullscreen .vd-where { color: var(--teal-2); }
.vd-stage.is-fullscreen .vd-line, .vd-stage:fullscreen .vd-line { display: none; }
.vd-stage.is-fullscreen .vd-btns, .vd-stage:fullscreen .vd-btns { grid-column: auto; }
.vd-stage.is-fullscreen .vd-fs-over, .vd-stage:fullscreen .vd-fs-over { display: none; }
.vd-stage.is-fullscreen .vd-btns .vd-fs, .vd-stage:fullscreen .vd-btns .vd-fs { display: inline-flex; }
.vd-stage.is-fullscreen .vd-fs, .vd-stage:fullscreen .vd-fs { background: transparent; color: var(--cream); border-color: rgba(243, 236, 214, .4); }
.vd-stage.is-fullscreen .vd-next, .vd-stage:fullscreen .vd-next { max-width: 24rem; display: block; white-space: nowrap; text-overflow: ellipsis; line-height: 1.6; }

@media (max-width: 700px) {
  .vd-stage.is-fullscreen .vd-info, .vd-stage:fullscreen .vd-info { grid-template-columns: auto minmax(0, 1fr); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .vd-stage.is-fullscreen .vd-btns, .vd-stage:fullscreen .vd-btns { grid-column: 1 / -1; }
  .vd-stage.is-fullscreen .vd-next, .vd-stage:fullscreen .vd-next { max-width: none; flex: 1 1 auto; min-width: 0; }
  .vd-stage.is-fullscreen .vd-loc, .vd-stage:fullscreen .vd-loc { width: 52px; }
}

/* ------------------------------------------------------------------ without JavaScript: a plain list of every film, each a link to YouTube */
@media (scripting: none) {
  .vd { display: block; height: auto; max-height: none; }
  .vd-stage { display: none; }
  .vd-prog { overflow: visible; padding: clamp(18px, 3vw, 36px); }
  .pg-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); column-gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .pg-row, .yt-link.vd-link img { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  .yt-link.vd-link .vd-ground { display: none; }
  .vd-fs-over { background: var(--ink); }
}
@media (prefers-contrast: more) {
  .pg-row.is-on .pg-line { color: var(--cream); }
}
