/* ============================================================================
   Cortex — hero section (/css/hero.css)
   Requires tokens.css + base.css. Owns .hero*, .hero-preview*, .hero-pane*,
   .hero-radar*, .hero-dossier*, .hero-bridge*.
   ========================================================================== */

/* ---- Section shell -------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 6vw, 6rem) clamp(2.5rem, 4vw, 4rem);
  background: var(--c-bg);
}

/* Stronger ambient glow than the default texture-glow, anchored to the art */
.hero.texture-grid.texture-glow::after {
  background:
    radial-gradient(ellipse 45% 55% at 72% 38%, var(--c-accent-glow), transparent 70%),
    radial-gradient(ellipse 30% 35% at 18% 85%, rgba(34, 211, 238, 0.10), transparent 70%);
  opacity: 0.6;
}

.hero__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: center;
}

@media (min-width: 960px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
    gap: clamp(2rem, 4vw, 4rem);
  }
}

/* ---- Decorative voxels ---------------------------------------------------- */
.hero__voxels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.hero__voxel {
  position: absolute;
  opacity: 0.75;
}

.hero__voxel--a { right: 4%;  top: 8%;  animation-delay: -1.5s; }
.hero__voxel--b { right: 46%; bottom: 14%; animation-delay: -3s; opacity: 0.5; }
.hero__voxel--c { right: 14%; bottom: 22%; animation-delay: -4.5s; }

@media (max-width: 959px) {
  .hero__voxel--a { right: 6%; top: 3%; }
  .hero__voxel--b { display: none; }
  .hero__voxel--c { right: 24%; top: 6%; bottom: auto; }
}

/* ---- Copy column ---------------------------------------------------------- */
.hero__copy {
  max-width: 620px;
}

.hero__title {
  font-size: var(--fs-3xl);
  margin-block-end: var(--sp-5);
  background: linear-gradient(180deg, #ffffff 0%, var(--c-text) 55%, var(--c-text-muted) 140%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  max-width: 54ch;
  margin-block-end: var(--sp-8);
}

.hero__cta {
  gap: var(--sp-3);
  margin-block-end: var(--sp-6);
}

@media (max-width: 479px) {
  .hero__cta .btn { flex: 1 1 100%; }
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-3);
  margin-block-end: var(--sp-8);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
}

.hero__fact {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
}

.hero__fact .status-dot {
  width: 6px;
  height: 6px;
}

.hero__fact-sep {
  color: var(--c-text-faint);
}

@media (max-width: 419px) {
  .hero__fact-sep { display: none; }
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-4);
  padding-block-start: var(--sp-6);
  border-top: 1px solid var(--c-border);
}

@media (max-width: 419px) {
  .hero__stats { grid-template-columns: 1fr 1fr; }
  .hero__stat:last-child { grid-column: 1 / -1; }
}

.hero__stat {
  display: flex;
  flex-direction: column-reverse;   /* value renders above its label; DOM keeps dt before dd */
  gap: var(--sp-1);
}

.hero__stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fs-xl);
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  color: var(--c-accent-hover);
  font-variant-numeric: tabular-nums;
}

.hero__stat-label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.03em;
  color: var(--c-text-muted);
  line-height: 1.4;
}

/* ---- Preview window ------------------------------------------------------- */
.hero__visual {
  position: relative;
  min-width: 0;
}

.hero-preview {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-xl);
  border-color: var(--c-border-hover);
  box-shadow:
    var(--sh-xl),
    var(--sh-inset-top),
    0 0 90px -20px var(--c-accent-glow);
  font-size: var(--fs-sm);
}

/* faint grid inside the window */
.hero-preview::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%);
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
}

.hero-preview__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 46px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--c-surface-1);
  border-bottom: 1px solid var(--c-border);
}

.hero-preview__dots {
  display: inline-flex;
  gap: 6px;
  flex: none;
}

.hero-preview__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-surface-3);
  border: 1px solid var(--c-border-hover);
}

.hero-preview__dots i:nth-child(1) { background: var(--c-danger);  border-color: transparent; opacity: 0.85; }
.hero-preview__dots i:nth-child(2) { background: var(--c-warning); border-color: transparent; opacity: 0.85; }
.hero-preview__dots i:nth-child(3) { background: var(--c-accent);  border-color: transparent; opacity: 0.85; }

.hero-preview__url {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
  letter-spacing: 0.02em;
}

.hero-preview__badge {
  flex: none;
  margin-inline-start: auto;
}

@media (max-width: 479px) {
  .hero-preview__url { display: none; }
}

/* Tabs: only on narrow screens where a single pane is shown at a time */
.hero-preview__tabs {
  position: relative;
  display: none;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  background: var(--c-surface-1);
  border-bottom: 1px solid var(--c-border);
}

.hero-preview__tab {
  flex: 1 1 0;
  min-height: 36px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.hero-preview__tab:hover {
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.04);
}

.hero-preview__tab[aria-selected="true"] {
  color: var(--c-accent-hover);
  background: var(--c-accent-soft);
  border-color: var(--c-border-accent);
}

.hero-preview__tab:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 1px;
}

/* Panes grid: radar tall on the left, dossier + bridge stacked on the right */
.hero-preview__panes {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--c-border);
}

.hero-pane {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-width: 0;
  padding: var(--sp-4);
  background: rgba(20, 23, 29, 0.92);
}

@media (min-width: 960px) {
  .hero-preview__panes {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto;
  }
  .hero-pane--radar   { grid-column: 1; grid-row: 1 / span 2; }
  .hero-pane--dossier { grid-column: 2; grid-row: 1; }
  .hero-pane--bridge  { grid-column: 2; grid-row: 2; }
}

/* under 960px: one pane at a time, driven by the tablist */
@media (max-width: 959px) {
  .hero-preview__tabs { display: flex; }
  .hero-pane:not(.is-active) { display: none; }
  .hero-pane { min-height: 380px; }
}

.hero-pane__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 20px;
}

.hero-pane__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-sm);
  color: var(--c-text);
  letter-spacing: 0.01em;
}

.hero-pane__meta {
  margin-inline-start: auto;
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---- Radar pane ----------------------------------------------------------- */
.hero-radar {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  flex: 1 1 auto;
}

.hero-radar__svg {
  width: min(100%, 220px);
  aspect-ratio: 1;
  margin-inline: auto;
  color: var(--c-accent);
  filter: drop-shadow(0 0 18px rgba(16, 185, 129, 0.18));
}

@media (min-width: 960px) {
  .hero-radar__svg { width: min(100%, 200px); }
}

.hero-radar__rings circle {
  fill: none;
  stroke: rgba(16, 185, 129, 0.28);
  stroke-width: 1;
}

.hero-radar__rings circle:first-child {
  stroke: rgba(16, 185, 129, 0.45);
}

.hero-radar__axes line {
  stroke: rgba(16, 185, 129, 0.18);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.hero-radar__sweep line {
  stroke: var(--c-accent-hover);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.hero-radar__center {
  fill: var(--c-accent-hover);
}

.hero-radar__blip {
  --blip: var(--c-accent);
  transform-box: fill-box;
}

.hero-radar__blip--danger  { --blip: var(--c-danger); }
.hero-radar__blip--warning { --blip: var(--c-warning); }
.hero-radar__blip--cyan    { --blip: var(--c-cyan); }

.hero-radar__blip-dot {
  fill: var(--blip);
  filter: drop-shadow(0 0 4px var(--blip));
  animation: hero-blip-fade 7s linear forwards;
}

.hero-radar__blip-ring {
  fill: none;
  stroke: var(--blip);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: hero-blip-ring 1.8s var(--ease-out) 3;
  opacity: 0;
}

/* static blips (no JS / reduced motion) stay put without animating away */
.hero-radar__blip[data-static] .hero-radar__blip-dot { animation: none; }
.hero-radar__blip[data-static] .hero-radar__blip-ring { animation: none; opacity: 0.45; transform: scale(2); }

@keyframes hero-blip-ring {
  0%   { transform: scale(0.8); opacity: 0.9; }
  100% { transform: scale(3.2); opacity: 0; }
}

@keyframes hero-blip-fade {
  0%, 60% { opacity: 1; }
  100%    { opacity: 0; }
}

.hero-radar__events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-block-start: var(--sp-2);
  border-top: 1px solid var(--c-border);
}

.hero-radar__event {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 28px;
  padding: 0.25rem 0.4rem;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  color: var(--c-text);
}

.hero-radar__event:first-child {
  background: rgba(255, 255, 255, 0.035);
}

.hero-radar__event .status-dot {
  width: 6px;
  height: 6px;
}

.hero-radar__time {
  flex: none;
  color: var(--c-text-faint);
  font-variant-numeric: tabular-nums;
}

.hero-radar__label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-radar__event.is-new,
.hero-bridge__msg.is-new {
  animation: hero-slide-in var(--dur-slow) var(--ease-out) both;
}

@keyframes hero-slide-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.hero-bridge__msg.is-new {
  animation-name: hero-slide-up;
}

@keyframes hero-slide-up {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ---- Dossier pane --------------------------------------------------------- */
.hero-dossier {
  --band: var(--c-accent);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  flex: 1 1 auto;
  transition: opacity var(--dur-base) var(--ease-out);
}

.hero-dossier.is-low  { --band: var(--c-accent); }
.hero-dossier.is-mid  { --band: var(--c-warning); }
.hero-dossier.is-high { --band: var(--c-danger); }

.hero-dossier.is-switching .hero-dossier__ident,
.hero-dossier.is-switching .hero-dossier__facts,
.hero-dossier.is-switching .hero-dossier__flags {
  opacity: 0.25;
}

.hero-dossier__ident,
.hero-dossier__facts,
.hero-dossier__flags {
  transition: opacity var(--dur-base) var(--ease-out);
}

.hero-dossier__ident {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
}

/* CSS pixel-art head: skin, hair band, two eye pixels — no raster art */
.hero-dossier__avatar {
  --skin: #b98a5b;
  --hair: #3b2a1e;
  --eye: #1e293b;
  display: block;
  width: 40px;
  height: 40px;
  border-radius: var(--r-xs);
  image-rendering: pixelated;
  box-shadow: 0 0 0 1px var(--c-border-hover), 0 6px 14px -6px rgba(0, 0, 0, 0.7);
  background:
    linear-gradient(var(--eye), var(--eye)) 25% 60% / 12.5% 12.5% no-repeat,
    linear-gradient(var(--eye), var(--eye)) 75% 60% / 12.5% 12.5% no-repeat,
    linear-gradient(rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.18)) 50% 82% / 25% 8% no-repeat,
    linear-gradient(var(--hair), var(--hair)) 0 0 / 100% 28% no-repeat,
    var(--skin);
}

.hero-dossier__avatar[data-skin="wraith"]  { --skin: #8b93a7; --hair: #2a1d3d; --eye: #a78bfa; }
.hero-dossier__avatar[data-skin="quill"]   { --skin: #d1a37a; --hair: #1f2937; --eye: #22d3ee; }
.hero-dossier__avatar[data-skin="lantern"] { --skin: #c98f5f; --hair: #7c3a12; --eye: #f59e0b; }

.hero-dossier__who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.hero-dossier__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-base);
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-dossier__uuid {
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}

.hero-dossier__gauge-wrap {
  position: relative;
  width: 92px;
  flex: none;
}

.hero-dossier__gauge {
  width: 100%;
  height: auto;
  overflow: visible;
}

.hero-dossier__gauge-track,
.hero-dossier__gauge-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.hero-dossier__gauge-track {
  stroke: rgba(255, 255, 255, 0.08);
}

.hero-dossier__gauge-fill {
  stroke: var(--band);
  filter: drop-shadow(0 0 6px var(--band));
  transition: stroke var(--dur-slow) var(--ease-out);
}

.hero-dossier__risk {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
}

.hero-dossier__risk-unit {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-text-faint);
  margin-block-start: 2px;
}

.hero-dossier__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2) var(--sp-3);
  padding: var(--sp-3);
  background: var(--c-bg-deep);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
}

.hero-dossier__facts > div {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-2);
  min-width: 0;
}

.hero-dossier__facts dt {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--c-text-muted);
  white-space: nowrap;
}

.hero-dossier__facts dd {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--c-text);
  text-align: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#hero-dossier-band {
  color: var(--band);
}

.hero-dossier__flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ---- Bridge pane ---------------------------------------------------------- */
.hero-bridge {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.hero-bridge__feed {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--sp-2);
  height: 268px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%);
  mask-image: linear-gradient(to bottom, transparent, #000 18%);
}

@media (max-width: 959px) {
  .hero-bridge__feed { height: 300px; }
}

.hero-bridge__msg {
  --origin: var(--c-accent);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--sp-2);
  row-gap: 2px;
  padding: 0.4rem 0.55rem 0.45rem;
  border-left: 2px solid var(--origin);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: rgba(255, 255, 255, 0.025);
}

.hero-bridge__msg[data-origin="game"]    { --origin: var(--c-accent); }
.hero-bridge__msg[data-origin="discord"] { --origin: var(--c-cyan); }
.hero-bridge__msg[data-origin="web"]     { --origin: var(--c-text-muted); }
.hero-bridge__msg[data-origin="mobile"]  { --origin: var(--c-warning); }

.hero-bridge__origin {
  font-size: var(--fs-xs);
  color: var(--origin);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hero-bridge__author {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-xs);
  color: var(--c-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-bridge__role {
  font-size: 0.62rem;
  padding: 0.1em 0.45em;
}

.hero-bridge__text {
  grid-column: 1 / -1;
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--c-text-muted);
  overflow-wrap: anywhere;
}

.hero-bridge__typing {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 22px;
  margin-block-start: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--c-text-faint);
}

.hero-bridge__typing[hidden] {
  display: none;
}

.hero-bridge__typing-dots {
  display: inline-flex;
  gap: 3px;
}

.hero-bridge__typing-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-accent);
  animation: hero-typing 1.1s var(--ease-in-out) infinite;
}

.hero-bridge__typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.hero-bridge__typing-dots i:nth-child(3) { animation-delay: 0.3s; }

@keyframes hero-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30%           { transform: translateY(-3px); opacity: 1; }
}

/* ---- Trust strip ---------------------------------------------------------- */
.hero__trust {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3) var(--sp-4);
  margin-block-start: clamp(2.5rem, 5vw, 4.5rem);
  padding-block-start: var(--sp-6);
}

.hero__trust::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  height: 1px;
  background: linear-gradient(to right, transparent, var(--c-border-hover) 20%, var(--c-border-hover) 80%, transparent);
}

.hero__trust-label {
  flex: none;
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--c-text-faint);
}

.hero__trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

.hero__trust-list .chip {
  transition: border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.hero__trust-list .chip:hover {
  border-color: var(--c-border-accent);
  color: var(--c-text);
}

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .hero__voxel,
  .hero-radar__blip-dot,
  .hero-radar__blip-ring,
  .hero-bridge__typing-dots i,
  .hero-radar__event.is-new,
  .hero-bridge__msg.is-new {
    animation: none !important;
  }

  .hero-radar__blip-ring { opacity: 0.45; transform: scale(2); }
  .hero-radar__blip-dot  { opacity: 1; }
  .hero-dossier.is-switching .hero-dossier__ident,
  .hero-dossier.is-switching .hero-dossier__facts,
  .hero-dossier.is-switching .hero-dossier__flags { opacity: 1; }
}
