/* ══════════════════════════════════════════════════════════════════════
   Pevra — first run

   Four beats where there were twenty-one screens. Five words a beat.

   Deliberately NOT themed: this paints its own midnight regardless of the
   user's light/dark setting, the same way the Deep Research deck does. An
   intro is a title sequence, not a view of the app — it should look the same
   for everybody, and it hands over to the themed app at the end.

   Everything is scoped under #pevra-firstrun or .fr-, so nothing here can
   reach the app it sits over. Every animation is transform / opacity /
   clip-path / stroke, so it stays on the compositor.
   ══════════════════════════════════════════════════════════════════════ */

#pevra-firstrun {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  background: #0b0d11;
  color: #f0f4f8;
  overflow: hidden;
  opacity: 0;
  transition: opacity .34s ease;
  font-family: "Geist", "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#pevra-firstrun.in  { opacity: 1; }
#pevra-firstrun.out { opacity: 0; }

/* The grid floor and the ember wash the existing decks already use. */
.fr-floor {
  position: absolute; inset: auto 0 0 0; height: 300px; opacity: .5; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, rgba(120,140,180,.16) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg,  rgba(120,140,180,.16) 0 1px, transparent 1px 42px);
  mask-image: linear-gradient(to top, #000 0%, transparent 88%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 88%);
  transform: perspective(320px) rotateX(62deg);
  transform-origin: bottom;
}
.fr-wash {
  position: absolute; top: -120px; left: 50%; transform: translateX(-50%);
  width: 520px; height: 420px; pointer-events: none;
  background: radial-gradient(ellipse, rgba(229,85,47,.18), rgba(229,85,47,0) 65%);
}

/* ── chrome ───────────────────────────────────────────────────────── */
.fr-step {
  flex: none;
  padding: max(24px, env(safe-area-inset-top)) 26px 0;
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: 10.5px; letter-spacing: .22em; color: #5a6170;
}
.fr-stage {
  flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 0 26px; position: relative; z-index: 2;
}
.fr-art { height: clamp(196px, 31vh, 268px); position: relative; }
.fr-art-mid { display: flex; align-items: center; justify-content: center; }
.fr-h1 {
  margin: 16px 0 0;
  font-family: "Bricolage Grotesque", "Geist", Georgia, serif;
  font-weight: 800; font-size: clamp(42px, 15vw, 60px); line-height: .92;
  letter-spacing: -.048em; color: #f0f4f8;
}
.fr-h1 .fr-l { display: block; overflow: hidden; }
.fr-h1 .fr-l i {
  display: block; font-style: normal;
  animation: fr-rise .9s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--w, 0) * 95ms + 1s);
}
.fr-grad {
  background: linear-gradient(96deg, #F2693E, #E5552F 55%, #b57bff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fr-sub {
  margin: 18px 0 0; font-size: clamp(14px, 4vw, 15.5px); line-height: 1.5; color: #8e97a6;
  max-width: 34ch;
}
.fr-foot {
  flex: none; padding: 0 26px max(30px, env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 16px; position: relative; z-index: 2;
}
.fr-cta {
  flex: 1; min-height: 56px; border: 0; border-radius: 16px; cursor: pointer;
  background: linear-gradient(100deg, #F2693E, #C8431F); color: #fff;
  font: inherit; font-size: 17px; font-weight: 600;
  box-shadow: 0 10px 34px rgba(229,85,47,.42);
  transition: transform .15s cubic-bezier(.16,1,.3,1);
}
.fr-cta:active { transform: scale(.985); }
.fr-skip {
  border: 0; background: transparent; color: #5a6170; font: inherit;
  font-size: 14px; cursor: pointer; min-height: 44px; padding: 0 4px;
}
.fr-cta:focus-visible, .fr-skip:focus-visible, .fr-tone:focus-visible {
  outline: 2px solid #F2693E; outline-offset: 3px;
}

@keyframes fr-rise { from { transform: translateY(112%); } to { transform: translateY(0); } }
@keyframes fr-fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.fr-f { animation: fr-fade .8s cubic-bezier(.16,1,.3,1) both var(--d, 0s); }

/* ══ BEAT 1 · routing ══════════════════════════════════════════════
   A question arrives, a wire fires to whichever model handles it, and that
   card lights while the rest stay dim. Showing the choice being made rather
   than describing it — and on the fourth question, which is a Deep Research
   question, all three fire together under one bracket.

   ONE cycle, 7.2s, four questions of 1.8s = 25% each. Every window below is
   a slice of that same cycle, and each wire / lit card / bracket is placed in
   its slot by animation-delay alone, so the picture follows the script in
   firstrun.js instead of repeating it.

   The windows are deliberately nested: a question is up 4%–20%, its wire
   only 12%–21% and its lit card only 13%–22%. A wire that outlives its
   question points the wrong answer at the wrong model, which is exactly the
   desync this arrangement rules out. */
@keyframes fr-q {
  0% { opacity: 0; transform: translateY(10px); }
  4%, 20% { opacity: 1; transform: none; }
  24%, 100% { opacity: 0; transform: translateY(-8px); }
}
/* Questions are anchored to the BOTTOM of this box so the line never shifts
   between one question and the next. */
.fr-asks { position: absolute; left: 0; right: 0; top: 0; height: 34px; }
/* `both` matters: without a backwards fill a delayed copy paints its normal
   state until it starts, and all four questions stack on top of each other. */
.fr-q {
  position: absolute; left: 0; right: 0; bottom: 0; opacity: 0;
  font-size: 14.5px; color: #c2cad6; text-align: center;
  animation: fr-q 7.2s ease-in-out infinite both;
}
/* The Deep Research question is the one the whole row answers, so it reads a
   shade brighter than the three everyday ones. */
.fr-q-deep { color: #f0f4f8; font-weight: 500; }
.fr-badge {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: 9px; font-style: normal; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: #F2693E;
  padding: 4px 9px; border-radius: 999px;
  background: rgba(229,85,47,.14); border: 1px solid rgba(242,105,62,.45);
}

.fr-net { position: absolute; left: 0; top: 34px; width: 100%; height: calc(100% - 34px); }
.fr-tag {
  font-family: "Geist Mono", ui-monospace, Menlo, monospace;
  font-size: 8.5px; font-weight: 500; letter-spacing: .13em;
}
.fr-tag-deep { font-size: 9px; letter-spacing: .18em; font-weight: 600; }

@keyframes fr-wire {
  0%, 6% { opacity: 0; stroke-dashoffset: 150; }
  12%, 18% { opacity: .95; stroke-dashoffset: 0; }
  21%, 100% { opacity: 0; }
}
.fr-wire { stroke-dasharray: 150; opacity: 0; animation: fr-wire 7.2s ease-in-out infinite both; }

/* The lit card is a congruent bright copy fading in over the dim one, so any
   number of questions can light any number of models without a bespoke
   keyframe per model. */
@keyframes fr-lit {
  0%, 7% { opacity: 0; }
  13%, 19% { opacity: 1; }
  22%, 100% { opacity: 0; }
}
.fr-lit { opacity: 0; animation: fr-lit 7.2s ease-in-out infinite both; }
.fr-brace { filter: drop-shadow(0 0 12px rgba(229,85,47,.5)); }

@keyframes fr-hub { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
.fr-hub {
  fill: #E5552F;
  filter: drop-shadow(0 0 16px rgba(229,85,47,.9));
  transform-box: fill-box; transform-origin: center;
  animation: fr-hub .7s cubic-bezier(.16,1,.3,1) both .1s;
}

/* ══ BEAT 2 · Deep Research ════════════════════════════════════════
   The three marks fly in and fuse into Pevra's ember. The pitch, made
   without a sentence. */
/* Everything here transforms about its own centre inside the SVG, so the
   whole cluster scales with the viewBox rather than fighting it. */
#pevra-firstrun .fr-mark, #pevra-firstrun .fr-fuse, #pevra-firstrun .fr-halo {
  transform-box: fill-box; transform-origin: center;
}
@keyframes fr-fly {
  0% { opacity: 0; transform: translate(var(--fx), var(--fy)) scale(.35); }
  56% { opacity: 1; transform: translate(0, 0) scale(1.07); }
  76%, 100% { opacity: 1; transform: translate(0, 0) scale(1); }
}
.fr-mark { animation: fr-fly 2.6s cubic-bezier(.16,1,.3,1) both; }

/* Same words the bracket wears on beat 1, so the two screens are visibly
   about the same switch rather than two unrelated claims about three models. */
@keyframes fr-badge-in {
  0%, 8% { opacity: 0; transform: translate(-50%, 8px); }
  30%, 100% { opacity: 1; transform: translate(-50%, 0); }
}
.fr-badge-top {
  position: absolute; left: 50%; bottom: 0; z-index: 2;
  animation: fr-badge-in 2.6s cubic-bezier(.16,1,.3,1) both;
}
/* The triangle draws itself last and stays: it is the line that makes the
   three cards read as one thing rather than three logos on a screen. */
@keyframes fr-tri {
  0%, 34% { opacity: 0; stroke-dashoffset: 500; }
  74%, 100% { opacity: .5; stroke-dashoffset: 0; }
}
.fr-tri { stroke-dasharray: 500; animation: fr-tri 2.6s cubic-bezier(.16,1,.3,1) both; }
@keyframes fr-fuse {
  0%, 52% { opacity: 0; transform: scale(.3); }
  72% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}
.fr-fuse {
  fill: #E5552F;
  filter: drop-shadow(0 0 26px rgba(229,85,47,.85));
  animation: fr-fuse 2.6s cubic-bezier(.16,1,.3,1) both;
}
@keyframes fr-halo {
  0%, 52% { opacity: 0; transform: scale(.5); }
  74% { opacity: .7; transform: scale(1); }
  100% { opacity: 0; transform: scale(2.1); }
}
.fr-halo { opacity: 0; animation: fr-halo 2.6s ease-out both; }

/* ══ BEAT 3 · standing jobs ════════════════════════════════════════
   A full minute in two seconds, then the one alert worth interrupting for. */
@keyframes fr-sweep { from { transform: rotate(-90deg); } to { transform: rotate(630deg); } }
.fr-hand { transform-origin: 65px 65px; animation: fr-sweep 2.5s cubic-bezier(.16,1,.3,1) both .15s; }
@keyframes fr-ring {
  0%, 54% { opacity: 0; transform: scale(.6); }
  70% { opacity: .85; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}
.fr-ring { transform-origin: center; animation: fr-ring 2.5s ease-out both .15s; }
@keyframes fr-alert {
  0%, 58% { opacity: 0; transform: translateY(18px) scale(.94); }
  76%, 100% { opacity: 1; transform: none; }
}
.fr-alert {
  position: absolute; bottom: 2px; left: 4px; right: 4px;
  display: flex; align-items: center; gap: 11px; padding: 13px 15px;
  background: #11141a; border: 1px solid rgba(231,238,250,.10); border-radius: 15px;
  box-shadow: 0 16px 44px rgba(0,0,0,.55);
  animation: fr-alert 2.5s cubic-bezier(.16,1,.3,1) both .15s;
}
.fr-alert .fr-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: #E5552F; box-shadow: 0 0 14px rgba(229,85,47,.9);
}

/* ══ BEAT 4 · tone ═════════════════════════════════════════════════ */
.fr-tones { display: flex; flex-direction: column; gap: 9px; margin-top: 22px; }
.fr-tone {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  width: 100%; min-height: 44px; padding: 13px 16px; cursor: pointer; text-align: left;
  background: #11141a; border: 1px solid rgba(231,238,250,.10); border-radius: 15px;
  font: inherit;
  animation: fr-fade .62s cubic-bezier(.16,1,.3,1) both;
  animation-delay: calc(var(--i, 0) * 80ms + 420ms);
  transition: border-color .2s ease, background .2s ease, transform .15s cubic-bezier(.16,1,.3,1);
}
.fr-tone:active { transform: scale(.99); }
.fr-tone.on { background: rgba(229,85,47,.12); border-color: #E5552F; }
.fr-tone-name {
  font-family: "Bricolage Grotesque", "Geist", Georgia, serif;
  font-weight: 700; font-size: 21px; letter-spacing: -.02em; color: #f0f4f8;
}
.fr-tone.on .fr-tone-name { color: #F2693E; }
.fr-tone-say { font-size: 13.5px; line-height: 1.45; color: #8e97a6; }
.fr-tone.on .fr-tone-say { color: #c2cad6; }
/* The chosen voice speaks: its line wipes on. A width/nowrap typewriter clips
   any line that wraps, so this uses clip-path. */
@keyframes fr-speak { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -2% 0 0); } }
.fr-tone.on .fr-tone-say { animation: fr-speak 1s steps(24, end) both; }
.fr-note { margin-top: 16px; font-size: 12.5px; line-height: 1.5; color: #5a6170; }

/* Motion is the polish, never the payload: the beats read identically
   without it, which is what makes it safe to use this much. */
@media (prefers-reduced-motion: reduce) {
  #pevra-firstrun *, #pevra-firstrun *::before, #pevra-firstrun *::after {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    clip-path: none !important;
  }
  /* Everything above is forced visible, which on beat 1 would mean four
     questions stacked and every wire firing at once. Freeze it on the Deep
     Research frame instead — the one still that carries both points: a
     question, three wires, all three cards lit under the bracket. */
  #pevra-firstrun .fr-q:not(.fr-q-deep) { display: none; }
  #pevra-firstrun [data-ask]:not(.fr-ask-deep) { display: none; }
}

/* Desktop: the art gets more room and the type gets bigger. */
@media (min-width: 900px) {
  .fr-stage, .fr-foot, .fr-step { max-width: 900px; width: 100%; margin: 0 auto; }
  .fr-stage { padding: 0 60px; }
  .fr-foot { padding: 0 60px 40px; }
  .fr-step { padding: 30px 60px 0; }
  .fr-h1 { font-size: 92px; line-height: .9; }
  .fr-sub { font-size: 19px; max-width: 46ch; }
  .fr-art { height: 300px; }
  /* The stage is far wider than the art, and an SVG that centres itself in
     all of it floats off to the right of a left-aligned headline. Pinning
     both header row and diagram to a column the width of the artwork keeps
     the picture over its own words. */
  .fr-asks, .fr-net { width: 370px; right: auto; }
  .fr-cta { flex: none; min-width: 240px; padding: 0 34px; }
  .fr-tones { max-width: 620px; }
}

