/* ==========================================================================
   Radio Silence — components: device frame, media, chips, checklist
   ========================================================================== */

/* ----- Device frame ------------------------------------------------------
   One component, two orientations, real footage inside a photographic
   iPhone 17 Pro mockup. `.device__frame` is a transparent-cutout PNG
   (built from scripts/iPhone 17 Pro Mockup.png by scripts/build-frame.py —
   frame ring, side buttons and Dynamic Island stay opaque, screen + surround
   knocked out) laid over the footage. `.device__screen` is positioned at the
   exact screen-cutout insets the build script reports, so the media lines up
   under the frame's inner rim. Insets/aspect below come straight from that
   script and must be regenerated with the artwork if it ever changes. */

.device {
  position: relative;
  margin: 0 auto;
}

.device--landscape {
  aspect-ratio: 1572 / 762;
  /* 100% (not 92vw) so the frame never exceeds its container — in the
     two-column feature--flip / stage grids its cell is far narrower than
     760px, and a fixed width would overflow and overlap the copy. */
  width: min(760px, 100%);
  --s-top: 4.46%; --s-right: 1.84%; --s-bottom: 4.59%; --s-left: 1.91%;
  --s-radius: clamp(20px, 3.4vw, 34px);
  /* Shadow padding baked into the frame PNG: 260px on a 1572x762 canvas */
  --f-pad-x: -16.539%; --f-pad-y: -34.121%;
}

.device--portrait {
  aspect-ratio: 762 / 1572;
  width: min(320px, 82vw);
  --s-top: 1.91%; --s-right: 4.46%; --s-bottom: 1.84%; --s-left: 4.59%;
  --s-radius: clamp(22px, 7vw, 32px);
  /* Shadow padding baked into the frame PNG: 320px on a 762x1572 canvas */
  --f-pad-x: -41.995%; --f-pad-y: -20.356%;
}

/* Photographic frame overlay, drawn above the footage. The soft drop-shadow
   that lifts the phone off the black page is BAKED INTO the PNG (see
   scratch bake_shadow.py / build-frame.py history) — a live CSS
   drop-shadow() filter forced a re-rasterization on every frame of the
   hero/scope scroll dives and made scrolling stutter. The baked canvas is
   padded for the shadow, so the img extends past the device box by the
   per-orientation --f-pad-x/--f-pad-y negative insets, keeping the phone
   artwork itself exactly where it always was. */
.device__frame {
  position: absolute;
  top: var(--f-pad-y, 0%);
  left: var(--f-pad-x, 0%);
  /* Replaced elements don't stretch from insets alone — size explicitly.
     The pads are negative, so this expands past the device box. */
  width: calc(100% - 2 * var(--f-pad-x, 0%));
  height: calc(100% - 2 * var(--f-pad-y, 0%));
  max-width: none; /* base.css img{max-width:100%} would re-clamp to the device box */
  object-fit: contain;
  pointer-events: none;
  z-index: 10;
}

/* The frame's baked-shadow padding pokes past the viewport wherever the
   device box nears full width (mobile), which would otherwise add a
   horizontal scrollbar. `clip` (not `hidden`) — it crops without creating
   a new scroll container, so sticky/fixed descendants keep working. */
body { overflow-x: clip; }

.device__screen {
  position: absolute;
  top: var(--s-top);
  right: var(--s-right);
  bottom: var(--s-bottom);
  left: var(--s-left);
  background: var(--rs-black);
  overflow: hidden;
  border-radius: var(--s-radius);
}

/* Real footage fills the screen edge-to-edge */
.device__screen video,
.device__screen img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Stacked chapter clips crossfade as the capture stage steps through them */
.device__screen video[data-chapter-video] {
  opacity: 0;
  transition: opacity 0.4s ease;
}

.device__screen video[data-chapter-video].is-active { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .device__screen video[data-chapter-video] { transition: none; }
}

/* ----- Share artifacts (Reception Report + Elite Intercept Certificate) --- */

.artifacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(28px, 4vw, 56px);
  margin-top: clamp(44px, 6vw, 76px);
}

.artifact { margin: 0; perspective: 1100px; }

/* The figures keep their reveal-group opacity fade + --d stagger but opt
   out of the stock rise (the .finale .kicker pattern) — the motion lives
   on the inner card, which the reveal system never touches, so
   [data-reveal].is-in { transform: none } can't fight the 3D entrance. */
.artifacts .artifact[data-reveal] { transform: none; }

.artifact__card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: #030303;
  box-shadow:
    0 30px 70px -22px rgba(0, 0, 0, 0.85),
    0 0 0 1px var(--rs-header-divider),
    0 0 90px rgba(255, 255, 255, 0.03);
}

/* Entrance: the card tilts up out of the page and settles flat.
   `backwards` fill (NOT forwards) is load-bearing: during the --d delay
   the card holds the from-pose (hidden behind the figure's opacity 0
   anyway), and when the animation ends transform ownership returns to
   the cascade — which is what lets the hover transition below work
   without fighting a held animation frame. */
.artifact.is-in .artifact__card {
  animation: artifact-tilt-in 0.95s var(--ease-out-quint) var(--d, 0ms) backwards;
}

@keyframes artifact-tilt-in {
  from { transform: rotateX(9deg) translateY(36px) scale(0.97); }
  to   { transform: none; }
}

/* One-shot specular sheen, sweeping as the card settles. Clipped by the
   card's overflow:hidden + radius. */
.artifact__card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
      transparent 42%, rgba(255, 255, 255, 0.09) 50%, transparent 58%);
  transform: translateX(-101%);
  pointer-events: none;
}

.artifact.is-in .artifact__card::after {
  animation: artifact-sheen 1s ease-in-out calc(var(--d, 0ms) + 0.7s) both;
}

@keyframes artifact-sheen {
  from { transform: translateX(-101%); }
  to   { transform: translateX(101%); }
}

/* Desktop pointer response: a quiet lift, CSS-only. Safe alongside the
   entrance because its backwards fill has already released transform. */
@media (hover: hover) and (min-width: 900px) {
  .artifact__card { transition: transform 0.5s var(--ease-out-quint); }
  .artifact__card:hover { transform: translateY(-6px) rotateX(2deg) scale(1.012); }
}

@media (prefers-reduced-motion: reduce) {
  .artifact.is-in .artifact__card,
  .artifact.is-in .artifact__card::after { animation: none; }
  .artifact__card::after { display: none; }
  .artifact__card { transition: none; }
  .artifact__card:hover { transform: none; }
}

.no-motion .artifact.is-in .artifact__card,
.no-motion .artifact.is-in .artifact__card::after { animation: none; }
.no-motion .artifact__card::after { display: none; }

.artifact__card img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* aspect-ratios match the source renders exactly, so object-fit: cover never
   crops and the box reserves correct space before the image loads. */
.artifact__card--report { width: min(580px, 92vw); aspect-ratio: 1206 / 875; }
.artifact__card--elite  { width: min(420px, 76vw); aspect-ratio: 1 / 1; }

.artifact__label {
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--rs-meta);
  text-align: center;
}

/* ----- Buttons live in base.css; badges shared with topbar ----- */

.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  border-radius: 5px;
  border: 1.5px solid var(--rs-green);
  color: var(--rs-green);
}

.badge--beta {
  border-color: var(--rs-orange);
  color: var(--rs-orange);
  white-space: nowrap;
}

/* ----- Tuning explorer pills (Apple "Take a closer look" pattern) -------- */

.pills {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 32px;
}

/* ----- Segmented instrument tray (SCOPE) -----
   Apple-style demo selector translated into the app's idiom: one quiet
   rounded container, mono icon+label segments, active segment styled like
   the in-app AM/USB mode pills (orange text + border + bloom). The demo
   description lives in a single crossfading caption below, not inside the
   control. */

.tray {
  display: inline-flex;
  gap: 4px;
  max-width: 100%;
  padding: 6px;
  border: 1px solid var(--rs-header-divider);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow-x: auto;
  scrollbar-width: none;
}

.tray::-webkit-scrollbar { display: none; }

.tray__seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  color: var(--rs-meta);
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 16px 14px;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, background-color 0.25s, box-shadow 0.25s;
}

.tray__seg svg {
  width: 19px;
  height: 19px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
}

.tray__seg:hover { color: var(--rs-tick); }

.tray__seg:focus-visible {
  outline: 2px solid var(--rs-amber);
  outline-offset: 2px;
}

.tray__seg.is-on {
  color: var(--rs-orange);
  border-color: var(--rs-orange);
  background: rgba(255, 107, 26, 0.06);
  box-shadow: 0 0 10px rgba(255, 107, 26, 0.18);
}

@media (max-width: 519px) {
  .tray__seg { padding: 12px 12px; }
}

/* Capture-sequence tray: a thin playback-progress underline fills the
   active segment as its chapter clip plays (auto-advance story loop).
   --seg-progress (0–1) is set by explorer.js on timeupdate. */
.tray--capture .tray__seg {
  position: relative;
  overflow: hidden;
}

.tray--capture .tray__seg.is-on::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(
    to right,
    var(--rs-orange) calc(var(--seg-progress, 0) * 100%),
    rgba(255, 107, 26, 0.18) 0
  );
}

@media (prefers-reduced-motion: reduce) {
  .tray--capture .tray__seg.is-on::after { display: none; }
}

.no-motion .tray--capture .tray__seg.is-on::after { display: none; }

.pill {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--rs-header-divider);
  border-radius: 8px;
  padding: 14px 18px;
  cursor: pointer;
  color: var(--rs-logbook-meta);
  transition: border-color 0.3s, color 0.3s;
}

.pill:hover {
  border-color: var(--rs-dim);
  color: var(--rs-amber);
}

.pill:focus-visible {
  outline: 2px solid var(--rs-amber);
  outline-offset: 2px;
}

.pill.is-on {
  border-color: var(--rs-orange);
  color: var(--rs-orange);
  cursor: default;
}

.pill__head {
  display: block;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.pill__marker::before { content: "[ + ]"; }
.pill.is-on .pill__marker::before { content: "[ − ]"; }

/* Expand/collapse via the grid-rows trick */
.pill__reveal {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-out-quint);
}

.pill.is-on .pill__reveal { grid-template-rows: 1fr; }

.pill__body {
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--rs-logbook-meta);
}

.pill.is-on .pill__body { padding-top: 10px; }

/* Retune dip while the explorer swaps clips */
[data-explorer-video] {
  transition: opacity 0.18s ease;
}

[data-explorer-video].is-dipping { opacity: 0.12; }

@media (prefers-reduced-motion: reduce) {
  .pill__reveal { transition: none; }
  [data-explorer-video] { transition: none; }
}

/* ----- Privacy checklist -------------------------------------------------- */

.checklist {
  list-style: none;
  margin: 40px 0 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.6vw, 15px);
  letter-spacing: 0.06em;
  counter-reset: checklist-counter;
}

.checklist li {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--rs-divider);
  color: var(--rs-status);
  line-height: 1.7;
  counter-increment: checklist-counter;
}

.checklist li::before {
  content: counter(checklist-counter, decimal-leading-zero);
  flex-shrink: 0;
  color: var(--rs-green);
  border: 1.5px solid var(--rs-green);
  border-radius: 5px;
  font-size: 11px;
  padding: 2px 6px;
  letter-spacing: 0.08em;
}

/* ----- Teletype audit print -----
   Each line prints on left-to-right (one-shot clip-path wipe in character-
   width steps), its green number badge relay-flashes on as the line lands,
   and a block caret blinks at the line end then extinguishes. Triggered by
   the per-li .is-in that reveal.js's [data-reveal-group] injects; the --d
   group stagger (i*80ms) is widened via calc for teletype pacing. The li
   opts out of the stock rise (the .finale .kicker pattern).

   Cascade notes: this selector (0,2,1) outranks [data-reveal].is-in
   (0,2,0), so the base opacity:0 would win even after reveal — the print
   keyframe therefore carries opacity:1 and holds it with `forwards`
   (animations beat all normal declarations). No-JS is safe two ways: the
   data-reveal attr is injected at runtime so bare li's never match this
   selector, and the <noscript> reset also clears clip-path. */
.checklist li[data-reveal] {
  transform: none;
  transition: none;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
}

.checklist li[data-reveal].is-in {
  animation: checklist-print 0.5s steps(26, end) calc(var(--d, 0ms) * 3.5) forwards;
}

@keyframes checklist-print {
  from { opacity: 1; clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; clip-path: inset(-2px); } /* -2px: spare the border/badge edges */
}

.checklist li[data-reveal].is-in::before {
  animation: checklist-badge-flash 0.45s steps(1) calc(var(--d, 0ms) * 3.5 + 0.1s) both;
}

@keyframes checklist-badge-flash {
  0%   { opacity: 0; }
  20%  { opacity: 1; }
  40%  { opacity: 0.15; }
  62%  { opacity: 1; }
  100% { opacity: 1; }
}

/* Block caret after the text; the wipe uncovers it as the line finishes,
   it blinks twice, then goes dark for good. */
.checklist li::after {
  content: "";
  flex-shrink: 0;
  width: 0.55em;
  height: 1em;
  margin-left: 2px;
  background: var(--rs-green);
  opacity: 0;
  transform: translateY(0.15em); /* optical baseline alignment in the flex row */
}

.checklist li[data-reveal].is-in::after {
  animation: checklist-caret 0.9s steps(1) calc(var(--d, 0ms) * 3.5 + 0.35s) both;
}

@keyframes checklist-caret {
  0%   { opacity: 1; }
  45%  { opacity: 0; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .checklist li[data-reveal] { opacity: 1; clip-path: none; }
  .checklist li[data-reveal].is-in,
  .checklist li[data-reveal].is-in::before,
  .checklist li[data-reveal].is-in::after { animation: none; }
}

.no-motion .checklist li[data-reveal] { opacity: 1; clip-path: none; }
.no-motion .checklist li[data-reveal].is-in,
.no-motion .checklist li[data-reveal].is-in::before,
.no-motion .checklist li[data-reveal].is-in::after { animation: none; }

.privacy__more {
  display: block;
  text-align: center;
  margin-top: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--rs-logbook-meta);
  text-decoration: none;
  transition: color 0.25s;
}

.privacy__more:hover { color: var(--rs-amber); }

.prompt-line {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.6vw, 15px);
  letter-spacing: 0.06em;
  color: var(--rs-amber);
  margin-top: 36px;
}

.prompt-line::after {
  content: "▌";
  animation: cursor-blink 1.1s steps(1) infinite;
}

@keyframes cursor-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .prompt-line::after { animation: none; }
}

/* ----- Invite request modal ----------------------------------------------
   Opened by the [data-invite] buttons via invite.js. Hidden by default
   (display: none) so no-JS visitors never see it — their click falls through
   to the button's real mailto: link instead. */
.invite-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.invite-modal.is-open { display: flex; }

.invite-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.invite-modal__card {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  background: #0a0a0a;
  border: 1.5px solid var(--rs-header-divider);
  border-radius: 12px;
  padding: 34px 28px 26px;
  text-align: center;
}

.invite-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 6px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--rs-meta);
  transition: color 0.2s;
}

.invite-modal__close:hover { color: var(--rs-amber); }

.invite-modal__kicker { margin: 0 0 14px; }

.invite-modal__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--rs-white);
  margin: 0 0 10px;
}

.invite-modal__sub {
  font-size: 14px;
  line-height: 1.55;
  color: var(--rs-logbook-meta);
  margin: 0 0 24px;
}

.invite-modal__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.invite-modal__actions .btn { width: 100%; }

.invite-modal__addr {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--rs-meta);
  margin: 18px 0 0;
  user-select: all;
}

/* Copy-confirmed state on the ghost button. */
.invite-modal__actions .btn--ghost.is-copied {
  color: var(--rs-green);
  border-color: var(--rs-green);
}

/* Entrance: card fades + rises in. Uses @starting-style like the topbar
   overlay, so it's driven purely by the .is-open display change. */
.invite-modal__card {
  transition: opacity 0.3s var(--ease-out-quint), transform 0.3s var(--ease-out-quint);
}

@starting-style {
  .invite-modal.is-open .invite-modal__card {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  .invite-modal__card { transition: none; }
}
