/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --color-primary: #4F46E5;
  --color-primary-dark: #4338CA;
  --color-primary-light: #818CF8;
  --color-violet: #7C3AED;
  --color-accent: #F59E0B;
  --color-accent-dark: #D97706;
  --gradient-brand: linear-gradient(135deg, var(--color-primary), var(--color-violet));

  --color-bg: #FAFAFA;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F3F4F8;
  --color-text: #0F172A;
  --color-text-muted: #475569;
  --color-border: #E2E8F0;

  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;

  --max-width: 1120px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 12px 32px rgba(79, 70, 229, 0.28);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #0B1120;
    --color-surface: #161F32;
    --color-surface-alt: #1C2740;
    --color-text: #F1F5F9;
    --color-text-muted: #94A3B8;
    --color-border: #2A3552;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.55);
  }
}

/* ==========================================================================
   Reset & base
   ========================================================================== */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3 {
  line-height: 1.15;
  margin: 0 0 var(--space-2);
  letter-spacing: -0.02em;
  font-weight: 800;
}

p {
  margin: 0 0 var(--space-2);
  color: var(--color-text-muted);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-2);
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================================
   Scroll reveal
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--color-surface) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.wordmark {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.wordmark:hover {
  text-decoration: none;
}

.wordmark span {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-links {
  display: none;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  position: relative;
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.25rem 0;
}

.nav-links a:hover {
  text-decoration: none;
  color: var(--color-primary);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--gradient-brand);
  transition: width 0.25s var(--ease);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.nav-toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--color-text);
}

.nav-mobile {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  padding: 0 var(--space-2) var(--space-2);
  list-style: none;
  margin: 0;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.nav-mobile.is-open {
  display: flex;
}

.nav-mobile a {
  color: var(--color-text);
  font-weight: 600;
  padding: var(--space-1) 0;
}

@media (min-width: 640px) {
  .nav-links {
    display: flex;
    align-items: center;
  }

  .nav-toggle {
    display: none;
  }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  padding: var(--space-5) 0 var(--space-5);
  overflow: hidden;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -1;
  opacity: 0.35;
}

.hero::before {
  width: 420px;
  height: 420px;
  background: var(--color-primary);
  top: -140px;
  left: -120px;
}

.hero::after {
  width: 380px;
  height: 380px;
  background: var(--color-accent);
  bottom: -160px;
  right: -100px;
  opacity: 0.25;
}

.hero .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: center;
}

.hero-content {
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.2);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 0.8rem;
  margin-bottom: var(--space-2);
}

.hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
}

.hero-lede {
  font-size: 1.15rem;
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
}

.hero-ctas {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--space-3);
}

.hero-visual {
  display: flex;
  justify-content: center;
}

@media (min-width: 900px) {
  .hero .container {
    grid-template-columns: 1.1fr 0.9fr;
    text-align: left;
  }

  .hero-content {
    text-align: left;
  }

  .hero-lede {
    margin-left: 0;
  }

  .hero-ctas {
    justify-content: flex-start;
  }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.36);
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border: 1.5px solid var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.btn-disabled {
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  cursor: default;
}

.btn-disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   Phone mockup (decorative — CSS-built Sudoku screen)
   ========================================================================== */
.phone-mockup {
  width: 240px;
  background: linear-gradient(160deg, #1E293B, #0F172A);
  border-radius: 2.4rem;
  padding: 12px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transform: rotate(-4deg);
  animation: float 5s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(-4deg) translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
  .phone-mockup {
    animation: none;
  }
}

.phone-screen {
  background: #F7F7F2;
  border-radius: 1.7rem;
  overflow: hidden;
  padding: 0.9rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* Top bar: back arrow, timer + difficulty, pause */
.phone-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pt-icon {
  width: 16px;
  height: 16px;
}

.pt-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.pt-time {
  font-weight: 800;
  font-size: 0.85rem;
  color: #14151A;
}

.pt-diff {
  font-size: 0.55rem;
  color: #9AA0AA;
}

.icon-pause {
  display: inline-flex;
  gap: 3px;
}

.icon-pause span {
  width: 3px;
  height: 13px;
  background: #14151A;
  border-radius: 1px;
}

/* Sudoku board */
.sudoku-mock {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  background: #fff;
  border: 2px solid #14151A;
  border-radius: 12px;
  overflow: hidden;
}

.sm-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(0.5rem, 1.7vw, 0.7rem);
  color: #14151A;
  background: #fff;
  border-right: 1px solid rgba(15, 23, 42, 0.12);
  border-bottom: 1px solid rgba(15, 23, 42, 0.12);
}

.sm-cell.sm-border-r {
  border-right: 1.5px solid #14151A;
}

.sm-cell.sm-border-b {
  border-bottom: 1.5px solid #14151A;
}

.sm-cell.sm-highlight {
  background: #ECEAF9;
}

.sm-cell.sm-selected {
  background: #AEC9F7;
}

/* Toolbar row: undo / erase / notes / hint */
.phone-toolbar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.3rem;
}

.tool-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: #6B7280;
}

.tool-item svg {
  width: 14px;
  height: 14px;
}

.tool-item span:last-child {
  font-size: 0.48rem;
  font-weight: 600;
}

.tool-badge {
  position: absolute;
  top: -6px;
  right: 22%;
  font-size: 0.4rem;
  font-weight: 700;
  padding: 0.05rem 0.25rem;
  border-radius: 999px;
  background: #E5E7EB;
  color: #6B7280;
}

.tool-badge.tool-badge-accent {
  background: var(--color-primary);
  color: #fff;
}

/* Number pad */
.sm-numpad {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 0.2rem;
}

.sm-num {
  aspect-ratio: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.sm-num .n {
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--color-primary);
}

.sm-num .c {
  font-size: 0.38rem;
  font-weight: 600;
  color: #9AA0AA;
}

/* ==========================================================================
   Features strip
   ========================================================================== */
.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.feature-card {
  text-align: center;
  padding: var(--space-3);
}

.feature-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--space-2);
  border-radius: var(--radius-md);
  background: rgba(79, 70, 229, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.feature-icon svg {
  width: 26px;
  height: 26px;
  stroke: var(--color-primary);
}

.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}

.feature-card p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* ==========================================================================
   Games grid
   ========================================================================== */
.section {
  padding: var(--space-5) 0;
}

.section-alt {
  background: var(--color-surface-alt);
}

.section-heading {
  text-align: center;
  margin-bottom: var(--space-4);
}

.section-heading h2 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 640px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.game-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
}

.game-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: transparent;
}

.game-card .game-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-1);
}

.game-card h3 {
  font-size: 1.3rem;
}

.game-card.is-placeholder {
  align-items: center;
  justify-content: center;
  text-align: center;
  border-style: dashed;
  color: var(--color-text-muted);
  box-shadow: none;
}

.game-card.is-placeholder:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--color-border);
}

.badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-accent-dark);
}

/* ==========================================================================
   Content pages (privacy)
   ========================================================================== */
.content-page {
  padding: var(--space-4) 0 var(--space-5);
}

.content-page h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.content-page h2 {
  font-size: 1.25rem;
  margin-top: var(--space-4);
}

.content-page ul {
  color: var(--color-text-muted);
  padding-left: 1.25rem;
}

.content-page li {
  margin-bottom: var(--space-1);
}

.updated-note {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: var(--space-4) 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--space-2);
  text-align: center;
}

.footer-brand .wordmark {
  display: inline-block;
  margin-bottom: 0.4rem;
}

.footer-brand p {
  max-width: 40ch;
  margin: 0 auto;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-text-muted);
  font-weight: 600;
}

.footer-links a:hover {
  color: var(--color-primary);
}

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

@media (min-width: 768px) {
  .footer-top {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .footer-brand p {
    margin: 0;
  }
}
