/* ════════════════════════════════════════════════════════════
   play.apeiron.games — Shared Portal Design System
   Apeiron navy/gold. Cinzel (display) / Lora (body) / Montserrat (UI).
   Matches the apeiron.games + obsidana studio system.
   ════════════════════════════════════════════════════════════ */

:root {
  /* Palette */
  --navy:        #0F1D38;
  --navy-deep:   #09162C;
  --obsidian:    #080B10;
  --gold:        #C9A84C;
  --gold-soft:   #E0C778;
  --paper:       #FAFAFA;
  --paper-dim:   #C7CEDB;
  --line:        rgba(201, 168, 76, 0.28);
  --danger:      #E06C5A;

  /* Fonts */
  --font-d: "Cinzel", Georgia, serif;
  --font-b: "Lora", Georgia, serif;
  --font-u: "Montserrat", system-ui, sans-serif;

  /* Rhythm */
  --r: 3px;
  --section: clamp(3.5rem, 9vw, 7rem);
  --wrap: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-b);
  background: var(--obsidian);
  color: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-d); font-weight: 500; line-height: 1.15; }
h1 { font-size: clamp(2.2rem, 5.4vw, 4rem); letter-spacing: 0.01em; }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.7rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.45rem); }

.eyebrow {
  font-family: var(--font-u);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--gold-soft); }

.muted { color: var(--paper-dim); }

/* ── Layout ─────────────────────────────────────────────────── */
.wrap { width: min(var(--wrap), 92vw); margin-inline: auto; }

.divider {
  width: 64px; height: 1px;
  background: var(--gold);
  opacity: 0.55;
  margin: 1.5rem 0;
}
.divider.center { margin-inline: auto; }

/* ── Top bar (shared shell chrome) ──────────────────────────── */
.portal-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(201,168,76,0.14);
  background: rgba(8,11,16,0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}
.portal-bar .brand {
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-d); font-size: 1.05rem; letter-spacing: 0.03em;
  color: var(--paper);
}
.portal-bar .brand b { color: var(--gold); font-weight: 500; }
.portal-bar .brand:hover { color: var(--paper); }
.portal-bar .brand .mark {
  width: 26px; height: 26px; flex: 0 0 26px;
}
.portal-bar nav { display: flex; align-items: center; gap: 1.4rem; font-family: var(--font-u); font-size: 0.8rem; letter-spacing: 0.04em; }
.portal-bar nav a { color: var(--paper-dim); }
.portal-bar nav a:hover { color: var(--gold); }

/* Auth state chip (filled by portal.js) */
.auth-chip { display: flex; align-items: center; gap: 0.6rem; font-family: var(--font-u); font-size: 0.8rem; }
.auth-chip .who { color: var(--paper-dim); }
.auth-chip [data-when] { display: none; }        /* toggled by JS */

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  font-family: var(--font-u);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  padding: 0.85rem 1.5rem;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold { background: var(--gold); color: var(--obsidian); }
.btn-gold:hover { background: var(--gold-soft); color: var(--obsidian); }
.btn-ghost { background: transparent; color: var(--paper); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-block { width: 100%; }
.btn-google { background: #fff; color: #1f1f1f; border-color: #fff; }
.btn-google:hover { background: #f1f1f1; color: #1f1f1f; }
.btn-google svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Cards / games grid ─────────────────────────────────────── */
.games {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.4rem;
}
.game-card {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid rgba(201,168,76,0.16);
  border-radius: var(--r);
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  overflow: hidden;
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.game-card:hover { transform: translateY(-3px); border-color: var(--gold); }
.game-card .thumb {
  aspect-ratio: 16 / 10;
  background: var(--navy-deep) center/cover no-repeat;
  border-bottom: 1px solid rgba(201,168,76,0.12);
  display: grid; place-items: center;
}
.game-card .thumb .glyph { font-family: var(--font-d); font-size: 2.6rem; color: var(--gold); opacity: 0.85; }
.game-card .body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.game-card .tag {
  font-family: var(--font-u); font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
}
.game-card h3 { color: var(--paper); }
.game-card p { font-size: 0.95rem; color: var(--paper-dim); flex: 1; }
.game-card .cta-row { margin-top: 0.8rem; display: flex; gap: 0.6rem; align-items: center; }

.badge {
  font-family: var(--font-u); font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.28rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--gold);
  align-self: flex-start;
}
.badge.soon { color: var(--paper-dim); border-color: rgba(199,206,219,0.3); }

/* ── Footer ─────────────────────────────────────────────────── */
.portal-foot {
  margin-top: auto;
  padding: 2rem clamp(1rem, 4vw, 2.5rem);
  border-top: 1px solid rgba(201,168,76,0.14);
  font-family: var(--font-u); font-size: 0.78rem; color: var(--paper-dim);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
}
.portal-foot a { color: var(--paper-dim); }
.portal-foot a:hover { color: var(--gold); }

/* ── Auth / login layout ────────────────────────────────────── */
.auth-shell { flex: 1; display: grid; place-items: center; padding: var(--section) 1rem; }
.auth-card {
  width: min(440px, 94vw);
  border: 1px solid rgba(201,168,76,0.18);
  border-radius: var(--r);
  background: linear-gradient(165deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding: clamp(1.6rem, 4vw, 2.4rem);
}
.auth-card h1 { font-size: clamp(1.6rem, 3.6vw, 2.2rem); }
.auth-card .lede { color: var(--paper-dim); font-size: 0.98rem; margin-top: 0.4rem; }
.auth-card .gate-reason {
  margin: 1rem 0 0; padding: 0.7rem 0.9rem;
  border-left: 2px solid var(--gold);
  background: rgba(201,168,76,0.07);
  font-size: 0.9rem; color: var(--paper);
}
.field { margin-top: 1rem; }
.field label { display: block; font-family: var(--font-u); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--paper-dim); margin-bottom: 0.4rem; }
.field input[type="email"] {
  width: 100%; padding: 0.85rem 1rem;
  background: var(--obsidian); color: var(--paper);
  border: 1px solid var(--line); border-radius: var(--r);
  font-family: var(--font-b); font-size: 1rem;
}
.field input[type="email"]:focus { outline: none; border-color: var(--gold); }

.consent {
  display: flex; gap: 0.7rem; align-items: flex-start;
  margin-top: 1rem; padding: 0.9rem 1rem;
  border: 1px solid rgba(201,168,76,0.16); border-radius: var(--r);
  background: rgba(15,29,56,0.5);
}
.consent input[type="checkbox"] { margin-top: 0.25rem; width: 18px; height: 18px; accent-color: var(--gold); flex: 0 0 18px; }
.consent label { font-family: var(--font-b); font-size: 0.88rem; color: var(--paper-dim); cursor: pointer; }
.consent label b { color: var(--paper); font-weight: 600; }

.or-rule { display: flex; align-items: center; gap: 0.8rem; margin: 1.4rem 0; color: var(--paper-dim); font-family: var(--font-u); font-size: 0.72rem; letter-spacing: 0.14em; }
.or-rule::before, .or-rule::after { content: ""; height: 1px; background: rgba(201,168,76,0.18); flex: 1; }

.form-note { font-size: 0.78rem; color: var(--paper-dim); margin-top: 1rem; text-align: center; }
.form-msg { margin-top: 1rem; padding: 0.8rem 1rem; border-radius: var(--r); font-size: 0.9rem; display: none; }
.form-msg.ok  { display: block; background: rgba(201,168,76,0.1); border: 1px solid var(--line); color: var(--paper); }
.form-msg.err { display: block; background: rgba(224,108,90,0.1); border: 1px solid rgba(224,108,90,0.4); color: var(--danger); }

.turnstile-slot { margin-top: 1rem; min-height: 65px; }

/* ── Gate modal (in-game "wow moment" gate) ─────────────────── */
.gate-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: none; place-items: center;
  background: rgba(8,11,16,0.82); backdrop-filter: blur(6px);
  padding: 1rem;
}
.gate-overlay.open { display: grid; }
.gate-overlay .auth-card { animation: gate-in 0.35s var(--ease); }
@keyframes gate-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── Utility ────────────────────────────────────────────────── */
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; }
.hidden { display: none !important; }

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