/* fairmaps.ca : video.css
   The explainer video's stage (assets/js/video.js builds the controls). At rest it is the site's
   light look. While the video plays the section dims to ink and the picture's colours glow round
   the frame. Uses the site's --fm-* tokens. */

.fm-cine {
  --cine-ink: #0F0F10;
  position: relative;
  background: var(--fm-paper);
  padding-block: clamp(2.5rem, 7vw, 5rem);
  transition: background-color 700ms var(--fm-ease);
}
.fm-cine.is-lit { background: var(--cine-ink); }
.fm-cine__head { position: relative; z-index: 1; max-width: 860px; margin-bottom: clamp(1.25rem, 3vw, 2rem); }
.fm-cine__head h2 { margin: 0; transition: color 700ms var(--fm-ease); }
.fm-cine.is-lit .fm-cine__head h2 { color: #fff; }

/* the stage keeps the page's layout; the shell inside it is what docks */
.fm-cine__stage { position: relative; aspect-ratio: 16 / 9; margin-inline: calc(-1 * var(--fm-gutter)); }
.fm-cine__shell { position: absolute; inset: 0; outline: none; }
.fm-cine__shell:focus-visible .fm-cine__screen { box-shadow: var(--fm-focus); }
.fm-cine__screen { position: absolute; inset: 0; overflow: hidden; background: #141414; }
.fm-cine__video { display: block; width: 100%; height: 100%; object-fit: contain; background: #141414; }
@media (min-width: 48em) {
  .fm-cine__stage {
    margin-inline: auto;
    /* never taller than the window, so the controls stay in view */
    max-width: min(100%, calc((100svh - var(--fm-header-h) - 1.5rem) * 16 / 9));
  }
  .fm-cine__screen { border-radius: var(--fm-radius); box-shadow: var(--fm-shadow-lg); }
}

/* the picture's own colours, blurred, behind the frame */
.fm-cine__glow {
  position: absolute; inset: -7%; width: 114%; height: 114%;
  filter: blur(44px) saturate(1.6);
  opacity: 0; pointer-events: none;
  transition: opacity 900ms var(--fm-ease);
}
.fm-cine.is-lit .fm-cine__glow { opacity: 0.7; }
.fm-cine__shell.is-docked .fm-cine__glow, .fm-cine__shell:fullscreen .fm-cine__glow { display: none; }

/* before play: the poster, drifting slowly, and one big control */
.fm-cine__cover {
  position: absolute; inset: 0; z-index: 3;
  display: grid; place-items: center; align-content: center; gap: 0.9rem;
  padding: 0; border: 0; margin: 0; cursor: pointer;
  color: #fff; background: #141414; font: inherit; overflow: hidden;
}
.fm-cine__cover[hidden] { display: none; }
.fm-cine__cover img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: fm-cine-drift 24s ease-in-out infinite alternate;
}
.fm-cine__cover::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(15, 15, 16, 0.42) 0%, rgba(15, 15, 16, 0.12) 46%, rgba(15, 15, 16, 0.38) 100%);
}
@keyframes fm-cine-drift { from { transform: scale(1.02); } to { transform: scale(1.1) translate(-1.2%, -1%); } }
.fm-cine__disc {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: clamp(4.25rem, 11vw, 6.5rem); aspect-ratio: 1; border-radius: 50%;
  background: var(--fm-red); color: #fff;
  box-shadow: 0 0 0 0 rgba(225, 37, 39, 0.55);
  animation: fm-cine-pulse 2.6s var(--fm-ease) infinite;
  transition: transform var(--fm-dur-move) var(--fm-ease);
}
.fm-cine__disc svg { width: 44%; height: 44%; margin-left: 6%; }
.fm-cine__cover:hover .fm-cine__disc { transform: scale(1.07); }
.fm-cine__cover:focus-visible { outline: none; }
.fm-cine__cover:focus-visible .fm-cine__disc { box-shadow: var(--fm-focus); animation: none; }
@keyframes fm-cine-pulse { 0% { box-shadow: 0 0 0 0 rgba(225, 37, 39, 0.5); } 70%, 100% { box-shadow: 0 0 0 1.4rem rgba(225, 37, 39, 0); } }

/* captions in the site's type */
.fm-cine__caption {
  position: absolute; inset-inline: 4%; bottom: clamp(3.4rem, 11%, 5.5rem); z-index: 2;
  text-align: center; pointer-events: none;
  transition: bottom var(--fm-dur-move) var(--fm-ease);
}
.fm-cine__shell.is-idle .fm-cine__caption { bottom: clamp(1rem, 5%, 2.25rem); }
.fm-cine__caption.is-top, .fm-cine__shell.is-idle .fm-cine__caption.is-top, .fm-cine__shell.is-docked .fm-cine__caption.is-top { bottom: auto; top: clamp(0.6rem, 5%, 2.25rem); transition: none; }
.fm-cine__caption span {
  display: inline; padding: 0.16em 0.55em; border-radius: 6px;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: rgba(15, 15, 16, 0.78); color: #fff;
  font-family: var(--fm-font-head); font-weight: 600; line-height: 1.5;
  font-size: clamp(1rem, 2.3vw, 1.625rem);
}

/* controls */
.fm-cine__bar {
  position: absolute; inset-inline: 0; bottom: 0; z-index: 4;
  display: flex; align-items: center; gap: 0.15rem;
  padding: 2.2rem clamp(0.35rem, 1.4vw, 1rem) clamp(0.2rem, 0.8vw, 0.6rem);
  background: linear-gradient(to top, rgba(15, 15, 16, 0.82), rgba(15, 15, 16, 0));
  color: #fff;
  opacity: 0; visibility: hidden;
  transition: opacity 220ms var(--fm-ease), visibility 0s linear 220ms;
}
.fm-cine__shell.is-started .fm-cine__bar { opacity: 1; visibility: visible; transition-delay: 0s; }
.fm-cine__shell.is-started.is-idle .fm-cine__bar,
.fm-cine__shell.is-ended .fm-cine__bar { opacity: 0; visibility: hidden; transition-delay: 0s, 220ms; }
.fm-cine__shell.is-idle { cursor: none; }
.fm-cine__btn {
  flex: none; display: grid; place-items: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: var(--fm-radius-sm);
  background: transparent; color: #fff; cursor: pointer;
  font-family: var(--fm-font-head); font-weight: 700; font-size: 0.9375rem; letter-spacing: 0.02em;
}
.fm-cine__btn:hover { background: rgba(255, 255, 255, 0.16); }
.fm-cine__btn:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }
.fm-cine__btn--cc[aria-pressed="false"] { opacity: 0.55; text-decoration: line-through; }
.fm-cine__time {
  flex: none; padding-inline: 0.3rem 0.5rem;
  font-family: var(--fm-font-body); font-weight: 600; font-size: 0.9375rem; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.fm-cine__scrub { --p: 0%; position: relative; flex: 1 1 auto; min-width: 3rem; height: 44px; display: grid; align-items: center; }
.fm-cine__scrub input {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; margin: 0; padding: 0; background: transparent; cursor: pointer;
}
.fm-cine__scrub input::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--fm-red) var(--p), rgba(255, 255, 255, 0.34) var(--p)); }
.fm-cine__scrub input::-moz-range-track { height: 5px; border-radius: 3px; background: linear-gradient(to right, var(--fm-red) var(--p), rgba(255, 255, 255, 0.34) var(--p)); }
.fm-cine__scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; }
.fm-cine__scrub input::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: #fff; border: 0; }
.fm-cine__scrub input:focus-visible { outline: 2px solid #fff; outline-offset: -8px; border-radius: 6px; }
.fm-cine__scrub i { position: absolute; top: 50%; width: 2px; height: 5px; margin-top: -2.5px; background: rgba(15, 15, 16, 0.75); pointer-events: none; }
.fm-cine__part {
  flex: none; max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-inline: 0.6rem 0.75rem; border-left: 1px solid rgba(255, 255, 255, 0.35);
  font-family: var(--fm-font-head); font-weight: 700; font-size: 0.9375rem;
}
@media (max-width: 47.99em) { .fm-cine__part { display: none; } }
@media (max-width: 26em) { .fm-cine__time { display: none; } }

/* the end: the site's two actions over the last frame */
.fm-cine__end {
  position: absolute; inset: 0; z-index: 5;
  display: grid; place-items: center; align-content: center; gap: clamp(0.6rem, 2vw, 1.25rem);
  padding: 1rem; text-align: center; color: #fff;
  background: rgba(15, 15, 16, 0.86);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fm-cine-in 500ms var(--fm-ease);
}
.fm-cine__end[hidden] { display: none; }
@keyframes fm-cine-in { from { opacity: 0; } to { opacity: 1; } }
.fm-cine__end-t { margin: 0; font-family: var(--fm-font-head); font-weight: 800; font-size: clamp(1.25rem, 4vw, 2.5rem); line-height: 1.1; }
.fm-cine__end-a { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem 0.75rem; }
.fm-cine__end .fm-cine__ghost { --_bg: transparent; --_bd: #fff; --_fg: #fff; background: transparent; border-color: #fff; color: #fff; }
.fm-cine__end .fm-cine__ghost:hover { background: #fff; color: var(--fm-ink); }
.fm-cine__again {
  min-height: 44px; padding: 0 0.5rem; border: 0; background: none; color: #fff; cursor: pointer;
  font-family: var(--fm-font-head); font-weight: 700; font-size: 1rem;
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 4px;
}
@media (max-width: 32.5em) { .fm-cine__end .fm-button { min-height: 44px; padding-block: 0.5rem; font-size: 1rem; } }

/* docked: keeps playing in the corner while the visitor reads on */
.fm-cine__shell.is-docked {
  position: fixed; inset: auto max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) auto;
  z-index: 70; width: min(23rem, 62vw); aspect-ratio: 16 / 9;
  animation: fm-cine-dock 320ms var(--fm-ease);
}
@keyframes fm-cine-dock { from { opacity: 0; transform: translateY(18px) scale(0.94); } to { opacity: 1; transform: none; } }
.fm-cine__shell.is-docked .fm-cine__screen { border-radius: 12px; box-shadow: 0 2px 6px rgba(15, 15, 16, 0.25), 0 18px 44px -10px rgba(15, 15, 16, 0.55); }
.fm-cine__shell.is-docked .fm-cine__bar > :not(:first-child):not(.fm-cine__scrub) { display: none; }
.fm-cine__shell.is-docked .fm-cine__bar { padding: 1rem 0.25rem 0; }
.fm-cine__shell.is-docked .fm-cine__caption { bottom: 1.5rem; padding-inline: 0.5rem; }
.fm-cine__shell.is-docked .fm-cine__caption span { font-size: 0.6875rem; line-height: 1.3; padding: 0.1em 0.35em; }
.fm-cine__dockbar { position: absolute; top: 0; right: 0; z-index: 6; display: none; padding: 0.15rem; background: linear-gradient(to bottom left, rgba(15, 15, 16, 0.7), rgba(15, 15, 16, 0) 70%); border-bottom-left-radius: 40px; }
.fm-cine__shell.is-docked .fm-cine__dockbar { display: flex; }
.fm-cine__dockbar .fm-cine__btn { width: 40px; height: 40px; }

/* full screen */
.fm-cine__shell:fullscreen { background: #000; }
.fm-cine__shell:fullscreen .fm-cine__screen { border-radius: 0; box-shadow: none; }

/* the scrubber names the part under the pointer */
.fm-cine__tip {
  position: absolute; bottom: 38px; left: 0; transform: translateX(-50%) translateY(4px);
  padding: 0.3em 0.65em; border-radius: 6px; background: #fff; color: var(--fm-ink);
  font-family: var(--fm-font-head); font-weight: 700; font-size: 0.875rem; line-height: 1.2; white-space: pre;
  box-shadow: 0 6px 20px -6px rgba(0, 0, 0, 0.6);
  opacity: 0; pointer-events: none; transition: opacity 140ms var(--fm-ease), transform 140ms var(--fm-ease);
}
.fm-cine__tip.is-on { opacity: 1; transform: translateX(-50%); }
.fm-cine__shell.is-docked .fm-cine__tip { display: none; }

/* the poster grows into place as it scrolls into view (where the browser can) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .fm-cine__shell:not(.is-started) .fm-cine__screen {
      animation: fm-cine-rise linear both; animation-timeline: view(); animation-range: entry 10% cover 38%;
    }
  }
}
@keyframes fm-cine-rise { from { transform: scale(0.9); opacity: 0.55; } to { transform: none; opacity: 1; } }

/* the browser's own captions never draw over ours */
.fm-cine__shell[role] .fm-cine__video::-webkit-media-text-track-container { display: none !important; }
.fm-cine__end-b { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 1rem; }

@media (max-width: 40em) {
  /* small screens: no captions over the tiny docked picture */
  .fm-cine__shell.is-docked .fm-cine__caption { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fm-cine, .fm-cine * { transition-duration: 0.01ms !important; }
  .fm-cine__cover img, .fm-cine__disc, .fm-cine__end, .fm-cine__shell.is-docked { animation: none; }
}
@media (forced-colors: active) {
  .fm-cine__disc { border: 2px solid CanvasText; }
}
