/* ==========================================================================
   Entangled Logic — site styles
   Layout: full-bleed hero art with the copy set in its dark left field;
   content sections sit on the facility's dark floor, left-aligned, max 1160px.
   Color story comes from the key art: cyan qubit streams in, orange beams out.
   ========================================================================== */

:root {
  /* Color */
  --ink: #030b19;          /* facility dark, sampled from the hero art */
  --ink-raised: #071328;   /* alternate section ground */
  --panel: #0d192d;        /* in-game HUD panel */
  --line: #22334f;         /* panel edges and rules */
  --text: #e1e9f4;
  --muted: #98a9c1;
  --cyan: #46d3df;         /* HUD teal, incoming qubit streams */
  --orange: #ff8a2a;       /* outgoing beams */
  --orange-hi: #ffa857;
  --on-orange: #1d0c00;

  /* Type */
  --font-display: "Chakra Petch", "Bahnschrift", "Segoe UI", system-ui, sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.125rem;
  --step-1: 1.375rem;
  --step-2: clamp(1.5rem, 2.6vw, 2rem);
  --step-3: clamp(2.1rem, 4.6vw, 3.4rem);
  --step-4: clamp(3.1rem, 8.4vw, 6.9rem);

  /* Space */
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1160px;
  --nav-h: 68px;
  --section-pad: clamp(72px, 10vw, 136px);
  --cut: 12px;

  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img,
svg,
canvas { display: block; max-width: 100%; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.08;
  text-wrap: balance;
}

h2 { font-size: var(--step-3); letter-spacing: -0.01em; }
h3 { font-size: var(--step-1); }

p { margin: 0; }

a { color: var(--cyan); text-underline-offset: 0.18em; }
a:hover { color: var(--text); }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--cyan);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* --------------------------------------------------------------------------
   Buttons: angled corners echo the facility hardware
   -------------------------------------------------------------------------- */
.btn {
  --btn-edge: var(--orange);
  --btn-fill: var(--orange);
  --btn-text: var(--on-orange);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.7em 1.5em;
  border: 0;
  background: none;
  color: var(--btn-text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn::before,
.btn::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  transition: background-color 0.18s ease;
}
.btn::before { inset: 0; background: var(--btn-edge); }
.btn::after  { inset: 0; background: var(--btn-fill); }
.btn:hover { color: var(--btn-text); }

.btn-primary:hover { --btn-edge: var(--orange-hi); --btn-fill: var(--orange-hi); }

.btn-ghost {
  --btn-edge: var(--cyan);
  --btn-fill: var(--ink-raised);
  --btn-text: var(--text);
}
.btn-ghost::after { inset: 1.5px; }
.btn-ghost:hover { --btn-fill: #0d2238; }

.btn-small { min-height: 40px; padding: 0.5em 1.1em; font-size: 0.95rem; --cut: 9px; }
.btn-large { min-height: 58px; padding: 0.8em 2em; font-size: 1.15rem; }

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */
.site-nav {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 50;
  height: var(--nav-h);
  border-bottom: 1px solid transparent;
  transition: background-color 0.25s ease, border-color 0.25s ease;
}
.site-nav.is-scrolled {
  background: rgb(3 11 25 / 0.9);
  border-bottom-color: var(--line);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.wordmark:hover { color: var(--text); }
.wordmark img { border-radius: 6px; }

.site-nav nav { margin-left: auto; }

.nav-links {
  display: flex;
  gap: 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-links a {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
}
.nav-links a:hover { color: var(--text); }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  isolation: isolate;
  min-height: min(56.25vw, 880px);
  margin-top: calc(-1 * var(--nav-h));
  background: var(--ink);
  overflow: hidden;
}

.hero-art {
  grid-area: 1 / 1;
  position: relative;
  z-index: -1;
}
.hero-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 72% 50%;
}
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, var(--ink) 0%, rgb(3 11 25 / 0.82) 28%, rgb(3 11 25 / 0.25) 52%, rgb(3 11 25 / 0) 64%),
    linear-gradient(0deg, var(--ink) 0%, rgb(3 11 25 / 0) 22%);
}

.hero-copy {
  grid-area: 1 / 1;
  align-self: center;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  padding-block: calc(var(--nav-h) + clamp(40px, 6vw, 88px)) clamp(48px, 6vw, 88px);
}

.title {
  font-size: var(--step-4);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-shadow: 0 2px 30px rgb(3 11 25 / 0.6);
}
.title span { display: block; }

.tagline {
  max-width: 22ch;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
}

.lede {
  max-width: 34ch;
  color: var(--muted);
  font-size: var(--step-0);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
}

/* HUD panel, modeled on the in-game interface panels */
.hud {
  position: relative;
  background: rgb(13 25 45 / 0.86);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.hud::before,
.hud::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: var(--cyan);
  border-style: solid;
  pointer-events: none;
}
.hud::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.hud::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.hud-label {
  color: var(--muted);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.03em;
}

.countdown {
  margin-top: 14px;
  padding: 16px 22px 14px;
  text-align: center;
}
.count {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin-block: 6px 4px;
}
.count-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 2.6ch;
}
.count-num {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.6vw, 2.6rem);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: center;
}
.count-unit {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}
.count-sep {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.1;
  color: var(--line);
}
.hud-foot {
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
}
.countdown.is-live .count { display: none; }

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section { padding-block: var(--section-pad); }

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(20px, 4vw, 64px);
  align-items: end;
  margin-bottom: clamp(36px, 5vw, 60px);
}
.section-head p {
  max-width: 62ch;
  color: var(--muted);
}

/* Video facade: poster first, YouTube player loads on click */
.video { margin: 0; }
.video-poster,
.video iframe {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}
.video iframe { height: auto; }
.video-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease, filter 0.4s ease;
}
.video-poster:hover img { transform: scale(1.02); filter: brightness(1.08); }
.video.is-offline .video-poster img { object-position: 72% 50%; }

.play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(64px, 8vw, 92px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 8px rgb(255 138 42 / 0.22), 0 10px 40px rgb(0 0 0 / 0.45);
  transition: scale 0.2s ease, box-shadow 0.2s ease;
}
.play::after {
  content: "";
  position: absolute;
  left: 54%;
  top: 50%;
  translate: -50% -50%;
  border-style: solid;
  border-width: 0.6em 0 0.6em 1em;
  border-color: transparent transparent transparent var(--on-orange);
  font-size: clamp(16px, 2vw, 22px);
}
.video-poster:hover .play,
.video-poster:focus-visible .play {
  scale: 1.07;
  box-shadow: 0 0 0 12px rgb(255 138 42 / 0.28), 0 10px 40px rgb(0 0 0 / 0.45);
}

.video figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
}

/* Gameplay pillars */
.pillars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 36px);
  margin: clamp(40px, 5vw, 64px) 0 0;
  padding: 0;
  list-style: none;
}
.pillars li {
  padding-top: 18px;
  border-top: 2px solid var(--orange);
}
.pillars h3 { font-size: 1.2rem; margin-bottom: 8px; }
.pillars p { color: var(--muted); font-size: 1.02rem; }

/* Quantum devices */
.devices {
  background-color: var(--ink-raised);
  background-image:
    linear-gradient(rgb(70 211 223 / 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgb(70 211 223 / 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  border-block: 1px solid var(--line);
}

.modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}
.modes li {
  display: grid;
  gap: 10px;
  align-content: start;
  padding: 4px clamp(18px, 3vw, 40px);
  border-left: 1px solid var(--line);
}
.modes li:first-child { padding-left: 0; border-left: 0; }
.modes p { color: var(--muted); max-width: 30ch; }

.mode-icon { width: 96px; height: 56px; margin-bottom: 6px; overflow: visible; }
.ic-core { fill: var(--cyan); }
.ic-fan { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linecap: round; }
.ic-beam { fill: none; stroke: var(--text); stroke-width: 3; stroke-linecap: round; }
.ic-beam-glow { fill: none; stroke: var(--cyan); stroke-width: 11; stroke-linecap: round; opacity: 0.55; }
.ic-pair { fill: none; stroke: var(--orange); stroke-width: 3; stroke-linecap: round; }
.ic-link { fill: none; stroke: var(--cyan); stroke-width: 1.5; stroke-dasharray: 3 4; }

/* The odds lab (interactive demo) */
.lab {
  margin-top: clamp(48px, 6vw, 80px);
  padding: clamp(20px, 3.4vw, 40px);
  background: var(--panel);
  border: 1px solid var(--line);
  position: relative;
}
.lab::before,
.lab::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--cyan);
  border-style: solid;
  pointer-events: none;
}
.lab::before { top: -1px; left: -1px; border-width: 2px 0 0 2px; }
.lab::after { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; }

.lab-head { margin-bottom: clamp(24px, 3vw, 36px); }
.lab-head h3 { font-size: var(--step-2); margin-bottom: 10px; }
.lab-head p { color: var(--muted); max-width: 64ch; }

.lab-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}
.lab-controls { display: grid; gap: 24px; min-width: 0; }
.lab-stage { min-width: 0; }

.circuit { width: 100%; max-width: 380px; height: auto; overflow: visible; }
.c-ket { fill: var(--cyan); font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.c-wire { stroke: var(--cyan); stroke-width: 2; }
.c-gate { fill: var(--ink); stroke: var(--cyan); stroke-width: 2; }
.c-gate-text { fill: var(--text); font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.c-angle { fill: var(--muted); font-family: var(--font-body); font-size: 15px; font-weight: 500; }
.c-meter { fill: var(--ink); stroke: var(--text); stroke-width: 2; }
.c-arc { fill: none; stroke: var(--text); stroke-width: 2; }
.c-needle { stroke: var(--orange); stroke-width: 2.5; stroke-linecap: round; }
.c-classical { stroke: var(--text); stroke-width: 1.5; }

.field { display: grid; gap: 8px; }
.field label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 500;
}
.field output {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  accent-color: var(--cyan);
  cursor: pointer;
}

.presets { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  min-height: 40px;
  padding: 0.4em 1em;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.chip:hover { border-color: var(--cyan); }
.chip[aria-pressed="true"] {
  border-color: var(--cyan);
  background: rgb(70 211 223 / 0.12);
  color: var(--cyan);
}

.probs { display: grid; gap: 12px; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.legend strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.swatch { width: 12px; height: 12px; display: inline-block; }
.swatch-fan { background: var(--orange); }
.swatch-beam { background: var(--cyan); }

.bar-row {
  display: grid;
  grid-template-columns: 6.5em minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.bar-label { color: var(--muted); font-size: 0.95rem; }
.bar {
  display: flex;
  height: 14px;
  background: var(--ink);
  border: 1px solid var(--line);
  overflow: hidden;
}
.seg { display: block; height: 100%; transition: width 0.3s ease; }
.seg-fan { background: var(--orange); }
.seg-beam { background: var(--cyan); }

.amps {
  color: var(--muted);
  font-size: 0.98rem;
  font-variant-numeric: tabular-nums;
}
.amps span { color: var(--text); }

.arena {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-width: 100%;
  background: var(--ink);
  border: 1px solid var(--line);
}

.stage-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.tally {
  margin-top: 12px;
  color: var(--muted);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

/* Circuits */
.circuits-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
.circuits-copy { display: grid; gap: 22px; }
.circuits-copy p { color: var(--muted); max-width: 46ch; }

/* Reassurance band */
.assure {
  padding-block: clamp(56px, 8vw, 104px);
  background:
    linear-gradient(90deg, rgb(70 211 223 / 0.1), rgb(70 211 223 / 0) 45%, rgb(255 138 42 / 0) 55%, rgb(255 138 42 / 0.1)),
    var(--ink-raised);
  border-block: 1px solid var(--line);
}
.assure .container { display: grid; gap: 18px; }
.assure-title {
  max-width: 24ch;
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 600;
  line-height: 1.1;
}
.assure p { max-width: 58ch; color: var(--muted); }

/* Steam */
.steam-card {
  position: relative;
  display: block;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.steam-card img { width: 100%; height: auto; transition: transform 0.4s ease; }
.steam-card:hover { border-color: var(--cyan); }
.steam-card:hover img { transform: scale(1.012); }
.steam-card-label {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 8px 14px;
  background: rgb(3 11 25 / 0.88);
  border: 1px solid var(--cyan);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px clamp(20px, 3vw, 36px);
  margin: clamp(36px, 5vw, 56px) 0 clamp(36px, 5vw, 48px);
}
.facts div { padding-top: 12px; border-top: 1px solid var(--line); min-width: 0; }
.facts dt { color: var(--muted); font-size: 0.95rem; }
.facts dd {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.3;
}

/* Footer */
.site-footer {
  padding-block: 40px 48px;
  border-top: 1px solid var(--line);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 36px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-links a { color: var(--muted); font-size: 1rem; text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.legal {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1000px) {
  .pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-grid { grid-template-columns: minmax(0, 1fr); }
  .circuits-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 820px) {
  :root { --nav-h: 60px; }

  .nav-links { display: none; }
  .site-nav nav { display: none; }
  .nav-inner { justify-content: space-between; }

  .hero { min-height: 0; }
  .hero-art { grid-area: 1 / 1; }
  .hero-art img {
    position: static;
    aspect-ratio: 4 / 3;
    height: auto;
    object-position: 74% 50%;
  }
  .hero-art::after {
    background:
      linear-gradient(0deg, var(--ink) 0%, rgb(3 11 25 / 0) 45%),
      linear-gradient(180deg, rgb(3 11 25 / 0.7) 0%, rgb(3 11 25 / 0) 25%);
  }
  .hero-copy {
    grid-area: 2 / 1;
    padding-block: 0 56px;
    margin-top: clamp(-120px, -18vw, -56px);
  }

  .section-head { grid-template-columns: minmax(0, 1fr); align-items: start; }

  .modes { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .modes li,
  .modes li:first-child {
    padding: 22px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .wordmark span { font-size: 0.95rem; letter-spacing: 0.04em; }
  .site-nav .wordmark span { display: none; }
  .pillars { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .countdown { align-self: stretch; padding-inline: 14px; }
  .count { gap: 4px; }
  .actions .btn { flex: 1 1 auto; }
  .steam-card-label { right: 10px; bottom: 10px; font-size: 0.85rem; }
  .bar-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
