/*
 * Home-page hero styles (fluid | streamlines | card3d | photo) + the optional picker.
 * Everything is scoped under .hero / .hero-switch and driven by hero-scoped
 * variables (--hero-*) that default to the graphite design tokens (dark) and
 * switch on <html data-theme="dark|light">. Canvas code reads these variables
 * at draw time, so a theme switch re-colours the artwork live.
 */

:root,
html[data-theme="dark"] {
  --hero-bg: #0e1116;
  --hero-bg-2: #12171e;
  --hero-panel: #151a21;
  --hero-border: #29313c;
  --hero-fg: #e4eaf0;
  --hero-muted: #93a1b0;
  --hero-accent: #2dd4bf; /* teal */
  --hero-accent-text: #2dd4bf; /* accent safe for text (>= 4.5:1 on bg) */
  --hero-accent-fg: #0e1116; /* text on a filled accent surface */
  --hero-amber: #f5a524;
  --hero-rose: #fb7185;
  --hero-sky: #60a5fa;
  --hero-flow-alpha: 0.85;
  --hero-focus: #60a5fa;
  /* photo hero is always light-on-dark: it sits on a photograph + dim overlay */
  --hero-photo-overlay: rgba(14, 17, 22, 0.62);
  --hero-photo-fg: #f2f6fa;
}

html[data-theme="light"] {
  --hero-bg: #f4f6f8;
  --hero-bg-2: #eaeef2;
  --hero-panel: #ffffff;
  --hero-border: #d3dae2;
  --hero-fg: #17202b;
  --hero-muted: #4f5b69;
  --hero-accent: #0f9f8f;
  --hero-accent-text: #0a7a6e;
  --hero-accent-fg: #ffffff;
  --hero-amber: #c7780a;
  --hero-rose: #d9465f;
  --hero-sky: #2f7fd6;
  --hero-flow-alpha: 0.75;
  --hero-focus: #1d5fb0;
  --hero-photo-overlay: rgba(14, 17, 22, 0.58);
}

.hero-switch {
  position: relative;
}
.hero-switch [hidden],
.hero[hidden] {
  display: none !important;
}

.hero {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  color: var(--hero-fg);
  font-family: var(--font-ui, system-ui, -apple-system, "Segoe UI", sans-serif);
  isolation: isolate;
}
.hero *,
.hero *::before,
.hero *::after {
  box-sizing: border-box;
}

/* ---------- shared headline ---------- */
.hero__inner {
  position: relative;
  z-index: 2;
  max-width: 1100px;
  margin: 0 auto;
  padding: 4.5rem 1.5rem;
}
.hero__name {
  margin: 0;
  font-family: var(--font-ui, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--hero-fg);
}
.hero__dot {
  color: var(--hero-accent);
}
.hero__tagline {
  margin: 1rem 0 0;
  max-width: 34ch;
  font-size: clamp(1.15rem, 2.6vw, 1.7rem);
  line-height: 1.3;
  color: var(--hero-muted);
}
.hero__cta {
  display: inline-block;
  margin-top: 1.75rem;
  padding: 0.65rem 1.25rem;
  border: 1.5px solid var(--hero-accent);
  border-radius: 999px;
  color: var(--hero-fg);
  background: transparent;
  font-weight: 600;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.hero__cta:hover {
  background: var(--hero-accent);
  color: var(--hero-accent-fg);
}
.hero a:focus-visible,
.hero button:focus-visible,
.hero-picker button:focus-visible {
  outline: 3px solid var(--hero-focus);
  outline-offset: 3px;
}

/* ---------- 0. fluid (WebGL2 flame / CFD) ---------- */
.hero--fluid {
  min-height: 520px;
  display: flex;
  align-items: center;
  background: var(--hero-bg);
  touch-action: pan-y;
}
.hero--fluid .hero__inner {
  width: 100%;
}
.hero--fluid .hero__canvas {
  pointer-events: none;
}
.hero--fluid .hero__tagline {
  max-width: 30ch;
}

/* ---------- 1. streamlines ---------- */
.hero--streamlines {
  min-height: 440px;
  display: flex;
  align-items: center;
  background: radial-gradient(120% 140% at 80% 0%, var(--hero-bg-2) 0%, var(--hero-bg) 60%);
}
.hero--streamlines .hero__inner {
  width: 100%;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* ---------- 2. card3d ---------- */
.hero--card3d {
  background: transparent;
  overflow: visible;
}
.hero--card3d .hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 2.5rem;
  align-items: center;
  padding: 2.5rem 1.5rem;
}
.hero-card {
  position: relative;
  height: clamp(360px, 33vw, 430px);
  min-height: 360px;
  border: 1px solid var(--hero-border);
  border-radius: 20px;
  background: var(--hero-panel);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 18px 40px -18px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.hero-card__stage,
.hero-card__fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.hero-card__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-card__fallback {
  object-fit: cover;
  opacity: 0.9;
}
.hero-card__chip {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 3;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--hero-border);
  border-radius: 999px;
  background: var(--hero-bg);
  color: var(--hero-fg);
  font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, monospace);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
}
.hero-card__chip::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--hero-amber);
  vertical-align: 1px;
}

/* ---------- 3. photo ---------- */
.hero--photo {
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #0e1116;
  color: var(--hero-photo-fg);
}
.hero__img {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--hero-photo-overlay);
}
.hero--photo .hero__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__title {
  margin: 0;
  font-weight: 600;
  font-size: clamp(1.7rem, 5.2vw, 3.4rem);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-indent: 0.28em; /* balance trailing letter-spacing */
  color: var(--hero-photo-fg);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}
.hero__subtitle {
  margin: 0.9rem 0 0;
  color: #d3dbe3;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.6);
}
.hero__menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 2.4rem 0 0;
  padding: 0;
  list-style: none;
}
.hero__menu a {
  display: block;
  min-width: 8.5rem;
  padding: 0.7rem 1.4rem;
  border: 1.5px solid rgba(242, 246, 250, 0.85);
  color: var(--hero-photo-fg);
  background: rgba(14, 17, 22, 0.25);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
}
.hero__menu a:hover,
.hero__menu a[aria-current] {
  background: var(--hero-photo-fg);
  color: #0e1116;
}
.hero--photo a:focus-visible {
  outline: 3px solid #93c5fd;
}

/* ---------- picker (shown only with ?heropick=1) ---------- */
.hero-picker {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 3px 3px 10px;
  border: 1px solid var(--hero-border);
  border-radius: 999px;
  background: var(--hero-panel);
  color: var(--hero-muted);
  font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, monospace);
  font-size: 0.72rem;
  opacity: 0.92;
}
.hero-picker__label {
  margin-right: 6px;
}
.hero-picker button {
  padding: 0.25rem 0.65rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--hero-fg);
  font: inherit;
  cursor: pointer;
}
.hero-picker button[aria-pressed="true"] {
  background: var(--hero-accent);
  color: var(--hero-accent-fg);
}

/* ---------- "Try the research live" strip (home-live.liquid) ---------- */
.home-live {
  box-sizing: border-box;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  color: var(--hero-fg);
}
.home-live *,
.home-live *::before,
.home-live *::after {
  box-sizing: border-box;
}
.home-live__title {
  margin: 0 0 1.25rem;
  font-family: var(--font-ui, system-ui, -apple-system, "Segoe UI", sans-serif);
  font-size: clamp(1.4rem, 3.4vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--hero-fg);
}
.home-live__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}
.home-live__plate {
  position: relative;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hero-border);
  border-radius: 16px;
  background: var(--hero-panel);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 18px 36px -20px rgba(0, 0, 0, 0.5);
}
.home-live__plate--wide {
  grid-column: 1 / -1;
}
.home-live__stage {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.home-live__stage iframe {
  display: block;
  border: 0;
  background: transparent;
}
.home-live__stage--scaled iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 644px;
  height: 284px;
  max-width: none;
  transform: scale(var(--live-k, 1));
  transform-origin: 0 0;
}
.home-live__stage--scaled {
  height: 284px;
}
.home-live__stage--auto iframe {
  width: 100%;
  height: 520px;
}
.home-live__cap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.9rem;
  border-top: 1px solid var(--hero-border);
  color: var(--hero-muted);
  font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, monospace);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}
.home-live__cap a {
  color: var(--hero-accent-text);
  text-decoration: none;
}
.home-live__cap a:hover,
.home-live__cap a:focus-visible {
  text-decoration: underline;
}
@media (max-width: 720px) {
  .home-live {
    padding: 2rem 1rem;
  }
  .home-live__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
  }
}

/* ---------- phone ---------- */
@media (max-width: 720px) {
  .hero__inner {
    padding: 3rem 1.1rem;
  }
  .hero--streamlines {
    min-height: 380px;
  }
  .hero--fluid {
    min-height: 480px;
  }
  .hero--card3d .hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding: 2rem 1rem;
  }
  .hero-card {
    height: 320px;
    min-height: 320px;
  }
  .hero--photo {
    min-height: 420px;
  }
  .hero__title {
    letter-spacing: 0.18em;
    text-indent: 0.18em;
  }
  .hero__menu {
    gap: 0.6rem;
  }
  .hero__menu a {
    min-width: 7rem;
    padding: 0.65rem 1rem;
  }
  .hero-picker {
    top: 6px;
    right: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__cta,
  .hero__menu a {
    transition: none;
  }
}
