/* PrishCraft — enchanted night-sky storybook */

:root {
  --ink: #0b0d24;
  --ink-2: #131642;
  --ink-3: #1c2058;
  --parchment: #f2ecff;
  --text: #dcd9f5;
  --text-dim: #9b97c9;
  --gold: #ffd24a;
  --gold-deep: #d9a520;
  --spell: #b9a8ee;
  --spell-deep: #7a5cc4;
  --glow: 0 0 24px rgba(255, 210, 74, 0.35);
  --card-bg: rgba(28, 32, 88, 0.55);
  --card-edge: rgba(185, 168, 238, 0.25);
  --radius: 22px;
  --display: "Cinzel Decorative", serif;
  --body: "Quicksand", sans-serif;
  --px: "Press Start 2P", monospace;
}

[data-theme="day"] {
  --ink: #cfe4ff;
  --ink-2: #e3efff;
  --ink-3: #f4f0ff;
  --text: #3a3460;
  --text-dim: #6e679c;
  --card-bg: rgba(255, 255, 255, 0.66);
  --card-edge: rgba(122, 92, 196, 0.25);
  --glow: 0 0 24px rgba(217, 165, 32, 0.3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--text);
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-2) 45%, var(--ink-3) 100%);
  overflow-x: hidden;
  min-height: 100vh;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden;
}

.pixel { font-family: var(--px); font-size: 9px; letter-spacing: 1px; color: var(--text-dim); }

/* ---------- loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--ink);
  transition: opacity 0.5s, visibility 0.5s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-star { font-size: 44px; color: var(--gold); animation: spin-pulse 1.2s ease-in-out infinite; }
#loader p { color: var(--text-dim); font-size: 14px; }
@keyframes spin-pulse {
  0%, 100% { transform: rotate(0deg) scale(1); text-shadow: 0 0 12px rgba(255,210,74,.6); }
  50% { transform: rotate(180deg) scale(1.35); text-shadow: 0 0 32px rgba(255,210,74,.9); }
}

/* ---------- sky ---------- */
#stars { position: fixed; inset: 0; z-index: -2; }
.aurora {
  position: fixed; inset: -20% -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 30% at 20% 15%, rgba(122, 92, 196, 0.35), transparent 70%),
    radial-gradient(35% 25% at 80% 10%, rgba(74, 158, 143, 0.22), transparent 70%),
    radial-gradient(50% 35% at 60% 90%, rgba(224, 106, 138, 0.16), transparent 70%);
  animation: aurora-drift 26s ease-in-out infinite alternate;
}
@keyframes aurora-drift {
  from { transform: translate3d(-2%, 0, 0) scale(1); }
  to { transform: translate3d(2%, 3%, 0) scale(1.06); }
}

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--ink) 75%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--card-edge);
}
.nav-logo {
  font-family: var(--display); font-weight: 700; font-size: 20px;
  color: var(--gold); text-decoration: none; white-space: nowrap;
}
.nav nav { display: flex; gap: clamp(10px, 2vw, 22px); flex-wrap: wrap; }
.nav nav a {
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 14px;
  opacity: 0.85; transition: opacity .15s, color .15s;
}
.nav nav a:hover { opacity: 1; color: var(--gold); }
.nav-right { display: flex; align-items: center; gap: 10px; }
#theme-toggle {
  border: 1px solid var(--card-edge); background: var(--card-bg);
  border-radius: 999px; width: 38px; height: 38px; font-size: 17px; cursor: pointer;
}
@media (max-width: 720px) { .nav nav { display: none; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; border: none; cursor: pointer; text-decoration: none;
  font-family: var(--body); font-weight: 700; border-radius: 999px;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:active { transform: scale(0.96); }
.btn-gold {
  color: #2a1f04;
  background: linear-gradient(135deg, #ffe28f, var(--gold) 55%, var(--gold-deep));
  box-shadow: var(--glow), inset 0 1px 0 rgba(255,255,255,.5);
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 0 38px rgba(255,210,74,.55), inset 0 1px 0 rgba(255,255,255,.5); }
.btn-ghost {
  color: var(--text); background: transparent;
  border: 2px solid var(--card-edge);
}
.btn-ghost:hover { border-color: var(--spell); color: var(--spell); transform: translateY(-2px); }
.btn-big { padding: 16px 30px; font-size: 17px; }
.btn-small { padding: 9px 18px; font-size: 14px; }

/* ---------- hero ---------- */
.hero {
  position: relative; text-align: center;
  padding: clamp(70px, 12vh, 130px) 20px 90px;
}
.hero-kicker {
  color: var(--spell); font-weight: 600; letter-spacing: 4px; text-transform: uppercase; font-size: 12px;
}
.hero-logo {
  margin: 10px 0 0;
  font-family: var(--display); font-weight: 900;
  font-size: clamp(46px, 11vw, 118px); line-height: 1;
  color: var(--parchment);
  text-shadow: 0 0 40px rgba(185, 168, 238, 0.55), 0 4px 0 rgba(0,0,0,.25);
  animation: rise .9s ease-out both;
}
.hero-logo span {
  background: linear-gradient(135deg, #ffe28f, var(--gold), var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 18px rgba(255, 210, 74, 0.45));
}
.hero-tagline {
  font-family: var(--display); font-size: clamp(17px, 3vw, 26px);
  color: var(--text); letter-spacing: 6px; text-transform: uppercase;
  animation: rise .9s .15s ease-out both;
}
.hero-tagline .dot { color: var(--gold); margin: 0 12px; }
.hero-sub {
  max-width: 560px; margin: 18px auto 30px; font-size: 17px; line-height: 1.65;
  color: var(--text-dim);
  animation: rise .9s .3s ease-out both;
}
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; animation: rise .9s .45s ease-out both; }
.hero-note { margin-top: 28px; animation: rise .9s .6s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* floating voxel isles */
.hero-isles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.isle {
  position: absolute; width: 130px; height: 44px;
  background: linear-gradient(180deg, #4a9e5f 0 32%, #6e4a2f 32% 100%);
  clip-path: polygon(0 0, 100% 0, 84% 100%, 16% 100%);
  filter: drop-shadow(0 18px 22px rgba(0,0,0,.35));
  animation: float 7s ease-in-out infinite;
}
.isle-1 { left: 6%; top: 22%; }
.isle-2 { right: 8%; top: 16%; width: 90px; height: 32px; animation-delay: -2.5s; }
.isle-3 { right: 18%; bottom: 8%; width: 70px; height: 26px; animation-delay: -5s; }
.isle-castle {
  position: absolute; left: 34px; top: -34px; width: 28px; height: 34px;
  background: #9aa3b8;
  box-shadow: 34px 6px 0 -6px #9aa3b8, -2px -10px 0 -8px #8d8ad6;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@media (max-width: 720px) { .isle { opacity: .5; } }

/* ---------- sections ---------- */
.section { padding: clamp(60px, 9vw, 110px) clamp(16px, 5vw, 56px); max-width: 1180px; margin: 0 auto; }
.section-title {
  font-family: var(--display); font-weight: 700; text-align: center;
  font-size: clamp(26px, 5vw, 44px); margin: 0 0 6px; color: var(--parchment);
}
.section-title em {
  font-style: normal;
  background: linear-gradient(135deg, #ffe28f, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.section-sub { text-align: center; color: var(--text-dim); margin: 0 auto 42px; max-width: 520px; }

.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-5 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- cards ---------- */
.card, .class-card, .creature, .world {
  background: var(--card-bg);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  padding: 26px 22px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover, .class-card:hover, .creature:hover {
  transform: translateY(-6px);
  border-color: var(--spell);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35), 0 0 24px rgba(122, 92, 196, 0.25);
}
.card-icon { font-size: 38px; margin-bottom: 10px; filter: drop-shadow(0 0 14px rgba(255,210,74,.35)); }
.card h3, .class-card h3, .creature h3, .world h3 {
  font-family: var(--display); font-size: 19px; margin: 0 0 8px; color: var(--parchment);
}
.card p, .class-card p, .creature p, .world p { margin: 0; color: var(--text-dim); line-height: 1.6; font-size: 14.5px; }

/* worlds */
.worlds { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.world { overflow: hidden; padding: 0 0 22px; }
.world h3, .world p { padding: 0 22px; }
.world-art {
  height: 150px; margin-bottom: 18px;
  background:
    radial-gradient(60% 70% at 50% 100%, var(--w2), transparent),
    linear-gradient(180deg, var(--w1), color-mix(in srgb, var(--w1) 55%, black));
  position: relative;
}
.world-art::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(2px 2px at 22% 30%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(2px 2px at 64% 18%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(2px 2px at 82% 44%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(3px 3px at 40% 60%, rgba(255, 210, 74, .8), transparent 60%);
}
.world .badge {
  margin: 14px 22px 0; display: inline-block;
  font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  border: 1px solid var(--card-edge); color: var(--text-dim);
  border-radius: 999px; padding: 5px 12px;
}
.world .badge-live { color: #7be0a0; border-color: rgba(123, 224, 160, 0.4); }

/* classes */
.class-card { text-align: center; }
.class-emblem {
  width: 64px; height: 64px; margin: 0 auto 12px;
  display: grid; place-items: center; font-size: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.18), transparent 60%), var(--ink-3);
  border: 2px solid var(--card-edge);
  box-shadow: 0 0 22px rgba(122, 92, 196, 0.3);
}
.class-card .stat { display: block; margin-top: 12px; color: var(--gold-deep); }

/* creatures */
.creature { text-align: center; }
.creature-art {
  width: 84px; height: 84px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 42px;
  border-radius: 26px;
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 55%, transparent), transparent 75%), var(--ink-3);
  border: 1px solid var(--card-edge);
}
.rarity { display: block; margin-top: 12px; font-size: 11.5px; font-weight: 700; letter-spacing: 1px; }
.r-rare { color: #7be0a0; }
.r-epic { color: var(--spell); }
.r-myth { color: var(--gold); text-shadow: 0 0 12px rgba(255,210,74,.5); }

/* ---------- spellbook ---------- */
.book {
  display: flex; align-items: stretch; gap: 10px; justify-content: center;
  max-width: 680px; margin: 0 auto; perspective: 1200px;
}
.book-page {
  flex: 1;
  min-height: 260px;
  border-radius: 16px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,.07), transparent 50%),
    linear-gradient(135deg, #221c4a, #161236);
  border: 1px solid var(--card-edge);
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  padding: 30px 34px;
  transform-style: preserve-3d;
}
[data-theme="day"] .book-page { background: linear-gradient(135deg, #fffdf4, #f1e8ff); }
.book-page.flip { animation: flip .45s ease; }
@keyframes flip {
  0% { transform: rotateY(0); }
  50% { transform: rotateY(-78deg); opacity: .35; }
  100% { transform: rotateY(0); }
}
.spell-name { font-family: var(--display); font-size: 26px; color: var(--gold); margin: 0 0 4px; }
.spell-kind { font-family: var(--px); font-size: 8px; color: var(--text-dim); letter-spacing: 2px; }
.spell-desc { color: var(--text); line-height: 1.7; margin-top: 14px; }
.spell-rune { font-size: 44px; float: right; filter: drop-shadow(0 0 16px rgba(185,168,238,.6)); }
.book-arrow {
  border: 1px solid var(--card-edge); background: var(--card-bg); color: var(--text);
  font-size: 26px; width: 46px; border-radius: 14px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.book-arrow:hover { color: var(--gold); border-color: var(--gold); }

/* ---------- gallery ---------- */
.gallery .shot {
  position: relative; height: 170px; border: 1px solid var(--card-edge); border-radius: var(--radius);
  cursor: zoom-in; overflow: hidden; display: grid; place-items: center;
  background:
    radial-gradient(80% 90% at 50% 110%, var(--g2), transparent 70%),
    linear-gradient(160deg, var(--g1), color-mix(in srgb, var(--g1) 45%, black));
  transition: transform .2s, box-shadow .2s;
}
.gallery .shot span { font-size: 52px; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); transition: transform .25s; }
.gallery .shot b {
  position: absolute; left: 14px; bottom: 12px; color: var(--parchment);
  font-size: 14px; text-shadow: 0 2px 8px rgba(0,0,0,.7);
}
.gallery .shot:hover { transform: scale(1.03); box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.gallery .shot:hover span { transform: scale(1.25) rotate(-6deg); }

dialog {
  border: 1px solid var(--card-edge); border-radius: var(--radius);
  background: var(--ink-2); color: var(--text);
  padding: 26px; max-width: min(92vw, 460px); text-align: center;
}
dialog::backdrop { background: rgba(5, 6, 20, 0.75); backdrop-filter: blur(4px); }
.lightbox-art {
  height: 220px; border-radius: 14px; display: grid; place-items: center; font-size: 90px;
  background: radial-gradient(70% 80% at 50% 100%, var(--g2, #7a5cc4), transparent 70%), linear-gradient(160deg, var(--g1, #1c2058), #0b0d24);
  margin-bottom: 14px;
}
#lightbox-title { font-family: var(--display); font-size: 20px; color: var(--parchment); }
.trailer-card h3 { font-family: var(--display); color: var(--parchment); margin: 8px 0; }
.trailer-stars { font-size: 26px; }
.trailer-card .btn { margin: 12px 6px 0; }

/* ---------- play band & owl ---------- */
.play-band { text-align: center; }
.play-buttons { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }

.owl-card {
  background: var(--card-bg); border: 1px solid var(--card-edge); border-radius: var(--radius);
  padding: clamp(26px, 5vw, 48px); text-align: center;
}
#owl-form { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#owl-form input {
  font-family: var(--body); font-size: 15px;
  padding: 13px 18px; border-radius: 999px; min-width: min(310px, 80vw);
  border: 1px solid var(--card-edge); background: var(--ink); color: var(--text);
}
#owl-form input:focus { outline: 2px solid var(--gold); }
#owl-confirm { color: #7be0a0; font-weight: 600; margin-top: 14px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--card-edge); padding: 40px clamp(16px, 5vw, 56px) 26px; }
.footer-grid {
  max-width: 1180px; margin: 0 auto 26px;
  display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.footer-tag { color: var(--text-dim); max-width: 320px; }
.footer nav { display: flex; flex-direction: column; gap: 8px; }
.footer nav a { color: var(--text-dim); text-decoration: none; }
.footer nav a:hover { color: var(--gold); }
.footer-note { text-align: center; }

/* ---------- spell click sparks ---------- */
.spark {
  position: fixed; width: 8px; height: 8px; pointer-events: none; z-index: 60;
  background: var(--gold); border-radius: 2px;
  animation: spark .7s ease-out forwards;
}
@keyframes spark {
  from { opacity: 1; transform: translate(0, 0) scale(1) rotate(0); }
  to { opacity: 0; transform: translate(var(--sx), var(--sy)) scale(0.2) rotate(220deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}
