/* Halostorm — built from DESIGN.md. Tokens are §9. */

@font-face {
  font-family: 'Unbounded';
  src: url('fonts/unbounded-latin-wght.woff2') format('woff2');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist';
  src: url('fonts/geist-latin-wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/geist-mono-latin-wght.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Neutrals (D-001, D-018) */
  --hs-canvas: #0a0a0a;
  --hs-surface: #111214;
  --hs-surface-hover: #16181b;
  --hs-line: #292d30;
  --hs-line-strong: #3b3e45;
  --hs-text: #f0f0f0;
  --hs-text-2: #a1a4a5;
  --hs-text-3: #6e727a;

  /* Brand accent: light blue, with a paler tint and a deeper partner (D-052) */
  --hs-halo: #7cc7ff;
  --hs-halo-soft: #c2e6ff;
  --hs-sky: #3f8cff;

  /* Venture signals (D-004) — add one line here per new venture */
  --sig-storyvault: #ffca16;
  --sig-strikepoint: #ff6465;
  --sig-techtonic: #3b9eff;
  --sig-thumbforge: #fa3abf;
  --sig-planbright: #a8ff53;
  --sig-puddlejump: #ee6018;
  --sig-reelsaga: #c58aff;
  --sig-signalwind: #27f795;
  --sig-cartwave: #e888f8;
  --sig-tradewinds: #70b8ff;
  --sig-pixelforge: #ff9592;

  /* Fonts (D-002, D-018, D-031) */
  --font-display: 'Unbounded', 'Geist', ui-sans-serif, system-ui, sans-serif;
  --font-sans: 'Geist', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

  /* Shape and layout */
  --radius-card: 10px;
  --radius-tag: 4px;
  --radius-panel: 20px;
  --max-width: 1200px;
  --gutter: 24px;
  --section-gap: 96px;
  --card-padding: 24px;
  --grid-gap: 16px;

  /* Motion */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 150ms;
  --dur-base: 180ms;
}

/* ---------- Base ---------- */

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

html {
  background: var(--hs-canvas);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--hs-text-2);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

main { flex: 1; position: relative; z-index: 1; }

h1, h2, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }

::selection { background: var(--hs-halo); color: var(--hs-canvas); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.wrap {
  width: 100%;
  max-width: calc(var(--max-width) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The system voice: mono, uppercase, wide tracking (D-007) */
.label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hs-text-3);
}

/* Background field of drifting specks (D-029) */
.field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Top bar (§4, D-016) ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease);
}

.topbar.is-scrolled {
  background-color: #0a0a0af2;
  border-bottom-color: var(--hs-line);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.topbar__row {
  height: 100%;
  display: flex;
  align-items: center;
}

/* Top-bar logo (§5.5, D-038): the storm O alone at the top of the page,
   swapping to the full wordmark once the hero logo has scrolled away */
.logo {
  display: inline-grid;
  align-items: center;
  justify-items: start;
  user-select: none;
}

.logo__mark,
.logo__word {
  grid-area: 1 / 1;
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}

.logo__mark {
  width: 24px;
  height: 24px;
}

.logo__word {
  --track: 0.14em;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: var(--track);
  color: var(--hs-text);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
}

.topbar.is-past-hero .logo__mark {
  opacity: 0;
  transform: scale(0.6);
}

.topbar.is-past-hero .logo__word {
  opacity: 1;
  transform: none;
}

/* ---------- The wordmark and its glitch (§5.5, D-038, D-039) ----------
   Several identical copies of the word sit exactly on top of each other.
   At rest only the base copy shows. While the page is scrolling, the base
   is swapped for copies cut into horizontal bands that jump sideways, with
   a violet and a blue ghost offset to either side. */
.glitch {
  --cap: 0.75em;              /* Unbounded's capital height */
  display: inline-grid;
}

.glitch__layer {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: baseline;
}

.glitch__layer svg {
  display: block;
  flex: none;
  height: var(--cap);
  width: auto;
  margin-right: var(--track, 0.14em);
  overflow: visible;
}

.glitch__band,
.glitch__ghost {
  visibility: hidden;
  pointer-events: none;
}

.glitch.is-glitching .glitch__base { visibility: hidden; }
.glitch.is-glitching .glitch__band { visibility: visible; }
.glitch.is-glitching .glitch__ghost { visibility: visible; mix-blend-mode: screen; }

.glitch__ghost--a { color: var(--hs-halo); }
.glitch__ghost--b { color: var(--hs-sky); }
.glitch__ghost .grad { stroke: currentColor; }

/* ---------- Hero (§4, D-010, D-034) ---------- */

.hero {
  position: relative;
  z-index: 0;
}

/* One soft pool of colour behind the eye of the storm (D-036) */
.hero::before {
  content: "";
  position: absolute;
  inset: -64px 0 -120px;
  background:
    radial-gradient(38% 46% at 70% 46%, rgba(86, 168, 255, 0.13), transparent 70%),
    radial-gradient(30% 40% at 86% 70%, rgba(63, 140, 255, 0.09), transparent 70%);
  pointer-events: none;
}

.hero__storm {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  will-change: transform, opacity;
  /* The chart is strongest around the eye and dissolves toward the logo and the edges */
  -webkit-mask-image: radial-gradient(52% 64% at 70% 50%, #000 30%, transparent 100%);
  mask-image: radial-gradient(52% 64% at 70% 50%, #000 30%, transparent 100%);
}

/* Tucking behind the cards (D-057). The hero's box is stretched down to the
   line above the cards, without moving anything, and its contents are masked
   so they dissolve just as they reach that line. As the logo, tagline and
   storm sink toward it on scroll, they slide out of sight behind it. */
.hero {
  --tuck: 55px;                       /* from the hero's bottom edge to the line above the cards */
  padding-bottom: var(--tuck);
  margin-bottom: calc(var(--tuck) * -1);
  -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent calc(100% - 6px));
  mask-image: linear-gradient(#000 calc(100% - 56px), transparent calc(100% - 6px));
}

.hero .hero__storm { height: calc(100% - var(--tuck)); }

@media (max-width: 767px) {
  .hero { --tuck: 71px; }
}

.hero__inner {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(480px, calc(100vh - 64px - 160px), 680px);
  padding-block: 48px;
}

.hero__copy { will-change: transform, opacity; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hs-text-3);
}

.eyebrow__dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hs-halo);
}

/* The hero logotype: hairline letters around one bold storm O (D-038) */
.logotype {
  --track: 0.14em;
  display: flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: clamp(44px, 4.4vw, 60px);
  font-weight: 200;
  line-height: 1;
  letter-spacing: var(--track);
  color: var(--hs-text);
  white-space: nowrap;
}

/* The hero tagline: one line of body-lg under the logo (§4, D-048) */
.hero__tagline {
  margin-top: 28px;
  max-width: 30em;
  font-size: 18px;
  line-height: 1.5;
  color: var(--hs-text-2);
  text-wrap: balance;
}

/* ---------- Ventures ---------- */

.ventures {
  position: relative;
  z-index: 1;
  padding-top: calc(var(--section-gap) - 48px);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.section-head__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(124, 199, 255, 0.55), rgba(63, 140, 255, 0.3) 22%, var(--hs-line) 55%);
  transform-origin: left center;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
}

/* A cell is the grid slot. It carries the scroll lag; the card inside
   carries the entrance and the hover, so the three never fight. */
.cell {
  display: flex;
  min-width: 0;
  will-change: transform;
}

.cell > * { flex: 1; min-width: 0; }

/* Venture card (§5.1) */
.card {
  --sig: var(--hs-line-strong);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 48px;
  min-height: 240px;
  padding: var(--card-padding);
  background-color: var(--hs-surface);
  border: 1px solid var(--hs-line);
  border-radius: var(--radius-card);
  transition: border-color var(--dur-base) var(--ease),
              background-color var(--dur-base) var(--ease),
              transform var(--dur-base) var(--ease);
}

/* Border-only spotlight: a radial gradient masked to the 1px edge */
.card::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: -1px;
  padding: 1px;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), var(--sig), transparent 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease);
}

/* A short tab of the venture's colour on the top edge (D-036) */
.card::after {
  content: "";
  position: absolute;
  z-index: 2;
  top: -1px;
  left: var(--card-padding);
  width: 24px;
  height: 1px;
  background: var(--sig);
  opacity: 0.7;
  transition: width 400ms var(--ease), opacity var(--dur-base) var(--ease);
}

/* Background line mark (D-030, D-035) */
.card__art {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(100deg, transparent 34%, #000 78%);
  mask-image: linear-gradient(100deg, transparent 34%, #000 78%);
}

/* 200px for a 100-unit drawing: exactly 2x, so hairlines sit on whole pixels */
.card__glyph {
  position: absolute;
  right: -28px;
  bottom: -24px;
  width: 200px;
  height: 200px;
  will-change: transform;
}

.card__glyph svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: color-mix(in srgb, var(--sig) 22%, var(--hs-line-strong));
  stroke-width: 0.5;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 8;
  shape-rendering: geometricPrecision;
  transition: stroke var(--dur-base) var(--ease);
}

.card__top,
.card__body {
  position: relative;
  z-index: 1;
}

.card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.index {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--hs-text-3);
}

/* LED housing: 4px radius, 1px inset ring of the signal at 15% */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: var(--radius-tag);
  background-color: var(--hs-surface);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sig) 15%, transparent);
  transition: background-color var(--dur-base) var(--ease);
}

.status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sig);
}

.status .label { color: var(--hs-text-2); }

.card__name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: var(--hs-text);
}

.card__blurb {
  margin-top: 10px;
  min-height: calc(2 * 1.43em);
  font-size: 14px;
  line-height: 1.43;
  color: var(--hs-text-2);
  text-wrap: pretty;
}

/* Mono tag (§5.3) — renders only when a venture has a `tag` */
.tag {
  display: inline-block;
  margin-top: 16px;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--sig) 25%, transparent);
  border-radius: var(--radius-tag);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--sig) 80%, transparent);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    border-color: color-mix(in srgb, var(--sig) 40%, transparent);
    background-color: var(--hs-surface-hover);
    transform: translateY(-2px);
  }
  .card:hover::before { opacity: 1; }
  .card:hover::after { width: 56px; opacity: 1; }
  .card:hover .status { background-color: var(--hs-surface-hover); }
  .card:hover .card__glyph svg { stroke: color-mix(in srgb, var(--sig) 78%, var(--hs-line-strong)); }
}

/* Touch screens: the card nearest the middle of the screen lights up */
.card.is-active {
  border-color: color-mix(in srgb, var(--sig) 40%, transparent);
  background-color: var(--hs-surface-hover);
}
.card.is-active::after { width: 56px; opacity: 1; }
.card.is-active .status { background-color: var(--hs-surface-hover); }
.card.is-active .card__glyph svg { stroke: color-mix(in srgb, var(--sig) 78%, var(--hs-line-strong)); }

/* Placeholder card (§5.2, D-012) */
.cell--placeholder { display: none; }

.placeholder {
  min-height: 240px;
  padding: var(--card-padding);
  border: 1px dashed var(--hs-line);
  border-radius: var(--radius-card);
}

.placeholder__line {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px; /* matches the status housing so the baselines line up */
}

.cursor {
  width: 7px;
  height: 14px;
  background: var(--hs-halo);
  animation: blink 1.8s steps(1, end) infinite;
}

@media (min-width: 1024px) {
  .grid[data-fill3] .cell--placeholder { display: flex; grid-column: span var(--span3, 1); }
}

/* ---------- Footer ---------- */

.footer {
  position: relative;
  z-index: 1;
  margin-top: var(--section-gap);
  border-top: 1px solid var(--hs-line);
  background: var(--hs-canvas);
}

.footer__row {
  display: flex;
  align-items: center;
  min-height: 80px;
}

/* ---------- Motion (§6, D-029) ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@keyframes rise-card {
  from { opacity: 0; transform: translateY(28px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@keyframes draw {
  from { stroke-dasharray: 1; stroke-dashoffset: 1; }
  to   { stroke-dasharray: 1; stroke-dashoffset: 0; }
}

@keyframes rule {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

@keyframes blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0; }
}

.js .rise {
  animation: rise 600ms var(--ease) backwards;
  animation-delay: calc(var(--i, 0) * 80ms + 80ms);
}

.js .reveal { opacity: 0; }

.js .reveal.is-in {
  opacity: 1;
  animation: rise-card 700ms var(--ease) backwards;
  animation-delay: var(--d, 0ms);
}

/* Each mark draws itself in as its card arrives */
.js .reveal.is-in .card__glyph .ink :is(path, circle, ellipse, rect) {
  animation: draw 1500ms var(--ease) backwards;
  animation-delay: calc(var(--d, 0ms) + 250ms);
}

/* ---------- Card-mark movement (D-045) ----------
   Each mark has one or more moving parts, wrapped in a .mv group by
   glyphs.js. They only run on the card being hovered (or, on touch screens,
   the card nearest the middle of the screen). Everywhere else they hold
   still, so there are never eleven things moving at once. */

@keyframes mv-spin    { to { transform: rotate(360deg); } }
@keyframes mv-spin-rev { to { transform: rotate(-360deg); } }
@keyframes mv-pulse   { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes mv-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.09); } }
@keyframes mv-slip    { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@keyframes mv-bob     { 0%, 100% { transform: translateY(0); } 25% { transform: translateY(-2px); } 75% { transform: translateY(2px); } }
@keyframes mv-run     { from { transform: translateX(var(--from)); } to { transform: translateX(var(--to)); } }
@keyframes mv-flip    { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(-1); } }
@keyframes mv-blink   { 0%, 62% { opacity: 1; } 64%, 100% { opacity: 0.12; } }

.mv-spin     { animation: mv-spin 24s linear infinite; }
.mv-spin-rev { animation: mv-spin-rev 30s linear infinite; }
.mv-pulse    { animation: mv-pulse 4.5s var(--ease) infinite; }
.mv-breathe  { animation: mv-breathe 4s var(--ease) infinite; }
.mv-slip     { animation: mv-slip 9s var(--ease) infinite; }
.mv-bob      { animation: mv-bob 6s var(--ease) infinite; }
.mv-run      { animation: mv-run 9s linear infinite; }
.mv-flip     { animation: mv-flip 12s linear infinite; }
.mv-blink    { animation: mv-blink 5s linear infinite; }

.card:not(:hover):not(.is-active) .mv { animation-play-state: paused; }

.js .section-head .label { opacity: 0; transition: opacity 600ms var(--ease); }
.js .section-head .section-head__rule { transform: scaleX(0); }
.js .section-head.is-in .label { opacity: 1; }
.js .section-head.is-in .section-head__rule {
  transform: none;
  animation: rule 900ms var(--ease) backwards;
}

@media (prefers-reduced-motion: reduce) {
  .js .rise,
  .js .reveal,
  .js .reveal.is-in,
  .js .reveal.is-in .card__glyph .ink :is(path, circle, ellipse, rect),
  .js .section-head.is-in .section-head__rule { animation: none; opacity: 1; }
  .mv { animation: none; }
  .js .section-head .label { opacity: 1; transition: none; }
  .js .section-head .section-head__rule { transform: none; }
  .cursor { animation: none; }
  .card:hover { transform: none; }
  .card::before { display: none; }
  .card::after { transition: none; }
  .logo__mark,
  .logo__word { transition: none; }
}

/* ---------- Responsive (§4) ---------- */

@media (min-width: 640px) and (max-width: 1023px) {
  .grid[data-fill2] .cell--placeholder { display: flex; grid-column: span var(--span2, 1); }
}

@media (max-width: 1023px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Stacked: the logo sits above, the eye of the storm below it */
  .logotype { font-size: clamp(30px, 8.6vw, 56px); }
  .hero__inner {
    align-items: flex-start;
    min-height: 560px;
    padding-block: 48px 0;
  }
  .hero::before {
    background:
      radial-gradient(70% 36% at 50% 66%, rgba(86, 168, 255, 0.14), transparent 70%),
      radial-gradient(50% 26% at 80% 84%, rgba(63, 140, 255, 0.08), transparent 70%);
  }
  .hero__storm {
    -webkit-mask-image: radial-gradient(90% 46% at 50% 66%, #000 30%, transparent 100%);
    mask-image: radial-gradient(90% 46% at 50% 66%, #000 30%, transparent 100%);
  }
}

@media (max-width: 767px) {
  .ventures { padding-top: 64px; }
}

@media (max-width: 639px) {
  :root { --gutter: 16px; --section-gap: 64px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card__blurb { min-height: 0; } /* one column: no row to line up with */
}
