/* hero.css: three-layer hero + terminal window */

/* ---------- layers ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-block: calc(var(--space-16) + env(safe-area-inset-top, 0px)) var(--space-16);
}

#rain {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.22;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 45%,
      rgba(10, 15, 22, 0) 0%,
      rgba(10, 15, 22, 0.75) 70%,
      var(--color-canvas) 100%),
    radial-gradient(ellipse at center,
      transparent 60%,
      rgba(0, 0, 0, 0.55) 100%);
}

/* v2: faint two-axis chart ruling instead of CRT scanlines.
   Reads as a market-chart canvas behind the telemetry streams. */
.hero-scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(
      to bottom,
      rgba(97, 168, 255, 0.045) 0 1px,
      transparent 1px 64px
    ),
    repeating-linear-gradient(
      to right,
      rgba(97, 168, 255, 0.03) 0 1px,
      transparent 1px 64px
    );
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  /* terminal column widened from 42fr so the boot lines fit without wrapping */
  grid-template-columns: 52fr 48fr;
  gap: var(--space-fluid-lg);
  align-items: center;
}

/* ---------- hero copy ---------- */

.hero-kicker {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--color-text-3);
  margin: 0;
}

.hero-kicker::before {
  content: '~ ';
}

.hero-title {
  font-family: var(--font-sans);
  font-size: var(--step-5);
  font-weight: 640;
  line-height: 1.02;
  letter-spacing: -0.022em;
  text-wrap: balance;
  color: var(--color-text-hi);
  margin: var(--space-3) 0 0;
  font-variation-settings: 'wght' 640;
}

.hero-title-accent {
  color: var(--color-accent);
}

@supports (syntax: "<number>") {
  @property --wght {
    syntax: "<number>";
    inherits: false;
    initial-value: 640;
  }

  @keyframes hero-title-settle {
    from {
      --wght: 180;
      opacity: 0.35;
    }
    to {
      --wght: 640;
      opacity: 1;
    }
  }

  .hero-title {
    font-variation-settings: 'wght' var(--wght, 640);
    animation: hero-title-settle 900ms var(--ease-out) both;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title {
    animation: none;
    opacity: 1;
    --wght: 640;
    font-variation-settings: 'wght' 640;
  }
}

.hero-sub {
  font-size: var(--step-1);
  color: var(--color-text-2);
  max-width: 52ch;
  margin-block: var(--space-4) var(--space-6);
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  min-height: 48px;
  padding: 14px 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--dur-state) var(--ease-spring),
    box-shadow var(--dur-state) var(--ease-out),
    background-color var(--dur-state) var(--ease-out),
    border-color var(--dur-state) var(--ease-out),
    color var(--dur-state) var(--ease-out);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-primary {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: 640;
}

.btn-primary:hover {
  background-color: var(--color-accent-bright);
  color: var(--color-on-accent);
  box-shadow:
    0 0 0 1px rgba(97, 168, 255, 0.4),
    0 0 24px rgba(97, 168, 255, 0.18);
}

.btn-ghost {
  background-color: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.btn-ghost::before {
  content: '$\00a0';
  color: var(--color-text-3);
}

.btn-ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-bright);
  text-decoration: none;
}

/* ---------- proof chips ---------- */

.hero-proof {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  list-style: none;
  margin: var(--space-8) 0 0;
  padding: 0;
}

.hero-proof li {
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--color-text-2);
  border: 1px solid var(--color-border-2);
  border-radius: 4px;
  padding: 6px 12px;
  background-color: color-mix(in srgb, var(--color-surface-1) 70%, transparent);
}

.hero-proof li::before {
  content: '✓ ';
  color: var(--color-ok);
}

/* ---------- terminal window ---------- */

.term-window {
  background-color: color-mix(in srgb, var(--color-surface-2) 88%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

@supports not (backdrop-filter: blur(10px)) {
  .term-window {
    background-color: var(--color-surface-2);
  }
}

@supports (backdrop-filter: blur(10px)) {
  .term-window {
    backdrop-filter: blur(10px);
  }
}

.term-titlebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background-color: var(--color-surface-3);
  border-bottom: 1px solid var(--color-border-2);
}

.term-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: none;
  opacity: 0.6;
}

.dot-r { background-color: #FF5F57; }
.dot-y { background-color: #FEBC2E; }
.dot-g { background-color: #28C840; }

.term-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: var(--step--2);
  color: var(--color-text-3);
}

.term-body {
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  line-height: 1.7;
  min-height: 280px;
  max-height: 420px;
  overflow-y: auto;
}

.term-log p {
  margin: 0;
}

.t-prompt { color: var(--color-accent); }
.t-cmd    { color: var(--color-text-hi); }
.t-out    { color: var(--color-text-2); }
.t-ok     { color: var(--color-ok); }
.t-dim    { color: var(--color-text-3); }
.t-info   { color: var(--color-info); }
.t-err    { color: var(--color-err); }

.term-caret {
  display: inline-block;
  color: var(--color-accent);
  animation: term-blink 1.06s step-end infinite;
}

@keyframes term-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .term-caret {
    animation: none;
    opacity: 1;
  }
}

.term-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.term-input-row:focus-within {
  outline: 2px solid var(--color-focus-ring);
  outline-offset: 2px;
}

.term-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--color-text-hi);
  caret-color: var(--color-accent);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-copy {
    order: -1;
  }

  .hero-title {
    font-size: var(--step-4);
  }

  .term-body {
    min-height: 220px;
  }

  /* grow the button's own box past the 44px tap bar without moving the h1 line box */
  .hero-title .slot {
    padding-block: 5px;
    margin-block: -5px;
  }
}

/* ---------- mobile pass (phones only, never at 901px or wider) ---------- */

/* B1 + B2: phone hero density and full width stacked CTAs */
@media (max-width: 640px) {
  .hero {
    padding-block: calc(2.5rem + env(safe-area-inset-top, 0px)) 2.5rem;
  }

  .hero-inner {
    gap: var(--space-6);
  }

  .hero-sub {
    font-size: var(--step-0);
    max-width: none;
    margin-block: var(--space-3) 1.25rem;
  }

  .hero-proof {
    margin-top: 1.25rem;
  }

  .hero-cta-row {
    gap: var(--space-3);
  }

  .hero-cta-row .btn {
    width: 100%;
  }
}

/* B3: extra relief on tiny phones */
@media (max-width: 360px) {
  .hero {
    padding-block: calc(2rem + env(safe-area-inset-top, 0px)) 2rem;
  }

  .btn {
    padding-inline: 18px;
  }
}

/* B4: landscape phones, short viewports */
@media (max-width: 900px) and (max-height: 520px) {
  .hero {
    min-height: auto;
    padding-block: calc(2rem + env(safe-area-inset-top, 0px)) 2rem;
  }
}

/* ---------- headline slot: the last word is a control ---------- */

.slot {
  display: inline-grid;
  grid-template-areas: 'w';
  align-items: baseline;
  justify-items: start;
  vertical-align: baseline;
  font: inherit;
  font-variation-settings: inherit;
  font-feature-settings: inherit;
  letter-spacing: inherit;
  line-height: inherit;
  color: var(--color-accent);
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.slot > span { grid-area: w; }

/* one hidden copy of the widest word reserves the width, so the headline never re-wraps
   and nothing extra lands in the h1's text content */
.slot::after {
  content: 'model.';
  grid-area: w;
  visibility: hidden;
  pointer-events: none;
  padding-inline-end: 0.6em;
}

.slot-word {
  color: var(--color-accent);
  text-decoration-line: underline;
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.08em;
  text-decoration-color: color-mix(in srgb, var(--color-accent) 55%, transparent);
  transition:
    color var(--dur-state) var(--ease-standard),
    text-decoration-color var(--dur-state) var(--ease-standard);
}

.slot:hover .slot-word,
.slot:focus-visible .slot-word {
  color: var(--color-accent-bright);
  text-decoration-color: var(--color-accent-bright);
  text-decoration-thickness: 0.07em;
}

/* the ring hugs the word, not the reserved width of the widest word */
.slot:focus-visible { outline: none; }

.slot:focus-visible .slot-word {
  outline: 3px solid var(--color-focus-ring);
  outline-offset: 0;
  border-radius: 2px;
}

/* the typing caret: a box, not a glyph, so it needs no font support */
.slot-word::after {
  content: '';
  display: none;
  width: 0.5em;
  height: 0.8em;
  margin-inline-start: 0.08em;
  vertical-align: -0.04em;
  background: var(--color-accent);
}

.slot[data-typing] .slot-word::after { display: inline-block; }
.slot[data-typing="hold"] .slot-word::after { animation: blink 1.06s step-end infinite; }

/* ---------- terminal affordance: you can type here ---------- */

.term-body { cursor: text; }

.term-input-wrap {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}

.term-idle-caret {
  display: none;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-accent);
  pointer-events: none;
  animation: term-blink 1.06s step-end infinite;
}

.term-input-row[data-idle] .term-idle-caret { display: inline-block; }

/* one pulse of the input row's top edge when the prompt unlocks */
.term-input-row.is-ready { animation: term-ready 1.8s var(--ease-out) 1; }

@keyframes term-ready {
  0%   { border-top-color: var(--color-accent); box-shadow: 0 -6px 18px -8px rgba(97, 168, 255, 0.55); }
  100% { border-top-color: var(--color-border); box-shadow: none; }
}

/* the "type help" line becomes a pill that glows twice, then rests */
.term-log p.t-hint-line { margin-top: 6px; margin-bottom: 10px; }

.t-hint {
  display: inline-block;
  padding: 1px 10px 1px 8px;
  border: 1px solid var(--color-accent-dim);
  border-radius: 4px;
  background: var(--color-accent-tint);
  color: var(--color-accent);
  animation: hint-pulse 2.4s var(--ease-out) 2;
}

.t-hint-arrow { margin-inline-end: 6px; }

.t-kbd {
  font: inherit;
  padding: 0 5px;
  border: 1px solid var(--color-border-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--color-surface-3);
  color: var(--color-text-hi);
}

@keyframes hint-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(97, 168, 255, 0); }
  40%      { box-shadow: 0 0 0 4px rgba(97, 168, 255, 0.18), 0 0 18px rgba(97, 168, 255, 0.28); }
}
