/* ==========================================================================
   ANTIHORIZN landing page: the pipeline (section #pipeline).
   Loaded after launch.css on index.html. One screen: the captions on the
   left, the four stage layers sharing the area on the right. It plays by
   itself; assets/js/pipeline.js is the clock.
   Each stage styles the inside of its own layer from its own stylesheet.
     P1  Stage and layers
     P2  Head and steps
     P3  Narrow screens and reduced motion
   ========================================================================== */

.pl {
  --pl-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --pl-line: rgba(244, 244, 245, 0.14);
  --pl-dim: rgba(244, 244, 245, 0.58);
  --pl-dimmer: rgba(244, 244, 245, 0.36);
  --pl-left: 31%;                 /* where the captions end and the stage layers begin */
  position: relative;
}

/* --- P1. Stage and layers -------------------------------------------------- */

/* One screen under the nav. Nothing is pinned and nothing depends on scroll:
   the section plays by itself while it is in view. */
.pl { scroll-margin-top: var(--nav-h, 60px); }
.pl__track { position: relative; }
.pl__stage {
  position: relative;
  height: clamp(600px, calc(100svh - var(--nav-h, 60px)), 880px);
  overflow: hidden;
  isolation: isolate;
}
.pl__layers {
  position: absolute;
  top: clamp(28px, 4.6vh, 48px);
  bottom: 52px;
  left: max(calc(var(--gutter) + var(--pl-left)), calc((100vw - var(--maxw)) / 2 + var(--gutter) + var(--pl-left)));
  right: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
}
.pl__layer {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 480ms var(--pl-ease), visibility 0s linear 480ms;
}
.pl__layer[data-on="true"] {
  opacity: 1;
  visibility: visible;
  transition: opacity 480ms var(--pl-ease), visibility 0s;
}
.pl__layer > canvas, .pl__layer > svg { display: block; width: 100%; height: 100%; }

/* --- P2. Head and steps ---------------------------------------------------- */

.pl__ui {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: clamp(28px, 5vh, 56px);
  padding-bottom: 52px;
  pointer-events: none;
}
.pl__ui > * { width: calc(var(--pl-left) - 28px); pointer-events: auto; }
.pl__title {
  margin-top: 18px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(30px, 3.1vw, 48px);
  line-height: 1.06;
  letter-spacing: -0.022em;
  color: var(--grey);
  text-wrap: balance;
}
.pl__title em { display: block; font-style: normal; color: var(--hot); }
.pl__prompt {
  margin-top: clamp(16px, 2.6vh, 26px);
  padding-left: 14px;
  border-left: 2px solid var(--hot);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.008em;
  color: var(--pl-dim);
}
.pl__prompt b { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--pl-dimmer); }

.pl__steps { margin-top: auto; border-top: 1px solid var(--pl-line); }
.pl__step { border-bottom: 1px solid var(--pl-line); }
.pl__step[hidden] { display: none; }
.pl__step button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  width: 100%;
  padding: 13px 0 12px;
  text-align: left;
  color: var(--pl-dimmer);
  cursor: pointer;
  transition: color 240ms var(--pl-ease);
}
.pl__step button:focus-visible { outline: 1.5px solid var(--hot); outline-offset: 2px; }
.pl__n { font-size: 12px; font-weight: 500; letter-spacing: 0.04em; line-height: 1.7; font-variant-numeric: tabular-nums; }
.pl__name { font-size: 17px; font-weight: 600; line-height: 1.25; letter-spacing: -0.012em; }
.pl__what {
  grid-column: 2;
  display: grid;
  grid-template-rows: 0fr;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: -0.006em;
  color: var(--pl-dim);
  transition: grid-template-rows 360ms var(--pl-ease);
}
.pl__what > span { overflow: hidden; }
.pl__what > span > span { display: block; padding-top: 6px; max-width: 36ch; }
.pl__step[data-state="now"] button { color: var(--on-dark); }
.pl__step[data-state="now"] .pl__n { color: var(--hot); }
.pl__step[data-state="now"] .pl__what { grid-template-rows: 1fr; }
@media (hover: hover) and (pointer: fine) {
  .pl__step button:hover { color: var(--on-dark); }
}

/* Each step carries the progress of its own stage as a line under it. */
.pl__step { position: relative; }
.pl__step::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--hot);
  transform: scaleX(var(--p, 0));
  transform-origin: left;
  opacity: 0;
}
.pl__step[data-state="now"]::after { opacity: 1; }

.pl__toggle {
  position: absolute;
  left: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pl-dimmer);
  cursor: pointer;
  transition: color 180ms var(--pl-ease);
}
.pl__toggle::before {
  content: "";
  width: 8px; height: 9px;
  border-left: 3px solid currentColor;
  border-right: 3px solid currentColor;
}
.pl[data-playing="false"] .pl__toggle::before,
.pl__track[data-playing="false"] .pl__toggle::before {
  width: 0; height: 0;
  border: 0;
  border-left: 8px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
}
.pl__toggle:focus-visible { outline: 1.5px solid var(--hot); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .pl__toggle:hover { color: var(--on-dark); } }
.pl__cap {
  position: absolute;
  right: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  bottom: 14px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--pl-dimmer);
}

/* --- P3. Narrow screens and reduced motion ---------------------------------- */

@media (max-width: 900px) {
  .pl { --pl-left: 100%; }
  .pl__stage { height: auto; min-height: 0; }
  .pl__layers { left: var(--gutter); right: var(--gutter); top: 20px; bottom: auto; height: 62vw; max-height: 520px; }
  .pl__ui { padding-top: calc(min(62vw, 520px) + 44px); padding-bottom: 56px; }
  .pl__ui > * { width: 100%; }
  .pl__prompt { display: none; }
  .pl__title { font-size: 26px; margin-top: 10px; }
  .pl__step button { padding: 8px 0 7px; }
  .pl__cap { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pl__layer, .pl__what, .pl__step button { transition: none; }
}

/* Each stage styles the inside of its own layer from its own file:
   pipeline-schematic.css, pipeline-parts.css, pipeline-board.css (the board
   and verification stages share it). */
