/* ═══════════════════════════════════════════════════════════════
   SnapGrid — Landing Page Styles
   Aesthetic: Warm Geometric Playfulness
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  /* Game palette (from Unity ColorPalette.cs) */
  --red: #FA5959;
  --crimson: #D92659;
  --pink: #FA73AD;
  --orange: #FA9E38;
  --yellow: #FCD940;
  --amber: #E0B826;
  --lime: #ADEB59;
  --emerald: #59E08C;
  --forest: #26A66B;
  --cyan: #40E0E0;
  --sky: #59B8F2;
  --royal: #387AE0;
  --violet: #946BEB;
  --purple: #BF59E0;
  --magenta: #EB59C7;
  --teal: #40C7AD;

  /* Theme */
  --bg-warm: #FAF6EE;
  --bg-warm-alt: #F3ECE0;
  --bg-grid: #EDE5D5;
  --bg-cell: #E6DBC8;
  --text-dark: #2D2A26;
  --text-mid: #6B6560;
  --text-light: #9B9590;
  --white: #FFFFFF;

  /* Layout */
  --max-w: 1180px;
  --section-py: clamp(4rem, 8vw, 7rem);
  --section-px: clamp(1.25rem, 4vw, 2.5rem);
  --radius: 18px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* Grid cell */
  --cell: clamp(28px, 4.2vw, 40px);
  --gap: clamp(2px, 0.35vw, 3px);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(45,42,38,0.06);
  --shadow-md: 0 8px 30px rgba(45,42,38,0.08);
  --shadow-lg: 0 20px 50px rgba(45,42,38,0.10);
  --shadow-glow: 0 12px 40px rgba(250,158,56,0.18);
}

/* ── Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Nunito', 'Segoe UI', sans-serif;
  color: var(--text-dark);
  background: var(--bg-warm);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; }

/* ── Container ─────────────────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--section-px);
}

/* ── Navigation ────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 var(--section-px);
  transition: background 0.3s, box-shadow 0.3s;
}

.nav.scrolled {
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 rgba(45,42,38,0.06);
}

.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text-dark);
}

.nav-logo span {
  background: linear-gradient(135deg, var(--orange), var(--red));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  background: var(--text-dark);
  color: var(--white);
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.875rem;
  transition: transform 0.2s, box-shadow 0.2s;
}

.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(45,42,38,0.18);
}

.nav-cta svg {
  width: 14px;
  height: 14px;
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero {
  padding-top: calc(64px + var(--section-py));
  padding-bottom: var(--section-py);
  position: relative;
  overflow: hidden;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.hero-content {
  max-width: 520px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(250, 158, 56, 0.12);
  color: var(--orange);
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.hero-badge svg { width: 14px; height: 14px; }

.hero h1 {
  font-size: clamp(2.8rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
}

.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--orange) 0%, var(--red) 40%, var(--magenta) 70%, var(--violet) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: clamp(1.05rem, 2vw, 1.2rem);
  color: var(--text-mid);
  margin-bottom: 2rem;
  max-width: 420px;
}

.store-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.store-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  background: var(--text-dark);
  color: var(--white);
  border-radius: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 168px;
}

.store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.store-btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.store-btn-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.store-btn-label {
  font-size: 0.65rem;
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.store-btn-name {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ── Animated Grid ─────────────────────────────────────────────── */
.hero-grid-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.grid-scene {
  perspective: 900px;
  display: flex;
  justify-content: center;
}

.grid-board {
  display: grid;
  grid-template-columns: repeat(9, var(--cell));
  grid-template-rows: repeat(9, var(--cell));
  gap: var(--gap);
  padding: clamp(8px, 1.2vw, 14px);
  background: var(--bg-grid);
  border-radius: var(--radius);
  box-shadow: var(--shadow-glow);
  transform: rotateY(-4deg) rotateX(2deg);
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
  position: relative;
}

.grid-board::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,0.5);
  pointer-events: none;
}

.grid-board:hover {
  transform: rotateY(0deg) rotateX(0deg);
}

.grid-cell {
  width: var(--cell);
  height: var(--cell);
  border-radius: var(--radius-xs);
  background: var(--bg-cell);
  transition: background-color 0.15s, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.25s;
  transform: scale(1);
  position: relative;
}

.grid-cell.filled {
  animation: cell-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  border-radius: var(--radius-xs);
}

.grid-cell.filled::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: calc(var(--radius-xs) - 1px);
  background: linear-gradient(135deg, rgba(255,255,255,0.35) 0%, transparent 60%);
  pointer-events: none;
}

.grid-cell.clearing {
  animation: cell-clear 0.4s ease-in forwards;
}

@keyframes cell-pop {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes cell-clear {
  0% { transform: scale(1); opacity: 1; filter: brightness(1.8); }
  50% { transform: scale(1.1); filter: brightness(2); }
  100% { transform: scale(0); opacity: 0; filter: brightness(1); }
}

/* Decorative shapes floating around the grid */
.grid-deco {
  position: absolute;
  border-radius: var(--radius-xs);
  opacity: 0.12;
  pointer-events: none;
  animation: float-drift linear infinite;
}

@keyframes float-drift {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(8deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

/* ── Section Shared ────────────────────────────────────────────── */
.section {
  padding: var(--section-py) 0;
}

.section-header {
  text-align: center;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-header p {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: var(--text-mid);
  max-width: 560px;
  margin: 0 auto;
}

/* ── Features ──────────────────────────────────────────────────── */
.features {
  background: var(--bg-warm-alt);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1rem, 2vw, 1.5rem);
}

.feature-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 3vw, 2rem);
  transition: transform 0.3s, box-shadow 0.3s;
  border: 1px solid rgba(45,42,38,0.04);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.feature-icon svg {
  width: 26px;
  height: 26px;
}

.feature-icon--drag { background: rgba(89, 184, 242, 0.14); color: var(--sky); }
.feature-icon--combo { background: rgba(250, 89, 89, 0.12); color: var(--red); }
.feature-icon--scale { background: rgba(148, 107, 235, 0.12); color: var(--violet); }

.feature-card h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.6;
}

/* ── Game Modes ────────────────────────────────────────────────── */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
}

.mode-card {
  border-radius: var(--radius);
  padding: clamp(2rem, 4vw, 2.75rem);
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(45,42,38,0.06);
  transition: transform 0.3s, box-shadow 0.3s;
}

.mode-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.mode-card--classic {
  background: linear-gradient(145deg, #FFF8F0, #FFF2E4);
}

.mode-card--weekly {
  background: linear-gradient(145deg, #F0F4FF, #E8EEFF);
}

.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 50px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.mode-card--classic .mode-badge {
  background: rgba(250,158,56,0.15);
  color: #C07A10;
}

.mode-card--weekly .mode-badge {
  background: rgba(56,122,224,0.12);
  color: #2A5EAE;
}

.mode-badge svg { width: 12px; height: 12px; }

.mode-card h3 {
  font-size: clamp(1.4rem, 2.5vw, 1.7rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.mode-card p {
  font-size: 0.95rem;
  color: var(--text-mid);
  line-height: 1.7;
  max-width: 380px;
}

.mode-card .mode-visual {
  position: absolute;
  bottom: -10px;
  right: -10px;
  opacity: 0.06;
  font-size: 8rem;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

/* ── How It Works ──────────────────────────────────────────────── */
.how-it-works {
  background: var(--bg-warm-alt);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  counter-reset: step;
}

.step-item {
  text-align: center;
  counter-increment: step;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 1.25rem;
  border-radius: 16px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--white);
}

.step-item:nth-child(1) .step-number { background: linear-gradient(135deg, var(--sky), var(--royal)); }
.step-item:nth-child(2) .step-number { background: linear-gradient(135deg, var(--orange), var(--red)); }
.step-item:nth-child(3) .step-number { background: linear-gradient(135deg, var(--violet), var(--magenta)); }

.step-item h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.step-item p {
  font-size: 0.92rem;
  color: var(--text-mid);
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── CTA Section ───────────────────────────────────────────────── */
.cta-section {
  background: linear-gradient(135deg, #FA9E38 0%, #FA5959 35%, #EB59C7 65%, #946BEB 100%);
  color: var(--white);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 30%, rgba(255,255,255,0.08) 0%, transparent 40%);
  pointer-events: none;
}

.cta-section .section-header h2 {
  color: var(--white);
}

.cta-section .section-header p {
  color: rgba(255,255,255,0.85);
}

.cta-section .store-btn {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
}

.cta-section .store-btn:hover {
  background: rgba(255,255,255,0.28);
}

/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  background: #2D2A26;
  color: rgba(255,255,255,0.5);
  padding: 2rem 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-logo {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: rgba(255,255,255,0.8);
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
}

.footer-links a {
  color: rgba(255,255,255,0.5);
  transition: color 0.2s;
}

.footer-links a:hover { color: rgba(255,255,255,0.85); }

.footer-copy {
  font-size: 0.8rem;
  width: 100%;
  text-align: center;
  padding-top: 1.5rem;
  margin-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Floating Background Shapes ────────────────────────────────── */
.bg-shapes {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.bg-shape {
  position: absolute;
  border-radius: var(--radius-xs);
  opacity: 0;
  animation: bg-float linear infinite;
}

@keyframes bg-float {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  5% { opacity: 0.06; }
  90% { opacity: 0.06; }
  100% {
    transform: translateY(-120px) rotate(45deg);
    opacity: 0;
  }
}

/* ── Scroll Animations ─────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ── Hero Entrance Animations ──────────────────────────────────── */
@keyframes hero-fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes hero-grid-in {
  from { opacity: 0; transform: scale(0.92) rotateY(-4deg) rotateX(2deg); }
  to   { opacity: 1; transform: scale(1) rotateY(-4deg) rotateX(2deg); }
}

.hero-content > * {
  opacity: 0;
  animation: hero-fade-up 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.hero-content > *:nth-child(1) { animation-delay: 0.1s; }
.hero-content > *:nth-child(2) { animation-delay: 0.2s; }
.hero-content > *:nth-child(3) { animation-delay: 0.3s; }
.hero-content > *:nth-child(4) { animation-delay: 0.45s; }

.grid-board {
  opacity: 0;
  animation: hero-grid-in 0.8s cubic-bezier(0.23, 1, 0.32, 1) 0.35s forwards;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }

  .hero-content {
    order: 2;
    max-width: 560px;
  }

  .hero-grid-wrapper {
    order: 1;
  }

  .hero-sub { margin-left: auto; margin-right: auto; }

  .store-buttons { justify-content: center; }

  .grid-board {
    transform: none;
  }

  .grid-board:hover {
    transform: none;
  }

  .features-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin: 0 auto;
  }

  .modes-grid {
    grid-template-columns: 1fr;
    max-width: 520px;
    margin: 0 auto;
  }

  .steps-grid {
    grid-template-columns: 1fr;
    max-width: 360px;
    margin: 0 auto;
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  :root {
    --cell: 30px;
    --gap: 2px;
  }

  .nav-inner { height: 56px; }

  .hero {
    padding-top: calc(56px + 2rem);
  }

  .store-btn {
    padding: 10px 18px;
    min-width: 152px;
  }

  .store-btn-name {
    font-size: 0.95rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .footer-copy { text-align: center; }
}

/* ── Privacy / Content Page ────────────────────────────────────── */
.page-content {
  padding-top: calc(64px + 3rem);
  padding-bottom: 4rem;
}

.page-content .container {
  max-width: 720px;
}

.page-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin-bottom: 0.5rem;
}

.page-content .page-date {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}

.page-content h2 {
  font-size: 1.3rem;
  margin-top: 2.25rem;
  margin-bottom: 0.75rem;
}

.page-content p {
  color: var(--text-mid);
  margin-bottom: 1rem;
}

.page-content ul {
  color: var(--text-mid);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.page-content li {
  margin-bottom: 0.4rem;
}

.page-content a {
  color: var(--royal);
  text-decoration: underline;
  text-decoration-color: rgba(56,122,224,0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.2s;
}

.page-content a:hover {
  text-decoration-color: var(--royal);
}
