/* ==========================================================================
   chrome — academy leader, focus reticle, top bar, iris menu, timecode rail
   ==========================================================================

   House rule for this file: hover and state changes animate transform,
   opacity and colour only. Never padding, width, height or margin — those
   lay out the element and everything inside it on every frame of the
   transition, and on a page already running a WebGL scene there is no budget
   for it.
   ========================================================================== */

/* ── academy leader ────────────────────────────────────────────────────── */

.leader {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  background: var(--void);
  padding: var(--gut);
}

.leader__frame {
  position: relative;
  display: grid;
  place-items: center;
  width: min(300px, 54vw);
  aspect-ratio: 1;
  align-self: center;
}

.leader__dial { position: absolute; inset: 0; width: 100%; height: 100%; }

.leader__sweep { transform-origin: 100px 100px; }

.leader__count {
  font-family: var(--f-display);
  font-weight: 700;
  font-variation-settings: "wdth" 100;
  font-size: clamp(4rem, 13vw, 8.5rem);
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--silver);
}

.leader__bar {
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* ── focus reticle ─────────────────────────────────────────────────────────
   A camera focus box rather than the usual dot-and-ring. The container is
   moved by a single transform each frame; the four brackets only ever scale
   and translate, so nothing here triggers layout.
   ------------------------------------------------------------------------ */

.reticle {
  position: fixed;
  top: 0; left: 0;
  z-index: 350;
  width: 74px; height: 74px;
  margin: -37px 0 0 -37px;
  pointer-events: none;
  will-change: transform;
  --spread: 0px;
  --edge: var(--silver-4);
  --dot: 1;
}

.reticle__b {
  position: absolute;
  width: 11px; height: 11px;
  border: 1px solid var(--edge);
  transition: transform 0.42s var(--ease), border-color 0.42s var(--ease);
}

.reticle__b--tl { top: 0; left: 0; border-right: 0; border-bottom: 0;
  transform: translate(calc(var(--spread) * -1), calc(var(--spread) * -1)); }
.reticle__b--tr { top: 0; right: 0; border-left: 0; border-bottom: 0;
  transform: translate(var(--spread), calc(var(--spread) * -1)); }
.reticle__b--bl { bottom: 0; left: 0; border-right: 0; border-top: 0;
  transform: translate(calc(var(--spread) * -1), var(--spread)); }
.reticle__b--br { bottom: 0; right: 0; border-left: 0; border-top: 0;
  transform: translate(var(--spread), var(--spread)); }

.reticle__dot {
  position: absolute;
  top: 50%; left: 50%;
  width: 3px; height: 3px;
  margin: -1.5px 0 0 -1.5px;
  background: var(--silver);
  border-radius: 50%;
  transform: scale(var(--dot));
  transition: transform 0.42s var(--ease), background-color 0.42s var(--ease);
}

.reticle__tag {
  position: absolute;
  top: 50%; left: calc(100% + 10px);
  transform: translateY(-50%) translateX(-6px);
  white-space: nowrap;
  color: var(--cyan);
  opacity: 0;
  transition: opacity 0.35s var(--ease), transform 0.45s var(--ease);
}

.reticle.is-active { --spread: 9px; --edge: var(--cyan); --dot: 0; }
.reticle.is-active .reticle__tag { opacity: 1; transform: translateY(-50%) translateX(0); }
.reticle.is-grab { --spread: 5px; --edge: var(--cyan); --dot: 2.4; }
.reticle.is-grab .reticle__dot { background: var(--cyan); }

@media (hover: none), (pointer: coarse) { .reticle { display: none; } }

/* ── top bar ───────────────────────────────────────────────────────────── */

.bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(0.9rem, 2.2vh, 1.5rem) var(--gut);
}

/* A backdrop that fades in once the page has moved, so the bar never sits
   raw on top of running footage. */
.bar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  /* Effectively solid behind the bar's own text, then falling away to
     nothing. A softer gradient let the contact section's display type read
     straight through the mark at the bottom of the page — but a fully opaque
     bar would slice the top off the corridor, which is the one place the
     scene needs to reach the edge of the screen. */
  background: linear-gradient(to bottom,
    var(--void) 0%, rgba(8, 9, 11, 0.88) 52%, rgba(8, 9, 11, 0) 100%);
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.bar.is-stuck::before { opacity: 1; }

.bar__mark { display: inline-flex; align-items: center; gap: 0.62em; }

/* The mark is an aperture, drawn in CSS: a ring with a wedge removed. */
.bar__glyph {
  width: 13px; height: 13px;
  border: 1.5px solid var(--cyan);
  border-radius: 50%;
  border-right-color: transparent;
  transform: rotate(-45deg);
  transition: transform 0.7s var(--ease);
}

.bar__mark:hover .bar__glyph { transform: rotate(135deg); }

.bar__name {
  font-family: var(--f-display);
  font-weight: 700;
  font-variation-settings: "wdth" 115;
  font-size: 0.98rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.bar__state { display: none; }
@media (min-width: 900px) { .bar__state { display: block; } }

.irisbtn { display: inline-flex; align-items: center; gap: 0.8em; }

.irisbtn__label {
  position: relative;
  display: block;
  height: 1.45em;
  min-width: 5.2ch;
  overflow: hidden;
  text-align: right;
  font-family: var(--f-mono);
  font-size: var(--t-meta);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Height and line-height are 1.45 rather than 1 so descenders are not
   sheared off by the mask, and min-width is set from the longer of the two
   words so the bar does not jump when they swap. */
.irisbtn__label i {
  display: block;
  font-style: normal;
  line-height: 1.45;
  transition: transform 0.55s var(--ease);
}

.irisbtn__label i:last-child { position: absolute; top: 100%; right: 0; }

body.iris-open .irisbtn__label i { transform: translateY(-100%); }

/* Three concentric arcs that rotate into an open aperture. */
.irisbtn__ring {
  position: relative;
  width: 17px; height: 17px;
  display: grid;
  place-items: center;
}

.irisbtn__ring span {
  position: absolute;
  border: 1px solid var(--silver-2);
  border-radius: 50%;
  border-bottom-color: transparent;
  transition: transform 0.6s var(--ease), border-color 0.5s var(--ease);
}

.irisbtn__ring span:nth-child(1) { inset: 0; }
.irisbtn__ring span:nth-child(2) { inset: 3px; transform: rotate(120deg); }
.irisbtn__ring span:nth-child(3) { inset: 6px; transform: rotate(240deg); }

.irisbtn:hover .irisbtn__ring span { border-color: var(--cyan); }
body.iris-open .irisbtn__ring span:nth-child(1) { transform: rotate(180deg); }
body.iris-open .irisbtn__ring span:nth-child(2) { transform: rotate(300deg); }
body.iris-open .irisbtn__ring span:nth-child(3) { transform: rotate(60deg); }

/* ── iris menu ─────────────────────────────────────────────────────────────
   The overlay opens the way a lens does: six blades swinging out of the
   frame. Each blade is one path rotated about the centre, so opening is a
   single rotation tween per blade rather than a shape morph.
   ------------------------------------------------------------------------ */

.iris {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  grid-template-rows: 1fr auto;
  align-content: center;
  padding: clamp(5rem, 13vh, 8rem) var(--gut) clamp(1.5rem, 4vh, 3rem);
  visibility: hidden;
}

body.iris-open .iris { visibility: visible; }

.iris__blades {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  z-index: -1;
  overflow: visible;
}

/* Each blade sits over the next. Alternating fills plus a hairline edge keep
   them legible as six overlapping leaves rather than one flat field — a real
   aperture shows its blades, and without this the seams read as compression
   artefacts instead of mechanism. */
.iris__blade path {
  fill: var(--void-2);
  stroke: rgba(217, 220, 225, 0.055);
  stroke-width: 0.6;
}

.iris__blade:nth-child(odd) path { fill: #0a0c0f; }

.iris__nav { align-self: center; justify-self: start; width: 100%; }

.iris__list { display: grid; }

.iris__list li {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

/* A fixed first column, so the aperture stops form a clean vertical rule and
   the labels all start on the same x. In a flex row the stops set their own
   widths — "f/1.4" against "f/4" — and the menu reads ragged. */
.iris__list a {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  align-items: baseline;
  padding: clamp(0.55rem, 1.8vh, 1rem) 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-variation-settings: "wdth" 108;
  font-size: clamp(1.9rem, 7vw, 5rem);
  line-height: 1;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  transform: translateY(115%);
  transition: color 0.4s var(--ease);
}

/* The label slides, the aperture stop stays put — the number is the fixed
   mark. The anchor's own transform belongs to the open/close stagger, so the
   hover shift has to live on an inner span. */
.iris__list a span { display: inline-block; transition: transform 0.55s var(--ease); }
.iris__list a:hover span { transform: translateX(0.55rem); }

.iris__list a em {
  font-family: var(--f-mono);
  font-style: normal;
  font-size: var(--t-meta);
  letter-spacing: 0.14em;
  color: var(--silver-4);
  transition: color 0.4s var(--ease);
}

.iris__list a:hover { color: var(--cyan); }
.iris__list a:hover em { color: var(--cyan); }

.iris__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  opacity: 0;
}

.iris__foot b { color: var(--silver); font-weight: 400; }

/* ── timecode rail ─────────────────────────────────────────────────────────
   A running timecode and five frame marks. It is the site's position
   indicator and its section nav at once.
   ------------------------------------------------------------------------ */

.rail {
  position: fixed;
  top: 50%; right: var(--gut);
  z-index: 200;
  transform: translateY(-50%);
  display: grid;
  gap: 1.1rem;
  justify-items: end;
  opacity: 0;
}

.rail__tc { color: var(--silver-3); }

.rail__ticks { display: grid; gap: 0.85rem; justify-items: end; }

/* The tick is the only thing in flow. Its label is taken out of flow
   entirely — left in place it still occupies its own width while invisible,
   which pushes every tick to a different x and turns a column of frame marks
   into a scatter of stray dashes. */
.rail__ticks a {
  position: relative;
  display: block;
  width: 22px; height: 12px;
  color: var(--silver-4);
  transition: color 0.4s var(--ease);
}

.rail__ticks i {
  position: absolute;
  top: 50%; right: 0;
  width: 22px; height: 1px;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(0.5);
  transition: transform 0.5s var(--ease);
}

.rail__ticks b {
  position: absolute;
  top: 50%; right: 30px;
  color: inherit;
  font-weight: 400;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-50%) translateX(6px);
  transition: opacity 0.4s var(--ease), transform 0.5s var(--ease);
}

.rail__ticks a:hover,
.rail__ticks a.is-on { color: var(--cyan); }
.rail__ticks a:hover i,
.rail__ticks a.is-on i { transform: scaleX(1); }
.rail__ticks a:hover b { opacity: 1; transform: translateY(-50%) translateX(0); }

.rail__line {
  position: relative;
  width: 1px; height: 64px;
  background: var(--line-2);
  overflow: hidden;
}

.rail__line b {
  position: absolute;
  inset: 0;
  background: var(--cyan);
  transform: scaleY(0);
  transform-origin: top;
}

@media (max-width: 860px) { .rail { display: none; } }
