/* Arcadia — Design Tokens
   Playful modern, Poki/CrazyGames-adjacent, with a distinct voice.
   --------------------------------------------------------------- */

:root {
  /* Brand — electric violet + sun yellow + mint */
  --brand-50:  #f3efff;
  --brand-100: #e4dbff;
  --brand-200: #c8b6ff;
  --brand-300: #a78bff;
  --brand-400: #8b66ff;
  --brand-500: #6c3bff; /* primary */
  --brand-600: #5a2ae0;
  --brand-700: #4820b3;
  --brand-800: #2f1485;
  --brand-900: #1a0b52;

  --accent-sun:  #ffd23f;
  --accent-mint: #3ddc97;
  --accent-pink: #ff5ea8;
  --accent-cyan: #3dc6ff;
  --accent-coral:#ff7a59;

  /* Light mode (default) */
  --bg:         #fbfaff;
  --bg-raised: #ffffff;
  --bg-sunken: #f1eeff;
  --bg-inset:  #e8e3f7;
  --surface-1: #ffffff;
  --surface-2: #faf8ff;
  --border:    #e5e0f2;
  --border-strong: #cfc6e8;
  --text:      #1a0b52;
  --text-muted:#5b5275;
  --text-dim:  #8a82a1;
  --shadow-sm: 0 1px 2px rgba(26, 11, 82, 0.06), 0 1px 3px rgba(26,11,82,0.04);
  --shadow-md: 0 6px 18px -6px rgba(26, 11, 82, 0.15), 0 2px 6px rgba(26,11,82,0.06);
  --shadow-lg: 0 20px 48px -12px rgba(26, 11, 82, 0.25), 0 8px 16px -4px rgba(26,11,82,0.10);
  --shadow-tile: 0 2px 0 rgba(26, 11, 82, 0.08), 0 8px 24px -8px rgba(26,11,82,0.18);

  /* Accent (overridden by Tweaks) */
  --accent: var(--brand-500);
  --accent-ink: #ffffff;
  --accent-soft: var(--brand-100);

  /* Type */
  --font-display: "Fraunces", "Recoleta", Georgia, serif;
  --font-sans:    "Plus Jakarta Sans", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:    "JetBrains Mono", "SF Mono", ui-monospace, monospace;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-2xl: 36px;
  --r-pill: 999px;

  /* Tile style (overridden by Tweaks) */
  --tile-radius: var(--r-lg);

  /* Spacing rhythm */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;

  /* Layout */
  --max-w: 1360px;
  --gutter: 28px;

  /* Grid density (overridden by Tweaks) */
  --tile-min: 168px;
  --tile-gap: 14px;

  /* Ad slot visibility (overridden by Tweaks) */
  --ad-label-opacity: 1;
  --ad-border-style: dashed;
  --ad-bg: rgba(108, 59, 255, 0.04);
  --ad-border-color: rgba(108, 59, 255, 0.35);
}

/* Dark */
:root[data-theme="dark"] {
  --bg:        #0c0a1a;
  --bg-raised:#141129;
  --bg-sunken:#0a0816;
  --bg-inset: #1c1838;
  --surface-1:#1a1632;
  --surface-2:#221e3e;
  --border:   #2a2550;
  --border-strong:#3a3366;
  --text:     #f3efff;
  --text-muted:#a79fc7;
  --text-dim: #6b6389;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 6px 18px -6px rgba(0,0,0,0.5), 0 2px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 20px 48px -12px rgba(0,0,0,0.6), 0 8px 16px -4px rgba(0,0,0,0.4);
  --shadow-tile: 0 2px 0 rgba(0,0,0,0.4), 0 8px 24px -8px rgba(0,0,0,0.5);
  --accent-soft: rgba(108, 59, 255, 0.18);
  --ad-bg: rgba(167, 139, 255, 0.06);
  --ad-border-color: rgba(167, 139, 255, 0.35);
}

/* Base reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light dark; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  font-feature-settings: "ss01", "ss02", "cv11";
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }

h1,h2,h3,h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text);
  text-wrap: balance;
}
p { text-wrap: pretty; }

/* Layout shell */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
@media (max-width: 720px) {
  :root { --gutter: 16px; }
}

/* -----------------------------------------------------------------
   HEADER
----------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header__row {
  height: 68px;
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.03em;
  color: var(--text);
  flex: none;
}
.brand__mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background:
    radial-gradient(circle at 30% 30%, var(--accent-sun) 0, transparent 50%),
    radial-gradient(circle at 75% 70%, var(--accent-pink) 0, transparent 50%),
    linear-gradient(135deg, var(--brand-500), var(--brand-700));
  position: relative;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.2);
  display: grid; place-items: center;
  color: white;
  font-weight: 800;
  font-family: var(--font-sans);
  font-size: 16px;
  transform: rotate(-4deg);
}
.brand__mark::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,0.35);
}

.nav-primary { display: flex; gap: 4px; align-items: center; }
.nav-primary a {
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  transition: all .15s ease;
}
.nav-primary a:hover { color: var(--text); background: var(--bg-sunken); }
.nav-primary a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.header-spacer { flex: 1; }

.search-wrap {
  position: relative;
  width: min(340px, 32vw);
  min-width: 160px;
}
.search-input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border);
  background: var(--surface-1);
  color: var(--text);
  font-size: 14px;
  transition: all .15s ease;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}
.search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  display: inline-grid; place-items: center;
  color: var(--text);
  transition: all .15s ease;
}
.icon-btn:hover { background: var(--bg-sunken); border-color: var(--border-strong); }

.menu-btn {
  display: none;
}
@media (max-width: 820px) {
  .nav-primary { display: none; }
  .menu-btn { display: inline-grid; }
  .search-wrap { flex: 1; min-width: 0; width: auto; }
  .search-input { min-width: 0; }
  .site-header__row { gap: 8px; }
  .icon-btn { flex-shrink: 0; }
  .header-spacer { display: none; }
}

.site-header.is-scrolled {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
}

/* -----------------------------------------------------------------
   BUTTONS
----------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--r-pill);
  font-weight: 700;
  font-size: 15px;
  border: none;
  background: var(--surface-1);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 2px 0 color-mix(in oklab, var(--accent) 70%, #000 30%), var(--shadow-md);
}
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-muted);
}
.btn--ghost:hover { background: var(--bg-sunken); box-shadow: none; }
.btn--lg { padding: 16px 32px; font-size: 17px; }
.btn--xl {
  padding: 20px 42px;
  font-size: 20px;
  font-weight: 800;
  border-radius: var(--r-xl);
}

/* -----------------------------------------------------------------
   AD SLOTS (required by PDF spec)
----------------------------------------------------------------- */
.ad-slot {
  position: relative;
  width: 100%;
  background: var(--ad-bg);
  border: 1.5px var(--ad-border-style) var(--ad-border-color);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  overflow: hidden;
  flex: none;
}
.ad-slot__label { opacity: var(--ad-label-opacity); text-align: center; }
.ad-slot__label small {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  letter-spacing: 0.1em;
  opacity: 0.7;
  font-weight: 500;
}

/* Fixed min-heights prevent CLS per PDF */
.ad-slot--leaderboard { min-height: 90px; }
.ad-slot--banner      { min-height: 90px; }
.ad-slot--rect        { min-height: 250px; aspect-ratio: 300/250; max-width: 300px; }
.ad-slot--sidebar     { min-height: 600px; aspect-ratio: 300/600; max-width: 300px; }
.ad-slot--mobile      { min-height: 50px; }
.ad-slot--native      { min-height: 120px; }

/* Safe-zone visualization (toggleable via Tweaks) */
body[data-show-safezones="1"] .safe-zone {
  outline: 2px dashed var(--accent-mint);
  outline-offset: 4px;
  position: relative;
}
body[data-show-safezones="1"] .safe-zone::before {
  content: "150px safe zone →";
  position: absolute;
  top: -22px; left: 0;
  font-size: 10px;
  color: var(--accent-mint);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* -----------------------------------------------------------------
   GAME TILES
----------------------------------------------------------------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr));
  gap: var(--tile-gap);
}
.tile {
  position: relative;
  border-radius: var(--tile-radius);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--surface-2);
  box-shadow: var(--shadow-tile);
  transition: transform .18s cubic-bezier(.2,.8,.2,1), box-shadow .18s ease;
  display: block;
  isolation: isolate;
}
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tile__art {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.tile__art--grad-1 { background: linear-gradient(135deg, #ff7a59, #ff5ea8); }
.tile__art--grad-2 { background: linear-gradient(135deg, #6c3bff, #3dc6ff); }
.tile__art--grad-3 { background: linear-gradient(135deg, #3ddc97, #3dc6ff); }
.tile__art--grad-4 { background: linear-gradient(135deg, #ffd23f, #ff7a59); }
.tile__art--grad-5 { background: linear-gradient(135deg, #1a0b52, #6c3bff); }
.tile__art--grad-6 { background: linear-gradient(135deg, #ff5ea8, #6c3bff); }
.tile__art--grad-7 { background: linear-gradient(135deg, #0a0816, #3dc6ff); }
.tile__art--grad-8 { background: linear-gradient(135deg, #3ddc97, #ffd23f); }
.tile__glyph {
  font-size: clamp(40px, 8vw, 64px);
  font-family: var(--font-display);
  font-weight: 800;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 4px 24px rgba(0,0,0,0.25);
  letter-spacing: -0.05em;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.1));
}
.tile__thumb-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.tile__meta {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px 11px;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 10%, rgba(0,0,0,0) 100%);
  color: white;
  font-size: 13px;
  font-weight: 700;
}
.tile__meta small {
  display: block;
  font-size: 10.5px;
  opacity: 0.75;
  font-weight: 500;
  margin-top: 1px;
  letter-spacing: 0.03em;
}
.tile__badge {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: var(--r-pill);
  background: var(--accent-sun);
  color: #1a0b52;
}
.tile__badge--new { background: var(--accent-mint); }
.tile__badge--hot { background: var(--accent-pink); color: white; }

/* Compact variant (no label over art) for gallery */
body[data-tile-labels="off"] .tile__meta { display: none; }

/* -----------------------------------------------------------------
   CATEGORY PILLS
----------------------------------------------------------------- */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface-1);
  border: 1.5px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all .15s ease;
  white-space: nowrap;
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill[aria-current="true"], .pill--active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.pill__count {
  font-size: 11px;
  opacity: 0.6;
  font-weight: 500;
}

/* -----------------------------------------------------------------
   SECTION HEADERS
----------------------------------------------------------------- */
.section {
  padding: var(--sp-12) 0;
}
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
}
.section-head h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}
.section-head__sub {
  display: block;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.section-head a {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.section-head a:hover { color: var(--accent); }

/* -----------------------------------------------------------------
   FOOTER
----------------------------------------------------------------- */
.site-footer {
  margin-top: var(--sp-16);
  background: var(--bg-sunken);
  border-top: 1px solid var(--border);
  padding: var(--sp-12) 0 var(--sp-8);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-8);
  margin-bottom: var(--sp-10);
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
.footer-col h4 {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.footer-col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a { color: var(--text-muted); font-size: 14px; }
.footer-col a:hover { color: var(--accent); }
.footer-blurb {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 38ch;
  margin: 10px 0 16px;
}
.footer-bottom {
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  font-size: 13px;
  color: var(--text-dim);
  flex-wrap: wrap;
}

/* -----------------------------------------------------------------
   UTIL
----------------------------------------------------------------- */
.u-eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.u-muted { color: var(--text-muted); }
.u-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin: var(--sp-6) 0;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb__sep { color: var(--text-dim); }
