/* ========================================
   BASE NATIVE - CLASSLESS CSS FOUNDATION
   ========================================
   
   Philosophy: Style semantic HTML beautifully by default.
   Classes are a last resort. Let the HTML structure and 
   element semantics drive the design.
   ======================================== */

/* CSS Custom Properties - Design System */
:root {
  /* Color Palette */
  --primary: #0066ff;
  --primary-hover: #0052cc;
  --primary-light: #e6f0ff;
  --secondary: #6c757d;
  --dark: #1a1a1a;
  --light: #f8f9fa;
  --text: #2c3e50;
  --text-light: #6c757d;
  --border: #e1e4e8;
  --success: #28a745;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  
  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  --font-size-base: 16px;
  --line-height-base: 1.6;
  
  /* Spacing Scale */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --space-xl: 6rem;
  
  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.2);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
}

/* ========================================
   BASELINE ELEMENT STYLES
   ======================================== */

/* Universal Box Sizing */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Root & Body */
html {
  font-size: var(--font-size-base);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  line-height: var(--line-height-base);
  color: var(--text);
  background-color: #ffffff;
  min-height: 100vh;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--dark);
  margin-bottom: var(--space-sm);
}

h1 {
  font-size: 3.5rem;
  font-weight: 800;
}

h2 {
  font-size: 2.5rem;
}

h3 {
  font-size: 1.75rem;
}

h4 {
  font-size: 1.5rem;
}

h5 {
  font-size: 1.25rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--space-sm);
  line-height: 1.8;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Lists */
ul, ol {
  margin-bottom: var(--space-sm);
  padding-left: var(--space-md);
}

li {
  margin-bottom: var(--space-xs);
  line-height: 1.8;
}

/* Quotes */
blockquote {
  border-left: 4px solid var(--primary);
  padding-left: var(--space-md);
  margin: var(--space-md) 0;
  font-style: italic;
  font-size: 1.25rem;
  color: var(--text-light);
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--dark);
  color: #e6e6e6;
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--dark);
  color: #e6e6e6;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-sm);
}

pre code {
  background: transparent;
  padding: 0;
  display: block;
  line-height: 1.6;
}

/* Emphasis */
strong, b {
  font-weight: 700;
}

em, i {
  font-style: italic;
}

/* Horizontal Rule */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-md) 0;
}

/* ========================================
   STRUCTURAL ELEMENTS
   ======================================== */

/* Header */
header {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

/* Navigation */
nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-sm) var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

nav ul {
  display: flex;
  list-style: none;
  gap: var(--space-md);
  align-items: center;
  margin: 0;
  padding: 0;
}

nav li {
  margin: 0;
}

nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-fast);
}

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

/* Main Content */
main {
  flex: 1;
}

/* Sections */
section {
  padding: var(--space-xl) var(--space-md);
}

section:nth-of-type(odd) {
  background: #ffffff;
}

section:nth-of-type(even) {
  background: var(--light);
}

/* First section (hero) gets special treatment */
main > section:first-child {
  background: var(--gradient-primary);
  color: white;
  text-align: center;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

main > section:first-child h1 {
  color: white;
  font-size: 3.5rem;
  margin-bottom: var(--space-md);
}

main > section:first-child p {
  font-size: 1.25rem;
  opacity: 0.95;
  line-height: 1.8;
}

main > section:first-child a {
  color: white;
}

/* Container Pattern - for content width constraint */
section > div:first-child {
  max-width: 1200px;
  margin: 0 auto;
}

/* Article Cards */
article {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: white;
  transition: all var(--transition-base);
}

article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

article h3 {
  margin-bottom: var(--space-sm);
  color: var(--dark);
}

article p {
  color: var(--text-light);
}

/* Footer */
footer {
  background: var(--dark);
  color: white;
  padding: var(--space-lg) var(--space-md) var(--space-md);
}

footer h3, footer h4 {
  color: white;
  margin-bottom: var(--space-sm);
}

footer h3 {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

footer p {
  color: rgba(255, 255, 255, 0.7);
}

footer ul {
  list-style: none;
  padding: 0;
}

footer li {
  margin-bottom: var(--space-xs);
}

footer a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color var(--transition-fast);
}

footer a:hover {
  color: white;
  text-decoration: none;
}

/* ========================================
   BUTTON PATTERNS (Minimal Class Usage)
   ======================================== */

/* Style buttons and button-like links */
button,
input[type="submit"],
input[type="button"],
a[href^="#"][role="button"],
a[download] {
  display: inline-block;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  border: 2px solid var(--primary);
  background: var(--primary);
  color: white;
  cursor: pointer;
  transition: all var(--transition-base);
  font-family: inherit;
  line-height: 1;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
a[href^="#"][role="button"]:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  text-decoration: none;
}

button:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ========================================
   GRID & LAYOUT PATTERNS
   ======================================== */

/* Auto-grid for common patterns */
section > div > div {
  display: grid;
  gap: var(--space-md);
}

/* 3-column grid for cards/features */
section > div > div[data-columns="3"],
section article:nth-child(3):last-child {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* 2-column grid for larger content */
section > div > div[data-columns="2"] {
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--space-lg);
  align-items: center;
}

/* ========================================
   UTILITY CLASSES (Last Resort Only)
   ======================================== */

/* Only for truly exceptional cases where semantic HTML can't express intent */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Button variant - secondary style */
.button-secondary {
  background: transparent;
  color: white;
  border-color: white;
}

.button-secondary:hover {
  background: white;
  color: var(--primary);
}

/* Hero section styling exception */
.hero-content {
  max-width: 800px;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin: var(--space-md) 0;
}

.hero-install {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hero-install code {
  background: transparent;
  color: white;
}

/* Feature icon sizing */
.feature-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--space-sm);
}

/* Text alignment utilities - rare cases */
.text-center {
  text-align: center;
}

/* Step circles for numbered instructions */
.step-number {
  width: 60px;
  height: 60px;
  background: var(--gradient-primary);
  color: white;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto var(--space-sm);
}

/* Grid override for examples alternating layout */
.example-reverse {
  direction: rtl;
}

.example-reverse > * {
  direction: ltr;
}

/* Footer grid layout */
footer > div:first-child {
  max-width: 1200px;
  margin: 0 auto;
}

footer > div > div:first-child {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

footer > div > div:first-child > div:last-child {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

footer > div > div:last-child {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
}

footer > div > div:last-child a {
  color: white;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }
  
  h2 {
    font-size: 2rem;
  }
  
  nav ul {
    gap: var(--space-sm);
    font-size: 0.9rem;
  }
  
  section > div > div[data-columns="2"],
  .example-reverse {
    grid-template-columns: 1fr;
    direction: ltr;
  }
  
  footer > div > div:first-child {
    grid-template-columns: 1fr;
  }
  
  .hero-actions {
    flex-direction: column;
  }
  
  button,
  a[href^="#"][role="button"] {
    width: 100%;
    max-width: 300px;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 2rem;
  }
  
  h2 {
    font-size: 1.75rem;
  }
  
  nav ul {
    flex-wrap: wrap;
  }
  
  section {
    padding: var(--space-lg) var(--space-sm);
  }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e6e6e6;
    --text-light: #a0a0a0;
    --dark: #f8f9fa;
    --light: #2a2a2a;
    --border: #404040;
  }
  
  body {
    background-color: #1a1a1a;
    color: var(--text);
  }
  
  header {
    background: rgba(26, 26, 26, 0.98);
  }
  
  article {
    background: #2a2a2a;
    border-color: var(--border);
  }
  
  section:nth-of-type(even) {
    background: #202020;
  }
  
  code {
    background: #2a2a2a;
  }
  
  pre {
    background: #2a2a2a;
  }
}
