/* ============================================================
   Object Fingerprint — investor visualizations
   Layered on top of styles.css. Reuses the same OKLCH tokens.
   ============================================================ */

/* ============================================================
   HOW IT WORKS — animated scanner-port glyphs
   ============================================================ */
.step-glyph {
  position: relative;
  width: 76px; height: 76px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 36%, oklch(0.82 0.16 200 / 0.14), transparent 70%),
    linear-gradient(180deg, #181d24, #11151b);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: 0 12px 30px -18px oklch(0.82 0.16 200 / 0.7);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
/* dashed crosshair frame */
.step-glyph::before {
  content: "";
  position: absolute; inset: 8px;
  border: 1px dashed oklch(0.82 0.16 200 / 0.28);
  border-radius: 11px;
  pointer-events: none;
}
/* internal scan-line — echoes the hero beam */
.step-glyph::after {
  content: "";
  position: absolute; left: 0; right: 0; height: 46%;
  top: 0;
  background: linear-gradient(180deg, transparent, oklch(0.82 0.16 200 / 0.14), transparent);
  transform: translateY(-130%);
  pointer-events: none;
}
.step:hover .step-glyph {
  border-color: var(--accent);
  box-shadow: 0 16px 36px -16px oklch(0.82 0.16 200 / 0.9);
  transform: translateY(-1px);
}
/* step number fused into the top-left of the module */
.step-glyph .step-l {
  position: absolute; top: 0; left: 0; z-index: 3;
  padding: 4px 9px 5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  color: var(--accent);
  background: linear-gradient(135deg, oklch(0.82 0.16 200 / 0.18), transparent 80%);
  border-bottom-right-radius: 12px;
  pointer-events: none;
}

.step-glyph .g { width: 44px; height: 44px; overflow: visible; margin-top: 9px; }
.step-glyph .g line,
.step-glyph .g path,
.step-glyph .g circle,
.step-glyph .g ellipse {
  fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.step-glyph .g .fill { fill: currentColor; stroke: none; }
.step-glyph .g .guide { stroke: oklch(0.82 0.16 200 / 0.5); stroke-width: 1.4; stroke-dasharray: 2 3; }

/* draw-in primitive — VISIBLE by default; entrance/hover replays the draw */
.step-glyph .g .draw { stroke-dasharray: var(--l, 120); stroke-dashoffset: 0; }

@media (prefers-reduced-motion: no-preference) {
  .step.is-in .g .draw { animation: g-redraw 1s cubic-bezier(.5,.6,.2,1) both; }
  @keyframes g-redraw { from { stroke-dashoffset: var(--l,120); } to { stroke-dashoffset: 0; } }

  /* container scan-line, runs while section is in view */
  .step.is-in .step-glyph::after { animation: glyph-scan 3.4s ease-in-out infinite; }
  @keyframes glyph-scan {
    0% { transform: translateY(-130%); }
    55% { transform: translateY(190%); }
    100% { transform: translateY(190%); }
  }

  /* 01 · place — instrument descends, platform ripples */
  .step.is-in .g-place .drop { animation: g-dropin .6s ease both; }
  @keyframes g-dropin { from { transform: translateY(-7px); opacity: 0; } to { transform: none; opacity: 1; } }
  .g-place .ripple { opacity: 0; transform-box: fill-box; transform-origin: center; }
  .step.is-in .g-place .ripple { animation: g-ripple 3.2s ease-out 1s infinite; }
  @keyframes g-ripple { 0% { opacity: .85; transform: scale(.35); } 70%,100% { opacity: 0; transform: scale(2); } }

  /* 02 · sense — sonar rings pulse out */
  .g-sense .r { opacity: 0; transform-box: fill-box; transform-origin: center; }
  .step.is-in .g-sense .r { animation: g-radar 2.6s ease-out infinite; }
  .step.is-in .g-sense .r2 { animation-delay: .87s; }
  .step.is-in .g-sense .r3 { animation-delay: 1.74s; }
  @keyframes g-radar { 0% { opacity: .9; transform: scale(.18); } 70%,100% { opacity: 0; transform: scale(1); } }
  .step.is-in .g-sense .core { animation: g-core 2.6s ease-in-out infinite; }
  @keyframes g-core { 0%,100% { opacity: .6; } 50% { opacity: 1; } }

  /* 03 · classify — reticle locks onto the signature */
  .step.is-in .g-class .lock .bb { animation: g-lockin .6s cubic-bezier(.3,.8,.2,1) .2s both; }
  @keyframes g-lockin { from { transform: scale(1.5); opacity: 0; } to { transform: none; opacity: 1; } }

  /* hover replays the draw-in on every glyph */
  .step:hover .g .draw { animation: g-redraw .9s cubic-bezier(.5,.6,.2,1); }
}

@media (prefers-reduced-motion: reduce) {
  .step-glyph .g .draw { stroke-dashoffset: 0; }
  .g-place .drop, .g-class .lock .bb { opacity: 1; }
  .g-sense .r { opacity: .4; }
}

/* ============================================================
   PRODUCT ARCHITECTURE — animated layer glyphs (L1–L4)
   ============================================================ */
.arch-glyph {
  position: relative;
  width: 68px; height: 60px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 42%, oklch(0.82 0.16 200 / 0.14), transparent 70%),
    linear-gradient(180deg, #181d24, #11151b);
  border: 1px solid var(--accent-line);
  color: var(--accent);
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: 0 10px 24px -18px oklch(0.82 0.16 200 / 0.7);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t);
}
.arch-glyph::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px dashed oklch(0.82 0.16 200 / 0.26);
  border-radius: 9px; pointer-events: none;
}
.arch-glyph::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 46%;
  background: linear-gradient(180deg, transparent, oklch(0.82 0.16 200 / 0.12), transparent);
  transform: translateY(-130%); pointer-events: none;
}
/* L-label fused into the top-left of the module */
.arch-glyph .arch-l {
  position: absolute; top: 0; left: 0; z-index: 3;
  padding: 4px 8px 5px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 0.14em;
  color: var(--accent);
  background: linear-gradient(135deg, oklch(0.82 0.16 200 / 0.18), transparent 80%);
  border-bottom-right-radius: 10px;
  pointer-events: none;
}
.arch-card:hover .arch-glyph {
  border-color: var(--accent);
  box-shadow: 0 14px 30px -16px oklch(0.82 0.16 200 / 0.9);
  transform: translateY(-1px);
}
.arch-glyph .g { width: 32px; height: 32px; overflow: visible; margin-top: 8px; }
.arch-glyph .g line,
.arch-glyph .g path,
.arch-glyph .g circle,
.arch-glyph .g rect { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.arch-glyph .g .fill { fill: currentColor; stroke: none; }
.arch-glyph .g .edges line, .arch-glyph .g .links line { stroke: oklch(0.82 0.16 200 / 0.55); }
.arch-glyph .g .row { stroke: oklch(0.82 0.16 200 / 0.6); stroke-width: 1.6; }
.arch-glyph .g .draw { stroke-dasharray: var(--l, 120); stroke-dashoffset: 0; }

@media (prefers-reduced-motion: no-preference) {
  .arch-card.is-in .arch-glyph::after { animation: glyph-scan 3.8s ease-in-out infinite; }
  .arch-card.is-in .g .draw { animation: g-redraw 1s cubic-bezier(.5,.6,.2,1) both; }
  .arch-card:hover .g .draw { animation: g-redraw .9s cubic-bezier(.5,.6,.2,1); }

  /* L1 — incoming capture waves */
  .g-l1 .wave { opacity: 0; }
  .arch-card.is-in .g-l1 .wave { animation: g-wave 2.8s ease-out infinite; }
  .arch-card.is-in .g-l1 .w2 { animation-delay: .5s; }
  @keyframes g-wave { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }

  /* L2 — signal lights the net left→right */
  .g-l2 .node { opacity: .4; }
  .arch-card.is-in .g-l2 .node { animation: g-pulse 2.4s ease-in-out infinite; }
  .arch-card.is-in .g-l2 .c1 { animation-delay: .35s; }
  .arch-card.is-in .g-l2 .c2 { animation-delay: .7s; }
  @keyframes g-pulse { 0%,100% { opacity: .4; } 45% { opacity: 1; } }

  /* L4 — endpoints handshake with the hub */
  .g-l4 .ep { opacity: .45; transform-box: fill-box; transform-origin: center; }
  .arch-card.is-in .g-l4 .ep { animation: g-pulse 2.6s ease-in-out infinite; }
  .arch-card.is-in .g-l4 .e1 { animation-delay: .4s; }
  .arch-card.is-in .g-l4 .e2 { animation-delay: .8s; }
  .arch-card.is-in .g-l4 .e3 { animation-delay: 1.2s; }
}

@media (prefers-reduced-motion: reduce) {
  .g-l1 .wave, .g-l2 .node, .g-l4 .ep { opacity: .7; }
}

/* shared viz scaffold ------------------------------------- */
.viz-caption {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  line-height: 1.5;
}
.viz-stage svg { display: block; width: 100%; height: auto; overflow: visible; margin: 0 auto; }
#marketSizing svg, #marketGrowth svg { max-width: 540px; }
#vsRadar svg { max-width: 460px; }
#accGauge svg { max-width: 300px; }
/* reserve area so the build has a sized target before it runs */
#cssdLoop { min-height: 200px; }
#marketSizing, #marketGrowth { min-height: 240px; }
#vsRadar { min-height: 300px; }
#accGauge { min-height: 150px; }

/* generic draw-in for SVG strokes */
.draw {
  stroke-dasharray: var(--len, 600);
  stroke-dashoffset: var(--len, 600);
}
.draw.in { transition: stroke-dashoffset 1.4s cubic-bezier(.4,.7,.2,1); stroke-dashoffset: 0; }

/* ============================================================
   1 · PROBLEM — the CSSD decontamination loop
   ============================================================ */
.cssd-loop {
  margin: 8px 0 56px;
  padding: 36px 28px 28px;
  background:
    radial-gradient(ellipse at 50% 35%, oklch(0.74 0.16 18 / 0.06), transparent 62%),
    var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.cssd-loop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.cssd-loop-head h3 { color: var(--ink); font-size: clamp(18px, 1.7vw, 22px); }
.cssd-loop-head .viz-caption { max-width: 46ch; }
.cssd-loop-stage { position: relative; max-width: 760px; margin: 0 auto; }
.cssd-node-rect {
  fill: #181d24;            /* concrete hex (≈ --bg-2) so SVG fill never falls back to a light inherited value on browsers without oklch-in-fill */
  stroke: #353b44;          /* ≈ --line */
  stroke-width: 1.2;
  transition: stroke var(--t), fill var(--t);
}
.cssd-node.is-bottleneck .cssd-node-rect {
  fill: rgba(227, 103, 94, 0.12);
  stroke: #e3675e;          /* ≈ --rose */
}
.cssd-node.is-active .cssd-node-rect { stroke: #3fd0e0; }  /* ≈ --accent */
.cssd-node-title {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 600;
  fill: #f2f3f1;            /* ≈ --ink */
}
.cssd-node-sub {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  fill: #707a86;            /* ≈ --ink-dim */
  letter-spacing: 0.04em;
}
.cssd-node.is-bottleneck .cssd-node-sub { fill: #e3675e; }
.cssd-path { fill: none; stroke: #353b44; stroke-width: 1.4; }
.cssd-flow { fill: none; stroke: #3fd0e0; stroke-width: 1.6; stroke-dasharray: 3 7; stroke-linecap: round; }
.cssd-token { fill: #3fd0e0; filter: drop-shadow(0 0 6px #3fd0e0); }
.cssd-token.jam { fill: #e3675e; filter: drop-shadow(0 0 7px #e3675e); }
.cssd-badge {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  fill: #e3675e;
}

/* ============================================================
   2 · MARKET — sizing + growth
   ============================================================ */
.market-viz {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 16px;
  margin: 16px 0 64px;
}
.mv-card {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 28px 28px 22px;
  position: relative;
  overflow: hidden;
}
.mv-card::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
}
.mv-head { margin-bottom: 14px; }
.mv-head h3 { color: var(--ink); font-size: clamp(18px, 1.6vw, 21px); margin-top: 8px; }
.mv-stage { position: relative; }

/* nested sizing rings */
.ms-ring { fill: none; stroke-width: 1.4; transition: opacity var(--t); cursor: default; }
.ms-disc { transition: opacity var(--t); cursor: default; }
.ms-label-val {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500;
  fill: var(--ink);
}
.ms-label-key {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
.ms-lead { stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.5; }
.ms-row { transition: opacity var(--t); cursor: pointer; }
.ms-row.dim { opacity: 0.32; }

/* growth bars */
.gw-bar { transition: opacity var(--t); cursor: pointer; }
.gw-bar rect { transform-box: fill-box; transform-origin: bottom; }
.gw-grid { stroke: var(--line-soft); stroke-width: 1; }
.gw-axis-lbl {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; fill: var(--ink-dim); letter-spacing: 0.02em;
}
.gw-val {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; fill: var(--ink); opacity: 0; transition: opacity var(--t);
}
.gw-bar:hover .gw-val, .gw-bar.show .gw-val { opacity: 1; }
.gw-trend { fill: none; stroke: var(--mint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gw-cagr {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; fill: var(--mint); letter-spacing: 0.04em;
}

/* ============================================================
   3 · VS — radar / spider
   ============================================================ */
.vs-radar-wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: center;
  margin-bottom: 40px;
  padding: 28px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
}
.vs-radar { position: relative; max-width: 480px; margin: 0 auto; width: 100%; }
.rad-grid { fill: none; stroke: var(--line-soft); stroke-width: 1; }
.rad-spoke { stroke: var(--line-soft); stroke-width: 1; }
.rad-axis-lbl {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.04em; fill: var(--ink-mute);
}
.rad-poly { stroke-width: 2; transition: opacity var(--t), fill var(--t); }
.rad-poly-pt { transition: opacity var(--t); }
.rad-roadmap { stroke-width: 1.6; stroke-dasharray: 4 4; opacity: 0.85; }
.rad-roadmap-pt { filter: drop-shadow(0 0 5px var(--accent)); }
.rad-roadmap-lbl { font-family: "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0.04em; }

.vs-legend-head {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 14px;
}
.vs-legend-items { display: flex; flex-direction: column; gap: 8px; }
.vs-legend-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px; color: var(--ink-mute);
  transition: border-color var(--t-fast), color var(--t-fast), background var(--t-fast);
  text-align: left;
}
.vs-legend-btn:hover { border-color: var(--ink-dim); color: var(--ink); }
.vs-legend-btn .swatch {
  width: 12px; height: 12px; border-radius: 3px; flex: none;
  background: var(--sw, var(--ink-dim));
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.12) inset;
  transition: opacity var(--t-fast);
}
.vs-legend-btn[aria-pressed="false"] { opacity: 0.55; }
.vs-legend-btn[aria-pressed="false"] .swatch { opacity: 0.25; }
.vs-legend-btn.is-anchor { border-color: var(--accent-line); color: var(--ink); cursor: default; }
.vs-legend-note {
  margin-top: 14px;
  font-size: 12px; color: var(--ink-dim); line-height: 1.5;
}

/* ============================================================
   4 · ROADMAP — accuracy gauge
   ============================================================ */
.gauge-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 36px;
  align-items: center;
  margin: 8px 0 56px;
  padding: 32px;
  background: linear-gradient(180deg, oklch(0.14 0.02 220), var(--bg-1));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
}
.gauge-stage { width: clamp(220px, 30vw, 300px); }
.g-track { fill: none; stroke: var(--bg-3); stroke-width: 14; stroke-linecap: round; }
.g-fill  { fill: none; stroke: var(--accent); stroke-width: 14; stroke-linecap: round;
           filter: drop-shadow(0 0 10px oklch(0.82 0.16 200 / 0.5)); }
.g-target { stroke: var(--warm); stroke-width: 3; stroke-linecap: round; }
.g-num {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 500; fill: var(--ink); text-anchor: middle;
}
.g-num small { font-size: 0.5em; fill: var(--ink-mute); }
.g-cap {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  fill: var(--ink-dim); text-anchor: middle;
}
.gauge-copy .kicker { margin-bottom: 12px; }
.gauge-copy h3 { color: var(--ink); font-size: clamp(20px, 2vw, 28px); margin-bottom: 12px; }
.gauge-copy p { color: var(--ink-mute); font-size: clamp(14px, 1.1vw, 16px); line-height: 1.6; max-width: 60ch; }
.gauge-copy .g-legend {
  display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 12px;
}
.gauge-copy .g-legend span { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-mute); }
.gauge-copy .g-legend i { width: 14px; height: 3px; border-radius: 2px; }
.g-legend .now { background: var(--accent); }
.g-legend .goal { background: var(--warm); }

/* ============================================================
   RESPONSIVE — tablet
   ============================================================ */
@media (max-width: 1100px) {
  .market-viz { grid-template-columns: 1fr; }
  .vs-radar-wrap { grid-template-columns: 1fr; gap: 24px; }
  .vs-radar { max-width: 380px; }
  .gauge-block { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 24px; }
  .gauge-copy .g-legend { justify-content: center; }
  .gauge-copy p { max-width: 64ch; }
}

/* ============================================================
   RESPONSIVE — phones (portrait)
   ============================================================ */
@media (max-width: 620px) {
  .cssd-loop { padding: 24px 16px 18px; }
  .mv-card { padding: 22px 18px 18px; }
  .vs-radar-wrap { padding: 20px 16px; }
  .gauge-block { padding: 24px 18px; }
  .vs-legend-btn { padding: 12px 14px; }   /* keeps 44px tap target */
  /* the 5-step loop is unreadable shrunk to phone width — let it scroll horizontally */
  .cssd-loop-stage { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  #cssdLoop svg { min-width: 580px; }
  .cssd-loop-head h3 { font-size: 18px; }
  /* sizing/growth/radar get a touch more height back so labels stay legible */
  #marketSizing svg, #marketGrowth svg, #vsRadar svg { max-width: 100%; }
}

/* ============================================================
   ORIENTATION — landscape phones / short viewports
   Compress vertical rhythm so a single section fits the screen,
   and force comparison rows + viz into single-column where wide
   grids would overflow a short, wide window.
   ============================================================ */
@media (orientation: landscape) and (max-height: 560px) {
  .hero { padding-top: 28px; padding-bottom: 36px; }
  .hero-inner { grid-template-columns: 1.1fr 0.9fr; gap: 28px; align-items: center; }
  .hero-scanner { order: 0; max-width: 320px; }
  .scanner3d { height: min(54vh, 320px); --pw: min(46vh, 280px); }
  .hero-stats { margin-top: 28px; }
  .scroll-hint { display: none; }
  .section { padding-top: 56px; padding-bottom: 56px; }
  .section-head { margin-bottom: 32px; }
}

/* Comparison table: in landscape phones the 5-column grid is unreadable,
   so reuse the portrait "row becomes a card" treatment up to 960px when short. */
@media (orientation: landscape) and (max-height: 560px) and (max-width: 960px) {
  .vs-table { display: flex; flex-direction: column; gap: 14px; background: none; border: none; overflow: visible; }
  .vs-row.vs-head { display: none; }
  .vs-row {
    display: grid;
    grid-template-columns: 1.4fr repeat(4, 1fr);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    background: var(--bg-1);
    overflow: hidden;
  }
  .vs-row:nth-child(2) { border-color: var(--accent-line); }
  .vs-row > * { padding: 12px 14px; }
  .vs-approach { font-size: 14px; color: var(--ink); }
  .vs-radar-wrap { grid-template-columns: 0.9fr 1.1fr; }
  .vs-radar { max-width: 260px; }
}
