/* ==========================================================================
   AdVerse Arcade — adversearcade.com
   Sketchbook design system (from docs/DESIGN_BIBLE.md):
   paper #FAF5E6 · ink #262633 · crayon palette · Patrick Hand (player voice)
   · Inter (ad/system voice) · radius 18 · card shadows · slight wobble
   ========================================================================== */

:root {
  --paper: #FAF5E6;
  --paper-strong: #FFFCEF;
  --ink: #262633;
  --ink-soft: rgba(38, 38, 51, 0.6);

  --crayon-red: #E63946;
  --crayon-orange: #F4A261;
  --crayon-yellow: #F1D302;
  --crayon-teal: #2A9D8F;
  --crayon-purple: #6B5B95;

  --tmpl-product: #3389F2;
  --tmpl-social: #F24D8C;
  --tmpl-creator: #1AC08C;
  --tmpl-event: #F29926;
  --tmpl-meme: #8C4DF2;

  --golden: #FFD933;

  --radius-card: 18px;
  --shadow-card: 4px 8px 14px rgba(38, 38, 51, 0.14);
  --shadow-lifted: 6px 10px 20px rgba(38, 38, 51, 0.18);
  --shadow-subtle: 0 2px 4px rgba(38, 38, 51, 0.06);

  --font-hand: 'Patrick Hand', 'Comic Sans MS', cursive;
  --font-system: 'Inter', -apple-system, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-system);
  color: var(--ink);
  background-color: var(--paper);
  /* Paper grain: subtle SVG turbulence noise, per SketchbookPaper spec */
  background-image:
    radial-gradient(ellipse 40% 30% at 0% 0%, rgba(102, 77, 38, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 30% at 100% 0%, rgba(102, 77, 38, 0.07), transparent 70%),
    radial-gradient(ellipse 40% 30% at 0% 100%, rgba(102, 77, 38, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 30% at 100% 100%, rgba(102, 77, 38, 0.07), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.15 0 0 0 0 0.12 0 0 0 0 0.06 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed;
  line-height: 1.6;
  overflow-x: hidden;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Shared type ---------- */

.eyebrow {
  font-family: var(--font-system);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-title {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.1;
  margin-bottom: 16px;
}

.section-sub {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 620px;
  margin-bottom: 40px;
}

/* Slight hand-placed wobble — Playful Chaos pillar */
.wobble-l { transform: rotate(-1.1deg); }
.wobble-r { transform: rotate(1.1deg); }

/* ---------- Buttons (canonical CTA: ink fill, radius 18, Inter bold white) ---------- */

.btn {
  display: inline-block;
  font-family: var(--font-system);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  text-align: center;
  padding: 15px 28px;
  border-radius: var(--radius-card);
  transition: transform 120ms ease, box-shadow 120ms ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { transform: translateY(-2px) rotate(-0.5deg); box-shadow: var(--shadow-card); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-subtle); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 2.5px solid var(--ink);
  padding: 12.5px 26px;
}
.btn-ghost:hover { transform: translateY(-2px) rotate(0.5deg); background: var(--paper-strong); }

.btn-block { display: block; width: 100%; }

.btn-disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 245, 230, 0.88);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(38, 38, 51, 0.1);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-system);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.1em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark::before {
  content: "";
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  background-image: url("../assets/logo.svg");
  background-size: contain;
  background-repeat: no-repeat;
  transform: rotate(-4deg);
}

.wordmark-arcade { color: var(--crayon-teal); }

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-family: var(--font-hand);
  font-size: 20px;
  color: var(--ink);
  text-decoration: none;
}
.nav-links a:hover { color: var(--crayon-teal); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px 64px;
  overflow: hidden;
}

.hero-playfield {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  pointer-events: none; /* let clicks fall through to the playfield… */
}
.hero-content a, .hero-content .btn { pointer-events: auto; } /* …except real controls */

.hero-title {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(52px, 9vw, 96px);
  line-height: 1.02;
  margin-bottom: 24px;
}

.hero-sub {
  font-size: 18px;
  color: var(--ink-soft);
  max-width: 580px;
  margin: 0 auto 32px;
}
.hero-sub strong { color: var(--ink); }

.hero-ctas {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.hero-hint {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--ink-soft);
  transform: rotate(-1.5deg);
}

.hero-score {
  font-family: var(--font-hand);
  font-size: 20px;
  color: var(--crayon-teal);
  transform: rotate(-1.5deg);
}

/* Floating ad cards in the hero (spawned by JS) */

.float-card {
  position: absolute;
  top: -90px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 74px;
  height: 74px;
  border: 3.5px solid var(--ink);
  border-radius: 14px;
  background: var(--paper-strong);
  box-shadow: var(--shadow-card);
  font-family: var(--font-system);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.02em;
  text-align: center;
  padding: 6px 4px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  z-index: 1;
  animation: fall linear forwards;
}

.float-card .fc-swatch {
  position: absolute;
  top: 5px;
  left: 5px;
  right: 5px;
  height: 55%;
  border-radius: 8px;
  opacity: 0.85;
}

.float-card .fc-cta { position: relative; }

.float-card.popped {
  animation: pop 150ms ease-out forwards;
  pointer-events: none;
}

@keyframes fall {
  from { transform: translateY(0) rotate(var(--tilt, -3deg)); }
  to   { transform: translateY(var(--fall, calc(100vh + 180px))) rotate(var(--tilt, -3deg)); }
}

@keyframes pop {
  0%   { transform: scale(1) rotate(var(--tilt, -3deg)); opacity: 1; }
  55%  { transform: scale(1.24) rotate(var(--tilt, -3deg)); opacity: 1; }
  100% { transform: scale(1.34) rotate(var(--tilt, -3deg)); opacity: 0; }
}

/* Confetti shards thrown out by a pop */
.pop-shard {
  position: absolute;
  border-radius: 3px;
  pointer-events: none;
  z-index: 3;
  animation: shard-fly 520ms cubic-bezier(0.16, 0.84, 0.44, 1) forwards;
}

@keyframes shard-fly {
  from { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  70%  { opacity: 1; }
  to   { transform: translate(var(--dx, 0), var(--dy, -60px)) rotate(var(--rot, 180deg)) scale(0.4); opacity: 0; }
}

.pop-burst {
  position: absolute;
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--crayon-red);
  pointer-events: none;
  z-index: 3;
  animation: burst 600ms ease-out forwards;
}

@keyframes burst {
  from { transform: translateY(0) scale(0.8) rotate(-4deg); opacity: 1; }
  to   { transform: translateY(-48px) scale(1.3) rotate(4deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .float-card { display: none; }
  .hero-hint { visibility: hidden; }
  html { scroll-behavior: auto; }
}

/* Narrow screens have no side gutters: cards fall full-width behind the
   text block, which gets a frosted paper backdrop to stay readable. */
@media (max-width: 940px) {
  .hero-content {
    background: rgba(250, 245, 230, 0.86);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    border-radius: 24px;
    padding: 24px 16px;
  }
}

/* ---------- Manifesto ---------- */

.manifesto { padding: 40px 0 90px; }

.manifesto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.manifesto-card {
  background: var(--paper-strong);
  border: 3px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 28px 24px;
}

.manifesto-emoji { font-size: 34px; margin-bottom: 12px; }

.manifesto-card h3 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
  margin-bottom: 10px;
}

.manifesto-card p {
  font-size: 15px;
  color: var(--ink-soft);
}

/* ---------- Games ---------- */

.games { padding: 70px 0 90px; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.game-card {
  background: var(--paper-strong);
  border: 3.5px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.game-card:hover { transform: translateY(-6px) rotate(0deg); box-shadow: var(--shadow-lifted); }

.game-art {
  position: relative;
  height: 190px;
  border-bottom: 3px solid var(--ink);
  background-size: cover;
  background-position: center;
}
.game-card[data-accent="red"]    .game-art { background-color: #FCEBE4; background-image: url("../assets/ad-slayer-art.svg"); }
.game-card[data-accent="teal"]   .game-art { background-color: #E3F2EE; background-image: url("../assets/ad-dash-art.svg"); }
.game-card[data-accent="purple"] .game-art { background-color: #ECE8F4; background-image: url("../assets/ad-invaders-art.svg"); }

/* CSS mini-scenes are fallback decoration behind the SVG art */
.game-art-scene { position: absolute; inset: 0; overflow: hidden; }
.mini-card, .mini-platform, .mini-invader { display: none; }

.status-pill {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--font-system);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--paper-strong);
}
.status-soon    { background: var(--crayon-yellow); }
.status-dev     { background: #BFE6DF; }
.status-concept { background: #DDD5EC; }

.game-body {
  padding: 22px 22px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-name {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  margin-bottom: 10px;
}

.game-tag {
  font-size: 14.5px;
  color: var(--ink-soft);
  margin-bottom: 16px;
  flex: 1;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.meta-chip {
  font-family: var(--font-system);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.03em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1.5px solid rgba(38, 38, 51, 0.35);
  color: var(--ink-soft);
}

/* ---------- How it works ---------- */

.how { padding: 70px 0 90px; }

.loop {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  max-width: 860px;
}

.loop-step {
  position: relative;
  background: var(--paper-strong);
  border: 3px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 26px 24px 24px 74px;
}

.loop-num {
  position: absolute;
  left: 20px;
  top: 22px;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-hand);
  font-size: 24px;
  color: #fff;
  background: var(--crayon-teal);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  transform: rotate(-6deg);
}

.loop-step h3 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 24px;
  margin-bottom: 6px;
}

.loop-step p { font-size: 14.5px; color: var(--ink-soft); }

/* ---------- Creators ---------- */

.creators { padding: 40px 0 100px; }

.creators-card {
  background: var(--paper-strong);
  border: 3.5px solid var(--ink);
  border-radius: 24px;
  box-shadow: var(--shadow-lifted);
  padding: 56px 52px;
  max-width: 760px;
  margin: 0 auto;
}

.creators-sub { margin-bottom: 24px; }
.creators-sub strong { color: var(--ink); }

.creators-points {
  list-style: none;
  margin-bottom: 32px;
}

.creators-points li {
  font-size: 16px;
  padding: 7px 0;
}

/* ---------- Legal pages (privacy.html / terms.html) ---------- */

.legal { padding: 56px 0 90px; }

.legal-card {
  background: var(--paper-strong);
  border: 3px solid var(--ink);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 48px 44px;
  max-width: 780px;
  margin: 0 auto;
}

.legal-card h1 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: clamp(36px, 5vw, 48px);
  line-height: 1.1;
  margin-bottom: 6px;
}

.legal-updated {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 32px;
}

.legal-card h2 {
  font-family: var(--font-hand);
  font-weight: 400;
  font-size: 26px;
  margin: 36px 0 10px;
}

.legal-card p, .legal-card li {
  font-size: 15px;
  color: var(--ink);
  margin-bottom: 12px;
}

.legal-card ul {
  padding-left: 22px;
  margin-bottom: 12px;
}
.legal-card ul li { margin-bottom: 6px; }

.legal-card a { color: var(--crayon-teal); font-weight: 600; }

.legal-summary {
  background: var(--paper);
  border: 2px dashed rgba(38, 38, 51, 0.35);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 8px;
}
.legal-summary p { font-family: var(--font-hand); font-size: 18px; margin: 0; }

@media (max-width: 600px) {
  .legal-card { padding: 32px 22px; }
}

/* ---------- Footer ---------- */

.footer {
  border-top: 2px solid rgba(38, 38, 51, 0.12);
  padding: 48px 0 32px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.footer-mark { font-size: 16px; margin-bottom: 8px; }

.footer-tagline {
  font-family: var(--font-hand);
  font-size: 18px;
  color: var(--ink-soft);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-family: var(--font-system);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-soft);
  text-decoration: none;
}
.footer-links a:hover { color: var(--ink); }

.footer-legal {
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .manifesto-grid, .game-grid { grid-template-columns: 1fr; max-width: 480px; margin: 0 auto; }
  .loop { grid-template-columns: 1fr; }
  .creators-card { padding: 40px 28px; }
}

@media (max-width: 560px) {
  .nav-links { display: none; }
  .float-card { width: 62px; height: 62px; font-size: 8px; }
}
