/*
 * SudokuWorldTournament - Global Stylesheet
 * Version: 2.1.8
 * Ad-free, JavaScript-free, SEO-optimised
 */

/* ========================================
   CSS Variables (Design Tokens)
   ======================================== */
:root {
  /* Colours - Dark Theme */
  --bg: #000;
  --surface: #0f0f12;
  --surface-2: #15151a;
  --text: #f2f2f5;
  --muted: #b6b6bf;
  --border: #282833;
  --accent: #8ec5ff;
  --accent-2: #7a9eff;
  --success: #28a745;
  --warning: #ff9800;
  --error: #dc3545;
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-full: 999px;
  
  /* Shadows */
  --shadow-1: 0 8px 24px rgba(0,0,0,.45);
  --shadow-2: 0 12px 28px rgba(0,0,0,.55);
  
  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, system-ui, sans-serif;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;
  --line-height: 1.5;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-md) 0;
  font-weight: 800;
  line-height: 1.2;
}

h1 {
  font-size: var(--font-size-2xl);
}

h2 {
  font-size: var(--font-size-xl);
}

h3 {
  font-size: var(--font-size-lg);
}

p {
  margin: 0 0 var(--space-md) 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover, a:focus {
  opacity: 0.9;
}

/* ========================================
   Layout
   ======================================== */
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: var(--space-md);
}

.row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
}

.spacer {
  flex: 1;
}

/* Grid Layout */
main {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

@media (min-width: 980px) {
  main {
    grid-template-columns: 1.3fr 0.7fr;
  }
}

/* Single column layout for comparison and content pages */
main.single-column {
  grid-template-columns: 1fr !important;
  max-width: 1000px;
  margin-left: auto;
  margin-right: auto;
}

/* ========================================
   Header
   ======================================== */
header.site-header {
  position: relative;
  margin-top: var(--space-md);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 20px 20px 16px;
}

.brand-title {
  font-weight: 800;
  font-size: var(--font-size-xl);
  letter-spacing: 0.2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  color: var(--muted);
  font-size: var(--font-size-sm);
}

/* Fox Mascot */
.fox-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.fox {
  position: absolute;
  top: -30px;
  left: -6px;
  width: 88px;
  height: auto;
  transform: rotate(-6deg);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.5));
}

/* Language Selector */
.lang-selector {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: 10px var(--space-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.lang-selector a {
  font-size: 20px;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.lang-selector a:hover,
.lang-selector a.active {
  opacity: 1;
}

/* ========================================
   Navigation
   ======================================== */
nav.menu {
  display: flex;
  gap: var(--space-sm);
  padding: 0 20px 20px;
  flex-wrap: wrap;
}

.pill {
  padding: 10px 14px;
  border-radius: var(--radius-full);
  font-weight: 700;
  background: #0e0e13;
  border: 1px solid var(--border);
  color: var(--text);
  transition: transform 0.08s ease, background 0.2s ease;
  cursor: pointer;
}

.pill:hover {
  transform: translateY(-1px);
}

.pill.active {
  background: linear-gradient(180deg, #101019, #0b0b10);
  outline: 1.5px solid rgba(142, 197, 255, 0.35);
}

/* Navbar (Alternative Style) */
.navbar {
  background-color: #1a252f;
  color: white;
  padding: 15px 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-weight: bold;
  font-size: 1.2rem;
  letter-spacing: 1px;
}

.nav-link {
  color: white;
  text-decoration: none;
  background: #34495e;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background 0.3s;
  font-size: 0.9rem;
}

.nav-link:hover {
  background: #3498db;
}

/* ========================================
   Cards
   ======================================== */
.card {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}

.card-header {
  padding: var(--space-md) var(--space-lg) 10px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-weight: 800;
  font-size: var(--font-size-lg);
}

.card-title.gradient {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card-sub {
  color: var(--muted);
  font-size: var(--font-size-sm);
  margin-top: 2px;
}

.card-body {
  padding: 14px var(--space-lg) var(--space-lg);
}

/* ========================================
   Lists
   ======================================== */
.list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #0c0c11;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.list-item .meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--muted);
}

.list-item.feature {
  align-items: flex-start;
}

.list-item.feature .meta {
  display: block;
}

.list-item.feature strong {
  color: var(--accent);
  font-size: 1.1em;
}

.list-item.feature p {
  margin: 6px 0 0 0;
  opacity: 0.8;
}

/* ========================================
   Badges
   ======================================== */
.badge {
  font-size: var(--font-size-xs);
  padding: 6px 8px;
  border-radius: var(--radius-full);
  background: #0a0a0e;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.success {
  background-color: var(--success);
  color: white;
  border-color: var(--success);
}

/* ========================================
   Section Titles
   ======================================== */
.section-title {
  font-weight: 800;
  font-size: var(--font-size-md);
  margin: 0 0 var(--space-sm) 0;
}

/* ========================================
   Highlight Boxes
   ======================================== */
.highlight-box {
  background: #e8f8f0;
  border-left: 4px solid var(--success);
  padding: 20px;
  margin: 25px 0;
  border-radius: 4px;
  color: #333;
}

.highlight-box.dark {
  background: rgba(142, 197, 255, 0.1);
  border-left-color: var(--accent);
  color: var(--text);
}

.note {
  background: #fff4e6;
  border-left: 4px solid var(--warning);
  padding: 15px;
  margin: 20px 0;
  font-style: italic;
  color: #333;
}

.quote-box {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  border-left: 4px solid #667eea;
  padding: 20px 24px;
  margin: 24px 0;
  border-radius: 0 12px 12px 0;
  font-style: italic;
}

/* ========================================
   Steps & Instructions
   ======================================== */
.steps {
  background: #f0fff4;
  border: 2px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 25px;
  margin: 25px 0;
  color: #333;
}

.steps ol {
  margin-left: 20px;
}

.steps li {
  margin-bottom: 12px;
  padding-left: 5px;
}

/* ========================================
   Link Cards
   ======================================== */
.link-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 2px solid var(--success);
  border-radius: 12px;
  padding: 25px;
  margin: 20px 0;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  color: #333;
}

.link-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.link-card h3 {
  margin-top: 0;
  color: var(--success);
}

.link-card a.btn {
  display: inline-block;
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: white;
  padding: 12px 30px;
  border-radius: 25px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 15px;
  transition: transform 0.2s;
}

.link-card a.btn:hover {
  transform: scale(1.05);
}

/* ========================================
   Technique Grid
   ======================================== */
.technique-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin: 25px 0;
}

.technique-item {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 10px;
  padding: 20px;
  transition: border-color 0.3s;
  color: #333;
}

.technique-item:hover {
  border-color: var(--success);
}

.technique-item h4 {
  color: var(--success);
  margin-bottom: 10px;
  font-size: 1.2em;
}

.technique-item a {
  color: var(--success);
  font-weight: bold;
}

/* ========================================
   Comparison Table
   ======================================== */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  background: var(--surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.comparison-table th,
.comparison-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.comparison-table th {
  background: var(--surface-2);
  font-weight: 700;
  color: var(--accent);
}

.comparison-table tr:hover {
  background: rgba(142, 197, 255, 0.05);
}

.comparison-table .check {
  color: var(--success);
  font-size: 1.2em;
}

.comparison-table .cross {
  color: var(--error);
  font-size: 1.2em;
}

.comparison-table .partial {
  color: var(--warning);
  font-size: 1.2em;
}

/* ========================================
   App Store Badge
   ======================================== */
.app-store-section {
  text-align: center;
  padding: 30px 0;
}

.app-store-section h2 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: 10px;
}

.app-store-section p {
  font-size: var(--font-size-lg);
  margin-bottom: 20px;
}

.app-store-section .free-badge {
  font-size: var(--font-size-base);
  color: var(--success);
  font-weight: bold;
  margin-bottom: 8px;
}

.app-store-section img {
  height: 60px;
}

/* ========================================
   Footer
   ======================================== */
footer {
  color: var(--muted);
  font-size: var(--font-size-sm);
  padding: var(--space-md) 0 var(--space-lg);
  text-align: center;
}

footer a {
  color: var(--accent);
}

/* ========================================
   Content Pages (Light Theme)
   ======================================== */
.content-page {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #333;
}

.content-page .container {
  max-width: 900px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  overflow: hidden;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 0;
}

.content-page header {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: white;
  padding: 40px 30px;
  text-align: center;
}

.content-page header h1 {
  font-size: 2.5em;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.content-page .subtitle {
  font-size: 1.1em;
  opacity: 0.95;
}

.content-page .content {
  padding: 40px 30px;
}

.content-page h2 {
  color: #27ae60;
  margin: 30px 0 15px 0;
  font-size: 1.8em;
  border-bottom: 3px solid #27ae60;
  padding-bottom: 10px;
}

.content-page h3 {
  color: #2ecc71;
  margin: 25px 0 12px 0;
  font-size: 1.3em;
}

.content-page p {
  margin-bottom: 15px;
  text-align: justify;
}

.content-page ul {
  margin-left: 40px;
  margin-bottom: 20px;
}

.content-page li {
  margin-bottom: 8px;
}

.content-page footer {
  background: #2d3748;
  color: white;
  text-align: center;
  padding: 20px;
  font-size: 0.9em;
}

/* ========================================
   About Page (Dark Gradient Theme)
   ======================================== */
.about-page {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  color: #e8e8e8;
  line-height: 1.7;
}

.about-page .container {
  max-width: 800px;
  padding: 40px 24px;
}

.about-page header {
  text-align: center;
  margin-bottom: 48px;
}

.about-page .logo {
  width: 120px;
  height: 120px;
  margin-bottom: 24px;
  border-radius: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.about-page h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.about-page .tagline {
  font-size: 1.1rem;
  color: #a0a0a0;
  font-style: italic;
}

.story-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 32px;
  margin-bottom: 32px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.story-section h2 {
  font-size: 1.5rem;
  color: #667eea;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  padding: 0;
}

.story-section h2 .icon {
  font-size: 1.8rem;
}

.story-section p {
  color: #c8c8c8;
  margin-bottom: 16px;
  text-align: left;
}

.story-section p:last-child {
  margin-bottom: 0;
}

.highlight {
  color: #667eea;
  font-weight: 600;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.feature-card {
  background: rgba(102, 126, 234, 0.1);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.feature-card .icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1rem;
  color: #667eea;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 0.9rem;
  color: #a0a0a0;
}

.author-section {
  text-align: center;
  padding: 40px 32px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
  border-radius: 16px;
  margin-top: 48px;
}

.author-section h2 {
  color: #667eea;
  margin-bottom: 16px;
  border: none;
  padding: 0;
}

.author-section p {
  color: #c8c8c8;
  max-width: 600px;
  margin: 0 auto;
}

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
  :root {
    --font-size-2xl: 24px;
    --font-size-xl: 20px;
  }
  
  .header-inner {
    flex-wrap: wrap;
  }
  
  .fox-wrap {
    display: none;
  }
  
  nav.menu {
    justify-content: center;
  }
  
  .technique-grid {
    grid-template-columns: 1fr;
  }
  
  .content-page .content {
    padding: 20px;
  }
  
  .about-page .container {
    padding: 24px 16px;
  }
  
  .about-page h1 {
    font-size: 1.8rem;
  }
  
  .story-section {
    padding: 24px 20px;
  }
  
  .comparison-table {
    font-size: var(--font-size-sm);
  }
  
  .comparison-table th,
  .comparison-table td {
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .lang-selector {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .pill {
    padding: 8px 12px;
    font-size: var(--font-size-sm);
  }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .lang-selector,
  nav.menu,
  .fox-wrap {
    display: none;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ========================================
   Accessibility
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
.pill:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  z-index: 100;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
}
