/* ==========================================================================
   Chatacombs: Roguelike Arena
   ========================================================================== */

:root {
  --void: #0c0a0f;
  --crypt: #141118;
  --stone: #1d1922;
  --stone-2: #2a2430;
  --line: rgba(232, 222, 200, 0.1);
  --bone: #ece4d2;
  --bone-dim: #a79f8f;
  --torch: #ff8a2a;
  --torch-hot: #ffc266;
  --ember: #ff4d1a;
  --spectral: #8dff6a;
  --blood: #e0242f;
  --yt: #ff0033;

  --font-display: "Pirata One", "Times New Roman", serif;
  --font-body: "Chakra Petch", system-ui, sans-serif;
  --font-mono: "VT323", ui-monospace, monospace;

  --gutter: clamp(16px, 4vw, 48px);
  --maxw: 1180px;
  --radius: 14px;
  --nav-h: 68px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

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

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.05; font-weight: 400; }
p { margin: 0; }

::selection { background: var(--torch); color: var(--void); }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--torch); color: var(--void); padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 8px; }

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

/* ---------- Buttons ---------- */
.btn {
  --h: 54px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding: 0 26px;
  border-radius: 999px; border: 1px solid transparent;
  font: 600 15px/1 var(--font-body);
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  cursor: pointer; white-space: nowrap;
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease;
}
.btn svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--sm { --h: 40px; padding: 0 16px; font-size: 13px; }
.btn--sm svg { width: 18px; height: 18px; }

.btn--torch {
  color: #1a0d03;
  background: linear-gradient(180deg, var(--torch-hot), var(--torch) 55%, var(--ember));
  box-shadow: 0 0 0 1px rgba(255, 194, 102, .4) inset, 0 10px 40px -8px rgba(255, 110, 30, .7);
}
.btn--torch:hover { box-shadow: 0 0 0 1px rgba(255, 220, 160, .7) inset, 0 14px 60px -6px rgba(255, 120, 30, .95); }

.btn--ghost {
  color: var(--bone);
  border-color: rgba(236, 228, 210, .28);
  background: rgba(12, 10, 15, .45);
  backdrop-filter: blur(6px);
}
.btn--ghost:hover { border-color: var(--torch); color: var(--torch-hot); }

.btn--yt { color: #fff; background: var(--yt); box-shadow: 0 8px 30px -10px rgba(255, 0, 51, .8); }
.btn--yt:hover { background: #ff1f4b; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter);
  transition: background .3s ease, border-color .3s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(12, 10, 15, .82);
  backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}
.nav__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.nav__brand span { font: 28px/1 var(--font-display); letter-spacing: .02em; }
.nav__links { display: flex; gap: clamp(18px, 2.4vw, 32px); }
.nav__links a {
  text-decoration: none; font-size: 14px; font-weight: 500;
  letter-spacing: .12em; text-transform: uppercase; color: var(--bone-dim);
  white-space: nowrap;
  transition: color .2s;
}
.nav__links a:hover { color: var(--torch-hot); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; place-items: center;
  padding: calc(var(--nav-h) + 40px) var(--gutter) 120px;
  overflow: hidden;
  isolation: isolate;
  --mx: 50%; --my: 45%;
  background:
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(255, 90, 20, .22), transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 40%, #1c1520, var(--void) 75%);
}

.hero__bricks {
  position: absolute; inset: 0; z-index: -3;
  opacity: .5;
  background-image:
    linear-gradient(rgba(0,0,0,.65) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,0,0,.65) 2px, transparent 2px),
    linear-gradient(90deg, rgba(0,0,0,.65) 2px, transparent 2px);
  background-size: 120px 56px, 120px 112px, 120px 112px;
  background-position: 0 0, 0 0, 60px 56px;
  -webkit-mask-image: radial-gradient(circle 380px at var(--mx) var(--my), #000 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,.08) 100%);
          mask-image: radial-gradient(circle 380px at var(--mx) var(--my), #000 0%, rgba(0,0,0,.25) 55%, rgba(0,0,0,.08) 100%);
}
.hero__bricks::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, #2b2230, #18131c);
  z-index: -1;
}

.hero__torch {
  position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(circle 420px at var(--mx) var(--my), rgba(255, 140, 50, .16), transparent 70%);
  animation: flicker 3.2s infinite steps(1);
}

.hero__fog {
  position: absolute; inset: -20% -10% 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 40% 18% at 20% 85%, rgba(160, 150, 190, .14), transparent 70%),
    radial-gradient(ellipse 45% 20% at 75% 90%, rgba(160, 150, 190, .12), transparent 70%),
    radial-gradient(ellipse 30% 14% at 50% 100%, rgba(160, 150, 190, .16), transparent 70%);
  filter: blur(10px);
  animation: drift 22s ease-in-out infinite alternate;
}

.embers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

.hero__inner {
  position: relative; z-index: 1;
  max-width: 980px; text-align: center;
  display: flex; flex-direction: column; align-items: center;
}

.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(12, 10, 15, .55);
  font-size: 13px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--bone-dim);
  margin-bottom: 28px;
}
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--yt);
  box-shadow: 0 0 0 0 rgba(255, 0, 51, .6);
  animation: pulse 1.8s infinite;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(64px, 15vw, 210px);
  line-height: .86;
  letter-spacing: .005em;
  display: flex; flex-wrap: wrap; justify-content: center;
}
.hero__chat {
  color: var(--spectral);
  text-shadow: 0 0 18px rgba(141, 255, 106, .55), 0 0 60px rgba(141, 255, 106, .3);
  animation: haunt 6s infinite;
}
.hero__combs {
  background: linear-gradient(180deg, #fff6e0 10%, var(--bone) 45%, #b8a88a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 138, 42, .35)) drop-shadow(0 6px 0 rgba(0,0,0,.6));
}

.hero__sub {
  margin-top: 14px;
  font: 600 clamp(14px, 2vw, 20px)/1 var(--font-body);
  letter-spacing: .6em; text-transform: uppercase;
  color: var(--torch);
  padding-left: .6em; /* balance trailing letter-spacing */
}
.hero__sub::before, .hero__sub::after {
  content: ""; display: inline-block; vertical-align: middle;
  width: clamp(24px, 6vw, 70px); height: 1px; margin: 0 1em 0 .4em;
  background: linear-gradient(90deg, transparent, var(--torch));
}
.hero__sub::after { transform: scaleX(-1); margin: 0 .4em 0 .4em; }

.hero__lede {
  margin-top: 30px; max-width: 620px;
  font-size: clamp(17px, 2vw, 20px); color: var(--bone-dim);
}
.hero__lede strong { color: var(--bone); font-weight: 600; }

.hero__ctas { margin-top: 38px; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }

.hero__scroll {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; letter-spacing: .3em; text-transform: uppercase; text-decoration: none; color: var(--bone-dim);
  padding-left: .3em;
}
.hero__scroll svg { width: 22px; height: 22px; fill: var(--torch); animation: bob 1.8s ease-in-out infinite; }

/* ---------- Ticker ---------- */
/* The tilted strip is wider than the page; keep it from widening the phone viewport. */
main { overflow-x: clip; }
.ticker {
  overflow: hidden; position: relative;
  border-block: 1px solid rgba(255, 138, 42, .35);
  background: linear-gradient(90deg, #1a0e07, #2a1408 50%, #1a0e07);
  transform: rotate(-1.2deg) scale(1.02);
  margin: -24px 0 0;
  z-index: 2;
}
.ticker__track {
  display: flex; align-items: center; gap: 28px; width: max-content;
  padding: 14px 0;
  font: clamp(26px, 3.4vw, 40px)/1 var(--font-display);
  color: var(--torch-hot);
  animation: marquee 30s linear infinite;
}
.ticker__track i { font-style: normal; font-size: .55em; color: var(--ember); }

/* ---------- Sections ---------- */
.section {
  position: relative;
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(80px, 12vw, 150px) var(--gutter);
}
.section__head { text-align: center; max-width: 720px; margin: 0 auto clamp(40px, 6vw, 64px); }
.kicker {
  font: 600 13px/1 var(--font-body); letter-spacing: .35em; text-transform: uppercase;
  color: var(--torch); margin-bottom: 16px; padding-left: .35em;
}
.section h2 { font-family: var(--font-display); font-size: clamp(42px, 7vw, 84px); }
.section h2 em { font-style: normal; color: var(--blood); text-shadow: 0 0 30px rgba(224, 36, 47, .45); }
.section__lede { margin-top: 18px; color: var(--bone-dim); font-size: 18px; }

/* ---------- Watch ---------- */
.watch__grid {
  display: grid; grid-template-columns: minmax(0, 400px); gap: 20px;
  justify-content: center;
}

/* The stream is vertical (YouTube Shorts live), so the player is 9:16. */
.player {
  position: relative; aspect-ratio: 9 / 16;
  border-radius: var(--radius); overflow: hidden;
  background: #070609;
  box-shadow: 0 0 0 1px var(--line), 0 30px 80px -30px rgba(255, 110, 30, .45);
}
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.player__facade {
  all: unset; cursor: pointer;
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  text-align: center; padding: 20px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 138, 42, .18), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.025) 0 2px, transparent 2px 4px),
    #0a080c;
}
.player__frame {
  position: absolute; inset: 14px; border-radius: 8px; pointer-events: none;
  border: 1px solid rgba(255, 138, 42, .18);
}
.player__play {
  position: relative;
  width: 88px; height: 88px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(180deg, var(--torch-hot), var(--ember));
  box-shadow: 0 0 0 10px rgba(255, 138, 42, .14), 0 0 60px rgba(255, 110, 30, .7);
  transition: transform .25s ease, box-shadow .25s ease;
}
.player__play svg { width: 36px; height: 36px; fill: #1a0d03; margin-left: 4px; }
.player__facade:hover .player__play,
.player__facade:focus-visible .player__play { transform: scale(1.08); box-shadow: 0 0 0 16px rgba(255, 138, 42, .12), 0 0 90px rgba(255, 110, 30, .9); }
.player__label { position: relative; font: 600 15px/1 var(--font-body); letter-spacing: .2em; text-transform: uppercase; }
.player__note { position: relative; font-size: 14px; color: var(--bone-dim); }

.watch__links { display: flex; justify-content: center; margin-top: 28px; }

/* ---------- Steps ---------- */
.steps {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
  counter-reset: none;
}
.step {
  position: relative;
  padding: 36px 30px 34px;
  border-radius: var(--radius);
  background:
    radial-gradient(ellipse 90% 70% at 50% 120%, rgba(255, 138, 42, .12), transparent 70%),
    linear-gradient(180deg, var(--stone), var(--crypt));
  box-shadow: 0 0 0 1px var(--line);
}
.step__num {
  display: block;
  font: 76px/1 var(--font-display);
  color: transparent; -webkit-text-stroke: 1px rgba(255, 138, 42, .7);
  margin-bottom: 18px;
}
.step h3, .feature h3 { font: 600 22px/1.2 var(--font-body); margin-bottom: 10px; }
.step p, .feature p { color: var(--bone-dim); font-size: 16px; }

/* ---------- Features ---------- */
.features { padding-top: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.feature {
  padding: clamp(28px, 4vw, 44px);
  background: var(--void);
  transition: background .3s;
}
.feature:hover { background: #120f15; }
.feature__icon {
  width: 52px; height: 52px; border-radius: 12px; margin-bottom: 22px;
  display: grid; place-items: center;
  background: rgba(141, 255, 106, .08); box-shadow: 0 0 0 1px rgba(141, 255, 106, .25) inset;
}
.feature__icon svg { width: 26px; height: 26px; fill: none; stroke: var(--spectral); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }

/* ---------- Grimoire ---------- */
.tome {
  max-width: 860px; margin: 0 auto;
  border-radius: var(--radius);
  padding: clamp(10px, 2vw, 18px);
  background:
    radial-gradient(ellipse at 50% 0, rgba(255, 138, 42, .1), transparent 60%),
    linear-gradient(180deg, #19141c, #0f0c12);
  box-shadow: 0 0 0 1px rgba(255, 138, 42, .22), 0 40px 100px -40px rgba(255, 110, 30, .4);
}
.tome__list { list-style: none; margin: 0; padding: 0; }
.tome__list li {
  display: grid; grid-template-columns: minmax(170px, 230px) 1fr; gap: 20px; align-items: baseline;
  padding: 18px clamp(14px, 3vw, 28px);
  border-bottom: 1px dashed rgba(236, 228, 210, .1);
  transition: background .2s;
}
.tome__list li:last-child { border-bottom: 0; }
.tome__list li:hover { background: rgba(255, 138, 42, .05); }
.tome__list code {
  font: 28px/1 var(--font-mono); color: var(--torch-hot);
  text-shadow: 0 0 14px rgba(255, 138, 42, .45);
}
.tome__list span { color: var(--bone-dim); }
.tome__list span code { font: inherit; color: var(--bone); text-shadow: none; }

/* Inline commands in body copy */
.hero__lede code, .section__lede code, .step p code, .feature p code {
  font: 1.2em/1 var(--font-mono); color: var(--torch-hot);
  padding: 1px 6px; border-radius: 6px; background: rgba(255, 138, 42, .1);
}

/* ---------- Roster ---------- */
.roster { padding-top: 0; }
.roster__grid {
  list-style: none; margin: 0 auto; padding: 0; max-width: 980px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 12px;
}
.roster__grid li {
  flex: 0 1 calc((100% - 36px) / 4); min-width: min(100%, 210px);
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline;
  padding: 16px 18px; border-radius: 12px;
  background: linear-gradient(180deg, var(--stone), var(--crypt));
  box-shadow: 0 0 0 1px var(--line);
}
.roster__grid b { font: 600 18px/1.2 var(--font-body); color: var(--bone); }
.roster__grid i { font-style: normal; font-size: 13px; color: var(--bone-dim); text-align: right; }
.roster__grid span {
  grid-column: 1 / -1;
  font: 20px/1.1 var(--font-mono); color: var(--torch-hot);
}
.roster__note { text-align: center; margin-top: 24px; color: var(--bone-dim); }
.roster__note a { color: var(--torch-hot); }

/* ---------- Final CTA ---------- */
.final {
  position: relative; overflow: hidden;
  padding: clamp(100px, 14vw, 180px) var(--gutter);
  text-align: center;
  border-top: 1px solid var(--line);
}
.final__glow {
  position: absolute; left: 50%; bottom: -40%; width: 1100px; height: 700px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(255, 100, 30, .35), transparent 65%);
  animation: flicker 4s infinite steps(1);
  pointer-events: none;
}
.final__inner { position: relative; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.final__logo { margin-bottom: 26px; filter: drop-shadow(0 0 30px rgba(255, 138, 42, .55)); animation: bob 4s ease-in-out infinite; }
.final h2 { font-family: var(--font-display); font-size: clamp(42px, 7vw, 86px); }
.final p { margin-top: 16px; color: var(--bone-dim); font-size: 18px; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--line);
  font-size: 14px; color: var(--bone-dim);
}
.footer__brand { display: flex; align-items: center; gap: 8px; color: var(--bone); }
.footer__brand span { font: 22px/1 var(--font-display); }
.footer__links { display: flex; gap: 20px; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: var(--torch-hot); }
.footer__yt { text-decoration: none; }
.footer__yt:hover { color: var(--torch-hot); }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.reveal.is-in { opacity: 1; transform: none; }
.steps .reveal:nth-child(2), .feature-grid .reveal:nth-child(2) { transition-delay: .1s; }
.steps .reveal:nth-child(3), .feature-grid .reveal:nth-child(3) { transition-delay: .2s; }
.feature-grid .reveal:nth-child(4) { transition-delay: .3s; }

/* ---------- Keyframes ---------- */
@keyframes flicker {
  0%, 100% { opacity: 1; }
  12% { opacity: .82; }
  14% { opacity: 1; }
  41% { opacity: .9; }
  43% { opacity: .75; }
  45% { opacity: 1; }
  77% { opacity: .88; }
}
@keyframes haunt {
  0%, 92%, 100% { opacity: 1; transform: none; }
  93% { opacity: .55; transform: translateX(-3px) skewX(-6deg); }
  95% { opacity: 1; transform: translateX(2px); }
  97% { opacity: .7; transform: none; }
}
@keyframes drift { from { transform: translateX(-4%); } to { transform: translateX(4%); } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 0, 51, .6); }
  70% { box-shadow: 0 0 0 10px rgba(255, 0, 51, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 0, 51, 0); }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .nav__links a[href="#how"] { display: none; }
}
@media (max-width: 720px) {
  .nav__links a:not([href$="wiki/"]):not([aria-current]) { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .tome__list li { grid-template-columns: 1fr; gap: 6px; }
  .roster__grid li { flex-basis: calc((100% - 12px) / 2); min-width: 0; grid-template-columns: 1fr; padding: 14px; }
  .roster__grid i { text-align: left; }
  .hero__sub { letter-spacing: .4em; padding-left: .4em; }
  .hero__sub::before, .hero__sub::after { display: none; }
  .footer { justify-content: center; text-align: center; }
}
@media (max-width: 420px) {
  .nav__brand span { display: none; }
  .hero__ctas .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
