/*
 * Home page hero for Computer Modules. Loaded after site.css on the home page only.
 * Owns: the dark hero band, the inline HGX node illustration, the glass selector panel
 * and the one orchestrated load sequence. Everything animates from a single .is-ready
 * class that hero.js adds once the headline has been split into its rendered lines;
 * reduced motion shows the final state.
 *
 * Sequence (ms from is-ready; --hero-t scales it on small screens):
 *   chassis .35 to 1    0 to 520      sub          700 to 1220
 *   lid lift           60 to 700      actions      820 to 1340
 *   headline lines    150 / 270 / 390 / 510, each 700 long
 *   GPU lights        500 + 90 per module, 320 long (last ends 1450)
 *   light spill       500 to 1450 (part of the same light)
 *   port lights      1000 + 55 per port, 260 long (last ends 1645)
 *   selector         1250 to 1870 (the touch fact list fades in with it)
 *   breathe          from 1900, 6 s, forever
 */

.hero {
  --hero-ink: #0B1021;
  --hero-glow: #7CE0FF;
  --hero-text: #ffffff;
  --hero-muted: rgba(255, 255, 255, 0.74);
  --hero-line: rgba(255, 255, 255, 0.14);
  --hero-t: 1; /* timing multiplier, shortened on small screens */
  --hero-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  min-height: clamp(640px, calc(100vh - 112px), 860px);
  padding: 44px 0 40px;
  margin: 0;
  background: var(--hero-ink);
  color: var(--hero-text);
  overflow: hidden;
}
/* the glow sits behind the node, not across the band */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(32% 44% at 74% 46%, rgba(124, 224, 255, 0.18), rgba(124, 224, 255, 0) 100%),
    radial-gradient(22% 30% at 74% 54%, rgba(124, 224, 255, 0.07), rgba(124, 224, 255, 0) 100%);
}

.hero .hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 13fr) minmax(0, 11fr);
  grid-template-rows: auto auto;
  column-gap: 48px;
  row-gap: 40px;
  align-items: center;
  width: 100%;
}
.hero .hero-copy { grid-column: 1; grid-row: 1; min-width: 0; container-type: inline-size; }
.hero .hero-visual { grid-column: 2; grid-row: 1; position: relative; min-width: 0; }
.hero .hero-selector { grid-column: 1 / -1; grid-row: 2; }
/* above 1800 px the band lets its one object grow: 1400 wrap, 620 px node, headline unchanged */
@media (min-width: 1801px) {
  .hero .wrap { max-width: 1400px; }
  .hero .hero-grid { grid-template-columns: minmax(0, 1fr) 620px; column-gap: 64px; }
}

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

/* The three lines are "Blackwell servers, / built and burned in. / San Diego, since 1978." The
   longest is 10.1 em wide, so beside the node the size follows the copy column (9.7 cqw keeps
   it inside with 2 percent to spare) and caps at 3.8rem; 68 px would need a 690 px column. */
.hero h1 {
  font-size: clamp(2.5rem, 9.7cqw, 3.8rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  color: var(--hero-text);
  margin: 0 0 24px;
  max-width: none;
  text-wrap: balance;
}
/* hidden until hero.js has wrapped each rendered line (no flash of unsplit text) */
.hero h1:not(.is-split) { visibility: hidden; }
.hero .hero-line { display: block; clip-path: inset(0 0 100% 0); }
.hero .hero-line-in { display: block; transform: translateY(105%); }

.hero .hero-sub {
  font-size: 1.125rem;
  line-height: 1.5;
  color: var(--hero-muted);
  max-width: 54ch;
  margin: 0 0 28px;
  opacity: 0;
  transform: translateY(8px);
}
.hero .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  opacity: 0;
  transform: translateY(8px);
}
.hero .hero-actions .btn { min-height: 46px; padding: 10px 20px; border-radius: 8px; font-weight: 700; }
.hero .hero-actions .btn-primary { background: #fff; color: var(--hero-ink); border-color: #fff; }
.hero .hero-actions .btn-primary:hover { background: #e4ecf5; border-color: #e4ecf5; color: var(--hero-ink); }
.hero .hero-actions .btn-secondary { background: transparent; color: var(--hero-text); border-color: rgba(255, 255, 255, 0.4); }
.hero .hero-actions .btn-secondary:hover { background: rgba(255, 255, 255, 0.07); border-color: #fff; color: var(--hero-text); }
.hero a:focus-visible, .hero button:focus-visible, .hero select:focus-visible { outline: 2px solid var(--hero-glow); outline-offset: 3px; }

/* ---------- illustration ---------- */

.hero .hero-node { display: block; width: 100%; height: auto; aspect-ratio: 491 / 540; overflow: visible; } /* matches the viewBox gen-hero.js writes */
.hero .hn-chassis { opacity: 0.35; }
.hero .hn-lid { opacity: 0; transform: translateY(18px); }
.hero .hn-lights > use, .hero .hn-ports > use, .hero .hn-spill { opacity: 0; }
.hero .hn-lights, .hero .hn-ports, .hero .hn-lid, .hero .hn-spill { pointer-events: none; }

/* hotspots: hover or focus brightens the group and dims the other three. The pointer target is
   the hull (the group's first child, one transparent path over the whole face); the drawn parts
   take no pointer events, so a sweep across the fan wall never drops between two fans. */
.hero .hn-hs { cursor: default; outline: none; transition: opacity 160ms ease, filter 160ms ease; }
.hero .hn-hull { fill: transparent; stroke: none; pointer-events: all; }
.hero .hn-hs > :not(.hn-hull) { pointer-events: none; }
.hero .hn-hs:focus-visible { outline: 2px solid var(--hero-glow); outline-offset: 8px; border-radius: 4px; }
.hero .hero-node[data-active] .hn-hs { opacity: 0.7; }
.hero .hero-node[data-active] .hn-hs.is-active { opacity: 1; filter: brightness(1.3); }
.hero .hn-lights { transition: filter 160ms ease; }
.hero .hero-node[data-active="gpus"] .hn-lights { filter: brightness(1.3); }

.hero .hero-label {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 8px 12px 9px;
  border-radius: 8px;
  background: rgba(11, 16, 33, 0.94);
  border: 1px solid rgba(124, 224, 255, 0.4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  color: var(--hero-text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) translateY(-12px);
  transition: opacity 140ms ease;
}
.hero .hero-label.is-shown { opacity: 1; }
.hero .hero-label-name { display: block; font-size: 0.9375rem; font-weight: 500; letter-spacing: 0.01em; color: var(--hero-glow); }

/* the four facts as a caption list: a grid row of its own, only on devices that cannot hover (see below) */
.hero .hero-facts { display: none; }

/* ---------- glass selector panel ---------- */

.hero .hero-selector {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr)) auto;
  gap: 16px;
  align-items: end;
  margin: 0;
  padding: 18px 20px 20px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--hero-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 30px 60px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(16px);
}
.hero .hero-selector h2 {
  align-self: center;
  margin: 0 8px 0 0;
  padding-top: 22px;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--hero-text);
  white-space: nowrap;
}
.hero .hero-field { display: grid; gap: 6px; min-width: 0; }
.hero .hero-field label { font-size: 0.9375rem; font-weight: 500; color: var(--hero-muted); }
.hero .hero-field select {
  width: 100%;
  min-width: 0;
  height: 46px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background-color: rgba(11, 16, 33, 0.62);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%23ffffff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  color: var(--hero-text);
  color-scheme: dark;
  padding: 0 36px 0 12px;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.hero .hero-field select:hover { border-color: rgba(255, 255, 255, 0.4); }
.hero .hero-selector .btn-primary {
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 8px;
  background: #fff;
  color: var(--hero-ink);
  border-color: #fff;
  font-weight: 700;
  white-space: nowrap;
}
.hero .hero-selector .btn-primary:hover { background: #e4ecf5; border-color: #e4ecf5; color: var(--hero-ink); }

/* ---------- the load sequence ---------- */

.hero.is-ready .hn-chassis { animation: hero-solid 520ms ease-out forwards; }
.hero.is-ready .hn-lid { animation: hero-lift 640ms var(--hero-ease) calc(60ms * var(--hero-t)) forwards; }
.hero.is-ready .hero-line { animation: hero-clip 700ms var(--hero-ease) forwards; }
.hero.is-ready .hero-line-in { animation: hero-rise 700ms var(--hero-ease) forwards; }
.hero.is-ready .hero-line:nth-child(1), .hero.is-ready .hero-line:nth-child(1) .hero-line-in { animation-delay: calc(150ms * var(--hero-t)); }
.hero.is-ready .hero-line:nth-child(2), .hero.is-ready .hero-line:nth-child(2) .hero-line-in { animation-delay: calc(270ms * var(--hero-t)); }
.hero.is-ready .hero-line:nth-child(3), .hero.is-ready .hero-line:nth-child(3) .hero-line-in { animation-delay: calc(390ms * var(--hero-t)); }
.hero.is-ready .hero-line:nth-child(4), .hero.is-ready .hero-line:nth-child(4) .hero-line-in { animation-delay: calc(510ms * var(--hero-t)); }
.hero.is-ready .hero-line:nth-child(n+5), .hero.is-ready .hero-line:nth-child(n+5) .hero-line-in { animation-delay: calc(630ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use { animation: hero-fade 320ms ease-out forwards; }
.hero.is-ready .hn-lights > use:nth-child(1) { animation-delay: calc(500ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(2) { animation-delay: calc(590ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(3) { animation-delay: calc(680ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(4) { animation-delay: calc(770ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(5) { animation-delay: calc(860ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(6) { animation-delay: calc(950ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(7) { animation-delay: calc(1040ms * var(--hero-t)); }
.hero.is-ready .hn-lights > use:nth-child(8) { animation-delay: calc(1130ms * var(--hero-t)); }
/* the spill is the same light reaching the floor, walls and lid: it rises with the modules */
.hero.is-ready .hn-spill { animation: hero-fade 950ms ease-out calc(500ms * var(--hero-t)) forwards, hero-breathe 6s ease-in-out calc(1900ms * var(--hero-t)) infinite; }
.hero.is-ready .hero-sub { animation: hero-settle 520ms var(--hero-ease) calc(700ms * var(--hero-t)) forwards; }
.hero.is-ready .hero-actions { animation: hero-settle 520ms var(--hero-ease) calc(820ms * var(--hero-t)) forwards; }
.hero.is-ready .hn-ports > use { animation: hero-blink 260ms linear forwards; }
.hero.is-ready .hn-ports > use:nth-child(1) { animation-delay: calc(1000ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(2) { animation-delay: calc(1055ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(3) { animation-delay: calc(1110ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(4) { animation-delay: calc(1165ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(5) { animation-delay: calc(1220ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(6) { animation-delay: calc(1275ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(7) { animation-delay: calc(1330ms * var(--hero-t)); }
.hero.is-ready .hn-ports > use:nth-child(8) { animation-delay: calc(1385ms * var(--hero-t)); }
.hero.is-ready .hero-selector { animation: hero-settle 620ms var(--hero-ease) calc(1250ms * var(--hero-t)) forwards; }
/* after the sequence: a slow breath on the GPU light, nothing else moves */
.hero.is-ready .hn-lights { animation: hero-breathe 6s ease-in-out calc(1900ms * var(--hero-t)) infinite; }

@keyframes hero-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes hero-solid { from { opacity: 0.35; } to { opacity: 1; } }
@keyframes hero-lift { from { opacity: 0; transform: translateY(18px); } 40% { opacity: 1; } to { opacity: 1; transform: translateY(0); } }
@keyframes hero-blink { 0% { opacity: 0; } 30% { opacity: 1; } 50% { opacity: 0.25; } 70% { opacity: 1; } 100% { opacity: 1; } }
@keyframes hero-clip { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(-0.2em 0 -0.25em 0); } }
@keyframes hero-rise { from { transform: translateY(105%); } to { transform: translateY(0); } }
@keyframes hero-settle { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes hero-breathe { 0% { opacity: 1; } 50% { opacity: 0.85; } 100% { opacity: 1; } }

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

@media (max-width: 1100px) {
  .hero .hero-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero .hero-selector h2 { grid-column: 1 / -1; padding-top: 0; margin: 0 0 2px; }
  .hero .hero-selector .btn-primary { grid-column: 1 / -1; justify-self: start; }
}
/* one column, placed by order: the node, the claim, the fact list (touch only), the selector.
   Auto placement means a hidden fact list leaves no empty track and no stray gap. */
@media (max-width: 900px) {
  .hero { --hero-t: 0.8; min-height: 0; padding: 28px 0 32px; }
  .hero::before { background: radial-gradient(44% 34% at 50% 24%, rgba(124, 224, 255, 0.16), rgba(124, 224, 255, 0) 100%); }
  .hero .hero-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; row-gap: 24px; }
  .hero .hero-visual, .hero .hero-copy, .hero .hero-facts, .hero .hero-selector { grid-column: 1; grid-row: auto; }
  /* one column: the headline follows the viewport, 2.5rem on phones so "Blackwell servers," holds one line at 390 */
  .hero h1 { font-size: clamp(2.5rem, 1.2rem + 3.6vw, 3.8rem); }
  .hero .hero-visual { order: 1; width: 56%; margin: -8px auto 8px; }
  .hero .hero-copy { order: 2; }
  .hero .hero-facts { order: 3; }
  .hero .hero-selector { order: 4; }
}
@media (max-width: 600px) {
  .hero .hero-selector { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .hero .hero-selector .btn-primary { justify-self: stretch; }
  .hero .hero-visual { width: 64%; }
  .hero .hero-sub { margin-bottom: 24px; }
  .hero .hero-actions .btn { flex: 1 1 auto; }
}

/* touch devices: no floating label; the four facts are a 2 x 2 caption list that arrives with the selector */
@media (hover: none) {
  .hero .hero-label { display: none; }
  .hero .hero-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9375rem;
    line-height: 1.35;
    color: var(--hero-muted);
    opacity: 0;
    transform: translateY(12px);
  }
  .hero .hero-facts b { display: block; font-weight: 600; color: var(--hero-text); }
  .hero.is-ready .hero-facts { animation: hero-settle 620ms var(--hero-ease) calc(1250ms * var(--hero-t)) forwards; }
  .hero .hero-node[data-active] .hn-hs { opacity: 1; filter: none; }
  .hero .hero-node[data-active="gpus"] .hn-lights { filter: none; }
}
/* two columns on a wide touch screen: the list sits under the node in its own column */
@media (hover: none) and (min-width: 901px) {
  .hero .hero-grid { grid-template-rows: auto auto auto; }
  .hero .hero-facts { grid-column: 2; grid-row: 2; margin-top: -16px; }
  .hero .hero-selector { grid-row: 3; }
}

/* ---------- reduced motion: the final state, immediately ---------- */

@media (prefers-reduced-motion: reduce) {
  .hero h1:not(.is-split) { visibility: visible; }
  .hero .hero-line { clip-path: none; }
  .hero .hero-line-in { transform: none; }
  .hero .hn-chassis, .hero .hn-lid, .hero .hn-lights > use, .hero .hn-ports > use, .hero .hn-spill,
  .hero .hero-sub, .hero .hero-actions, .hero .hero-facts, .hero .hero-selector { opacity: 1; transform: none; animation: none; }
  .hero.is-ready .hn-lights, .hero.is-ready .hn-spill { animation: none; }
  .hero .hero-label, .hero .hn-hs, .hero .hn-lights { transition: none; }
}
