/* Interlinked product films (spec 16): a 16:9 stage whose em is 1/120 of its width (16px at 1920),
   the starfield, a camera, the dark app shell and the small UI kit the four films share.

   Timeline convention: every animated element carries .film-anim (duration var(--loop), infinite,
   delay var(--t0) plus its own stagger --film-d) and names its keyframes in its film's css. Keyframes are
   percentages of the 10s loop with holds; 0% and 100% are the bare starfield. .is-paused on the root
   freezes every descendant; reduced motion (and .is-still) parks the film on its settled frame --settle. */

/* --film-d is a per-element stagger: it must not leak into children */
@property --film-d {
  syntax: '<time>';
  inherits: false;
  initial-value: 0s;
}

.il.film-root {
  --loop: 10s;
  --film-ease: cubic-bezier(.4, 0, .2, 1);
  /* spec 16 UI kit */
  --f-page: #131210;
  --f-card: #1f1e1a;
  --f-graph: #0e0d08;
  --f-rail: #070604;
  --f-line: #2a2826;
  --f-line-2: #373631;
  --f-line-3: #3a3936;
  --f-line-hi: #8a8985;
  --f-wire: #54534e;
  --f-track: #181715;
  --f-queued: #504d44;
  --f-text: #f4f0ed;
  --f-text-2: #b0ada8;
  --f-text-3: #6f6b65;
  --f-teal: #2fb18b;
  --f-teal-text: #4b9e82;
  --f-amber: #c08a3c;
  --f-port: #958cb9;
  --f-port-pink: #aa8398;
  --f-blue: #74a1d8;
  --f-teal-2: #5c8b7b;
  --f-purple: #ae9ee9;
  --f-bool: #9a8cd8;
  --f-on-primary: #11100e;
  --f-copper: var(--accent, #ed670f);
  container-type: inline-size;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #000;
  isolation: isolate;
  color: var(--f-text);
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: slashed-zero tabular-nums;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.film-root *,
.film-root *::before,
.film-root *::after {
  box-sizing: border-box;
}
.film-root,
.film-root * {
  cursor: inherit; /* a picture of an app: the page keeps its own pointer */
}
.film-root svg {
  display: block;
  flex: none;
  overflow: visible;
}

/* Timeline */
.film-anim {
  animation-duration: var(--loop);
  animation-timing-function: var(--film-ease);
  animation-delay: calc(var(--t0, 0s) + var(--film-d, 0s));
  animation-iteration-count: infinite;
  animation-fill-mode: both;
}
.film-step {
  animation-timing-function: step-end;
}
.film-linear {
  animation-timing-function: linear;
}
.film-root.is-paused *,
.film-root.is-paused *::before,
.film-root.is-paused *::after {
  animation-play-state: paused !important;
}
.il.film-root.is-still {
  --t0: var(--settle, 0s);
}
@media (prefers-reduced-motion: reduce) {
  .il.film-root {
    --t0: var(--settle, 0s);
  }
  .film-root *,
  .film-root *::before,
  .film-root *::after {
    animation-play-state: paused !important;
  }
}

/* Stage, starfield, camera */
.film-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  font-size: 16px;
  font-size: calc(100cqw / 120);
}
.film-sky {
  position: absolute;
  inset: 0;
  background: #000 url(../assets/71cb10346cafc6578df5d7904360301b.png) center / cover no-repeat;
  image-rendering: pixelated;
  pointer-events: none;
}
.film-cam {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.film-layer {
  position: absolute;
  inset: 0;
}

/* Type */
.film-mono {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-variant-numeric: slashed-zero tabular-nums;
}
.film-serif {
  font-family: 'IL Serif', Georgia, serif;
  font-weight: 400;
  font-variant-numeric: normal;
  letter-spacing: 0;
}
.film-xs { font-size: .75em; }
.film-sm { font-size: .8125em; }
.film-md { font-size: .875em; }
.film-u {
  text-decoration: underline;
  text-decoration-color: rgba(244, 240, 237, .4);
  text-underline-offset: .2em;
}
.film-ell {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Icons: 16px stroke drawings (path d only; stroke styling lives here) and filled glyphs */
.film-ico {
  display: block;
  flex: none;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.film-glyph {
  display: block;
  flex: none;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* App window: rail, top bar, content */
.film-app {
  position: absolute;
  left: 7.5em;
  top: 5em;
  width: 105em;
  height: 57.5em;
  display: grid;
  grid-template-columns: 3.5em minmax(0, 1fr);
  grid-template-rows: 3.5em minmax(0, 1fr);
  overflow: hidden;
  background: var(--f-page);
  border: 1px solid var(--f-line);
  border-radius: 2px;
}
.film-rail {
  grid-column: 1;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .375em;
  padding: .75em 0 .875em;
  background: var(--f-rail);
  border-right: 1px solid var(--f-line);
  color: var(--f-text-3);
}
.film-mark {
  display: block;
  width: 2.3125em;
  height: 2em;
  margin-bottom: 1em;
  image-rendering: pixelated;
}
.film-rail-i {
  display: grid;
  place-items: center;
  width: 2.25em;
  height: 2.25em;
  border-radius: 2px;
}
.film-rail-i.is-on {
  background: var(--f-card);
  color: var(--f-text);
}
.film-rail-gap {
  flex: 1 1 auto;
}
.film-avatar {
  display: grid;
  place-items: center;
  width: 1.75em;
  height: 1.75em;
  margin-top: .5em;
  background: var(--f-port);
  color: var(--f-rail);
  border-radius: 2px;
}
.film-avatar .film-ico {
  width: 1.125em;
  height: 1.125em;
}
.film-top {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: .75em;
  min-width: 0;
  padding: 0 1.25em 0 1em;
  border-bottom: 1px solid var(--f-line);
  color: var(--f-text-3);
  white-space: nowrap;
}
.film-crumbs {
  display: flex;
  align-items: center;
  gap: .625em;
  min-width: 0;
  color: var(--f-text-3);
}
.film-crumbs > span {
  font-size: .875em;
}
.film-crumbs .film-ico {
  width: .75em;
  height: .75em;
}
.film-crumbs .is-here {
  color: var(--f-text);
}
.film-top-gap {
  flex: 1 1 auto;
}
.film-fuel {
  display: flex;
  align-items: center;
  gap: .375em;
  color: var(--f-text-2);
}
.film-fuel > span {
  font-size: .875em;
}
.film-select {
  display: flex;
  align-items: center;
  gap: .5em;
  height: 2em;
  padding: 0 .5em 0 .75em;
  background: var(--f-card);
  border: 1px solid var(--f-line);
  border-radius: 2px;
  color: var(--f-text);
  white-space: nowrap;
}
.film-select > span {
  font-size: .8125em;
}
.film-select .film-ico {
  width: .75em;
  height: .75em;
  margin-left: auto;
  color: var(--f-text-3);
}
.film-ibtn {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 2em;
  height: 2em;
  background: var(--f-card);
  border: 1px solid var(--f-line);
  border-radius: 2px;
  color: var(--f-text-2);
}
.film-ibtn .film-ico {
  width: .875em;
  height: .875em;
}
.film-badge {
  position: absolute;
  top: -.5em;
  right: -.5em;
  display: grid;
  place-items: center;
  width: 1.125em;
  height: 1.125em;
  background: var(--f-text);
  color: var(--f-on-primary);
  border-radius: 2px;
  opacity: 0;
}
.film-badge > span {
  font-size: .75em;
  font-weight: 600;
  line-height: 1;
}
.film-main {
  grid-column: 2;
  grid-row: 2;
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 1.75em 2em;
  overflow: hidden;
}

/* Page header */
.film-ph {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2em;
}
.film-h1 {
  display: flex;
  align-items: center;
  gap: .625em;
  color: var(--f-text);
}
.film-h1 .film-ico {
  width: 1.375em;
  height: 1.375em;
  color: var(--f-text-2);
}
.film-h1 > span {
  font-family: 'IL Serif', Georgia, serif;
  font-size: 1.75em;
  line-height: 1;
}
.film-sub {
  margin-top: .75em;
  font-size: .875em;
  color: var(--f-text-2);
  white-space: nowrap;
}

/* Surfaces and controls (radii stay at 2px or less) */
.film-card {
  position: relative;
  background: var(--f-card);
  border: 1px solid var(--f-line);
  border-radius: 2px;
}
.film-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  height: 2em;
  padding: 0 .75em;
  background: var(--f-text);
  color: var(--f-on-primary);
  border: 1px solid var(--f-text);
  border-radius: 2px;
  white-space: nowrap;
}
.film-btn > span {
  font-size: .8125em;
  font-weight: 500;
}
.film-btn .film-ico,
.film-btn .film-glyph {
  width: .875em;
  height: .875em;
}
.film-btn--ghost {
  background: transparent;
  color: var(--f-text);
  border-color: var(--f-line);
}
.film-btn--quiet {
  background: var(--f-card);
  color: var(--f-text-2);
  border-color: var(--f-line);
}
.film-chip {
  display: inline-flex;
  align-items: center;
  gap: .375em;
  height: 1.5em;
  padding: 0 .4375em;
  background: var(--f-card);
  border: 1px solid var(--f-line);
  border-radius: 2px;
  color: var(--f-text-2);
  white-space: nowrap;
}
.film-chip > span {
  font-size: .75em;
}
.film-chip .film-ico {
  width: .75em;
  height: .75em;
}
.film-chip--teal {
  background: rgba(47, 177, 139, .08);
  border-color: rgba(47, 177, 139, .55);
  color: var(--f-teal-text);
}
.film-chip--amber {
  background: rgba(192, 138, 60, .08);
  border-color: rgba(192, 138, 60, .55);
  color: var(--f-amber);
}
.film-chip--blue {
  background: rgba(116, 161, 216, .1);
  border-color: rgba(116, 161, 216, .35);
  color: var(--f-blue);
}
.film-chip--purple {
  background: rgba(174, 158, 233, .1);
  border-color: rgba(174, 158, 233, .35);
  color: var(--f-purple);
}
.film-chip--white {
  background: var(--f-text);
  border-color: var(--f-text);
  color: var(--f-on-primary);
}
.film-input {
  display: flex;
  align-items: center;
  gap: .5em;
  height: 2em;
  padding: 0 .375em 0 .625em;
  border: 1px solid var(--f-line);
  border-radius: 2px;
  color: var(--f-text-3);
  white-space: nowrap;
}
.film-input > span {
  font-size: .8125em;
}
.film-input .film-ico {
  width: .875em;
  height: .875em;
}
.film-input > .film-kbd {
  font-size: 1em; /* the key hint keeps stage units; only its label shrinks */
}
.film-kbd {
  display: grid;
  place-items: center;
  width: 1.25em;
  height: 1.25em;
  margin-left: auto;
  border: 1px solid var(--f-line);
  border-radius: 2px;
}
.film-kbd > span {
  font-size: .75em;
  line-height: 1;
}
.film-check {
  position: relative;
  flex: none;
  width: .875em;
  height: .875em;
  border: 1px solid #5c5a55;
  border-radius: 2px;
}
.film-check-on {
  position: absolute;
  inset: -1px;
  display: grid;
  place-items: center;
  background: var(--f-text);
  color: var(--f-on-primary);
  border-radius: 2px;
}
.film-check-on .film-ico {
  width: .75em;
  height: .75em;
  stroke-width: 2;
}
.film-sq {
  flex: none;
  width: .5em;
  height: .5em;
  background: var(--f-queued);
}
.film-dot {
  flex: none;
  width: .4375em;
  height: .4375em;
  background: var(--f-teal);
}
.film-th {
  font-size: .75em;
  color: var(--f-text-3);
  white-space: nowrap;
}
.film-td {
  min-width: 0;
  overflow: hidden;
  font-size: .8125em;
  color: var(--f-text-2);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.film-modal {
  position: absolute;
  background: var(--f-page);
  border: 1px solid var(--f-line-3);
  border-radius: 2px;
}

/* Org graph: dotted canvas (a dot every 16px), nodes with square ports, elbow wires, check rows */
.film-graph {
  position: absolute;
  background-color: #35332e;
  background-image:
    linear-gradient(to bottom, var(--f-graph) calc(100% - .1em), transparent 0),
    linear-gradient(to right, var(--f-graph) calc(100% - .1em), transparent 0);
  background-size: 1em 1em;
  border: 1px solid var(--f-line);
  border-radius: 2px;
}
.film-node {
  position: absolute;
  width: 16em;
  height: 3.5em;
  padding: .5em .75em;
  background: var(--f-card);
  border: 1px solid #383732;
  border-radius: 2px;
}
.film-node-hd {
  display: flex;
  align-items: center;
  gap: .5em;
  height: 1.25em;
}
.film-node-hd .film-ico {
  color: var(--f-text-2);
}
.film-node-t {
  font-size: .875em;
  font-weight: 500;
  color: var(--f-text);
  white-space: nowrap;
}
.film-node-k {
  margin-left: auto;
  font-size: .75em;
  color: var(--f-text-3);
  white-space: nowrap;
}
.film-node-s {
  margin: .25em 0 0 2em;
  overflow: hidden;
  font-size: .75em;
  line-height: 1.2;
  color: var(--f-text-3);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.film-port {
  position: absolute;
  top: 1.53125em;
  width: .4375em;
  height: .4375em;
  background: var(--f-port);
}
.film-port--in { left: -.25em; }
.film-port--out { right: -.25em; }
.film-port--white { background: var(--f-text); }
.film-port--pink { background: var(--f-port-pink); }
.film-wires {
  position: absolute;
  pointer-events: none;
}
.film-wires path {
  fill: none;
  stroke: var(--f-wire);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
}
.film-crow {
  display: flex;
  align-items: center;
  gap: .3125em;
  height: 1.5em;
  padding: 0 .375em;
  background: var(--f-page);
  border: 1px solid #353430;
  border-radius: 2px;
}
.film-crow .film-ico {
  width: .75em;
  height: .75em;
  color: var(--f-text-3);
}
.film-crow-n {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-size: .75em;
  color: var(--f-text);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.film-crow-k {
  flex: none;
  font-size: .75em;
  color: var(--f-text-3);
}

/* Transitions: CRT scanline dissolve and the dim behind modals */
.film-crt {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  background-color: rgba(0, 0, 0, .45);
  background-image: repeating-linear-gradient(to bottom, rgba(0, 0, 0, .75) 0 1px, rgba(255, 255, 255, .05) 1px 2px, transparent 2px 3px);
}
.film-dim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: rgba(10, 9, 8, .55);
}

/* The white pixel pointing hand (32px at 1920); its fingertip sits on the element's origin */
.film-cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 30;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  transform-origin: 0 0;
}
.film-cursor svg {
  position: absolute;
  left: -.75em;
  top: -.0625em;
  width: 2em;
  height: 2em;
  shape-rendering: crispEdges;
}

/* Colour utilities last, so they win over component colours */
.film-t1 { color: var(--f-text); }
.film-t2 { color: var(--f-text-2); }
.film-t3 { color: var(--f-text-3); }
.film-teal { color: var(--f-teal-text); }
.film-amber { color: var(--f-amber); }
