/* Kingdomity — palette pulled from the throne-room banner and crown avatar */
:root {
  --night: #17122e;
  --night-2: #211a42;
  --panel: rgba(44, 34, 88, 0.72);
  --panel-solid: #2c2258;
  --line: rgba(190, 180, 255, 0.18);
  --lav: #9d97f5;
  --peri: #6f7fe8;
  --pink: #f4a6c0;
  --sunset: #f7b39b;
  --gold: #f9b234;
  --orange: #ef7a22;
  --royal: #c9333d;
  --snow: #eef0ff;
  --text: #f2efff;
  --muted: #b9b2e6;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(8, 4, 30, 0.45);
  --pixel: "Pixelify Sans", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, Segoe UI, sans-serif;
  --link: #f9b234;
  --heading: #eef0ff;
  --glass: rgba(23, 18, 46, 0.55);
  --field: rgba(23, 18, 46, 0.7);
  --flake: rgba(238, 240, 255, 0.75);
  --hero-fade: rgba(23, 18, 46, 0.35);
  color-scheme: dark;
}

/* Light mode — snowy daytime version of the kingdom */
:root[data-theme="light"] {
  --night: #f4f1ff;
  --night-2: #e9e5ff;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --line: rgba(92, 80, 190, 0.18);
  --text: #2a2150;
  --muted: #625a96;
  --link: #b4500a;
  --heading: #2a2150;
  --glass: rgba(255, 255, 255, 0.72);
  --field: #f6f4ff;
  --flake: rgba(124, 132, 232, 0.55);
  --hero-fade: rgba(244, 241, 255, 0.25);
  --shadow: 0 10px 26px rgba(70, 56, 160, 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--text);
  background: var(--night);
  background-image:
    radial-gradient(1200px 600px at 10% 20%, rgba(111,127,232,.18), transparent 60%),
    radial-gradient(900px 500px at 90% 60%, rgba(244,166,192,.12), transparent 60%),
    radial-gradient(800px 600px at 50% 100%, rgba(249,178,52,.08), transparent 60%);
  background-attachment: fixed;
  line-height: 1.6;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--link); }
.pixel { font-family: var(--pixel); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; margin-top: 1.5rem; }
[hidden] { display: none !important; }

#snow { position: fixed; inset: 0; pointer-events: none; z-index: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 4rem 16px 6rem;
  background:
    linear-gradient(180deg, rgba(23,18,46,.15) 0%, var(--hero-fade) 55%, var(--night) 100%),
    url("/assets/banner.jpg") center 40% / cover no-repeat;
  z-index: 2;
}
.hero-inner { position: relative; z-index: 2; max-width: 720px; }
.avatar-frame {
  width: 180px; height: 180px; margin: 0 auto 1.2rem;
  border-radius: 50%;
  padding: 6px;
  background: conic-gradient(from 200deg, var(--gold), var(--orange), var(--royal), var(--lav), var(--gold));
  box-shadow: 0 0 0 6px rgba(23,18,46,.55), 0 0 60px rgba(249,178,52,.45);
  animation: bob 5s ease-in-out infinite;
}
.avatar-frame img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.hero h1 {
  font-size: clamp(2.6rem, 8vw, 5rem);
  margin: 0;
  letter-spacing: .04em;
  color: var(--gold);
  text-shadow: 0 4px 0 var(--orange), 0 8px 0 #8a3a14, 0 14px 30px rgba(0,0,0,.5);
}
.tagline {
  font-size: clamp(1.05rem, 2.6vw, 1.3rem);
  font-weight: 700;
  margin: 1rem auto 1.8rem;
  padding: .5rem 1.1rem;
  display: inline-block;
  background: var(--glass);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  border: 1px solid var(--line);
}
.hero-actions { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; }
.scroll-hint {
  position: absolute; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  color: var(--snow); font-size: 2.2rem; text-decoration: none; z-index: 2;
  animation: hint 2s ease-in-out infinite;
}
@keyframes hint { 0%,100% { transform: translate(-50%, 0); opacity: .6; } 50% { transform: translate(-50%, 8px); opacity: 1; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--pixel); font-size: 1.05rem; font-weight: 700;
  padding: .75rem 1.4rem;
  border-radius: 12px; border: 0; cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn-gold { background: var(--gold); color: #3a1a05; box-shadow: 0 5px 0 var(--orange); }
.btn-lav { background: var(--lav); color: #1c1540; box-shadow: 0 5px 0 #5f58c4; }
.btn-discord { background: #5865f2; color: #fff; box-shadow: 0 5px 0 #3a43b8; }

/* ---------- Sections ---------- */
main { position: relative; z-index: 2; }
.section { max-width: 1120px; margin: 0 auto; padding: 4.5rem 16px 1rem; }
.sec-title {
  font-family: var(--pixel);
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  margin: 0 0 1.6rem;
  display: flex; align-items: center; gap: .7rem;
  color: var(--heading);
}
.sec-title::after {
  content: ""; flex: 1; height: 4px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, var(--lav) 0 12px, transparent 12px 20px);
  opacity: .45;
}
.sec-ico {
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--panel-solid); border: 2px solid var(--line); border-radius: 12px;
  font-size: 1.4rem;
}
.sec-sub { color: var(--muted); margin: -1rem 0 1.5rem; }

.card {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.chip {
  display: inline-block; font-size: .8rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #3a1a05; background: var(--pink); padding: .2rem .7rem; border-radius: 999px;
}
.empty { color: var(--muted); text-align: center; padding: 2rem; margin: 0; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Latest ---------- */
.latest-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 1.4rem; }
.embed { aspect-ratio: 16/9; overflow: hidden; padding: 0; }
.embed iframe { width: 100%; height: 100%; border: 0; display: block; }
.latest-info { padding: 1.6rem; display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.latest-info h3 { font-size: 1.35rem; margin: .2rem 0 0; line-height: 1.3; }
.latest-info p { margin: 0; }
.about { flex: 1; }

.skeleton, .skeleton-card {
  background: linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.1), rgba(255,255,255,.04));
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
.skeleton { width: 100%; height: 100%; }
.skeleton-card { min-height: 240px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Recent videos ---------- */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.video-card { overflow: hidden; text-decoration: none; color: inherit; display: flex; flex-direction: column; transition: transform .2s ease; }
.video-card:hover { transform: translateY(-4px) rotate(-.3deg); }
.video-card .thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; background: #000; }
.video-card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.video-card:hover .thumb img { transform: scale(1.06); }
.video-card .play {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 2.4rem; color: #fff; opacity: 0; background: rgba(23,18,46,.35); transition: opacity .2s;
}
.video-card:hover .play { opacity: 1; }
.video-card .meta { padding: .9rem 1.1rem 1.1rem; }
.video-card h3 { font-size: 1rem; margin: 0 0 .3rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.video-card .muted { font-size: .85rem; }
.link-more { font-weight: 800; text-decoration: none; }
.link-more:hover { text-decoration: underline; }

/* ---------- Fan art ---------- */
.fanart-grid { columns: 3 260px; column-gap: 1.2rem; }
.fan {
  break-inside: avoid; margin: 0 0 1.2rem; padding: 10px; cursor: zoom-in;
  transition: transform .2s ease;
}
.fan:nth-child(odd) { transform: rotate(-.6deg); }
.fan:nth-child(even) { transform: rotate(.6deg); }
.fan:hover { transform: rotate(0) scale(1.02); }
.fan img { width: 100%; border-radius: 12px; }
.fan figcaption { padding: .6rem .3rem .2rem; font-size: .92rem; }
.fan figcaption strong { color: var(--pink); }
.fan figcaption .muted { display: block; font-size: .8rem; }

.lightbox {
  border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); max-height: 92vh;
}
.lightbox::backdrop { background: rgba(10,6,30,.85); backdrop-filter: blur(4px); }
.lb-body img { max-height: 80vh; width: auto; margin: 0 auto; border-radius: 14px; }
.lb-body p { text-align: center; color: var(--text); margin: .8rem 0 0; }
.lb-close {
  position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--panel-solid); color: var(--text); font-size: 1.2rem; cursor: pointer;
}

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; transform: translateX(-50%);
  background: repeating-linear-gradient(180deg, var(--lav) 0 14px, var(--peri) 14px 28px);
  border-radius: 6px; opacity: .55;
}
.tl-item { position: relative; width: 50%; padding: 0 2.4rem 2rem; }
.tl-item:nth-child(odd) { left: 0; text-align: right; }
.tl-item:nth-child(even) { left: 50%; }
.tl-item::before {
  content: attr(data-icon); position: absolute; top: .4rem; width: 42px; height: 42px;
  display: grid; place-items: center; font-size: 1.2rem;
  background: var(--gold); border: 4px solid var(--night); border-radius: 10px;
  box-shadow: 0 0 0 3px var(--orange);
}
.tl-item:nth-child(odd)::before { right: -21px; }
.tl-item:nth-child(even)::before { left: -21px; }
.tl-card { padding: 1.1rem 1.3rem; display: inline-block; text-align: left; max-width: 100%; }
.tl-date { font-family: var(--pixel); color: var(--link); font-size: .95rem; }
.tl-card h3 { margin: .1rem 0 .3rem; font-size: 1.15rem; }
.tl-card p { margin: 0; color: var(--muted); }
.tl-card img { margin-top: .7rem; border-radius: 10px; }

/* ---------- Specs ---------- */
.specs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.spec { padding: 1.1rem 1.2rem; display: flex; gap: .9rem; align-items: center; }
.spec-ico {
  flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-size: 1.4rem;
  background: linear-gradient(135deg, var(--peri), var(--lav)); border-radius: 12px;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
}
.spec small { display: block; color: var(--muted); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: .72rem; }
.spec span { font-weight: 700; }

/* ---------- Socials ---------- */
.socials { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.social {
  padding: 1rem 1.1rem; display: flex; align-items: center; gap: .8rem; text-decoration: none; color: var(--text);
  transition: transform .18s, border-color .18s;
}
.social:hover { transform: translateY(-3px); border-color: var(--brand, var(--gold)); }
.social .s-ico {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--brand, var(--peri)); color: #fff;
}
.social .s-ico svg { width: 24px; height: 24px; fill: currentColor; }
.social b { display: block; }
.social > span:last-child { min-width: 0; }
.social small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Discord ---------- */
.discord-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 1.4rem; align-items: stretch; }
.discord-card { padding: 2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.discord-card img { border-radius: 50%; box-shadow: 0 0 0 4px var(--gold); }
.discord-card h3 { font-family: var(--pixel); font-size: 1.5rem; margin: .4rem 0 0; }
.discord-card p { margin: 0 0 .6rem; }
.discord-widget { overflow: hidden; min-height: 420px; display: grid; place-items: center; padding: 0; }
.discord-widget iframe { width: 100%; height: 100%; min-height: 420px; border: 0; }

/* ---------- Footer ---------- */
.footer {
  position: relative; z-index: 2; text-align: center; padding: 4rem 16px 2.5rem; color: var(--muted); font-size: .9rem;
}
.footer-admin { opacity: .25; text-decoration: none; font-size: 1rem; transition: opacity .2s; }
.footer-admin:hover { opacity: 1; }
.to-top {
  position: fixed; right: 18px; bottom: 18px; z-index: 5; width: 48px; height: 48px; border-radius: 12px;
  display: grid; place-items: center; text-decoration: none; font-weight: 800; font-size: 1.3rem;
  background: var(--gold); color: #3a1a05; box-shadow: 0 4px 0 var(--orange);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.to-top.show { opacity: 1; pointer-events: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .latest-grid, .discord-grid { grid-template-columns: 1fr; }
  .timeline::before { left: 21px; }
  .tl-item, .tl-item:nth-child(even), .tl-item:nth-child(odd) { width: 100%; left: 0; text-align: left; padding: 0 0 1.6rem 64px; }
  .tl-item:nth-child(odd)::before, .tl-item:nth-child(even)::before { left: 0; right: auto; }
}
@media (max-width: 520px) {
  .avatar-frame { width: 140px; height: 140px; }
  .sec-title::after { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: fixed; top: 16px; right: 16px; z-index: 20;
  width: 46px; height: 46px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; font-size: 1.25rem;
  background: var(--glass); color: var(--text);
  border: 1px solid var(--line); backdrop-filter: blur(8px);
  box-shadow: var(--shadow); transition: transform .15s;
}
.theme-toggle:hover { transform: translateY(-2px) rotate(-8deg); }
.theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: inline; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }
.admin .theme-toggle { position: static; width: 36px; height: 36px; font-size: 1rem; box-shadow: none; }
body, .card, .a-head, .a-bar { transition: background-color .3s ease, color .3s ease, border-color .3s ease; }
