/* ===========================================================
   nchanted.eu — "Enchanted Intellect"
   A premium, business-credible canvas with a spark of magic.
   =========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg:        #0c0a1a;
  --bg-2:      #100c24;
  --surface:   #171232;
  --surface-2: #1f1942;
  --line:      rgba(168, 150, 255, 0.14);
  --line-strong: rgba(168, 150, 255, 0.28);

  --text:      #f1edff;
  --muted:     #b3a9d6;
  --faint:     #7e74a8;

  --violet:    #8b5cf6;
  --violet-lo: #6d4ad8;
  --magenta:   #d946a6;
  --amber:     #f7b955;
  --teal:      #46d6c0;

  --spark: radial-gradient(circle at 30% 30%, var(--amber), #ff7a59 70%);

  --shadow:   0 24px 60px -20px rgba(0,0,0,.7);
  --shadow-lg: 0 40px 90px -30px rgba(20, 6, 60, .85);

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;

  --maxw: 1180px;
  --ease: cubic-bezier(.22,.61,.36,1);

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  position: relative;
}

/* Atmospheric background — gradient glows + fine grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(48rem 32rem at 12% -8%, rgba(139,92,246,.30), transparent 60%),
    radial-gradient(40rem 30rem at 92% 4%, rgba(217,70,166,.20), transparent 55%),
    radial-gradient(46rem 40rem at 78% 96%, rgba(70,214,192,.10), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a { color: inherit; text-decoration: none; }

/* ---------- Top bar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(12,10,26,.55);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--display); font-weight: 600; font-size: 1.42rem; letter-spacing: -.01em; }
.brand .mark {
  width: 28px; height: 28px; flex: none;
  background: linear-gradient(135deg, var(--violet) 8%, var(--magenta) 52%, var(--amber));
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2028%2028'%3E%3Cpath%20d='M11%206%20C11.5%2012%2014%2014.5%2021%2016%20C14%2017.5%2011.5%2020%2011%2026%20C10.5%2020%208%2017.5%201%2016%20C8%2014.5%2010.5%2012%2011%206%20Z%20M22%203%20C22.3%206%2024%207.7%2027%208%20C24%208.3%2022.3%2010%2022%2013%20C21.7%2010%2020%208.3%2017%208%20C20%207.7%2021.7%206%2022%203%20Z'%20fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2028%2028'%3E%3Cpath%20d='M11%206%20C11.5%2012%2014%2014.5%2021%2016%20C14%2017.5%2011.5%2020%2011%2026%20C10.5%2020%208%2017.5%201%2016%20C8%2014.5%2010.5%2012%2011%206%20Z%20M22%203%20C22.3%206%2024%207.7%2027%208%20C24%208.3%2022.3%2010%2022%2013%20C21.7%2010%2020%208.3%2017%208%20C20%207.7%2021.7%206%2022%203%20Z'%20fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 1px 7px rgba(217,70,166,.5));
  transition: transform .55s var(--ease);
}
.brand:hover .mark { transform: rotate(90deg) scale(1.06); }
.brand b { font-weight: 600; }
.brand .e { color: var(--text); }
.nav-links { display: flex; align-items: center; gap: 30px; font-size: .94rem; }
.nav-links a { color: var(--muted); transition: color .2s var(--ease); }
.nav-links a:hover { color: var(--text); }
.nav-cta {
  border: 1px solid var(--line-strong);
  padding: 8px 16px; border-radius: 999px; color: var(--text) !important;
  transition: background .25s var(--ease), border-color .25s var(--ease);
}
.nav-cta:hover { background: rgba(139,92,246,.16); border-color: var(--violet); }
.nav-burger { display:none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 96px 0 78px; overflow: hidden; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: .8rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber); font-weight: 600; margin-bottom: 26px;
}
.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 10px var(--amber); }
.hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 6.4vw, 5rem);
  line-height: 1.02;
  letter-spacing: -.02em;
  max-width: 16ch;
}
.hero h1 em { font-style: italic; color: transparent; background: linear-gradient(100deg, var(--violet), var(--magenta) 55%, var(--amber)); -webkit-background-clip: text; background-clip: text; }
.hero p.lead {
  margin-top: 26px; max-width: 54ch; font-size: 1.18rem; color: var(--muted);
}
.hero-actions { margin-top: 38px; display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--body); font-weight: 600; font-size: 1rem;
  padding: 14px 26px; border-radius: 999px; cursor: pointer; border: 0;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}
.btn-primary { background: linear-gradient(100deg, var(--violet), var(--magenta)); color: #fff; box-shadow: 0 14px 34px -12px rgba(217,70,166,.7); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 22px 44px -12px rgba(217,70,166,.85); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--violet); background: rgba(139,92,246,.1); }

.hero-stats { margin-top: 56px; display: flex; gap: 44px; flex-wrap: wrap; }
.hero-stats .stat .n { font-family: var(--display); font-size: 2rem; font-weight: 600; line-height: 1; }
.hero-stats .stat .l { color: var(--faint); font-size: .85rem; letter-spacing: .04em; margin-top: 6px; }

/* floating sparks */
.sparks { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.sparks i {
  position: absolute; width: 4px; height: 4px; border-radius: 50%;
  background: #fff; opacity: .0; animation: twinkle 5s infinite var(--ease);
}
.sparks i:nth-child(1){ top: 18%; left: 70%; animation-delay: .2s; background: var(--amber);}
.sparks i:nth-child(2){ top: 32%; left: 84%; animation-delay: 1.1s; }
.sparks i:nth-child(3){ top: 58%; left: 62%; animation-delay: 2.0s; background: var(--violet);}
.sparks i:nth-child(4){ top: 12%; left: 50%; animation-delay: 2.7s; }
.sparks i:nth-child(5){ top: 70%; left: 90%; animation-delay: 3.4s; background: var(--teal);}
.sparks i:nth-child(6){ top: 44%; left: 94%; animation-delay: 1.6s; }
@keyframes twinkle { 0%,100%{opacity:0; transform: scale(.6);} 50%{opacity:.9; transform: scale(1.4);} }

/* ---------- Section heading ---------- */
.section { padding: 72px 0; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.sec-head h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.9rem, 3.6vw, 2.9rem); letter-spacing: -.02em; }
.sec-head .kicker { color: var(--amber); font-size: .8rem; letter-spacing: .18em; text-transform: uppercase; font-weight: 600; display:block; margin-bottom: 12px; }
.sec-head p { color: var(--muted); max-width: 46ch; }
.count-pill { font-family: var(--display); font-size: .95rem; color: var(--muted); border: 1px solid var(--line); padding: 7px 15px; border-radius: 999px; white-space: nowrap; }
.count-pill b { color: var(--text); }

/* ---------- Games grid ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 26px;
}
.card {
  position: relative;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
  animation: rise .7s var(--ease) both;
}
.card:hover { transform: translateY(-6px); border-color: var(--line-strong); box-shadow: var(--shadow-lg); }
@keyframes rise { from { opacity: 0; transform: translateY(22px);} to {opacity:1; transform: translateY(0);} }

.card .cover {
  position: relative; aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card .cover.img { background-size: cover; background-position: center; }
.card .cover.art-cover { padding: 0; }
.card .cover .art { width: 100%; height: 100%; display: block; transition: transform .6s var(--ease); }
.card:hover .cover .art { transform: scale(1.07); }
.card .cover .glyph { font-size: 3.4rem; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); transition: transform .5s var(--ease); }
.card:hover .cover .glyph { transform: scale(1.12) rotate(-4deg); }
.card .cover::after {
  content:""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(12,10,26,.55));
}
.featured-flag {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: rgba(12,10,26,.6); backdrop-filter: blur(6px);
  border: 1px solid rgba(247,185,85,.5); color: var(--amber);
  font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
  padding: 5px 10px; border-radius: 999px;
}
.tag {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  background: rgba(12,10,26,.55); backdrop-filter: blur(6px);
  border: 1px solid var(--line); color: var(--text);
  font-size: .72rem; font-weight: 600; padding: 5px 11px; border-radius: 999px;
}
.card .body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card h3 { font-family: var(--display); font-weight: 600; font-size: 1.32rem; letter-spacing: -.01em; margin-bottom: 9px; }
.card .desc { color: var(--muted); font-size: .96rem; flex: 1; }
.card .meta { display: flex; gap: 18px; margin-top: 18px; color: var(--faint); font-size: .82rem; }
.card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.card .play {
  margin-top: 20px; display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--amber); font-size: .95rem;
  transition: gap .25s var(--ease);
}
.card:hover .play { gap: 14px; }
.card .stretch { position: absolute; inset: 0; z-index: 3; }

/* empty state */
.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
  padding: 56px 30px; text-align: center; color: var(--muted);
  grid-column: 1 / -1;
}
.empty .glyph { font-size: 2.6rem; }
.empty code { background: var(--surface); padding: 3px 9px; border-radius: 7px; color: var(--amber); font-size: .9em; }

/* ---------- Value props ---------- */
.values { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.012); }
.value-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.value { padding: 4px; }
.value .ic {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.4rem; margin-bottom: 18px;
  background: linear-gradient(140deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-strong);
}
.value h4 { font-family: var(--display); font-weight: 600; font-size: 1.25rem; margin-bottom: 8px; }
.value p { color: var(--muted); font-size: .96rem; }

/* ---------- Educator band ---------- */
.band { text-align: center; }
.band .panel {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg); padding: 64px 36px;
  background: linear-gradient(120deg, rgba(139,92,246,.18), rgba(217,70,166,.14));
  border: 1px solid var(--line-strong);
}
.band h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.8rem,3.6vw,2.8rem); letter-spacing:-.02em; max-width: 20ch; margin: 0 auto 16px; }
.band p { color: var(--muted); max-width: 50ch; margin: 0 auto 28px; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 46px 0 60px; color: var(--faint); }
.footer .wrap { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: center; }
.footer .brand { font-size: 1.2rem; }
.footer a { color: var(--faint); transition: color .2s; }
.footer a:hover { color: var(--text); }

/* ---------- Admin ---------- */
.admin-body { max-width: 920px; }
.admin-head { display:flex; justify-content: space-between; align-items:center; padding: 30px 0; flex-wrap: wrap; gap: 16px; }
.admin-head h1 { font-family: var(--display); font-weight: 600; font-size: 1.8rem; }
.login-card {
  max-width: 420px; margin: 90px auto; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 36px; box-shadow: var(--shadow);
}
.login-card h1 { font-family: var(--display); font-size: 1.6rem; margin-bottom: 8px; }
.login-card p { color: var(--muted); margin-bottom: 22px; font-size: .95rem; }
label { display:block; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); margin: 0 0 7px; font-weight: 600; }
input[type=text], input[type=password], textarea, select {
  width: 100%; font-family: var(--body); font-size: .98rem;
  background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 11px 13px; transition: border-color .2s, box-shadow .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,.22); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.admin-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; margin-bottom: 20px;
}
.admin-card .top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.admin-card .top .em { font-size: 1.8rem; }
.admin-thumb { width: 86px; height: 54px; border-radius: 8px; overflow: hidden; flex: none; border: 1px solid var(--line); display: block; }
.admin-thumb img, .admin-thumb svg { width: 100%; height: 100%; object-fit: cover; display: block; }
.admin-thumb .thumb-grad { width: 100%; height: 100%; display: grid; place-items: center; font-size: 1.4rem; }
.admin-card .top .slug { font-family: var(--display); font-size: 1.2rem; font-weight: 600; }
.admin-card .top .path { color: var(--faint); font-size: .82rem; }
.admin-grid { display: grid; grid-template-columns: 80px 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.admin-grid .full { grid-column: 1 / -1; }
.row-flex { display:flex; gap: 14px; flex-wrap: wrap; }
.chk { display:flex; align-items:center; gap: 9px; color: var(--muted); font-size:.92rem; }
.chk input { width:auto; }
.flash { background: rgba(70,214,192,.12); border:1px solid rgba(70,214,192,.4); color: var(--teal); padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 22px; font-size:.95rem; }
.flash.err { background: rgba(217,70,166,.12); border-color: rgba(217,70,166,.4); color: #ff9ad4; }
.muted-note { color: var(--faint); font-size: .86rem; }
.linklike { color: var(--amber); cursor: pointer; background:none; border:0; font: inherit; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .nav-links { display: none; }
  .hero { padding: 60px 0 50px; }
  .hero-stats { gap: 28px; }
  .value-grid { grid-template-columns: 1fr; gap: 22px; }
  .admin-grid { grid-template-columns: 1fr; }
  .sec-head { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto; }
}
