/* =========================================================================
   BalatRobot — landing page
   A Balatro card table rendered in 3D, narrated by HTML on top of it.
   ========================================================================= */

/* Balatro's own UI typeface, sliced from the game's resources */
@font-face {
  font-family: "m6x11";
  src: url("../assets/fonts/m6x11plus.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Palette — grounded in Balatro's felt + chips/mult colours */
  --ink:        #0c0c12;   /* the void behind the cards            */
  --ink-2:      #12121b;   /* raised panel                          */
  --felt:       #141d24;   /* deep table green-blue                 */
  --cream:      #f3ecd9;   /* card face / primary text              */
  --chips:      #38bdf2;   /* Balatro "chips" blue                  */
  --mult:       #fe5f55;   /* Balatro "mult" red                    */
  --gold:       #ffc14e;   /* money / legendary                     */
  --green:      #62c46a;   /* a winning hand                        */
  --muted:      #8a8aa0;   /* secondary text                        */
  --line:       rgba(243,236,217,.12);

  --maxw: 1080px;
  --gutter: clamp(20px, 5vw, 64px);

  --font-display: "m6x11", "Pixelify Sans", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

/* A faint felt vignette under the canvas so cards never float on flat black */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(120% 90% at 50% 8%, #1b2733 0%, var(--felt) 38%, var(--ink) 78%);
}

/* The WebGL stage sits between the felt and the content */
#stage {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  display: block;
  touch-action: pan-y;
}

a { color: inherit; }

::selection { background: var(--mult); color: #fff; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--cream);
  color: var(--ink);
  padding: 10px 16px;
  z-index: 100;
  font-family: var(--font-display);
}
.skip-link:focus { left: 12px; top: 12px; }

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

/* ───────────────────────── Top bar ───────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--gutter);
  background: linear-gradient(var(--ink) 12%, transparent);
  backdrop-filter: blur(2px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .02em;
}
.brand-pip { color: var(--mult); }
.brand-name { color: var(--cream); }

.topnav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 28px);
  font-family: var(--font-display);
  font-size: 15px;
}
.topnav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.topnav a:hover { color: var(--cream); }
.topnav-gh {
  color: var(--ink) !important;
  background: var(--gold);
  padding: 6px 12px;
  border-radius: 6px;
}
.topnav-gh:hover { filter: brightness(1.08); }
@media (max-width: 720px) {
  .topnav a:not(.topnav-gh) { display: none; }
}

/* ───────────────────────── Layout primitives ───────────────────────── */
main { position: relative; z-index: 1; }

/* anchored sections clear the fixed top bar when jumped to */
section[id] { scroll-margin-top: 78px; }
[hidden] { display: none !important; }

.band {
  padding: clamp(80px, 14vh, 180px) var(--gutter);
}
.band-inner {
  max-width: var(--maxw);
  margin: 0 auto;
}
.band-inner.narrow { max-width: 720px; }

.kicker {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--chips);
  margin: 0 0 14px;
}
.band-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.05;
  margin: 0 0 22px;
  letter-spacing: .01em;
  text-shadow: 0 2px 22px rgba(8,8,14,.7);
}
.band-body {
  max-width: 60ch;
  color: #d9d3c4;
  font-size: clamp(17px, 2vw, 19px);
  margin: 0 0 18px;
  text-shadow: 0 1px 14px rgba(8,8,14,.6);
}
.band-body.wide { max-width: 68ch; }
.band-body em { color: var(--cream); font-style: italic; }
.band-body b { color: var(--gold); font-weight: 600; }
.band-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 26px;
}
.band-foot {
  font-size: 14px;
  color: var(--muted);
  margin-top: 18px;
}
.band-foot code, .band-body code, .band-meta code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: rgba(255,255,255,.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--cream);
}

/* ───────────────────────── Hero ───────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 120px var(--gutter) 60px;
}
/* a soft scrim so the (light) cards never sap the headline's contrast */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, var(--ink) 8%, rgba(12,12,18,.72) 38%, transparent 68%);
  pointer-events: none;
}
.hero-inner { max-width: 760px; position: relative; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: .1em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
  margin: 0 0 26px;
}
.eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(46px, 13vw, 150px);
  line-height: .9;
  margin: 0 0 22px;
  letter-spacing: .005em;
  /* hug the text so the clipped gradient covers every glyph; cap at the
     viewport so a long word can't be cut by body overflow */
  width: max-content;
  max-width: 92vw;
  background: linear-gradient(180deg, var(--cream) 30%, #c9b98f 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 40px rgba(0,0,0,.5);
}
.hero-lede {
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.5;
  max-width: 30ch;
  color: #e7e1d2;
  margin: 0 0 30px;
  text-shadow: 0 1px 16px rgba(8,8,14,.7);
}
.hero-lede em { font-style: italic; color: var(--gold); }

/* chips × mult = score readout, animated by JS */
.hero-readout {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-display);
  background: rgba(8,8,14,.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 20px;
  margin: 0 0 32px;
}
.ro-chips { color: var(--chips); font-size: 28px; }
.ro-mult  { color: var(--mult);  font-size: 28px; }
.ro-x, .ro-eq { color: var(--muted); font-size: 22px; }
.ro-score { color: var(--gold); font-size: 30px; min-width: 4ch; }
.ro-ante {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
  align-self: center;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.ro-ante b { color: var(--cream); }

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 40px; }
.btn {
  font-family: var(--font-display);
  font-size: 17px;
  text-decoration: none;
  padding: 13px 26px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: transform .15s var(--ease), filter .15s, background .2s;
  display: inline-block;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--mult);
  color: #fff;
  box-shadow: 0 8px 28px -8px var(--mult);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-2px); }
.btn-ghost {
  border-color: var(--line);
  color: var(--cream);
  background: rgba(255,255,255,.03);
}
.btn-ghost:hover { border-color: var(--cream); transform: translateY(-2px); }

.hero-stats {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 5vw, 56px);
  padding: 0; margin: 0;
}
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats b {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 30px);
  color: var(--cream);
  line-height: 1.1;
}
.hero-stats span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }

.scroll-hint {
  position: absolute;
  bottom: 26px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  animation: bob 2.2s var(--ease) infinite;
}
@keyframes bob { 0%,100%{transform:translate(-50%,0)} 50%{transform:translate(-50%,7px)} }

/* ───────────────────────── How it works ───────────────────────── */
.pipeline {
  list-style: none;
  padding: 0;
  margin: 44px 0 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 880px) { .pipeline { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .pipeline { grid-template-columns: 1fr; } }

.stage {
  background: linear-gradient(180deg, rgba(20,20,30,.78), rgba(12,12,20,.7));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 20px;
  position: relative;
  overflow: hidden;
}
.stage::after {  /* a thin chips-blue rail along the top */
  content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 100%;
  background: linear-gradient(90deg, var(--chips), transparent 70%);
}
.stage-no {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--chips);
  letter-spacing: .1em;
}
.stage h3 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 6px 0 8px;
}
.stage p { font-size: 14.5px; color: #cfc9bb; margin: 0; }

.brains { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.brains li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 4px 10px;
  font-size: 13px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.brains b { font-family: var(--font-display); font-size: 15px; grid-column: 2; }
.brains span:last-child { grid-column: 2; color: var(--muted); }
.brains .suit { grid-row: 1 / span 2; font-size: 20px; align-self: center; }
.s-spade { color: var(--cream); }
.s-heart { color: var(--mult); }
.s-diamond { color: var(--gold); }

/* ───────────────────────── Scoring grid ───────────────────────── */
.score-grid {
  list-style: none;
  padding: 0;
  margin: 40px 0 0;
  display: grid;
  gap: 12px;
}
.score-grid li {
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 10px 18px;
}
.sg-name {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--cream);
}
.sg-bar {
  position: relative;
  height: 12px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  overflow: hidden;
}
.sg-bar i {
  position: absolute; inset: 0;
  width: var(--w);
  background: linear-gradient(90deg, var(--chips), var(--green));
  border-radius: inherit;
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1s var(--ease);
}
.sg-bar.lit i { transform: scaleX(1); }
.sg-note {
  grid-column: 2;
  font-size: 13px;
  color: var(--muted);
  margin-top: -4px;
}
@media (max-width: 560px) {
  .score-grid li { grid-template-columns: 92px 1fr; }
  .sg-name { font-size: 15px; }
}

/* ───────────────────────── Endless ───────────────────────── */
.band-endless { position: relative; }
.nan {
  color: var(--mult);
  font-family: var(--font-mono);
  font-weight: 700;
  background: rgba(254,95,85,.12) !important;
  border: 1px solid rgba(254,95,85,.4);
}
.ante-ladder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 34px;
  font-family: var(--font-display);
  font-size: 15px;
}
.ante-ladder span {
  border: 1px solid var(--line);
  padding: 7px 13px;
  border-radius: 8px;
  color: var(--muted);
  position: relative;
}
.ante-ladder span::after {
  content: "→"; position: absolute; right: -13px; top: 50%; transform: translateY(-50%);
  color: var(--line); font-size: 12px;
}
.ante-ladder span:last-child::after { content: none; }
.ante-ladder .lim { color: var(--gold); border-color: rgba(255,193,78,.5); }
.ante-ladder .nanstop {
  color: var(--mult);
  border-color: rgba(254,95,85,.5);
  background: rgba(254,95,85,.08);
}

/* ───────────────────────── Terminal ───────────────────────── */
.terminal {
  margin: 36px 0 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0a10;
  box-shadow: 0 24px 60px -24px #000;
  max-width: 760px;
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 16px;
  background: #15151f;
  border-bottom: 1px solid var(--line);
}
.term-bar span { width: 11px; height: 11px; border-radius: 50%; background: #34343f; }
.term-bar span:nth-child(1){ background:#fe5f55 } .term-bar span:nth-child(2){ background:#ffc14e } .term-bar span:nth-child(3){ background:#62c46a }
.term-bar i {
  margin-left: auto; font-style: normal;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
}
.terminal pre {
  margin: 0;
  padding: 22px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.85;
  color: #d4d0c4;
}
.c-cm { color: #5f6072; }
.c-fn { color: var(--green); }
.c-fl { color: var(--chips); }

/* ───────────────────────── Entry gate (coming soon) ───────────────────────── */
body.gate-open { overflow: hidden; }

#gate {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(8,8,13,.72);
  backdrop-filter: blur(10px) saturate(.9);
  -webkit-backdrop-filter: blur(10px) saturate(.9);
  transition: opacity .5s var(--ease);
}
#gate.closing { opacity: 0; pointer-events: none; }
#gate[hidden] { display: none; }

.gate-box {
  position: relative;
  width: min(640px, 100%);
  text-align: center;
  padding: clamp(32px, 5vw, 56px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(56,189,242,.10), transparent 60%),
    linear-gradient(180deg, rgba(20,20,30,.96), rgba(10,10,16,.97));
  box-shadow: 0 40px 120px -30px #000, inset 0 1px 0 rgba(255,255,255,.05);
  animation: gate-pop .6s var(--ease) both;
}
@keyframes gate-pop { from { transform: translateY(18px) scale(.97); opacity: 0; } }

.gate-brand {
  font-family: var(--font-display); font-size: 20px; letter-spacing: .02em;
  margin: 0 0 18px; color: var(--cream);
}

.gate-eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-display); font-size: 13px; color: var(--gold);
  border: 1px solid rgba(255,193,78,.35); border-radius: 999px;
  padding: 6px 14px; margin: 0 0 22px;
}
.gate-eyebrow .blink {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
  animation: blink 1.3s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: .25; } }

.gate-title {
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(48px, 11vw, 96px); line-height: .92;
  margin: 0 0 18px; letter-spacing: .01em;
  background: linear-gradient(180deg, var(--cream) 30%, #c9b98f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.gate-text {
  max-width: 42ch; margin: 0 auto 28px;
  font-size: 16px; line-height: 1.6; color: #cfc9bb;
}

.gate-build {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; color: var(--muted);
  margin: 0 0 30px;
}
.gate-build-track {
  width: 160px; height: 8px; border-radius: 999px;
  background: rgba(255,255,255,.08); overflow: hidden;
}
.gate-build-track b {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--chips), var(--green));
  animation: gate-fill 1.6s var(--ease) .35s forwards;
}
@keyframes gate-fill { to { width: 62%; } }
.gate-build-pct { color: var(--cream); }

.gate-close {
  font-family: var(--font-display); font-size: 18px;
  color: #fff; background: var(--mult);
  border: 0; border-radius: 12px; cursor: pointer;
  padding: 15px 34px;
  box-shadow: 0 12px 34px -10px var(--mult);
  transition: transform .15s var(--ease), filter .15s;
}
.gate-close:hover { transform: translateY(-2px); filter: brightness(1.08); }
.gate-close:active { transform: translateY(0); }

.gate-foot {
  margin: 18px 0 0; font-size: 12px; color: var(--muted);
  font-family: var(--font-mono);
}

/* ───────────────────────── Cookie consent ───────────────────────── */
.consent {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%) translateY(10px);
  z-index: 120;
  width: min(740px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 18px;
  background: rgba(13,13,20,.97);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 24px 64px -22px #000;
  opacity: 0;
  transition: opacity .4s var(--ease), transform .4s var(--ease);
}
.consent.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.consent-text {
  margin: 0;
  flex: 1 1 320px;
  font-size: 13px;
  line-height: 1.55;
  color: #cfc9bb;
}
.consent-text b { color: var(--cream); font-weight: 600; }
.consent-actions { display: flex; gap: 10px; margin-left: auto; }
.consent-btn {
  font-family: var(--font-display);
  font-size: 15px;
  cursor: pointer;
  padding: 10px 22px;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: transform .15s var(--ease), filter .15s, border-color .2s;
}
.consent-btn:active { transform: translateY(1px); }
.consent-accept { background: var(--green); color: #0c0c12; }
.consent-accept:hover { filter: brightness(1.08); }
.consent-decline { background: transparent; border-color: var(--line); color: var(--cream); }
.consent-decline:hover { border-color: var(--cream); }
@media (max-width: 520px) {
  .consent-actions { width: 100%; }
  .consent-btn { flex: 1; }
}

/* ───────────────────────── Footer ───────────────────────── */
.site-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--line);
  background: rgba(8,8,13,.85);
  padding: 40px var(--gutter) 30px;
}
.foot-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.foot-brand {
  font-family: var(--font-display);
  font-size: 18px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.foot-ver { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.foot-links { display: flex; gap: 22px; font-family: var(--font-display); }
.foot-links a { color: var(--muted); text-decoration: none; transition: color .2s; }
.foot-links a:hover { color: var(--cream); }
.disclaimer {
  max-width: var(--maxw);
  margin: 26px auto 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #6a6a7c;
}

/* ───────────────────────── CSS fallback fan (no WebGL) ───────────────────────── */
#fallback-fan {
  position: fixed; inset: 0; z-index: -1;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#fallback-fan .fb-card {
  position: absolute;
  width: 120px; height: 168px;
  border-radius: 10px;
  background: var(--cream);
  border: 3px solid #fff;
  box-shadow: 0 18px 40px -10px rgba(0,0,0,.6);
  transform-origin: 50% 220%;
}

/* ───────────────────────── Reduced motion ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .eyebrow .dot, .scroll-hint, .gate-eyebrow .blink { animation: none; }
  .sg-bar i { transition: none; transform: scaleX(1); }
  #gate { transition: none; }
  .gate-box { animation: none; }
  .gate-build-track b { animation: none; width: 62%; }
  .consent { transition: none; }
}
