/* ============================================================
   PopJoy — Candy-Cartoon Game Portal
   Palette & radius live in :root for easy theming.
   ============================================================ */
:root {
  /* Surfaces */
  --cream: #fff8f0;
  --cream-2: #fff1e6;
  --peach: #ffe4d6;
  --blush: #ffd6e0;
  --white: #ffffff;

  /* Candy accents */
  --candy-orange: #ff8a3d;
  --candy-pink: #ff6f91;
  --candy-grape: #9b5de5;
  --mint: #34d399;
  --lemon: #ffd166;

  /* Ink */
  --ink: #3a1d2a;
  --ink-soft: #8a6a76;
  --line: #f3ddd2;

  /* Shape */
  --maxw: 1200px;
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 30px;
  --radius-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 4px 14px rgba(255, 111, 145, 0.12);
  --shadow: 0 14px 32px rgba(255, 138, 61, 0.18);
  --shadow-lg: 0 22px 50px rgba(155, 93, 229, 0.20);

  /* Type */
  --font-head: "Fredoka", "Baloo 2", "Segoe UI", sans-serif;
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 600px at 100% -8%, var(--blush), transparent 60%),
    radial-gradient(900px 500px at -8% 8%, var(--peach), transparent 55%),
    var(--cream);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, rgba(255,248,240,.92), rgba(255,228,214,.92));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 74px; gap: 16px; }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 42px; width: auto; }

.nav-list { display: flex; align-items: center; gap: 6px; }
.nav-item { position: relative; }
.nav-item > a, .nav-item > button {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink); padding: 9px 16px; font-family: var(--font-head);
  font-weight: 600; font-size: 16px; border-radius: var(--radius-pill);
  transition: background .15s, color .15s, transform .12s;
}
.nav-item > a:hover, .nav-item > button:hover { background: rgba(255, 138, 61, .14); color: var(--candy-orange); }
.nav-item > a:active { transform: scale(.96); }
.nav-item .caret { font-size: 10px; opacity: .65; }

.submenu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius); min-width: 210px; padding: 8px;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(8px); transition: all .16s ease;
}
.nav-item:hover .submenu, .nav-item:focus-within .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.submenu a { display: block; padding: 9px 14px; border-radius: var(--radius-sm); color: var(--ink); font-weight: 700; font-size: 15px; }
.submenu a:hover { background: var(--cream-2); color: var(--candy-orange); }

.hamburger { display: none; color: var(--ink); font-size: 26px; padding: 6px 10px; border-radius: var(--radius-sm); }
.hamburger:hover { background: rgba(255, 138, 61, .14); }

/* ---------------- Sections ---------------- */
main { padding: 30px 0 10px; }
.hero-section { margin-bottom: 8px; }
.hero-head, .all-head { margin-bottom: 22px; }
.all-head { margin-top: 52px; }
.section-title { font-family: var(--font-head); font-weight: 700; font-size: 32px; line-height: 1.1; letter-spacing: -.5px; }
.section-sub { color: var(--ink-soft); font-weight: 600; margin-top: 4px; }

/* ---------------- Featured heroes ---------------- */
.featured-track {
  display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 6px 4px 16px; scrollbar-width: thin; scrollbar-color: var(--candy-pink) transparent;
}
.featured-track::-webkit-scrollbar { height: 8px; }
.featured-track::-webkit-scrollbar-thumb { background: var(--candy-pink); border-radius: 8px; }
.featured-track::-webkit-scrollbar-track { background: transparent; }

.featured-card {
  flex: 0 0 auto; width: clamp(280px, 82vw, 440px); min-height: 250px;
  scroll-snap-align: start; position: relative; overflow: hidden;
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 22px; color: #fff; isolation: isolate;
}
.featured-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent 35%, rgba(58,29,42,.42));
}
.featured-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); transition: transform .18s, box-shadow .18s; }
.fc-top { display: flex; align-items: flex-start; justify-content: space-between; }
.fc-cat {
  background: rgba(255,255,255,.26); padding: 5px 13px; border-radius: var(--radius-pill);
  font-weight: 800; font-size: 12px; letter-spacing: 1px; text-transform: uppercase;
}
.fc-glyph {
  font-size: 78px; line-height: 1; filter: drop-shadow(0 8px 14px rgba(0,0,0,.22));
  align-self: center; margin: -6px 0;
}
.fc-name { font-family: var(--font-head); font-weight: 700; font-size: 28px; line-height: 1.05; }
.fc-tag { font-size: 14px; font-weight: 600; opacity: .95; margin-top: 3px; }
.fc-play {
  align-self: flex-start; margin-top: 14px; background: #fff; color: var(--ink);
  font-family: var(--font-head); font-weight: 700; font-size: 15px;
  padding: 9px 20px; border-radius: var(--radius-pill); box-shadow: var(--shadow-sm);
}

/* ---------------- Category sections ---------------- */
#categories { scroll-margin-top: 90px; }
.cat-section { margin-top: 46px; scroll-margin-top: 90px; }
.cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.cat-dot {
  width: 14px; height: 14px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent);
}
.cat-title { font-family: var(--font-head); font-weight: 700; font-size: 24px; }
.cat-count {
  font-size: 13px; font-weight: 800; color: var(--ink-soft);
  background: var(--cream-2); padding: 3px 11px; border-radius: var(--radius-pill);
}

/* ---------------- Game grid ---------------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 18px; }
.game-card { position: relative; }
.card-link {
  display: flex; flex-direction: column; align-items: center; gap: 11px; text-align: center;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 16px; height: 100%;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card-link:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.card-link:active { transform: translateY(-2px) scale(.99); }
.card-link .thumb {
  width: 86px; height: 86px; border-radius: 22px; overflow: hidden;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--cream-2);
}
.card-link .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-link .name { font-family: var(--font-head); font-weight: 700; font-size: 16px; line-height: 1.15; min-height: 20px; }
.card-link .tag { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; line-height: 1.3; }

/* hover download overlay (rendered only for games with store links) */
.on-hover {
  position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 82%, #000);
  border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  opacity: 0; transition: opacity .15s; padding: 16px;
}
.game-card:hover .on-hover { opacity: 1; }
.on-hover .dl-label { color: #fff; font-family: var(--font-head); font-weight: 700; letter-spacing: 1.5px; font-size: 13px; }
.on-hover .badges { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.on-hover .badges img { height: 42px; width: auto; border-radius: 8px; }
.on-hover .badges a:hover { opacity: .85; }

/* ---------------- About band ---------------- */
.about-band {
  margin-top: 64px; padding: 54px 0;
  background: linear-gradient(135deg, var(--peach), var(--blush));
  border-top: 1px solid var(--line);
}
.about-inner { max-width: 720px; text-align: center; }
.about-emoji { font-size: 52px; line-height: 1; }
.about-band h3 { font-family: var(--font-head); font-weight: 700; font-size: 28px; margin: 12px 0 8px; }
.about-band p { color: var(--ink-soft); font-weight: 600; font-size: 16px; }

/* ---------------- Footer ---------------- */
.site-footer {
  background: linear-gradient(135deg, #3a1d2a, #5a2a44);
  color: #ffd9e3; padding: 50px 0 28px; margin-top: 0;
  border-radius: 36px 36px 0 0;
}
.footer-tag { max-width: 760px; font-size: 15.5px; font-weight: 600; color: #ffc4d4; }
.footer-links { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 22px 0; }
.footer-links a { color: #ffd9e3; font-weight: 700; font-size: 14px; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,.14); padding-top: 18px; font-size: 13px; color: #d9a9b8;
}
.footer-social { display: flex; gap: 12px; }
.footer-social .soc {
  width: 30px; height: 30px; color: #ffd9e3; display: inline-flex;
  background: rgba(255,255,255,.12); border-radius: 50%; align-items: center; justify-content: center;
  transition: background .15s, color .15s, transform .12s;
}
.footer-social .soc svg { width: 16px; height: 16px; fill: currentColor; }
.footer-social .soc:hover { background: var(--candy-orange); color: #fff; transform: translateY(-2px); }

/* ---------------- Loading ---------------- */
.loading { text-align: center; padding: 90px 0; }
.candy-loader { display: inline-block; font-size: 44px; animation: pop .85s ease-in-out infinite; }
@keyframes pop { 0%, 100% { transform: scale(1) rotate(-8deg); } 50% { transform: scale(1.22) rotate(8deg); } }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
  .hamburger { display: block; }
  .nav-list {
    position: absolute; top: 74px; left: 14px; right: 14px;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 10px; box-shadow: var(--shadow);
    max-height: 0; overflow: hidden; transition: max-height .26s ease;
  }
  .nav-list.open { max-height: 80vh; overflow-y: auto; }
  .nav-item > a, .nav-item > button { padding: 13px 16px; }
  .submenu { position: static; opacity: 1; visibility: visible; transform: none; background: var(--cream-2); border: none; box-shadow: none; padding: 4px; margin-top: 2px; }
  .section-title { font-size: 27px; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
  .about-band { padding: 42px 0; }
}
