/* Proto film popup: sections/proto/proto-film-popup.njk + assets/js/proto-film-popup.js.
   The launch film's look on every page (owner, 2026-10-14): an ink card with the
   film's Proto chapter as a muted loop, a Clash headline, the film's orange and the
   visitor's installer. Minimised, it is a pill on the right edge. It stays dark in
   both site themes because it is a piece of the film, not page chrome. */
.proto-film-popup {
  --proto-film-ink: var(--ink-deep, #130f0c);
  --proto-film-paper: var(--ink-light, #f4f0e9);
  /* The launch film's orange; pricing's "Today, SaaS is free." section uses the same. */
  --proto-film-orange: #ff6b32;
  --proto-film-ease: cubic-bezier(0.16, 1, 0.3, 1);
  /* Its own corner inset, and the return arrows' (.back-to-search, .scroll-return). */
  --proto-film-inset: 1rem;
  --proto-film-arrow-inset: var(--space-6);

  position: fixed;
  right: max(var(--proto-film-inset), env(safe-area-inset-right));
  bottom: max(var(--proto-film-inset), env(safe-area-inset-bottom));
  /* Under the cookie banner (80), which owns the bottom-left corner. */
  z-index: 75;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: var(--proto-film-paper);
  font-family: Supreme, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Only the card and the pill take pointer input: on phones this box spans the width. */
  pointer-events: none;
  transition:
    opacity 0.25s var(--proto-film-ease),
    transform 0.25s var(--proto-film-ease),
    translate 0.25s var(--proto-film-ease),
    visibility 0s;
}

/* The footer is on screen (proto-film-popup.js): step aside so no footer link is covered. */
.proto-film-popup[data-footer-showing] {
  visibility: hidden;
  opacity: 0;
  transform: translateY(0.5rem);
  transition:
    opacity 0.25s var(--proto-film-ease),
    transform 0.25s var(--proto-film-ease),
    translate 0.25s var(--proto-film-ease),
    visibility 0s 0.25s;
}

/* A return arrow is on screen (Back to search on the homepage, Back to top on long
   pages; both 3.5rem round at --proto-film-arrow-inset from the right and bottom edges,
   plus the bottom safe area): sit 0.75rem above it with right edges aligned, so both
   take clicks (owner, 2026-10-14). */
body:has(.back-to-search[data-visible='true'], .scroll-return[data-visible='true'])
  .proto-film-popup {
  translate: calc(
      max(var(--proto-film-inset), env(safe-area-inset-right)) - var(--proto-film-arrow-inset)
    )
    calc(
      max(var(--proto-film-inset), env(safe-area-inset-bottom)) - var(--proto-film-arrow-inset) -
        env(safe-area-inset-bottom, 0px) - 3.5rem - 0.75rem
    );
}

.proto-film-popup[hidden],
.proto-film-popup__card[hidden],
.proto-film-popup__launcher[hidden],
.proto-film-popup__status[hidden],
.proto-film-popup__platforms a[hidden] {
  display: none;
}

.proto-film-popup__card,
.proto-film-popup__launcher {
  pointer-events: auto;
}

.proto-film-popup__card {
  box-sizing: border-box;
  width: min(21.5rem, calc(100vw - 2rem));
  padding: 0.75rem 0.75rem 1.125rem;
  border: 1px solid color-mix(in oklab, var(--proto-film-paper) 14%, transparent);
  border-radius: 1.125rem;
  background: var(--proto-film-ink);
  box-shadow:
    0 24px 64px rgb(0 0 0 / 0.38),
    0 2px 8px rgb(0 0 0 / 0.22);
  animation: proto-film-rise 0.55s var(--proto-film-ease) both;
}

.proto-film-popup__film {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 0.75rem;
  background: var(--proto-film-ink);
}

.proto-film-popup__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.proto-film-popup__minimize {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: color-mix(in oklab, var(--proto-film-ink) 74%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--proto-film-paper) 18%, transparent);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: background-color 0.2s var(--proto-film-ease);
}

.proto-film-popup__minimize span {
  width: 0.75rem;
  height: 2px;
  border-radius: 2px;
  background: var(--proto-film-paper);
}

.proto-film-popup__minimize:hover {
  background: var(--proto-film-ink);
}

.proto-film-popup__minimize:focus-visible,
.proto-film-popup__launcher:focus-visible {
  outline: 2px solid var(--proto-film-orange);
  outline-offset: 2px;
}

.proto-film-popup__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.875rem 0.25rem 0;
  font-size: 0.8125rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.proto-film-popup__dot {
  flex: none;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--proto-film-orange);
}

.proto-film-popup__eyebrow-note {
  color: color-mix(in oklab, var(--proto-film-paper) 58%, transparent);
  font-weight: 500;
}

.proto-film-popup__title {
  margin: 0.625rem 0.25rem 0;
  color: var(--proto-film-paper);
  font-family: 'Clash Grotesk', Supreme, system-ui, sans-serif;
  font-size: 1.625rem;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.proto-film-popup__title span {
  display: block;
  color: var(--proto-film-orange);
}

.proto-film-popup__copy {
  margin: 0.75rem 0.25rem 0;
  color: color-mix(in oklab, var(--proto-film-paper) 74%, transparent);
  font-size: 0.9375rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.proto-film-popup__proof,
.proto-film-popup__status {
  margin: 0.5rem 0.25rem 0;
  color: color-mix(in oklab, var(--proto-film-paper) 56%, transparent);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.proto-film-popup__status {
  color: var(--proto-film-paper);
}

.proto-film-popup__proof a,
.proto-film-popup__fine a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.proto-film-popup__download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  height: 2.875rem;
  margin: 1rem 0.25rem 0;
  border-radius: 999px;
  background: var(--proto-film-orange);
  color: var(--proto-film-ink);
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition:
    filter 0.2s var(--proto-film-ease),
    transform 0.2s var(--proto-film-ease);
}

.proto-film-popup__download:hover {
  filter: brightness(1.08);
}

.proto-film-popup__download:active {
  transform: scale(0.985);
}

.proto-film-popup__download:focus-visible {
  outline: 2px solid var(--proto-film-paper);
  outline-offset: 3px;
}

.proto-film-popup__arrow {
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.proto-film-popup__platforms {
  display: flex;
  justify-content: center;
  gap: 0.625rem;
  margin: 0.625rem 0.25rem 0;
  color: color-mix(in oklab, var(--proto-film-paper) 56%, transparent);
  font-size: 0.8125rem;
}

.proto-film-popup__platforms a {
  color: color-mix(in oklab, var(--proto-film-paper) 84%, transparent);
  text-decoration: none;
}

.proto-film-popup__platforms a:hover {
  color: var(--proto-film-orange);
}

.proto-film-popup__fine {
  margin: 0.5rem 0.25rem 0;
  color: color-mix(in oklab, var(--proto-film-paper) 46%, transparent);
  font-size: 0.75rem;
  text-align: center;
}

.proto-film-popup__launcher {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  height: 2.75rem;
  padding: 0 0.875rem 0 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--proto-film-ink);
  box-shadow:
    inset 0 0 0 1.5px color-mix(in oklab, var(--proto-film-paper) 22%, transparent),
    0 12px 32px rgb(0 0 0 / 0.3);
  color: var(--proto-film-paper);
  font-family: Supreme, system-ui, sans-serif;
  font-size: 0.875rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.01em;
  cursor: pointer;
  animation: proto-film-rise 0.45s var(--proto-film-ease) both;
  transition: box-shadow 0.2s var(--proto-film-ease);
}

.proto-film-popup__launcher:hover {
  box-shadow:
    inset 0 0 0 1.5px var(--proto-film-orange),
    0 12px 32px rgb(0 0 0 / 0.3);
}

.proto-film-popup__launcher-note {
  padding: 0.3125rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in oklab, var(--proto-film-orange) 18%, transparent);
  color: var(--proto-film-orange);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

@keyframes proto-film-rise {
  from {
    opacity: 0;
    transform: translateY(0.875rem) scale(0.98);
  }
}

@media (max-width: 40rem) {
  .proto-film-popup {
    --proto-film-inset: 0.75rem;
    --proto-film-arrow-inset: var(--space-4);

    left: max(var(--proto-film-inset), env(safe-area-inset-left));
  }

  .proto-film-popup__card {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .proto-film-popup__card,
  .proto-film-popup__launcher {
    animation: none;
  }

  .proto-film-popup,
  .proto-film-popup[data-footer-showing],
  .proto-film-popup__download,
  .proto-film-popup__minimize,
  .proto-film-popup__launcher {
    transition: none;
  }
}

/* One Proto entry point: on system pages the contextual popup still opens from this
   card's download, but its own launcher stays hidden while this pill is on screen. */
body:has(.proto-film-popup:not([hidden])) .proto-popup-launcher {
  display: none;
}
