/* Helion site: paper, copper, silicon. Live die is the signature. */

:root {
  --paper: #f3f0ea;
  --ink: #141210;
  --mute: #5c574e;
  --line: #d9d3c8;
  --copper: #b85c28;
  --gold: #c9a227;
  --silicon: #1c2f26;
  --clb-a: #24382e;
  --clk: #e2b43a;
  --io: #c47a3a;
  --white: #fffcf7;
  --display: "Source Serif 4", "Times New Roman", serif;
  --body: "Public Sans", "Segoe UI", sans-serif;
  --mono: "Red Hat Mono", ui-monospace, Menlo, monospace;
  --measure: 68ch;
  --pad: clamp(1rem, 3vw, 2.4rem);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.55 var(--body);
}

::selection { background: var(--copper); color: #fff; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

a { color: var(--ink); text-underline-offset: 4px; }
a:hover { color: var(--copper); }

.skip {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -120%);
  background: var(--ink);
  color: #fff;
  padding: 0.5rem 0.8rem;
  z-index: 80;
  text-decoration: none;
}
.skip:focus { transform: translate(-50%, 0.5rem); }

.bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: calc(0.85rem + var(--safe-t)) var(--pad) 0.85rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
}

.mark {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
}
.mark img {
  height: 36px;
  width: 36px;
  display: block;
  border-radius: 4px;
  object-fit: cover;
}
.mark .word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.bar.is-open .nav-toggle span:first-child {
  transform: translateY(3.25px) rotate(45deg);
}
.bar.is-open .nav-toggle span:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

#site-nav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.15rem 1.25rem;
  justify-content: flex-end;
}
#site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--ink);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
#site-nav a:hover { text-decoration: underline; text-underline-offset: 5px; }
#site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--gold);
  text-underline-offset: 5px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 34rem);
  min-height: min(78vh, 46rem);
  background: #05070a;
  color: var(--paper);
  overflow: hidden;
}

.hero-media {
  position: relative;
  min-height: 22rem;
  background: #05070a;
}
.hero-media video,
.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 50%;
  display: block;
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.6rem, 4vw, 3.5rem) var(--pad);
  background: linear-gradient(90deg, rgba(5, 7, 10, 0.08), rgba(5, 7, 10, 0.55) 18%, #05070a);
}

.hero h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.05rem, 4.2vw, 3.35rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 1rem;
  color: #f6f1e8;
  max-width: 22ch;
}

.lede { color: var(--mute); font-size: 1.12rem; max-width: 38rem; margin: 0 0 1.5rem; }

.hero .lede {
  color: color-mix(in srgb, var(--paper) 84%, #9aa0a8);
  max-width: 34rem;
}
.hero .lede code { color: #fff; }
.hero .btn.ghost {
  color: var(--paper);
  border-color: color-mix(in srgb, var(--paper) 70%, transparent);
}
.hero .btn.ghost:hover {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.cta { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--ink);
  color: var(--white);
  text-decoration: none;
  font-weight: 550;
  padding: 0.8rem 1.25rem;
  min-height: 44px;
  font-size: 1rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  line-height: 1;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.btn:hover {
  background: var(--copper);
  border-color: var(--copper);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}
.btn.ghost:hover { background: var(--ink); color: var(--white); }

.device {
  display: flex;
  flex-direction: column;
  background: #0c1210;
  color: #ebe6d4;
  border: 1px solid #243028;
  min-height: 32rem;
  box-shadow: 0 24px 60px rgba(20, 18, 16, 0.18);
}
.device-bar, .device-read, .device-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.device-bar {
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid #243028;
  color: var(--clk);
}
.device-bar .mute { color: #8b958c; }
.device-stage { padding: 0.65rem 0.7rem 0.25rem; flex: 1; display: flex; }
#die {
  width: 100%;
  height: auto;
  flex: 1;
  display: block;
  aspect-ratio: 35 / 34;
  cursor: crosshair;
}
#die rect[data-k] { pointer-events: none; }
.device-legend { padding: 0.2rem 0.85rem 0.45rem; color: #8b958c; }
.device-legend i {
  display: inline-block; width: 0.7rem; height: 0.7rem; margin-right: 0.35rem; vertical-align: -1px;
}
.sw-io { background: var(--io); }
.sw-clk { background: var(--clk); }
.sw-clb { background: var(--clb-a); box-shadow: inset 0 0 0 1px #3d8f6a; }
.device-read {
  padding: 0.55rem 0.85rem 0.65rem;
  border-top: 1px solid #243028;
  color: #b7b09a;
  min-height: 2.4em;
}
.gold { color: var(--clk); }

.die-film {
  background: #05070a;
  border-block: 1px solid var(--line);
}
.die-film video,
.die-film img {
  display: block;
  width: min(100%, 72rem);
  height: auto;
  margin: 0 auto;
  background: #05070a;
}

.page { max-width: 88rem; margin: 0 auto; padding: 2.4rem var(--pad) 4.5rem; }
.page.narrow, .prose-wrap { max-width: 46rem; }

.section { margin: 4.5rem 0 0; }
.section h2, .prose h2, .split h2 {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 600;
  margin: 0 0 0.8rem;
  letter-spacing: -0.02em;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-top: 1.6rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  min-height: 14rem;
  overflow: hidden;
  border-radius: 12px;
  transition: transform 0.25s, box-shadow 0.25s;
}
@media (hover: hover) {
  .card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(20,18,16,0.1); color: inherit; }
  .card:hover .card-visual span { opacity: 1; }
}
.card-visual {
  height: 7.5rem;
  background: #0c1210;
  position: relative;
}
.card-visual span {
  position: absolute;
  right: 0.7rem;
  bottom: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  opacity: 0.85;
}
.card-body { padding: 0.9rem 1rem 1.1rem; }
.card-body strong { display: block; font-family: var(--display); font-size: 1.15rem; margin-bottom: 0.3rem; }
.card-body p { margin: 0; color: var(--mute); font-size: 0.92rem; }

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.6rem;
  border-top: 1px solid var(--line);
  padding-top: 1.6rem;
}
.facts strong {
  display: block;
  font-family: var(--display);
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}
.facts span { color: var(--mute); font-size: 0.92rem; }

.band {
  background: var(--gold);
  color: var(--ink);
  padding: 3rem var(--pad);
  margin-top: 4.5rem;
}
.band-inner { max-width: 88rem; margin: 0 auto; }
.band h2 { margin-top: 0; }
.band .cta { margin-top: 1.2rem; }
.band .btn { background: var(--ink); color: #fff; border-color: var(--ink); }

.giant {
  font-family: var(--display);
  font-size: clamp(2.8rem, 8vw, 6.5rem);
  line-height: 0.92;
  font-weight: 600;
  margin: 3rem 0;
}
.giant em { font-style: italic; color: var(--copper); }

footer, footer.site {
  border-top: 1px solid var(--line);
  padding: 1.4rem var(--pad) calc(2rem + var(--safe-b));
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  justify-content: space-between;
  color: var(--mute);
  font-size: 0.9rem;
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.anim-toggle {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 3;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: color-mix(in srgb, var(--silicon) 82%, transparent);
  color: #fff;
  cursor: pointer;
  font: 700 0.7rem/1 var(--mono);
}
.anim-toggle:hover { background: var(--ink); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem 2.5rem;
  margin: 0 0 2rem;
}
.split h2 { margin-top: 0; }

.toc {
  margin: 0 0 1.6rem;
  padding: 0;
  list-style: none;
  columns: 2;
  gap: 1.5rem;
}
.toc li { margin: 0.2rem 0; break-inside: avoid; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.prose h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 3.4vw, 2.8rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.8rem;
}
.prose h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 600;
  margin: 1.6rem 0 0.4rem;
}
.prose .lede { color: var(--ink); }

.wide-table { max-width: 72rem; }

@media (max-width: 720px) {
  .split, .toc { grid-template-columns: 1fr; columns: 1; }
}

.prose { max-width: var(--measure); }
.prose p, .prose li { color: var(--mute); }
.prose p { margin: 0 0 1rem; }
.prose ul, .prose ol { padding-left: 1.2rem; }
.prose li { margin: 0.35rem 0; }
.prose h2 { margin-top: 2.2rem; }
.prose table, .table-wrap table { border-collapse: collapse; width: 100%; }
.prose th, .prose td, .table-wrap th, .table-wrap td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.5rem 0.45rem 0;
  vertical-align: top;
}
.prose code, code { font-family: var(--mono); font-size: 0.9em; }
pre {
  background: #0c1210;
  color: #d7e0d4;
  border: 1px solid #243028;
  padding: 1rem 1.05rem;
  overflow: auto;
  font: 0.8rem/1.5 var(--mono);
  -webkit-overflow-scrolling: touch;
}

.had { margin: 1.2rem 0 1.6rem; max-width: 28rem; }
.had svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); }
.had figcaption { font-family: var(--mono); font-size: 0.78rem; color: var(--mute); margin-top: 0.5rem; }
.fence { border: 1px solid var(--copper); padding: 1rem 1.1rem; color: var(--mute); }
.steps { counter-reset: step; list-style: none; padding: 0; }
.steps > li {
  position: relative;
  padding: 0 0 1.4rem 3rem;
  border-left: 1px solid var(--line);
  margin-left: 0.7rem;
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -0.75rem; top: 0;
  width: 1.5rem; height: 1.5rem;
  background: var(--ink); color: #fff;
  font-family: var(--mono); font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px;
}

.pipeline { display: flex; flex-wrap: wrap; gap: 0.4rem; font-family: var(--mono); font-size: 0.82rem; }
.pipeline span { background: var(--white); border: 1px solid var(--line); padding: 0.35rem 0.55rem; }
.pipeline i { font-style: normal; color: var(--copper); padding: 0.35rem 0.1rem; }
.need { display: grid; grid-template-columns: 8.5rem 1fr; gap: 0.35rem 1.1rem; border-top: 1px solid var(--line); padding: 0.85rem 0; }
.need dt { font-family: var(--mono); font-size: 0.78rem; color: var(--copper); }
.need dd { margin: 0; color: var(--mute); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 0 1rem; }

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

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .bar { flex-wrap: wrap; }
  #site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.25rem 0 0.5rem;
  }
  .bar.is-open #site-nav { display: flex; }
  #site-nav a {
    padding: 0.65rem 0.15rem;
    border-bottom: 1px solid var(--line);
  }
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hero-media {
    min-height: 42vw;
    aspect-ratio: 16 / 10;
  }
  .hero-copy {
    background: #05070a;
    padding: 1.5rem var(--pad) 2rem;
  }
  .hero h1 { max-width: none; font-size: clamp(2rem, 9vw, 2.8rem); }
  .device { min-height: 22rem; }
}

@media (max-width: 640px) {
  html, body { font-size: 16px; }
  .cards, .facts, .need { grid-template-columns: 1fr; }
  .card { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  video { animation: none; }
}
