/* Tilely — brutalist dark marketing site */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/IBMPlexSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #141416;
  --bg-deep: #0a0a0c;
  --bg-elevated: #1a1a1e;
  --text: #fafafa;
  --muted: #a1a1aa;
  --faint: #52525b;
  --line: rgba(255, 255, 255, 0.1);
  --icon-border: #8a8a92;
  --green: #34c759;
  --red: #ff3b30;
  --grey-heat: #6b6b76;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --max: 1320px;
  /* Desktop mockup: +30% then +15% from original 280px baseline → ~419px */
  --phone-w: 419px;
  --phone-h: calc(var(--phone-w) * 3000 / 1470);
  --nav-h: 0px; /* no site header — full viewport for sticky stage */
  --footer-h: 56px;
  /* Center phone in the free area above the footer */
  --phone-sticky-top: max(
    8px,
    calc((100dvh - var(--footer-h) - var(--phone-h)) / 2)
  );
  /*
   * mockup-phone.png (1470×3000) — display glass under Dynamic Island.
   * Top inset ~54/3000 — ~5px higher than prior on the 364px mockup.
   */
  --screen-inset-l: 5.102%;
  --screen-inset-r: 5.102%;
  --screen-inset-t: 1.80%;
  --screen-inset-b: 2.200%;
  /* Outer device silhouette (clips any square screen layers) */
  --phone-outer-radius: 22.5% / 11.05%;
  /* Inner display corner radius */
  --screen-radius: 12% / 5.85%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, #1c1c20 0%, transparent 55%),
    linear-gradient(180deg, #18181b 0%, #0e0e10 42%, #0a0a0c 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 600;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

/* Noise grain over the page (refined film texture) */
.noise-bg {
  position: fixed;
  inset: 0;
  /* Above page chrome (footer, rail) so grain is seamless everywhere */
  z-index: 100;
  margin: 0;
  padding: 0;
  pointer-events: none;
  opacity: 0.1;
  mix-blend-mode: screen;
  filter: grayscale(100%);
}

.noise-bg-svg {
  display: block;
  width: 100%;
  height: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--muted);
}

/* —— Nav (removed site-wide — section rail is the only chrome) —— */

.site-nav {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand.small {
  font-size: 13px;
  gap: 8px;
}

.brand-icon-wrap {
  display: inline-flex;
  perspective: 900px;
  transform-style: preserve-3d;
  border-radius: 12px;
  /* Larger hit area for tilt without layout shift */
  padding: 4px;
  margin: -4px;
}

.brand-icon-wrap.sm {
  perspective: 400px;
  border-radius: 6px;
  padding: 0;
  margin: 0;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: block;
  object-fit: cover;
  border: 1.5px solid var(--icon-border);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 4px 14px rgba(0, 0, 0, 0.45);
  transform-style: preserve-3d;
  transition: transform 0.08s ease-out, box-shadow 0.2s ease;
  will-change: transform;
  /* Avoid subpixel layout jump from 3D transforms */
  backface-visibility: hidden;
}

.brand-icon-wrap.sm .brand-icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border-width: 1px;
  box-shadow: none;
}

.brand:hover .brand-icon {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 10px 28px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 13px;
  color: var(--muted);
}

.nav-links a:hover {
  color: var(--text);
}

/* —— Story layout —— */

.story {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 480px);
  column-gap: 32px;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  /* Space for fixed footer so last section doesn’t sit under it */
  padding-bottom: var(--footer-h);
  /* MUST stretch: sticky phone needs a full-height column to stay in view */
  align-items: stretch;
}

.story-left {
  /* Stage fills the area above the footer bar */
  --stage-h: calc(100dvh - var(--footer-h));
  position: relative;
  grid-column: 1;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  padding-bottom: 0;
}

.story-right {
  position: relative;
  grid-column: 2;
  width: 100%;
  max-width: 100%;
  /* Full runway height of left column (via stretch) — required for position:sticky */
  align-self: stretch;
  /* Pre-offset so visual’s natural position == sticky position (no jump at top) */
  padding-top: var(--phone-sticky-top);
  padding-right: 28px;
  padding-left: 8px;
  /* Clear fixed footer while sticky */
  padding-bottom: calc(var(--footer-h) + 24px);
  box-sizing: border-box;
}

/* —— Feature copy stage ——
   Copy is stacked in one sticky viewport and only crossfades (like phone).
   Spacers below provide scroll distance; text never scrolls into place. */

.feature-text-stage {
  position: sticky;
  top: 0;
  z-index: 2;
  height: var(--stage-h);
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  pointer-events: none;
  box-sizing: border-box;
}

.feature-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  max-width: 100%;
  margin: 0;
  opacity: 0;
  pointer-events: none;
  box-sizing: border-box;
  /* Same duration as .phone-screen .screen */
  transition: opacity 0.5s ease;
}

.feature-panel.is-active {
  opacity: 1;
  pointer-events: auto;
}

.feature-spacers {
  /* Pull spacers up so stage overlays the runway (match stage height) */
  margin-top: calc(-1 * var(--stage-h));
  padding-bottom: 0;
}

.feature-block {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  border-bottom: none;
  scroll-margin-top: 12px;
  /* Invisible scroll markers only */
  pointer-events: none;
}

.feature-block.feature-close {
  /* Last step is exactly one stage height — ends into the footer, no extra jump */
  min-height: var(--stage-h);
}

/* —— Section rail (minimalist step nav) —— */

.section-rail {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 14px;
  color: var(--faint);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  line-height: 1;
  transition: color 0.25s ease;
}

.section-rail-item:hover {
  color: var(--muted);
}

.section-rail-line {
  display: block;
  width: 14px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
  transition:
    width 0.3s ease,
    opacity 0.25s ease,
    background-color 0.25s ease;
}

.section-rail-num {
  min-width: 1.4em;
  opacity: 0.7;
  transition: opacity 0.25s ease, color 0.25s ease;
}

.section-rail-item.is-active {
  color: var(--text);
}

.section-rail-item.is-active .section-rail-line {
  width: 28px;
  opacity: 1;
  background: var(--text);
}

.section-rail-item.is-active .section-rail-num {
  opacity: 1;
}

.section-rail-item:focus-visible {
  outline: 1px solid rgba(255, 255, 255, 0.35);
  outline-offset: 4px;
  border-radius: 2px;
}

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

  .section-rail-line,
  .section-rail-item,
  .section-rail-num {
    transition: none;
  }

  .close-icon-large {
    transition: none;
  }
}

.eyebrow {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.feature-panel h1 {
  margin: 0 0 12px;
  font-size: clamp(48px, 8vw, 72px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.feature-panel h2 {
  margin: 0 0 16px;
  font-size: clamp(28px, 4.2vw, 40px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.lede {
  margin: 0 0 20px;
  font-size: clamp(20px, 2.4vw, 26px);
  color: var(--muted);
  letter-spacing: -0.02em;
  max-width: 28ch;
}

.body {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
  max-width: 38ch;
  line-height: 1.55;
}

.meta {
  margin: 28px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.02em;
}

/* —— Phone / close icon visual —— */

.sticky-visual {
  position: sticky;
  top: var(--phone-sticky-top);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  /* In-flow height so the sticky box is real (absolute children alone collapse it) */
  min-height: var(--phone-h);
  height: var(--phone-h);
  margin: 0;
  padding: 0;
  z-index: 2;
}

.phone-frame {
  width: var(--phone-w);
  height: var(--phone-h);
  aspect-ratio: 1470 / 3000;
  position: relative;
  flex-shrink: 0;
  background: transparent;
  border: none;
  /* Clip square screen layers to the device silhouette */
  border-radius: var(--phone-outer-radius);
  overflow: hidden;
  /* drop-shadow follows alpha of the bezel PNG — no rectangular halo */
  box-shadow: none;
  filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.55));
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease, visibility 0s linear 0s;
  pointer-events: auto;
  z-index: 2;
}

/* Last step: hide phone, show large icon */
.story.is-close .phone-frame {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  /* Delay visibility:hidden until fade finishes */
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}

.close-icon-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
  perspective: 900px;
  transform-style: preserve-3d;
  /* Stay fully gone after fade (never sit above the phone while “hidden”) */
  transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}

.story.is-close .close-icon-stage,
.close-icon-stage.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 3;
  transition: opacity 0.45s ease, visibility 0s linear 0s;
}

.close-icon-large {
  width: min(220px, 70%);
  height: auto;
  aspect-ratio: 1;
  border-radius: 28%;
  border: 1.5px solid var(--icon-border);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 24px 60px rgba(0, 0, 0, 0.55);
  object-fit: cover;
  display: block;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.08s ease-out, box-shadow 0.2s ease;
  backface-visibility: hidden;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: default;
  opacity: 0.92;
}

.cta-btn:disabled {
  cursor: default;
  opacity: 0.85;
}

.phone-bezel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  /* Bezel defines the visible silhouette; no extra compositing layer */
  display: block;
}

.phone-screen {
  position: absolute;
  left: var(--screen-inset-l);
  right: var(--screen-inset-r);
  top: var(--screen-inset-t);
  bottom: var(--screen-inset-b);
  border-radius: var(--screen-radius);
  /* Transparent — black square must never paint outside the glass */
  background: transparent;
  overflow: hidden;
  z-index: 1;
  /* No transform/isolation — those create a rectangular opaque layer */
}

.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
  overflow: hidden;
  border-radius: inherit;
}

.screen.is-active {
  opacity: 1;
  pointer-events: none;
  z-index: 1;
}

/* Real screenshots — fill display glass; status bar wraps Dynamic Island */
.screen-shot {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 0%;
  /* No scale transform — was creating a square overscan beyond the radius */
  border-radius: inherit;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Screen chrome (legacy CSS mock — unused with real screenshots) */

.scr-status {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 10px;
  padding: 0 4px;
}

.scr-status.light {
  color: rgba(255, 255, 255, 0.7);
}

.scr-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 22px;
}

.scr-title {
  font-size: 15px;
  letter-spacing: -0.02em;
}

.scr-chev,
.scr-back {
  color: var(--muted);
  font-size: 14px;
}

.scr-sort,
.scr-star {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.scr-periods {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--faint);
}

.scr-periods span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.scr-periods span.on {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.scr-periods.mini {
  justify-content: flex-start;
}

/* Treemap mock */

.scr-treemap {
  flex: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr;
  grid-template-rows: 1.3fr 1fr 0.9fr;
  gap: 2px;
  min-height: 0;
}

.scr-treemap.dense {
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-template-rows: 1.2fr 1fr 1fr 0.8fr;
}

.scr-treemap.dim {
  opacity: 0.85;
}

.tm {
  border-radius: 2px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9px;
  color: #fff;
  min-height: 0;
  overflow: hidden;
}

.tm.big {
  grid-row: span 2;
}

.tm .up { color: #b8f5c0; }
.tm .dn { color: #ffc0c0; }
.tm .flat { color: rgba(255, 255, 255, 0.55); }

.tm-tech { background: linear-gradient(180deg, #2f7a48, #163d24); }
.tm-fin  { background: linear-gradient(180deg, #3a6b4a, #1a3324); }
.tm-hc   { background: linear-gradient(180deg, #6a3038, #3a1418); }
.tm-cd   { background: linear-gradient(180deg, #2f8a52, #184828); }
.tm-en   { background: linear-gradient(180deg, #8a3038, #4a1418); }
.tm-ind  { background: linear-gradient(180deg, #3a7a48, #1a3824); }
.tm-com  { background: linear-gradient(180deg, #2f6a88, #163848); }
.tm-util { background: linear-gradient(180deg, #3a3a48, #1a1a24); }

.scr-fab {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 44px;
  height: 28px;
  border-radius: 14px;
  background: rgba(40, 40, 44, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  letter-spacing: 0.08em;
}

/* Equal grid (RSI) */

.scr-grid-eq {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  min-height: 0;
}

.eq {
  border-radius: 2px;
  padding: 8px 6px;
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.eq span { opacity: 0.85; font-size: 12px; }
.eq.hot  { background: linear-gradient(180deg, #3aa05a, #1a502c); }
.eq.mid  { background: linear-gradient(180deg, #3a3a44, #1e1e24); }
.eq.cold { background: linear-gradient(180deg, #8a3a42, #4a1a20); }

.scr-mode-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 8px;
  font-size: 9px;
  color: var(--faint);
  font-family: var(--mono);
}

.scr-mode-row .on {
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
}

/* Sector */

.scr-sector-band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin-bottom: 8px;
}

.scr-sector-band .tm {
  min-height: 72px;
}

.scr-sector-band.muted {
  opacity: 0.45;
}

.scr-sector-label {
  text-align: center;
  font-size: 9px;
  color: var(--faint);
  font-family: var(--mono);
  margin: 6px 0 10px;
}

/* Extended hours banner */

.scr-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 4px 12px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(40, 40, 48, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 9px;
  color: #fff;
  line-height: 1.3;
}

.scr-banner-icon {
  flex-shrink: 0;
}

/* Search */

.scr-search-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.scr-search-q {
  color: #fff;
}

.scr-x {
  color: var(--muted);
  font-size: 12px;
}

.scr-search-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.scr-row {
  display: flex;
  gap: 12px;
  padding: 10px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.scr-row .tkr {
  font-family: var(--mono);
  min-width: 44px;
}

.scr-row .nm {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Watchlist */

.scr-watch {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  flex: 1;
  align-content: start;
}

.wq {
  aspect-ratio: 1;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  gap: 4px;
  background: #1a1a20;
}

.wq.up { background: linear-gradient(180deg, #2f7a48, #163d24); }
.wq.dn { background: linear-gradient(180deg, #8a3038, #4a1418); }
.wq.flat { background: linear-gradient(180deg, #3a3a48, #1a1a24); }

/* Detail */

.scr-detail-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
  min-height: 24px;
}

.scr-tkr-fly {
  margin-right: auto;
  margin-left: auto;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.scr-star-btn,
.scr-x-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

.scr-detail-card {
  flex: 1;
  background: #000;
  border-radius: 14px 14px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: none;
  padding: 12px 10px 10px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.scr-detail-card.full {
  margin: 0 -2px;
}

.scr-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.scr-detail-head.compact {
  margin-bottom: 6px;
}

.scr-co {
  font-size: 13px;
  letter-spacing: -0.02em;
}

.scr-px {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.scr-price {
  font-family: var(--mono);
  font-size: 15px;
}

.scr-chg {
  font-family: var(--mono);
  font-size: 15px;
}

.scr-chg.up { color: var(--green); }
.scr-chg.dn { color: var(--red); }

.scr-past {
  font-size: 9px;
  color: var(--faint);
}

.scr-chart-mini {
  flex: 1;
  min-height: 80px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  padding: 8px;
}

.scr-line-svg {
  width: 100%;
  height: 100%;
}

/* Candles mock */

.scr-candles {
  position: relative;
  height: 100px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 3px;
  padding: 8px 2px 4px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  overflow: hidden;
}

.scr-candles .c {
  flex: 1;
  max-width: 8px;
  border-radius: 0;
  display: block;
  position: relative;
}

.scr-candles .c.u {
  background: var(--green);
  height: 40%;
}

.scr-candles .c.d {
  background: var(--red);
  height: 32%;
}

.scr-candles .c:nth-child(3n) { height: 55%; }
.scr-candles .c:nth-child(4n) { height: 28%; }
.scr-candles .c:nth-child(5n) { height: 48%; }

.scr-candles .sma {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  opacity: 0.7;
}

.scr-candles .s20 {
  top: 38%;
  background: #3d8bfd;
  transform: rotate(-4deg);
}

.scr-candles .s50 {
  top: 52%;
  background: #ff9f0a;
  transform: rotate(-2deg);
}

.scr-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  font-size: 8px;
  font-family: var(--mono);
  color: var(--faint);
}

.scr-toggles span {
  padding: 2px 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.scr-toggles .on {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.25);
}

.scr-toggles span.r:nth-of-type(5) {
  margin-left: auto;
}

.scr-vol-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  margin-bottom: 4px;
}

.scr-vol-bars i {
  flex: 1;
  background: rgba(52, 199, 89, 0.45);
  display: block;
  height: 40%;
}

.scr-vol-bars i:nth-child(odd) { height: 70%; background: rgba(255, 59, 48, 0.4); }
.scr-vol-bars i:nth-child(3n) { height: 50%; }

.scr-rsi-line {
  height: 20px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, transparent 0%, #3d8bfd 20%, #3d8bfd 40%, transparent 55%, #3d8bfd 70%, #3d8bfd 90%, transparent);
  opacity: 0.7;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* —— Footer (fixed bar — transparent so body gradient + noise stay seamless) —— */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  height: var(--footer-h);
  box-sizing: border-box;
  border-top: none;
  padding: 0 24px;
  /* No solid fill — page bg + noise overlay show through */
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  display: flex;
  align-items: center;
}

.footer-inner {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  color: var(--faint);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  text-align: center;
}

.footer-links a {
  color: inherit;
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--text);
}

.link-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.link-btn:hover {
  color: var(--text);
}

.sep {
  opacity: 0.4;
}

/* —— Legal lightbox —— */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(80dvh, 640px);
  overflow: auto;
  background: #161618;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 28px 28px 32px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65);
}

.lightbox-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lightbox-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.lightbox-panel h2 {
  margin: 0 0 12px;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  font-family: var(--mono);
  padding-right: 36px;
}

.legal-rule {
  height: 1px;
  background: var(--line);
  margin-bottom: 22px;
  max-width: 48px;
}

.lightbox-body p {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

.lightbox-body strong {
  color: var(--text);
  font-weight: 600;
}

.lightbox-body .legal-owner {
  margin-top: 24px;
  margin-bottom: 0;
  color: var(--text);
}

body.lightbox-open {
  overflow: hidden;
}

/* —— Responsive —— */

@media (max-width: 960px) {
  /* Section rail moves to the right edge */
  .section-rail {
    display: flex;
    left: auto;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    gap: 10px;
  }

  .section-rail-item {
    flex-direction: row-reverse;
    gap: 8px;
  }

  .section-rail-line {
    width: 12px;
  }

  .section-rail-item.is-active .section-rail-line {
    width: 22px;
  }

  .story {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    gap: 0;
    padding: 0 16px;
    padding-bottom: calc(var(--footer-h) + 16px);
    padding-right: 40px; /* room for right rail */
  }

  /* Phone pinned to the top ~60dvh while feature copy scrolls beneath */
  .story-right {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 6;
    grid-column: auto;
    width: 100%;
    max-width: 100%;
    height: 60dvh;
    max-height: 60dvh;
    margin: 0;
    padding: 10px 0 12px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Solid band so scrolling text doesn’t show through the phone zone */
    background:
      linear-gradient(180deg, #18181b 0%, #141416 78%, rgba(14, 14, 16, 0.97) 100%);
  }

  .sticky-visual {
    position: relative;
    top: auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-width: none;
    transform: none;
    margin: 0 auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .phone-frame {
    /* Fit the mockup inside the 60dvh sticky band */
    width: auto;
    height: min(calc(60dvh - 24px), 520px);
    max-height: calc(60dvh - 24px);
    max-width: min(var(--phone-w), 70vw);
    aspect-ratio: 1470 / 3000;
    margin: 0 auto;
  }

  .close-icon-stage {
    position: absolute;
    inset: 0;
  }

  /* Mobile: hard-hide icon when not on last step (no residual overlay) */
  .story:not(.is-close) .close-icon-stage {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: 0 !important;
  }

  .story.is-close .phone-frame {
    display: none;
    opacity: 0;
    visibility: hidden;
  }

  .story.is-close .close-icon-stage,
  .close-icon-stage.is-visible {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    z-index: 3;
  }

  .close-icon-large {
    width: min(140px, 42vw);
  }

  /* Copy scrolls under / below the sticky phone band */
  .story-left {
    order: 1;
    grid-column: auto;
    width: 100%;
    --stage-h: auto;
    padding-bottom: 12vh;
    position: relative;
    z-index: 1;
  }

  .feature-text-stage {
    position: relative;
    top: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    pointer-events: auto;
  }

  .feature-panel {
    position: relative;
    top: auto;
    transform: none;
    opacity: 1 !important;
    padding: 36px 0 44px;
    pointer-events: auto;
    transition: none;
    border-bottom: 1px solid var(--line);
  }

  .feature-panel:last-child {
    border-bottom: none;
  }

  .feature-panel h1 {
    font-size: clamp(36px, 10vw, 48px);
  }

  .feature-panel h2 {
    font-size: clamp(24px, 6.5vw, 32px);
  }

  /* Spacers unused on mobile — panels are the scroll markers */
  .feature-spacers {
    display: none;
  }

  .feature-block {
    min-height: auto;
  }

  .feature-block.feature-close {
    min-height: auto;
  }

  .site-footer {
    position: fixed;
    padding: 0 16px;
    padding-right: 40px;
  }

  .footer-inner {
    justify-content: center;
  }
}

/* Leave room for the rail on wide desktops */
@media (min-width: 1200px) {
  .story {
    padding-left: 48px;
  }
}

@media (max-width: 480px) {
  .story {
    padding: 0 14px;
    padding-right: 36px;
    padding-bottom: calc(var(--footer-h) + 12px);
  }

  .phone-frame {
    max-width: min(var(--phone-w), 74vw);
    height: min(calc(60dvh - 20px), 480px);
    max-height: calc(60dvh - 20px);
  }

  .lightbox-panel {
    padding: 24px 20px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .screen {
    transition: none;
  }

  .brand-icon {
    transition: none;
  }
}
