/*
  Imge Games — Magical, cinematic theme (v6)
  - Full-screen header hero
  - Enter veil to reliably start audio with first gesture
*/

:root {
  --bg: #06080b;
  --surface: #0c1016;
  --elev: #151b24;
  --fg: #e8ecf0;
  --muted: #9aa6b2;
  --line: #1e2632;
  --accent: #a6d4ff;
  --accent-2: #b7ffd9;
  --accent-3: #ffc4f2;

  --radius: 14px;
  --shadow: 0 12px 40px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji;
  background: radial-gradient(1200px 700px at 70% -10%, rgba(183,255,217,0.06), transparent 60%),
              radial-gradient(1000px 560px at 10% -20%, rgba(166,212,255,0.08), transparent 60%),
              var(--bg);
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent background scroll when dialogs/veil are open */
html.no-scroll, body.no-scroll { overflow: hidden; height: 100%; }

.container { width: min(1160px, 92%); margin: 0 auto; }

/* Veil */
.veil { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background:
  radial-gradient(120% 100% at 50% 50%, rgba(0,0,0,0.45), rgba(0,0,0,0.32) 60%, rgba(0,0,0,0.26) 80%, rgba(0,0,0,0.22) 100%);
  transition: opacity 360ms ease, visibility 360ms ease; }
.veil::before { content: ""; position: absolute; inset: 0; pointer-events: none; background:
  radial-gradient(120% 100% at 60% 30%, rgba(255,196,242,0.12), transparent 60%),
  radial-gradient(120% 100% at 30% 70%, rgba(183,255,217,0.12), transparent 60%); }
.veil.hidden { opacity: 0; visibility: hidden; }
.veil-inner { text-align: center; display: grid; gap: 12px; padding: 24px; background: rgba(12,16,22,0.28); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }
.veil-brand { font-weight: 800; letter-spacing: 0.6px; font-size: 1.3rem; }
.veil-brand { position: relative; }
.veil-copy { color: #cfd6dd; margin: 4px 0 8px; }
.veil-hint { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }
.veil-actions { display: flex; gap: 10px; justify-content: center; align-items: center; }
.veil-button { justify-self: center; }
.veil-actions .button[aria-pressed="true"] {
  border-color: #2f3e5b;
  background: linear-gradient(180deg, #22304a, #141b2b);
}
.button .icon { display: inline-block; vertical-align: -2px; margin-right: 8px; fill: currentColor; opacity: 0.95; }

/* Align veil action button icons vertically with text */
.veil-actions .button { display: inline-flex; align-items: center; gap: 8px; }
.veil-actions .button .icon { margin-right: 0; vertical-align: middle; }

/* Header (full-screen hero) */
.site-header.full { position: relative; min-height: 100vh; min-height: 100svh; display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--line); }
.header-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 80; backdrop-filter: saturate(120%) blur(10px); background: transparent; border-bottom: 1px solid transparent; transition: background 200ms ease, border-color 200ms ease, box-shadow 200ms ease; }
.header-bar.scrolled { background: linear-gradient(to bottom, rgba(6,8,11,0.92), rgba(6,8,11,0.86)); border-bottom-color: rgba(255,255,255,0.08); box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { font-weight: 800; letter-spacing: 0.6px; font-size: 1.1rem; position: relative; }
.brand, .brand:link, .brand:visited { color: var(--fg); text-decoration: none; }
.accent { color: var(--accent); }
.nav a { color: var(--muted); text-decoration: none; margin-left: 20px; font-size: 0.95rem; }
.nav a:hover { color: var(--fg); }

.hero-inner { text-align: center; padding: 140px 0 110px; position: relative; z-index: 3; }
.eyebrow { color: var(--muted); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.8rem; }
.site-header h1 { margin: 14px 0 12px; font-size: clamp(2.5rem, 7.2vw, 4rem); line-height: 1.06; }
.lead { color: #cfd6dd; font-size: 1.08rem; max-width: 760px; margin: 0 auto; }
.cta { margin-top: 22px; display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; }
.scroll-cue { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); opacity: 0.8; color: var(--accent); animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -8px); } }

/* Layers */
.aurora { position: absolute; inset: -10% -10% -20% -10%; z-index: 1; filter: blur(40px) saturate(120%); opacity: 0.9; transform: translate3d(var(--mx,0), var(--my,0), 0); }
.a1 { background: radial-gradient(60% 60% at 30% 20%, rgba(166,212,255,0.30), transparent 60%),
                 radial-gradient(50% 50% at 70% 30%, rgba(255,196,242,0.24), transparent 60%); animation: drift1 18s ease-in-out infinite alternate; }
.a2 { background: radial-gradient(60% 60% at 60% 60%, rgba(183,255,217,0.24), transparent 60%),
                 radial-gradient(50% 50% at 20% 70%, rgba(166,212,255,0.20), transparent 70%); animation: drift2 22s ease-in-out infinite alternate; mix-blend-mode: screen; }
.a3 { background: radial-gradient(60% 60% at 40% 40%, rgba(255,196,242,0.22), transparent 60%),
                 radial-gradient(50% 50% at 80% 20%, rgba(183,255,217,0.20), transparent 60%); animation: drift3 26s ease-in-out infinite alternate; mix-blend-mode: screen; }
@keyframes drift1 { from { transform: translate3d(-16px, -12px, 0); } to { transform: translate3d(16px, 14px, 0); } }
@keyframes drift2 { from { transform: translate3d(14px, -10px, 0); } to { transform: translate3d(-14px, 12px, 0); } }
@keyframes drift3 { from { transform: translate3d(10px, 16px, 0); } to { transform: translate3d(-12px, -16px, 0); } }

/* Canvases */
#stars, #sparkles { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; }
#sparkles { z-index: 2; pointer-events: none; }

/* Buttons */
.button { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 18px; border-radius: 999px; background: linear-gradient(180deg, #1a2230, #111722); color: var(--fg); border: 1px solid #243045; text-decoration: none; font-weight: 700; letter-spacing: 0.2px; transition: transform 120ms ease, background 120ms ease, border-color 120ms ease; box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.button:hover { transform: translateY(-1px); border-color: #2f3e5b; }
.button:active { transform: translateY(0); }
.button.outline { background: transparent; border-color: #2d3748; }
.muted { color: var(--muted); }

/* Sections */
.section { padding: 64px 0; }
.section h2 { font-size: clamp(1.5rem, 3.8vw, 2.2rem); margin: 0 0 10px; }
.section p { color: #c7ccd3; }

/* Section backdrop gradients to avoid visual gaps above content on mobile */
.section.principles,
.section.tales,
.section.games,
.section.featured,
.section.contact {
  position: relative;
  background: none; /* avoid stacking with body gradient to prevent perceived repetition */
}

/* Top-only gradient overlay so tint never repeats down the section */
.section.principles::before,
.section.tales::before,
.section.games::before,
.section.featured::before,
.section.contact::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: clamp(90px, 16vw, 160px);
  pointer-events: none;
  z-index: 0;
  /* Magical hues echo the header aurora, kept very subtle */
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(166,212,255,0.060), transparent 60%),
    radial-gradient(110% 60% at 20% 6%, rgba(183,255,217,0.045), transparent 55%),
    radial-gradient(120% 60% at 80% 10%, rgba(255,196,242,0.040), transparent 55%);
}

/* Gentle bottom glow to close each section, mirroring the hero's feel */
.section.principles::after,
.section.tales::after,
.section.games::after,
.section.featured::after,
.section.contact::after {
  content: "";
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: clamp(60px, 14vw, 140px);
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(120% 70% at 50% 100%, rgba(166,212,255,0.035), transparent 60%),
    radial-gradient(110% 60% at 80% 92%, rgba(183,255,217,0.030), transparent 55%),
    radial-gradient(120% 60% at 20% 90%, rgba(255,196,242,0.028), transparent 55%);
}

/* Mask the site-wide body glow inside long sections so it doesn't look like a
   second gradient reappears mid‑section on mobile (especially when cards stack). */
.section.principles,
.section.tales,
.section.games,
.section.featured,
.section.contact {
  background-color: var(--bg);
}

/* Cards */
.cards { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.card { background: linear-gradient(180deg, var(--surface), var(--elev)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: border-color 160ms ease, transform 160ms ease; }
.card:hover { border-color: rgba(166,212,255,0.35); transform: translateY(-1px); }
.card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: #c3c9d1; }

/* Tales Coming Soon */
.tales .coming { margin-top: 18px; position: relative; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background:
  radial-gradient(120% 100% at 60% 30%, rgba(255,196,242,0.12), transparent 60%),
  radial-gradient(120% 100% at 30% 70%, rgba(183,255,217,0.12), transparent 60%),
  linear-gradient(180deg, var(--surface), var(--elev)); }
.coming-inner { position: relative; display: grid; place-items: center; padding: clamp(48px, 10vw, 110px) 10px; }
.badge { font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; background: linear-gradient(90deg, #bfffe6, #a6d4ff, #ffc4f2, #bfffe6); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 24px rgba(160,200,255,0.25)); font-size: clamp(1.2rem, 5vw, 2.4rem); animation: shimmer 6s ease-in-out infinite; }
.sub { margin-top: 8px; color: #cfd6dd; opacity: 0.9; }
.twinkle { position: absolute; width: 2px; height: 2px; background: #fff; border-radius: 999px; opacity: 0.85; box-shadow:
  240px 40px 0 0 rgba(255,255,255,0.8),
  460px 60px 0 0 rgba(183,255,217,0.9),
  760px 30px 0 0 rgba(166,212,255,0.8),
  960px 70px 0 0 rgba(255,196,242,0.9);
  animation: tw1 14s linear infinite; }
.twinkle.t2 { transform: translateY(16px); animation-duration: 18s; opacity: 0.7; }
.twinkle.t3 { transform: translateY(-12px); animation-duration: 22s; opacity: 0.6; }
@keyframes tw1 { from { transform: translateX(-20%); } to { transform: translateX(20%); } }
@keyframes shimmer { 0%,100% { filter: drop-shadow(0 6px 24px rgba(160,200,255,0.25)); } 50% { filter: drop-shadow(0 10px 28px rgba(255,196,242,0.35)); } }

/* Contact */
.contact .button.email { margin-top: 8px; }
.contact { padding-bottom: 88px; }
.contact-note { margin-top: 10px; color: var(--muted); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #080a0d; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 28px 0; color: var(--muted); font-size: 0.92rem; flex-wrap: wrap; }
.fineprint { opacity: 0.85; }
.footer-right a { color: var(--fg); text-decoration: none; opacity: 0.9; }
.footer-right a:hover { opacity: 1; color: var(--accent); }

/* Logo structure and decorative star above the "I" */
.logo { display: inline-block; position: relative; }
.logo-i { position: relative; display: inline-block; }
.logo-i::before {
  content: '✧';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: -0.80em;
  font-size: 0.72em;
  color: var(--accent);
  opacity: 0.95;
  pointer-events: none;
  text-shadow: 0 0 6px rgba(166,212,255,0.45), 0 0 12px rgba(183,255,217,0.25);
}
/* Fine-tune star position per context */
.header-bar .logo-i::before { top: -0.74em; }
.header-bar .brand { position: relative; top: 2px; }
.veil-brand .logo-i::before { top: -0.78em; }

/* FAB sound toggle */
.fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: 52px; height: 52px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); background: linear-gradient(180deg, #1a2230, #111722); border: 1px solid #243045; box-shadow: 0 10px 28px rgba(0,0,0,0.4); transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, opacity 200ms ease; }
.fab:hover { transform: translateY(-1px); border-color: #2f3e5b; }
.fab.hidden { opacity: 0; pointer-events: none; }
.fab .icon { fill: currentColor; opacity: 0.95; }
.fab[aria-pressed="true"] .off { display: none; }
.fab[aria-pressed="false"] .on1, .fab[aria-pressed="false"] .on2 { display: none; }

/* Games: featured and grid */
.featured .wrap { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: center; }
.featured .cover { aspect-ratio: 16/9; border-radius: 14px; border: 1px solid var(--line); overflow: hidden; position: relative; }
.featured .cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 100% at 50% 70%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.55) 100%); }
.featured .meta h3 { margin: 0 0 6px; font-size: clamp(1.2rem, 3.2vw, 1.6rem); }
.featured .meta .tags { color: var(--muted); margin-bottom: 8px; }
.featured .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.cover.c1 { background:
  radial-gradient(80% 100% at 30% 60%, rgba(142,255,199,0.20), transparent 60%),
  radial-gradient(90% 100% at 70% 40%, rgba(121,200,255,0.18), transparent 60%),
  conic-gradient(from 180deg at 50% 90%, #0e1419, #112018, #0e1419); }
.cover.c2 { background:
  radial-gradient(80% 100% at 20% 30%, rgba(255,0,128,0.18), transparent 60%),
  radial-gradient(80% 100% at 80% 70%, rgba(0,255,204,0.20), transparent 60%),
  conic-gradient(from 90deg at 60% 40%, #0f0d16, #171b2a, #0f0d16); }
.cover.c3 { background:
  radial-gradient(100% 100% at 30% 30%, rgba(155,209,255,0.20), transparent 60%),
  radial-gradient(100% 100% at 70% 70%, rgba(255,179,236,0.16), transparent 60%),
  linear-gradient(180deg, #0e111a, #0b0f19); }
.cover.c4 { background:
  radial-gradient(80% 100% at 30% 70%, rgba(255,170,120,0.18), transparent 60%),
  radial-gradient(80% 100% at 70% 30%, rgba(255,90,90,0.16), transparent 60%),
  linear-gradient(180deg, #121116, #1b1410); }

.games .grid { margin-top: 18px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.game-card { display: grid; gap: 10px; background: linear-gradient(180deg, var(--surface), var(--elev)); border: 1px solid var(--line); border-radius: 14px; padding: 10px; box-shadow: var(--shadow); }
.game-card .cover { aspect-ratio: 16/9; border-radius: 10px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.game-card .cover::after { content:""; position:absolute; inset:0; background: radial-gradient(120% 100% at 50% 70%, rgba(0,0,0,0) 40%, rgba(0,0,0,0.5) 100%); }
.game-card .meta h3 { margin: 0; font-size: 1.06rem; }
.game-card .meta .tags { color: var(--muted); font-size: 0.92rem; }
.game-card .actions { display: flex; gap: 10px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .featured .wrap { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 720px) { .nav a { margin-left: 14px; } .header-inner { padding: 12px 0; } }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .aurora { animation: none !important; }
}
