/* =========================================================
   Devil Gate Games — site styles
   Quirky-dark theme, modern CSS, no build step.
   ========================================================= */

/* ---------- Design tokens --------------------------------- */
:root {
  /* Palette */
  --bg:          #0a0a0d;
  --bg-elev:     #14141a;
  --bg-elev-2:   #1d1d26;
  --ink:         #ece9e2;
  --ink-dim:     #8a8794;
  --ink-faint:   #50505c;
  --accent:      #ff2a3d;          /* devil red */
  --accent-hot:  #ff5c4d;
  --accent-cool: #b94dff;          /* arcane purple */
  --accent-soft: #ffd75e;          /* candle gold */
  --rule:        #2a2a35;

  /* Type */
  --font-display: "Cinzel", "Times New Roman", serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "Cascadia Mono", Menlo, monospace;

  /* Shape & motion */
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -20px rgba(0,0,0,.8);
  --shadow-2: 0 30px 60px -25px rgba(255, 42, 61, 0.35);
  --ease: cubic-bezier(.2,.8,.2,1);
  --dur: 320ms;

  /* Layout */
  --maxw: 1200px;
  --gutter: clamp(1rem, 3vw, 2rem);

  /* Sticky-header height — used for scroll-margin so anchored
     sections aren't hidden under the nav. Page can override
     (e.g. the game page adds a sticky tab bar). */
  --sticky-h: 64px;
  --anchor-pad: 16px;
}

/* Any element a same-page anchor jumps to must clear the sticky
   header. Applied broadly so we never hide a section behind the bar. */
:target,
section[id],
[data-anchor] {
  scroll-margin-top: calc(var(--sticky-h) + var(--anchor-pad));
}

/* ---------- Reset ----------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-hot); text-decoration: none; }
a:hover { color: var(--accent-soft); }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #fff; }

/* Backdrop noise + subtle gradient bloom (decorative) */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,42,61,.12), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(185,77,255,.10), transparent 60%);
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  mix-blend-mode: overlay;
  z-index: 0;
}

main, header, footer { position: relative; z-index: 1; }

/* ---------- Typography ------------------------------------ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.15;
  margin: 0 0 .6em;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.2rem; letter-spacing: .08em; text-transform: uppercase; }
p  { margin: 0 0 1em; color: var(--ink); }
.muted { color: var(--ink-dim); }
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--accent-hot);
  padding: .3rem .55rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: rgba(255,42,61,.06);
}

/* ---------- Layout helpers -------------------------------- */
.wrap {
  width: min(var(--maxw), 100% - var(--gutter) * 2);
  margin-inline: auto;
}
.section {
  padding: clamp(4rem, 9vw, 7rem) 0;
  position: relative;
}
.section + .section { border-top: 1px dashed var(--rule); }
.lede {
  max-width: 62ch;
  font-size: 1.1rem;
  color: var(--ink-dim);
}

/* ---------- Buttons --------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev));
  color: var(--ink);
  font-weight: 600;
  letter-spacing: .02em;
  transition: transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn:hover {
  transform: translateY(-2px) rotate(-.4deg);
  border-color: var(--accent);
  box-shadow: var(--shadow-2);
  color: #fff;
}
.btn--primary {
  background: linear-gradient(180deg, var(--accent-hot), var(--accent));
  border-color: transparent;
  color: #fff;
}
.btn--primary:hover { color: #fff; }
.btn--ghost { background: transparent; }

/* ---------- Header / nav ---------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px) saturate(140%);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--rule);
}
.nav {
  display: flex; align-items: center; gap: 1rem;
  padding: .75rem 0;
}
.brand {
  display: inline-flex; align-items: center; gap: .65rem;
  color: var(--ink); font-family: var(--font-display);
  font-size: 1.05rem; letter-spacing: .12em; text-transform: uppercase;
}
.brand img { width: 34px; height: 34px; filter: drop-shadow(0 0 6px rgba(255,42,61,.45)); }
.brand:hover img { animation: jiggle .6s var(--ease); }
.nav ul {
  list-style: none; padding: 0; margin: 0 0 0 auto;
  display: flex; gap: 1.25rem; align-items: center;
}
.nav a {
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: .85rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  position: relative;
  padding: .25rem 0;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px;
  height: 2px; background: var(--accent);
  transition: right var(--dur) var(--ease);
}
.nav a:hover::after, .nav a[aria-current="page"]::after { right: 0; }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: .4rem .55rem;
  margin-left: auto;
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav ul {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--rule);
    margin: 0; padding: .5rem 0;
    gap: 0;
    transform: translateY(-8px);
    opacity: 0; pointer-events: none;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  }
  .nav ul.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav ul li { border-top: 1px solid var(--rule); }
  .nav ul a { display: block; padding: .9rem var(--gutter); }
}

/* ---------- Hero ------------------------------------------ */
.hero {
  padding: clamp(4rem, 10vw, 9rem) 0 clamp(3rem, 7vw, 6rem);
  position: relative;
  overflow: hidden;
}
.hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
@media (max-width: 880px) {
  .hero__inner { grid-template-columns: 1fr; text-align: left; }
}
.hero h1 .accent { color: var(--accent-hot); font-style: italic; }
.hero h1 .wobble {
  display: inline-block;
  animation: wobble 6s var(--ease) infinite;
  transform-origin: 50% 80%;
}
.hero p { font-size: clamp(1rem, 1.6vw, 1.2rem); max-width: 56ch; color: var(--ink-dim); }
.hero__cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
/* Hero art: backlit logo, mostly shrouded.
   The logo itself is rendered as a near-black silhouette and sits in front
   of a dim, dark-red radial glow that "leaks" around its edges. A vignette
   layer keeps the corners swallowed in darkness so the gate is suggested
   more than it is shown. */
.hero__art {
  position: relative;
  width: clamp(220px, 30vw, 360px);
  aspect-ratio: 1 / 1;
  isolation: isolate;
}
.hero__art img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 2;
  /* Logo at full strength — the source PNG is already a near-black
     silhouette, so leaving it untouched preserves the red eyes. A soft
     dark drop-shadow keeps it grounded against the glow. */
  filter: drop-shadow(0 0 18px rgba(0,0,0,.9));
  /* Subtle, slow breathing — replaces the old floaty bounce. */
  animation: emberPulse 9s ease-in-out infinite;
}
/* The backlight: a deep, dark red glow that's clearly larger than the
   logo so it bleeds out around the silhouette on all sides. */
.hero__art-glow {
  position: absolute;
  inset: -55%;
  z-index: 1;
  background:
    radial-gradient(closest-side at 50% 50%,
      rgba(255, 70, 55, .85) 0%,
      rgba(220, 30, 40, .70) 14%,
      rgba(170, 16, 26, .55) 28%,
      rgba(110, 8, 16, .38) 46%,
      rgba(50, 2, 6, .18) 66%,
      transparent 82%);
  filter: blur(34px);
  animation: emberFlicker 7s ease-in-out infinite;
  pointer-events: none;
}
/* Tighter inner ember — the "lit from inside the gate" hot core. */
.hero__art-glow::after {
  content: "";
  position: absolute;
  inset: 30% 32%;
  background: radial-gradient(closest-side,
    rgba(255, 110, 80, .75),
    rgba(200, 30, 30, .45) 50%,
    rgba(120, 10, 18, .22) 75%,
    transparent 90%);
  filter: blur(20px);
  animation: emberFlicker 4.7s ease-in-out infinite reverse;
}
/* Vignette: pulls the far corners back into darkness so the figure is
   shrouded, not spotlit. Pulled outward and softened so it doesn't
   clip the glow itself. */
.hero__art-vignette {
  position: absolute;
  inset: -55%;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(closest-side at 50% 50%,
    transparent 55%,
    rgba(10, 10, 13, .45) 82%,
    rgba(10, 10, 13, .85) 100%);
  mix-blend-mode: multiply;
}

/* ---------- Cards (games / blog / press) ------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}
.card {
  position: relative;
  display: flex; flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,.02), transparent 50%),
    var(--bg-elev);
  transition: transform var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              box-shadow var(--dur) var(--ease);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), rgba(255,42,61,.10), transparent 40%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  pointer-events: none;
}
.card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in oklab, var(--accent) 60%, var(--rule));
  box-shadow: var(--shadow-1);
}
.card:hover::before { opacity: 1; }
.card h3 { color: var(--ink); margin-bottom: .25rem; }
.card .tag {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent-soft);
  margin-bottom: .75rem;
}
.card .meta {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
  padding-top: 1rem;
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--ink-faint);
}

.game-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 1rem;
  align-items: start;
}
.game-card .sigil {
  width: 96px; height: 96px;
  background: linear-gradient(135deg, var(--accent), var(--accent-cool));
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 2rem; color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), 0 10px 30px -15px var(--accent);
}
.game-card.coming .sigil {
  background: repeating-linear-gradient(45deg, var(--bg-elev-2) 0 8px, var(--bg-elev) 8px 16px);
  color: var(--ink-faint);
}

/* ---------- About ----------------------------------------- */
.about {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 880px) {
  .about { grid-template-columns: 1.2fr .8fr; align-items: start; }
}
.factoids {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .6rem;
}
.factoids li {
  display: flex; gap: .8rem; align-items: baseline;
  padding: .6rem .8rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.factoids strong {
  font-family: var(--font-mono);
  color: var(--accent-soft);
  font-size: .8rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  min-width: 7ch;
}

/* ---------- Feedback form --------------------------------- */
.feedback {
  display: grid; gap: 1rem;
  max-width: 640px;
}
.feedback .row { display: grid; gap: .35rem; }
.feedback label {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.feedback input,
.feedback select,
.feedback textarea {
  width: 100%;
  padding: .8rem 1rem;
  background: var(--bg-elev);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.feedback input:focus,
.feedback select:focus,
.feedback textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,42,61,.18);
}
.feedback textarea { min-height: 140px; resize: vertical; }
.feedback .actions { display: flex; gap: .75rem; align-items: center; }
.feedback .hint { font-size: .8rem; color: var(--ink-faint); }

/* ---------- Footer ---------------------------------------- */
.site-footer {
  margin-top: 3rem;
  padding: 2.2rem 0;
  border-top: 1px solid var(--rule);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: .82rem;
}
.site-footer .wrap {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
}
.site-footer a { color: var(--ink-dim); }
.site-footer a:hover { color: var(--accent-hot); }

/* ---------- Game page ------------------------------------- */
.game-hero {
  padding: clamp(4rem, 9vw, 7rem) 0 clamp(2rem, 5vw, 4rem);
}
.game-hero h1 {
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  background: linear-gradient(120deg, #fff 30%, var(--accent-hot) 60%, var(--accent-cool) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.game-hero .specs {
  display: flex; flex-wrap: wrap; gap: 1rem;
  font-family: var(--font-mono); font-size: .82rem;
  color: var(--ink-dim); margin-top: 1rem;
}
.game-hero .specs span::before { content: "› "; color: var(--accent-hot); }

.tabs {
  position: sticky;
  top: var(--sticky-h);
  z-index: 20;
  background: color-mix(in oklab, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-block: 1px solid var(--rule);
  margin-block: 1.5rem 2rem;
}
.tabs .wrap {
  display: flex; gap: .25rem; overflow-x: auto;
}
.tabs a {
  padding: .9rem 1rem;
  font-family: var(--font-mono);
  font-size: .82rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); border-color: var(--accent); }

/* Game page has the studio header AND a sticky tab strip, so
   anchors must clear both. Applied via <body class="game-page">. */
.game-page {
  --sticky-h: 120px;
}

.timeline {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 1rem;
}
.timeline li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  position: relative;
}
.timeline time {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .12em;
  color: var(--accent-soft);
}
.timeline h4 {
  margin: 0 0 .35rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.press-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.press-grid .card .meta a { color: var(--accent-hot); }

.kv {
  display: grid; grid-template-columns: 9rem 1fr;
  gap: .35rem 1rem;
  padding: 0; margin: 0;
}
.kv dt {
  font-family: var(--font-mono);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .15em;
  color: var(--ink-dim);
}
.kv dd { margin: 0; }
@media (max-width: 540px) {
  .kv { grid-template-columns: 1fr; gap: .1rem 0; margin-bottom: .8rem; }
  .kv dd { margin-bottom: .6rem; }
}

/* ---------- Reveal-on-scroll ------------------------------ */
/* Default: visible. We only hide when JS has confirmed it can
   reliably reveal them. This makes the site safe for no-JS,
   reduced-motion, or JS-error scenarios. */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  will-change: opacity, transform;
}
/* Set by JS on <html> once IntersectionObserver is wired up. */
html.js-reveal .reveal {
  opacity: 0;
  transform: translateY(18px);
}
html.js-reveal .reveal.is-visible {
  opacity: 1;
  transform: none;
}
/* Reduced-motion users skip the dance entirely — always visible. */
@media (prefers-reduced-motion: reduce) {
  html.js-reveal .reveal,
  html.js-reveal .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Konami easter egg overlay --------------------- */
.invocation {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(255,42,61,.25), rgba(0,0,0,.85) 60%);
  z-index: 100;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 3rem);
  color: var(--accent-soft);
  text-shadow: 0 0 30px var(--accent);
  letter-spacing: .1em;
  text-align: center;
  padding: 2rem;
  animation: invoke 2.4s var(--ease) forwards;
  pointer-events: none;
}

/* ---------- Animations ------------------------------------ */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-14px) rotate(1deg); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
/* Hero backlight: very slow, low-amplitude breathing. */
@keyframes emberPulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(0,0,0,.9)); }
  50%      { filter: drop-shadow(0 0 28px rgba(140,12,20,.55)); }
}
@keyframes emberFlicker {
  0%, 100% { opacity: .85; transform: scale(1); }
  35%      { opacity: 1;   transform: scale(1.04); }
  70%      { opacity: .78; transform: scale(.98); }
}
@keyframes wobble {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-1.5deg); }
  60%      { transform: rotate(1.2deg); }
}
@keyframes jiggle {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-12deg); }
  50% { transform: rotate(8deg); }
  75% { transform: rotate(-4deg); }
}
@keyframes invoke {
  0%   { opacity: 0; transform: scale(.9); }
  20%  { opacity: 1; transform: scale(1); }
  80%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.05); }
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
