/* ==========================================================================
   Design Tokens & Base
   ========================================================================== */
:root {
  /* Colors - Blue & White Theme */
  --primary: #2563EB; /* Bright Blue */
  --primary-hover: #1D4ED8;
  --secondary: #EFF6FF; /* Very Light Blue */
  --accent: #3B82F6;
  --accent-hover: #2563EB;
  
  --bg-main: #f5f2eb; /* Warm parchment bg */
  --bg-2: #ebe8e0; /* Secondary warm bg */
  --bg-card: #fbf9f5; /* Cream card bg */
  
  --text-main: #18181b; /* Soft dark charcoal */
  --text-muted: #3f3f46; /* Muted charcoal */
  --text-dim: #71717a;
  --text-light: #FFFFFF;
  
  --border: #dfdbcf;
  --border-light: #ece9df;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Layout & Sizing */
  --container-width: 1200px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Effects */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -1px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -2px rgba(15, 23, 42, 0.05);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

a {
  text-decoration: none;
  color: var(--primary);
  transition: color var(--transition);
}
a:hover {
  color: var(--primary-hover);
}

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.highlight {
  color: var(--primary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-light);
  box-shadow: 0 4px 14px 0 rgba(37, 99, 235, 0.39);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: var(--text-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.23);
}

.btn-secondary {
  background-color: var(--secondary);
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.1);
}
.btn-secondary:hover {
  background-color: #DBEAFE;
  transform: translateY(-2px);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.125rem;
}

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--bg-main);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}

.nav-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.5px;
}
.nav-logo img {
  height: 32px;
  width: auto;
}
.nav-logo span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 20px;
  align-items: center;
}

.nav-links li a {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color var(--transition);
}
.nav-links li a:hover, .nav-links li a.active {
  color: var(--primary);
}

.dropdown {
  position: relative;
}
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}
.dropdown:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.dropdown-menu a {
  display: block;
  padding: 8px 20px;
  color: var(--text-muted) !important;
  font-weight: 500;
  white-space: nowrap;
}
.dropdown-menu a:hover {
  background: var(--secondary);
  color: var(--primary) !important;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-play-btn {
  white-space: nowrap;
  flex-shrink: 0;
  text-align: center;
  background: var(--primary);
  color: white;
  padding: 8px 20px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.9rem;
}
.nav-play-btn:hover {
  background: var(--primary-hover);
  color: white;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: all var(--transition);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 300px;
  height: 100vh;
  background: var(--bg-card);
  box-shadow: -5px 0 20px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 16px;
  transition: right 0.4s ease;
  z-index: 2000;
}
.mobile-menu.open {
  right: 0;
}
.mobile-menu a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-main);
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
  padding: 80px 0 100px;
  background: linear-gradient(to bottom, var(--bg-main) 0%, var(--bg-card) 100%);
  overflow: hidden;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: 64px;
}

.hero-content {
  flex: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-main);
  border: 1px solid var(--primary);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: #10B981; /* Green dot for 'live/free' */
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-content h1 {
  font-size: 4rem;
  letter-spacing: -1px;
  margin-bottom: 20px;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 540px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  margin-bottom: 48px;
}

.hero-stats {
  display: flex;
  gap: 40px;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}
.hero-stat-num {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
}
.hero-stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.hero-visual {
  flex: 1;
  position: relative;
  display: flex;
  justify-content: center;
}

.hero-board-preview {
  width: 440px;
  height: 440px;
  background: white;
  border: 8px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(37, 99, 235, 0.25);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  transform: rotateX(15deg) rotateY(-15deg);
  transform-style: preserve-3d;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  0% { transform: rotateX(15deg) rotateY(-15deg) translateY(0px); }
  50% { transform: rotateX(15deg) rotateY(-15deg) translateY(-20px); }
  100% { transform: rotateX(15deg) rotateY(-15deg) translateY(0px); }
}

.hero-sq {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  user-select: none;
}
.hero-sq.light { background-color: #F8FAFC; }
.hero-sq.dark { background-color: #DBEAFE; } /* Very light blue for dark squares */
.hero-sq .piece {
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}

/* ==========================================================================
   Sections & General
   ========================================================================== */
.section {
  padding: 100px 0;
}
.section-sm {
  padding: 40px 0;
}

.section-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 56px;
}
.section-label {
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 0.875rem;
  margin-bottom: 12px;
}
.section-header h2 {
  font-size: 2.5rem;
  margin-bottom: 16px;
}
.section-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* ==========================================================================
   Features Grid
   ========================================================================== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 32px;
}

.feature-card {
  background: var(--bg-card);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #DBEAFE;
}
.feature-icon {
  width: 56px;
  height: 56px;
  background: var(--secondary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: 24px;
}
.feature-card h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
}
.feature-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   Blog Section
   ========================================================================== */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 32px;
}

.blog-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all var(--transition);
  color: inherit;
}
.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.blog-card-img {
  height: 200px;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.blog-card-img-placeholder {
  font-size: 4rem;
  opacity: 0.8;
}
.blog-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.blog-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 0.85rem;
}
.blog-tag {
  background: var(--secondary);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 600;
}
.blog-date {
  color: var(--text-dim);
}
.blog-card h3 {
  font-size: 1.25rem;
  margin-bottom: 12px;
  color: var(--text-main);
}
.blog-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
  flex: 1;
}
.blog-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
}
.blog-read-time {
  color: var(--text-dim);
}
.read-more {
  color: var(--primary);
  font-weight: 600;
}

/* ==========================================================================
   Openings Grid
   ========================================================================== */
.openings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.opening-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-align: center;
  color: inherit;
}
.opening-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  background: var(--secondary);
}
.opening-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  display: inline-block;
  background: var(--bg-main);
  width: 64px;
  height: 64px;
  line-height: 64px;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.opening-card h3 {
  font-size: 1.15rem;
  margin-bottom: 8px;
}
.opening-moves {
  margin-top: 16px;
  font-family: monospace;
  background: rgba(15, 23, 42, 0.05);
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   Ads
   ========================================================================== */
.ad-unit {
  background: #f1f5f9;
  border: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ad-label {
  position: absolute;
  top: 4px;
  left: 8px;
  font-size: 0.65rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
  background: #0F172A; /* Dark blue background for footer */
  color: #F8FAFC;
  padding: 80px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 64px;
}

.footer-brand .nav-logo {
  color: #FFFFFF;
  margin-bottom: 20px;
}
.footer-brand .nav-logo span {
  color: #60A5FA; /* Lighter blue for contrast */
}
.footer-brand p {
  color: #94A3B8;
  max-width: 300px;
}

.footer-col h4 {
  color: #FFFFFF;
  font-size: 1.1rem;
  margin-bottom: 24px;
}
.footer-col a {
  display: block;
  color: #94A3B8;
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.footer-col a:hover {
  color: #60A5FA;
  padding-left: 4px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 992px) {
  .hero-inner {
    flex-direction: column;
    text-align: center;
    gap: 40px;
  }
  .hero-content p {
    margin: 0 auto 32px;
  }
  .hero-actions {
    justify-content: center;
  }
  .hero-stats {
    justify-content: center;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1024px) {
  .nav-links, .nav-play-btn, #auth-container {
    display: none !important;
  }
  .hamburger {
    display: flex;
  }
  .hero-content h1 {
    font-size: 2.8rem;
  }
  .hero-board-preview {
    width: 320px;
    height: 320px;
  }
  .hero-sq {
    font-size: 1.6rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Dark Theme (Global)
   ========================================================================== */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --secondary: #1e293b;
  --bg-main: #0f172a;
  --bg-2: #1e293b;
  --bg-card: #1e293b;
  
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --text-dim: #94a3b8;
  
  --border: #334155;
  --border-light: #1e293b;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

.theme-btn {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s;
  margin-right: 15px;
}
.theme-btn:hover {
  background: var(--bg-2);
  color: var(--primary);
}

/* Icon toggling */
.theme-btn .sun-icon { display: none; }
.theme-btn .moon-icon { display: block; }

[data-theme="dark"] .theme-btn .sun-icon { display: block; color: #fbbf24; }
[data-theme="dark"] .theme-btn .moon-icon { display: none; }

/* Page Hero section styling */
.page-hero {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 60px 0;
    text-align: center;
    margin-bottom: 40px;
}
.page-hero .section-label {
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
}
.page-hero h1 {
    font-size: 3rem;
    font-family: var(--font-display);
    color: var(--text-main);
    font-weight: 800;
    margin: 0 0 12px 0;
}
.page-hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}
