/* ============================================
   DDD Hero — Terminal rebuild
   Bloomberg-meets-modern live market terminal.
   Scoped to the .dt-* namespace so legacy hero
   styles in index.css no longer apply.
   ============================================ */

/* dt-* design tokens. Hoisted to html.dt-page so the ticker and topbar
   (now siblings of .dt rather than children) still inherit them. */
html.dt-page,
.dt {
  --dt-bg: #0a0d12;
  --dt-bg-card: #0f1318;
  --dt-border: #1f262f;
  --dt-fg: #e8eaed;
  --dt-fg-dim: #9ca3af;
  --dt-fg-faint: #4b5563;
  --dt-teal: #7dd3c0;
  --dt-teal-lit: #a7f3d0;
  --dt-red: #f87171;

  --dt-serif: 'Fraunces', Georgia, serif;
  --dt-mono: 'IBM Plex Mono', 'SF Mono', Menlo, monospace;
  --dt-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Allow the page to scroll past the hero. Overrides index.css:7–17
   and the @media (max-width: 768px) html/body overflow rules in
   index.css, which locked html/body/.page to 100vh for the old
   single-screen layout.
   IMPORTANT: only html is the scroll container. Body uses overflow-x:
   clip + overflow-y: visible so position:sticky descendants
   (e.g. .dt-topbar) walk up to html for their scroll context. If body
   were also a scroll container (overflow-y: auto), sticky would attach
   to body (which never scrolls) and silently fail. We use `clip`
   instead of `hidden` for overflow-x because the CSS spec converts
   `overflow-y: visible` to `auto` whenever overflow-x is `hidden` or
   `auto` — `clip` is the only value that suppresses overflow without
   triggering that conversion. The !important is required to defeat the
   `body { overflow: hidden auto }` rule inside index.css's
   @media (max-width: 768px) block. */
html.dt-page {
  height: auto;
  overflow-x: hidden;
  overflow-y: auto;
}
html.dt-page body {
  height: auto !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
}
html.dt-page .page {
  height: auto;
  min-height: 100vh;
}

/* Container sits above the background map. Transparent so the world-map
   canvas (#bgCanvas) + payment comets show through the ticker, top bar,
   hero, and bottom bar. The formula card and stats cells below provide
   their own opaque backgrounds so their content reads cleanly. */
.dt {
  position: relative;
  z-index: 3;
  color: var(--dt-fg);
  background: transparent;
  font-family: var(--dt-sans);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
}

/* Subtle 40px grid overlay above the map, below the terminal surface.
   Very low alpha so it doesn't fight the payment-comet visuals. */
.dt-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(125, 211, 192, 0.012) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(125, 211, 192, 0.012) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ---------- 1. Ticker ---------- */
.dt-ticker {
  height: 44px;
  border-bottom: 1px solid var(--dt-border);
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  display: flex;
  align-items: center;
}
.dt-ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 2.5rem;
  padding-left: 2.5rem;
  animation: dt-ticker-scroll 40s linear infinite;
  will-change: transform;
}
.dt-ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.65rem;
  font-family: var(--dt-mono);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.dt-ticker-sym {
  color: var(--dt-fg);
  font-weight: 500;
}
.dt-ticker-supply {
  color: var(--dt-fg-dim);
}
.dt-ticker-delta {
  color: var(--dt-teal);
}
.dt-ticker-delta.is-down {
  color: var(--dt-red);
}
@keyframes dt-ticker-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}
.dt-ticker.is-loading .dt-ticker-track {
  animation: none;
  opacity: 0.35;
}

/* ---------- 2. Top bar ----------
   Sticky across the whole page scroll. Sits above the world-map canvas
   (z:0), grid (z:1), story overlay (z:2), and .dt surface (z:3) with
   a blurred translucent background so scrolling content reads through. */
.dt-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 24px;
  border-bottom: 1px solid var(--dt-border);
  gap: 1rem;
  background: rgba(10, 13, 18, 0.82);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
  backdrop-filter: blur(10px) saturate(140%);
}
.dt-topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 16px;
}
.dt-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--dt-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--dt-fg-dim);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
}
.dt-brand svg {
  width: 34px;
  height: 34px;
  display: block;
  flex-shrink: 0;
  transform: translateY(-1px);
}
.dt-live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--dt-mono);
  font-size: 11px;
  color: var(--dt-fg-dim);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.dt-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dt-teal);
  box-shadow: 0 0 8px rgba(125, 211, 192, 0.55);
  animation: dt-live-pulse 2s ease-in-out infinite;
}
.dt-live.is-stale .dt-live-dot {
  background: #f59e0b;
  box-shadow: none;
  animation: none;
}
@keyframes dt-live-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}
.dt-live-label {
  color: var(--dt-teal);
}
.dt-live.is-stale .dt-live-label {
  color: #f59e0b;
}
.dt-live-sep {
  color: var(--dt-fg-faint);
}
.dt-menu {
  font-family: var(--dt-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dt-fg-dim);
  background: transparent;
  border: 1px solid var(--dt-border);
  padding: 6px 12px;
  border-radius: 3px;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.dt-menu:hover {
  color: var(--dt-fg);
  border-color: var(--dt-fg-faint);
}

/* ---------- 3. Hero block ---------- */
.dt-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 3rem;
  padding: 56px 24px 48px;
  align-items: start;
  border-bottom: 1px solid var(--dt-border);
  position: relative;
}
/* Soft vignette behind the headline so the 1/71 figure and DDD Ratio card
   stay legible over the world-map canvas and in-flight payment comets. */
.dt-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(
    ellipse 70% 80% at 25% 45%,
    rgba(10, 13, 18, 0.85) 0%,
    rgba(10, 13, 18, 0.55) 45%,
    rgba(10, 13, 18, 0) 85%
  );
}
.dt-kicker {
  font-family: var(--dt-mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--dt-fg-faint);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0 0 22px;
  line-height: 1.45;
}
.dt-kicker-brand {
  display: block;
  margin-bottom: 6px;
  color: var(--dt-fg-dim);
  letter-spacing: 0.18em;
}
.dt-kicker-sub {
  display: block;
  color: var(--dt-fg-faint);
}
.dt-headline {
  font-family: var(--dt-serif);
  font-weight: 400;
  font-size: clamp(72px, 11vw, 120px);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--dt-fg);
  margin: 0 0 20px;
  font-variant-numeric: tabular-nums lining-nums;
  display: inline-flex;
  align-items: baseline;
  gap: 0.02em;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.38), 0 2px 8px rgba(0, 0, 0, 0.34);
}
.dt-headline-num,
.dt-headline-ratio {
  display: inline-block;
}
.dt-headline-slash {
  color: var(--dt-fg-faint);
  margin: 0 0.02em;
  font-weight: 300;
}
.dt-headline-ratio {
  color: var(--dt-teal);
  text-shadow: 0 0 22px rgba(125, 211, 192, 0.18), 0 8px 24px rgba(0, 0, 0, 0.34);
  transition: opacity 400ms ease;
}
.dt-headline-ratio.is-swapping {
  opacity: 0;
}
.dt-subhead {
  font-family: var(--dt-sans);
  font-size: 14px;
  font-weight: 300;
  color: var(--dt-fg-dim);
  line-height: 1.6;
  max-width: 44ch;
  margin: 0;
}

.dt-dot-explainer {
  max-width: 42rem;
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  border-left: 2px solid rgba(125, 211, 192, 0.9);
  background: linear-gradient(90deg, rgba(10, 13, 18, 0.56), rgba(10, 13, 18, 0.18));
  color: rgba(232, 234, 237, 0.82);
  font-family: var(--dt-sans);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}

.dt-dot-explainer strong {
  color: var(--dt-teal);
  font-weight: 600;
}

.dt-dot-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-top: 0.7rem;
  max-width: 52rem;
}

.dt-dot-legend-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  font-family: var(--dt-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dt-dot-legend-chip {
  gap: 0.45rem;
  padding: 0.38rem 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 13, 18, 0.38);
  color: rgba(232, 234, 237, 0.74);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}

.dt-dot-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dt-dot-legend-dot--stable {
  background: var(--dt-teal);
  box-shadow: 0 0 8px rgba(125, 211, 192, 0.45);
}

.dt-dot-legend-dot--base {
  background: rgba(156, 163, 175, 0.8);
}

.dt-ratio {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: start;
  min-width: min(100%, 16rem);
  padding: 16px 18px 15px;
  padding-top: 8px;
  border: 1px solid rgba(125, 211, 192, 0.14);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(10, 13, 18, 0.92), rgba(10, 13, 18, 0.78));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}
.dt-ratio-label {
  font-family: var(--dt-mono);
  font-size: 10px;
  color: rgba(232, 234, 237, 0.62);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.dt-ratio-value {
  font-family: var(--dt-serif);
  font-weight: 400;
  font-size: clamp(44px, 5vw, 64px);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--dt-teal);
  font-variant-numeric: tabular-nums lining-nums;
  text-shadow: 0 0 24px rgba(125, 211, 192, 0.16), 0 8px 24px rgba(0, 0, 0, 0.28);
}
.dt-ratio-delta {
  font-family: var(--dt-mono);
  font-size: 12px;
  color: rgba(167, 243, 208, 0.92);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}
.dt-ratio-delta.is-down {
  color: var(--dt-red);
}

/* ---------- 4. Formula card ---------- */
.dt-formula {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0;
  margin: 32px 24px;
  padding: 22px 28px;
  background: rgba(15, 19, 24, 0.90);
  border: 1px solid var(--dt-border);
  border-radius: 4px;
}
.dt-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 10px;
  min-width: 0;
}
.dt-cell-label {
  font-family: var(--dt-mono);
  font-size: 10px;
  color: var(--dt-fg-faint);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.dt-cell-value {
  font-family: var(--dt-serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--dt-fg);
  font-variant-numeric: tabular-nums lining-nums;
}
.dt-cell.is-result .dt-cell-label {
  color: var(--dt-teal);
  opacity: 0.8;
}
.dt-cell.is-result .dt-cell-value {
  color: var(--dt-teal);
}
.dt-ddd-24h {
  font-family: var(--dt-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dt-fg-faint);
  margin-top: -2px;
}
.dt-ddd-24h[data-dir="up"] { color: var(--dt-teal); }
.dt-ddd-24h[data-dir="down"] { color: #e87a7a; }
.dt-op {
  font-family: var(--dt-mono);
  font-size: 18px;
  color: var(--dt-fg-faint);
  padding: 0 6px;
  line-height: 1;
  user-select: none;
}

/* ---------- 5. Stats grid (7D / 30D / 90D / 1Y) ---------- */
.dt-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 0 24px 24px;
  background: var(--dt-border);
  border: 1px solid var(--dt-border);
  border-radius: 4px;
  overflow: hidden;
}
.dt-stat {
  background: rgba(10, 13, 18, 0.90);
  padding: 22px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.dt-stat-label {
  font-family: var(--dt-mono);
  font-size: 10px;
  color: var(--dt-fg-faint);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.dt-stat-value {
  font-family: var(--dt-serif);
  font-weight: 300;
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--dt-teal);
  font-variant-numeric: tabular-nums lining-nums;
}
.dt-spark {
  display: block;
  width: 100%;
  height: 32px;
  margin-top: 4px;
}
.dt-spark path {
  fill: none;
  stroke: var(--dt-teal);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- 6. Bottom bar ---------- */
.dt-footstrip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  padding: 14px 24px;
  border-top: 1px solid var(--dt-border);
  font-family: var(--dt-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dt-fg-faint);
}
.dt-footstrip-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.dt-footstrip-slot:nth-child(2) {
  justify-content: center;
}
.dt-footstrip-slot:nth-child(3) {
  justify-content: flex-end;
}
.dt-footstrip-slot .dt-foot-key {
  color: var(--dt-fg-faint);
}
.dt-footstrip-slot .dt-foot-val {
  color: var(--dt-fg-dim);
  font-variant-numeric: tabular-nums;
}

/* ---------- Entrance stagger ---------- */
.dt-fade {
  opacity: 0;
  transform: translateY(12px);
  animation: dt-fade-in 200ms ease-out forwards;
}
@keyframes dt-fade-in {
  to { opacity: 1; transform: translateY(0); }
}
.dt-ticker      { animation-delay:   0ms; }
.dt-topbar      { animation-delay:  50ms; }
.dt-hero        { animation-delay: 100ms; }
.dt-formula     { animation-delay: 150ms; }
.dt-stats       { animation-delay: 200ms; }
.dt-footstrip   { animation-delay: 250ms; }

@media (prefers-reduced-motion: reduce) {
  .dt-ticker-track { animation: none; }
  .dt-live-dot { animation: none; }
  .dt-fade { animation: none; opacity: 1; transform: none; }
  .dt-headline-ratio { transition: none; }
}

/* ---------- Responsive (below 900px) ---------- */
@media (max-width: 900px) {
  .dt-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding: 40px 20px 36px;
  }
  .dt-headline {
    font-size: clamp(56px, 18vw, 72px);
  }
  .dt-dot-explainer {
    margin-top: 0.85rem;
    padding: 0.7rem 0.82rem;
    font-size: 12px;
  }
  .dt-dot-legend {
    gap: 0.45rem 0.5rem;
  }
  .dt-ratio {
    min-width: 0;
    padding: 14px 16px 13px;
  }
  .dt-topbar {
    padding: 12px 20px;
  }
  .dt-formula {
    grid-template-columns: minmax(0, 1fr);
    margin: 24px 20px;
    padding: 18px 22px;
    gap: 14px;
  }
  .dt-formula .dt-op {
    display: none;
  }
  .dt-formula .dt-cell {
    padding: 8px 0;
    border-bottom: 1px solid var(--dt-border);
  }
  .dt-formula .dt-cell:last-child {
    border-bottom: 0;
  }
  .dt-stats {
    grid-template-columns: minmax(0, 1fr);
    margin: 0 20px 20px;
  }
  .dt-footstrip {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 12px 20px;
  }
  .dt-footstrip-slot,
  .dt-footstrip-slot:nth-child(2),
  .dt-footstrip-slot:nth-child(3) {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .dt-ticker-track { gap: 1.75rem; padding-left: 1.75rem; }
  .dt-brand { font-size: 10px; letter-spacing: 0.16em; }
  .dt-brand svg { width: 30px; height: 30px; }
  .dt-brand-tail { display: none; }
  .dt-live { font-size: 10px; letter-spacing: 0.14em; }
  .dt-dot-explainer {
    font-size: 11px;
    line-height: 1.5;
  }
  .dt-dot-legend-chip {
    font-size: 9px;
  }
}

/* ---------- Map + story overlays (layered over terminal) ----------
   The world-map canvas sits at z:0 (background). Payment-story
   controller positions origin/destination beacons inside
   #storyOverlay at z:2. The terminal surface sits at z:3.
   The story banner and the map legend both live inline inside
   .live-scenario-section (see css/index.css) — neither is floated at
   the viewport level. */

/* Homepage-only: near-opaque backdrop on the signup block so map comets
   don't bleed through the newsletter copy. Scoped to html.dt-page to
   leave the shared .signup-block (used on subpages) untouched. */
html.dt-page .signup-block {
  background: linear-gradient(180deg, rgba(10, 13, 18, 0.08), rgba(10, 13, 18, 0.14));
  -webkit-backdrop-filter: blur(1px);
  backdrop-filter: blur(1px);
}

html.dt-page .page-footer {
  background: rgba(10, 13, 18, 0.04);
}
