/* Clak "Macro" hero film, site build. Forked from lab/macro/film/film.css: every class is
 * namespaced under .film so the page's own .stage, .hero, .caret and .hint rules can't reach
 * in, and page tokens (--font, --gutter, .button, .sr-only) come from index.html. */

.film {
  /* Film plus the live hold; meta.json filmEnd says where the film stops. */
  --film-length: 560svh;
  --film-void: #0B0B0D;
  --film-text: #f5f5f7;
  --film-text-2: rgba(245, 245, 247, 0.72);
  --film-link: #3ea0ff;
  --film-edge: max(var(--gutter, 24px), env(safe-area-inset-left));
  position: relative;
  /* Starts under the sticky site header, which turns to dark glass while it's over the film. */
  margin-top: -48px;
  height: var(--film-length);
  background: var(--film-void);
  color: var(--film-text);
  color-scheme: dark;
}
/* No script: one screen with the poster and the title. */
html:not(.js) .film { height: auto; }
html:not(.js) .film__stage { position: relative; }

.film__stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  contain: strict;
  width: 100%;
}
/* The last few pixels fade to the void, so the frame's floor light doesn't end in a hard cut
 * where the page takes over. */
.film__stage::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 56px; pointer-events: none;
  background: linear-gradient(rgba(11, 11, 13, 0), var(--film-void));
}
.film__poster, .film__frames, .film__fx {
  position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none;
}
.film__poster img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; display: block; }
/* The frame canvas is opaque black until its first draw; the poster shows until then. */
.film__frames { opacity: 0; }
.film.is-drawn .film__frames { opacity: 1; }
.film.is-drawn .film__poster { visibility: hidden; }

/* ---------- live screens (native size; film.js maps them onto the frame) ---------- */

.film__screen {
  position: absolute;
  left: 0; top: 0;
  transform-origin: 0 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  will-change: transform, opacity;
  -webkit-font-smoothing: antialiased;
}
.film__screen.is-on { visibility: visible; }

/* HUD pill: 1260×323 = calib/film.js pillContent (46 pt tall, so 1 pt = 7.022 px); film.js
 * takes the width from frames/overlay_spec.json when the render publishes one. The dot and
 * the glass stay baked; this strip covers the text area with the rendered pill colour and
 * feathers into it. Text: 24 pt Menlo at x = 29 pt, centred +1 pt. */
.film__screen--pill { width: 1260px; height: 323px; }
.film__strip {
  position: absolute;
  left: 168.5px; right: 60px; top: 42px; bottom: 42px;
  background: var(--film-pill-bg, linear-gradient(90deg, rgb(24, 31, 45), rgb(21, 28, 41) 60%, rgb(22, 29, 42)));
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14px, #000 calc(100% - 40px), transparent);
}
.film__hud {
  position: absolute;
  left: 35.1px;
  top: calc(50% + 7px);
  transform: translateY(-50%);
  font: 168.52px/1 Menlo, "SF Mono", ui-monospace, monospace;
  color: var(--film-pill-text, #E9EAEE);   /* #F5F5F7 after the render's grade */
  white-space: pre;
}

/* Phone panel: 800×1686 = calib/film.js phoneContent. The panel and its gradient stay baked;
 * the text field (x 8%, y 40%, 84% × 7.5%, radius 30% of its height) is live. */
.film__screen--phone { width: 800px; height: 1686px; }
.film__field {
  position: absolute;
  left: 64px; top: 674.4px; width: 672px; height: 126.45px;
  display: flex; align-items: center;
  padding-left: 40.32px;
  border-radius: 37.94px;
  background: var(--film-field-bg, rgb(24, 34, 46));
  /* The texture's 3 px stroke survives the grade as only a faint edge. */
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.025);
  font: 500 63.23px/1 Inter, sans-serif;
  color: var(--film-field-text, #E9EAEE);
  white-space: pre;
  overflow: hidden;
}
.film__fieldtext { transform: translateY(1.9px); }
.film__caret {
  flex: none;
  width: 5.6px; height: 66.39px;
  margin-left: 5.06px;
  border-radius: 2.8px;
  background: var(--film-caret, #3EA0FF);
}
.film__screen--phone.is-blinking .film__caret { animation: film-blink 1.1s steps(1) infinite; }
.film__screen--phone.is-typing .film__caret { animation: none; }
@keyframes film-blink { 50% { opacity: 0; } }

/* ---------- copy ---------- */

.film__copy { position: absolute; inset: 0; pointer-events: none; }
/* Keeps the title and the lines legible over the bright key and the Mac window's edge. */
.film__copy::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 38svh;
  background: linear-gradient(rgba(11, 11, 13, 0), rgba(11, 11, 13, 0.55));
}
.film__line {
  position: absolute;
  left: var(--film-edge);
  right: 16px;
  bottom: max(24px, 6svh);
  margin: 0;
  text-align: left;
  font-family: var(--font);
  font-weight: 500;
  font-size: clamp(15px, 1.2vw, 17px);
  line-height: 1.35;
  color: rgba(245, 245, 247, 0.8);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
  will-change: opacity, transform;
}
.js .film__line { opacity: 0; }

/* The title is the first beat: fully there at the top of the page, gone once the key drops. */
.film__title {
  position: absolute;
  left: var(--film-edge);
  right: 16px;
  bottom: max(24px, 6svh);
  pointer-events: auto;
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.55);
}
.film__title h1 {
  font-family: var(--font-display);
  font-size: clamp(56px, 7.5vw, 104px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--film-text);
}
.film__tagline {
  margin-top: 12px;
  max-width: 17em;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--film-text);
}
.film__cta {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
  text-shadow: none;
}
.film__cta .text-link { color: var(--film-link); }
.film__cue {
  position: absolute;
  right: var(--film-edge);
  bottom: max(24px, 6svh);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--film-text-2);
}
.film__cue::after {
  content: ""; display: block; width: 1px; height: 28px; margin: 8px auto 0;
  background: linear-gradient(currentColor, transparent);
}

@media (max-aspect-ratio: 4/5) {
  .film__line { bottom: auto; top: calc(48px + max(12px, 4svh)); }
  /* Portrait crops put the Mac window's bright edge under the copy; a scrim keeps it legible. */
  .film__copy::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 26svh; background: linear-gradient(rgba(11, 11, 13, 0.75), rgba(11, 11, 13, 0)); }
  .film__cue { display: none; }
}
/* The rendered portrait set fills its top with the Mac window and leaves the void at the
 * bottom, under the keyboard, so the copy goes back to the bottom there. */
.film.has-portrait-set .film__line { top: auto; bottom: max(24px, 5svh); }
.film.has-portrait-set .film__copy::after { content: none; }

.film__tap { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }
.film__tap input { font-size: 16px; }

.film__loading {
  position: absolute; left: 50%; bottom: 32px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  color: #a1a1a6; font-size: 14px;
}
.film__loading span {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: film-spin 0.8s linear infinite;
}
.film__loading[hidden] { display: none; }
@keyframes film-spin { to { transform: rotate(360deg); } }

/* Reduced motion (or Save-Data): no pinning, one screen, the locked frame with live screens.
 * The title sits where it always does; of the scroll copy only the invitation stays. */
.film.is-static { height: auto; }
.film.is-static .film__stage { position: relative; }
.film.is-static .film__line { display: none; }
.film.is-static .film__line--live { display: block; opacity: 1; bottom: auto; top: calc(48px + max(16px, 4svh)); }
.film.is-static.has-portrait-set .film__line--live { top: auto; bottom: max(24px, 5svh); }
.film.is-static .film__cue { display: none; }
.film.is-static .film__caret { animation: none !important; }
.film > .film__title { position: relative; left: auto; right: auto; bottom: auto; padding: 8px var(--film-edge) 56px; }
