/* ============================================================
   THE ARCANUM - Stacked Alchemist gaming hub
   Brand: alchemy + forge. Dark workshop, molten gold, ember
   accents, alembic glyphs. Sister to stackedalchemist.dev.
   ============================================================ */

:root {
  --bg: #0c0a0f;            /* deep workshop dark, faint violet */
  --bg-2: #15121b;
  --panel: #1a1622;
  --panel-2: #221c2c;
  --line: #2e2738;
  --gold: #d9a431;          /* molten gold, primary accent */
  --gold-bright: #f0c155;
  --ember: #c2541f;         /* forge ember, secondary */
  --violet: #6b4fa0;        /* arcane glow */
  --text: #e7e0d4;
  --text-dim: #a299b2;
  --text-mute: #6f6680;

  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Courier New", monospace;

  --maxw: 1200px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(107,79,160,0.18), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(194,84,31,0.10), transparent 50%),
    var(--bg);
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(180deg, rgba(12,10,15,0.97), rgba(12,10,15,0.85));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.05rem; letter-spacing: 0.04em; color: var(--text);
  display: flex; align-items: center; gap: 9px; white-space: nowrap;
}
.brand .alembic { color: var(--gold); font-size: 1.3rem; }
.brand small {
  display: block; font-family: var(--font-mono); font-weight: 400;
  font-size: 0.62rem; letter-spacing: 0.18em; color: var(--text-mute);
  text-transform: uppercase;
}
.brand:hover { color: var(--gold-bright); }
.topbar-links { display: flex; gap: 22px; font-size: 0.9rem; }
.topbar-links a { color: var(--text-dim); }
.topbar-links a:hover { color: var(--text); }
@media (max-width: 640px) { .topbar-links { display: none; } }

/* ---------- hero ---------- */
.hero { position: relative; padding: 84px 0 56px; text-align: center; overflow: hidden; }
.hero::before {
  content: "\2697"; /* alembic */
  position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  font-size: 3.4rem; color: var(--gold); opacity: 0.12;
}
.eyebrow {
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.32em; font-size: 0.72rem; color: var(--ember);
  display: block; margin-bottom: 1.1em;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.3rem, 6vw, 4.2rem); line-height: 1.05;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, var(--text) 40%, var(--gold) 160%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lede {
  max-width: 600px; margin: 1.1em auto 0;
  color: var(--text-dim); font-size: 1.1rem;
}
.hub-counts {
  display: inline-block; margin-top: 1.6em;
  font-family: var(--font-mono); font-size: 0.8rem;
  letter-spacing: 0.08em; color: var(--gold);
  border: 1px solid var(--line); padding: 6px 16px; border-radius: 2px;
  background: rgba(217,164,49,0.05);
}

/* ---------- search ---------- */
.search-zone { max-width: 600px; margin: 36px auto 0; }
#hub-search {
  width: 100%; background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--gold); color: var(--text);
  font-family: var(--font-body); font-size: 1.02rem; padding: 13px 18px;
}
#hub-search::placeholder { color: var(--text-mute); }
#hub-search:focus { outline: none; border-left-color: var(--ember); border-color: var(--violet); }
#search-note { text-align: center; font-size: 0.85rem; color: var(--text-dim); min-height: 1.4em; margin-top: 10px; }

/* ---------- section scaffolding ---------- */
.section { padding: 30px 0; }
.section-label {
  font-family: var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.2em; font-size: 0.7rem; color: var(--ember);
  display: flex; align-items: center; gap: 10px; margin-bottom: 18px;
}
.section-label::before { content: "\2697"; color: var(--gold); font-size: 1rem; }

.genre-head {
  display: flex; align-items: baseline; gap: 14px;
  border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 22px;
}
.genre-head h2 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.5rem; color: var(--text); letter-spacing: 0.02em;
}
.genre-count { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-mute); }
.genre-block { padding: 26px 0; }

/* ---------- grids ---------- */
.game-grid, .featured-grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
}
.featured-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

/* ---------- game card ---------- */
.game-card {
  position: relative; display: flex; flex-direction: column;
  background: linear-gradient(165deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-top: 3px solid var(--gold);
  padding: 22px 22px 18px; color: var(--text);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
  min-height: 200px;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px rgba(0,0,0,0.55), 0 0 0 1px rgba(217,164,49,0.18);
}
.game-card h3 {
  font-family: var(--font-display); font-weight: 600; font-size: 1.3rem;
  margin-bottom: 10px; color: var(--text); letter-spacing: 0.01em;
}
.game-card:hover h3 { color: var(--gold-bright); }
.game-card p { font-size: 0.92rem; color: var(--text-dim); flex-grow: 1; }

.genre-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.genre-tag {
  font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-dim);
  border: 1px solid var(--line); padding: 2px 8px; border-radius: 2px;
}

.card-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 0.8rem;
}
.card-meta .updated { font-family: var(--font-mono); color: var(--text-mute); }
.card-meta .go { color: var(--gold); font-weight: 500; }
.game-card:hover .go { color: var(--gold-bright); }

/* status badge */
.badge {
  position: absolute; top: 16px; right: 16px;
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 2px; border: 1px solid;
}
.badge-live { color: #7bbf6a; border-color: #3f5e38; background: rgba(123,191,106,0.08); }
.badge-building { color: var(--gold); border-color: #5c4a1f; background: rgba(217,164,49,0.08); }
.badge-planned { color: var(--text-mute); border-color: var(--line); }

/* non-live cards read as inert */
.game-card.status-building, .game-card.status-planned { cursor: default; opacity: 0.92; }
.game-card.status-building:hover, .game-card.status-planned:hover {
  transform: none; box-shadow: none; border-top-color: inherit;
}
.game-card.status-building:hover h3, .game-card.status-planned:hover h3 { color: var(--text); }

.is-hidden { display: none !important; }

/* ---------- footer ---------- */
.footer {
  border-top: 1px solid var(--line); margin-top: 60px;
  padding: 46px 0; background: var(--bg-2); color: var(--text-mute);
}
.footer .wrap { display: flex; flex-wrap: wrap; gap: 30px; justify-content: space-between; }
.footer .col { max-width: 460px; }
.footer h4 {
  font-family: var(--font-display); color: var(--text);
  font-size: 1rem; margin-bottom: 10px; letter-spacing: 0.03em;
}
.footer p { font-size: 0.88rem; margin-bottom: 8px; }
.footer .links a { color: var(--text-dim); margin-right: 16px; font-size: 0.88rem; }
.footer .links a:hover { color: var(--gold); }
.footer .quote { font-style: italic; color: var(--text-dim); border-left: 2px solid var(--ember); padding-left: 14px; }

/* ---------- back to top ---------- */
.totop {
  position: fixed; right: 20px; bottom: 20px;
  background: var(--gold); color: #1a1410; border: none;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 600;
  padding: 10px 14px; cursor: pointer; opacity: 0; pointer-events: none;
  transition: opacity 0.2s; z-index: 90; border-radius: 2px;
}
.totop.show { opacity: 0.92; pointer-events: auto; }
.totop:hover { background: var(--gold-bright); }

/* ============================================================
   LIVING SANCTUM - the alchemist's touch
   Ambient embers (canvas), breathing aura, a rotating sigil
   crest, drifting glyphs, and cards that smolder.
   ============================================================ */

/* --- stacking: ambient layers sit behind the content --- */
body { position: relative; }
body::before {
  content: ""; position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(38% 38% at 50% 10%, rgba(217,164,49,0.10), transparent 70%),
    radial-gradient(42% 42% at 82% 88%, rgba(194,84,31,0.09), transparent 70%),
    radial-gradient(40% 40% at 10% 62%, rgba(107,79,160,0.12), transparent 70%);
  animation: auraDrift 20s ease-in-out infinite alternate;
}
@keyframes auraDrift {
  from { transform: scale(1) translate3d(0,0,0); opacity: 0.7; }
  to   { transform: scale(1.14) translate3d(0,-1.5%,0); opacity: 1; }
}
#ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.hero, main, .footer { position: relative; z-index: 1; }
.totop { z-index: 120; }

/* the old static alembic is replaced by the rotating crest */
.hero::before { display: none; }
.hero { padding-top: 58px; }

/* --- rotating sigil crest --- */
.sigil-ring {
  position: relative; width: 116px; height: 116px; margin: 0 auto 26px;
  display: grid; place-items: center;
}
.sigil-ring::before, .sigil-ring::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
}
.sigil-ring::before {
  border: 1px solid rgba(217,164,49,0.20);
  border-top-color: rgba(240,193,85,0.65);
  border-right-color: rgba(194,84,31,0.45);
  animation: spin 26s linear infinite;
}
.sigil-ring::after {
  inset: 17px; border: 1px dashed rgba(107,79,160,0.38);
  animation: spin 18s linear infinite reverse;
}
.sigil-core {
  font-size: 2.5rem; color: var(--gold);
  text-shadow: 0 0 18px rgba(240,193,85,0.55), 0 0 40px rgba(194,84,31,0.35);
  animation: breathe 4.5s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe {
  0%,100% { opacity: 0.82; transform: scale(1);
            text-shadow: 0 0 16px rgba(240,193,85,0.45), 0 0 34px rgba(194,84,31,0.25); }
  50%     { opacity: 1; transform: scale(1.06);
            text-shadow: 0 0 26px rgba(240,193,85,0.78), 0 0 60px rgba(194,84,31,0.5); }
}

/* --- living sheen on the title --- */
.hero h1 {
  background: linear-gradient(100deg,
    var(--text) 20%, var(--gold-bright) 45%, var(--gold) 55%, var(--text) 80%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: sheen 9s ease-in-out infinite;
}
@keyframes sheen {
  0%,100% { background-position: 0% 50%; }
  50%     { background-position: 100% 50%; }
}

/* --- drifting hero glyphs --- */
.hero-glyphs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.hero-glyphs span {
  position: absolute; left: var(--x); top: var(--y);
  font-family: var(--font-display); font-size: 1.5rem; color: var(--gold);
  opacity: 0;
  animation: glyphFloat var(--t, 22s) ease-in-out var(--d, 0s) infinite;
}
@keyframes glyphFloat {
  0%   { opacity: 0; transform: translateY(12px) rotate(0deg); }
  25%  { opacity: 0.18; }
  50%  { opacity: 0.30; transform: translateY(-14px) rotate(8deg); }
  75%  { opacity: 0.18; }
  100% { opacity: 0; transform: translateY(12px) rotate(0deg); }
}

/* --- search bar arcane focus glow --- */
#hub-search:focus {
  box-shadow: 0 0 0 1px var(--violet), 0 0 22px rgba(107,79,160,0.28);
}

/* --- cards that smolder --- */
.game-card { overflow: hidden; }
.game-card::after {
  content: "\2697"; position: absolute; right: 12px; bottom: 8px;
  font-family: var(--font-display); font-size: 2.6rem; line-height: 1;
  color: var(--gold); opacity: 0.05; pointer-events: none; transition: opacity 0.25s;
}
.game-card:hover::after { opacity: 0.13; }
.game-card:hover {
  box-shadow: 0 16px 40px rgba(0,0,0,0.6),
              0 0 26px rgba(217,164,49,0.16),
              0 0 0 1px rgba(240,193,85,0.25);
}
.game-card.status-live { animation: cardGlow 6.5s ease-in-out infinite; }
@keyframes cardGlow {
  0%,100% { box-shadow: 0 0 0 rgba(0,0,0,0); }
  50%     { box-shadow: 0 0 20px rgba(217,164,49,0.10); }
}
.badge-live { animation: livePulse 3.5s ease-in-out infinite; }
@keyframes livePulse {
  0%,100% { box-shadow: 0 0 0 rgba(123,191,106,0); }
  50%     { box-shadow: 0 0 11px rgba(123,191,106,0.45); }
}

/* the counts pill gets a soft glow so it reads as "alive" */
.hub-counts { box-shadow: 0 0 18px rgba(217,164,49,0.08) inset; }
