/* ============================================================
   Pixel Gift Shop — Shared Styles
   ============================================================ */

/* --- Design Tokens --- */
:root {
  /* Neutrals */
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F3F0EA;
  --text: #1A1A1A;
  --text-muted: #5B5B5B;
  --border: rgba(26,26,26,0.12);

  /* Site accent */
  --accent: #5B7CFF;
  --accent-2: #28D7C5;
  --focus: #5B7CFF;

  /* Semantic */
  --success: #19B37A;
  --warning: #E6A700;
  --danger: #E5484D;

  /* Radii */
  --r-card: 16px;
  --r-input: 12px;
  --r-pill: 999px;

  /* Shadows */
  --sh-1: 0 6px 20px rgba(0,0,0,0.08);
  --sh-2: 0 10px 30px rgba(0,0,0,0.12);

  /* Motion */
  --ease-out: cubic-bezier(.2,.8,.2,1);
  --t-fast: 140ms;
  --t-med: 240ms;
  --t-slow: 420ms;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Typography --- */
h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.35; }
h4 { font-size: 1rem; font-weight: 600; line-height: 1.4; }
.small { font-size: 0.85em; color: var(--text-muted); }
.text-muted { color: var(--text-muted); }

/* --- Layout --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 64px 0; }
.section-sm { padding: 40px 0; }

.row { display: flex; gap: 12px; }
.row > div { flex: 1; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

@media (max-width: 768px) {
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.4rem; }
  .section { padding: 40px 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
}

/* --- Navigation --- */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,247,242,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-nav .nav-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.site-nav .nav-brand {
  font-weight: 700; font-size: 1.1rem; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.site-nav .nav-brand:hover { text-decoration: none; }
.site-nav .nav-links {
  display: flex; align-items: center; gap: 4px; list-style: none;
}
.nav-link {
  padding: 8px 16px; border-radius: var(--r-pill); font-size: 0.9rem;
  font-weight: 500; color: var(--text-muted); text-decoration: none;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.nav-link:hover {
  color: var(--text); background: var(--surface-2); text-decoration: none;
}
.nav-link--active {
  color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.nav-link--active:hover { color: var(--accent); }

/* Mobile hamburger */
.nav-hamburger {
  display: none; background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: var(--r-input); color: var(--text);
}
.nav-hamburger:focus-visible {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 40%, transparent);
}
.nav-hamburger svg { display: block; }

@media (max-width: 768px) {
  .nav-hamburger { display: block; }
  .site-nav .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; background: var(--surface);
    border-bottom: 1px solid var(--border); padding: 8px 16px;
    box-shadow: var(--sh-1);
  }
  .site-nav .nav-links.open { display: flex; }
  .nav-link { padding: 12px 16px; width: 100%; border-radius: var(--r-input); }
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0; margin-top: 64px;
  color: var(--text-muted); font-size: 0.85rem;
}
.site-footer .footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.site-footer a {
  color: var(--text-muted);
  transition: color var(--t-fast) var(--ease-out);
}
.site-footer a:hover { color: var(--accent); text-decoration: none; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 24px; font-size: 0.95rem; font-family: inherit; font-weight: 600;
  border: none; cursor: pointer; text-decoration: none;
  transition: filter var(--t-fast) var(--ease-out),
              box-shadow var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out),
              border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out);
}
.btn:focus-visible {
  outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 40%, transparent);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: #fff; border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08); text-decoration: none; color: #fff;
  box-shadow: var(--sh-2), 0 0 16px color-mix(in srgb, var(--accent) 25%, transparent);
}

.btn-secondary {
  background: var(--surface); color: var(--text); border-radius: var(--r-input);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: var(--sh-1); text-decoration: none; color: var(--text);
}

.btn-ghost {
  background: transparent; color: var(--accent); border-radius: var(--r-input);
  border: none; padding: 0 8px; height: auto;
}
.btn-ghost:hover { text-decoration: underline; }

/* --- Inputs --- */
label { display: block; margin: 8px 0 2px; font-weight: 600; font-size: 0.9em; }

input[type="text"], textarea {
  width: 100%; padding: 8px 12px; height: 44px;
  border: 1px solid var(--border); border-radius: var(--r-input);
  font-size: 0.95em; font-family: inherit; background: var(--surface);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
input[type="text"]:focus, textarea:focus {
  outline: none; border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
textarea { resize: vertical; min-height: 80px; height: auto; }
input[type="file"] { margin: 4px 0; }
input[type="range"] { accent-color: var(--accent); }

/* --- Cards --- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--sh-1); padding: 24px;
  transition: transform var(--t-med) var(--ease-out),
              box-shadow var(--t-med) var(--ease-out),
              border-color var(--t-med) var(--ease-out);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* --- Badge --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--r-pill); font-size: 0.75rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted);
}

/* --- Toggle groups (from builder) --- */
.toggle-group {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-input); overflow: hidden; margin-top: 6px;
}
.toggle-group label {
  padding: 5px 14px; font-size: 0.85em; cursor: pointer; user-select: none;
  border-right: 1px solid var(--border);
  transition: background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.toggle-group label:last-child { border-right: none; }
.toggle-group input[type="radio"] { display: none; }
.toggle-group input[type="radio"]:checked + span {
  background: var(--accent); color: #fff;
  margin: -5px -14px; padding: 5px 14px; display: inline-block;
  border-radius: calc(var(--r-input) - 1px);
}

/* --- Hero --- */
.hero {
  text-align: center; padding: 80px 0 64px;
}
.hero h1 { margin-bottom: 16px; }
.hero p { font-size: 1.15rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 32px; }
.hero .hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

@media (max-width: 768px) {
  .hero { padding: 48px 0 40px; }
  .hero p { font-size: 1rem; }
}

/* --- FAQ Accordion --- */
details.faq-item {
  background: var(--surface); padding: 0; border-radius: var(--r-card);
  border: 1px solid var(--border); overflow: hidden;
}
details.faq-item + details.faq-item { margin-top: 8px; }
details.faq-item summary {
  cursor: pointer; padding: 16px 20px; font-weight: 600; font-size: 0.95rem;
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after {
  content: '+'; font-size: 1.2em; color: var(--text-muted);
  transition: transform var(--t-fast) var(--ease-out);
}
details.faq-item[open] summary::after { content: '\2212'; }
details.faq-item .faq-body {
  padding: 0 20px 16px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.6;
}

/* --- Theme Scope --- */
.theme-scope {
  --theme-primary: var(--accent);
  --theme-secondary: var(--accent-2);
  --theme-glow: rgba(91,124,255,0.18);
  --theme-tint: rgba(91,124,255,0.04);
}

/* --- Checkerboard BG --- */
.checkerboard-bg {
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.06) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.06) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.06) 75%);
  background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

/* --- Filter Pills --- */
.filter-bar {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px;
}
.filter-pill {
  padding: 8px 20px; border-radius: var(--r-pill); font-size: 0.85rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  color: var(--text-muted);
  transition: all var(--t-fast) var(--ease-out);
}
.filter-pill:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--text);
}
.filter-pill.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* --- CTA Banner --- */
.cta-banner {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  padding: 48px; text-align: center; box-shadow: var(--sh-1);
}
.cta-banner h2 { margin-bottom: 12px; }
.cta-banner p { color: var(--text-muted); margin-bottom: 24px; }

/* --- Step Cards (How It Works) --- */
.step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent); font-weight: 700; font-size: 1rem;
  margin-bottom: 16px;
}

/* --- Feature Cards --- */
.feature-icon {
  width: 48px; height: 48px; border-radius: var(--r-input);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; font-size: 1.4rem;
}

/* --- Game Card (Browse) --- */
.game-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
  box-shadow: var(--sh-1); overflow: hidden;
  transition: transform var(--t-med) var(--ease-out),
              box-shadow var(--t-med) var(--ease-out),
              border-color var(--t-med) var(--ease-out);
}
.game-card:hover {
  transform: translateY(-3px); box-shadow: var(--sh-2);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
}
.game-card .game-card-header {
  height: 160px; display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem;
}
.game-card .game-card-body { padding: 20px; }
.game-card .game-card-body h3 { margin-bottom: 8px; }
.game-card .game-card-body p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; }
.game-card .game-card-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.game-card .game-card-features {
  list-style: none; margin-bottom: 16px; font-size: 0.85rem; color: var(--text-muted);
}
.game-card .game-card-features li { padding: 3px 0; }
.game-card .game-card-features li::before { content: '\2713\00a0'; color: var(--success); font-weight: 700; }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
