/* CSS Variables for theming */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-code: #f6f8fa;
  --text-primary: #24292f;
  --text-secondary: #656d76;
  --text-muted: #8c959f;
  --border: #d1d9e0;
  --border-muted: #e1e4e8;
  --accent: #0969da;
  --accent-hover: #0550ae;
  --success: #1a7f37;
  --shadow: rgba(31, 35, 40, 0.04);
  --shadow-medium: rgba(31, 35, 40, 0.15);
}

[data-theme="dark"] {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-code: #161b22;
  --text-primary: #f0f6fc;
  --text-secondary: #9198a1;
  --text-muted: #7d8590;
  --border: #30363d;
  --border-muted: #21262d;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --success: #3fb950;
  --shadow: rgba(1, 4, 9, 0.3);
  --shadow-medium: rgba(1, 4, 9, 0.8);
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
}

.brand-text h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.tagline {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  transition: all 0.3s ease;
  font-size: 16px;
}

.theme-toggle:hover {
  background-color: var(--bg-code);
  border-color: var(--accent);
}

/* Main content */
main {
  padding: 48px 0;
}

section {
  margin-bottom: 64px;
}

section:last-child {
  margin-bottom: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 16px;
}

h2 {
  font-size: 32px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-muted);
}

h3 {
  font-size: 24px;
  margin-top: 32px;
  margin-bottom: 16px;
}

p {
  margin-bottom: 16px;
  color: var(--text-primary);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.3s ease;
}

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

/* Badges */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.badges img {
  height: 20px;
  transition: opacity 0.3s ease;
}

.badges a:hover img {
  opacity: 0.8;
}

/* Hero section */
.hero {
  background-color: var(--bg-secondary);
  border-radius: 12px;
  padding: 48px;
  text-align: center;
  border: 1px solid var(--border);
}

.hero h2 {
  border: none;
  margin-bottom: 16px;
  font-size: 40px;
}

.hero p {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* Code blocks */
.code-block {
  position: relative;
  margin: 24px 0;
}

.code-block pre {
  background-color: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  overflow-x: auto;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 14px;
  line-height: 1.5;
}

.code-block code {
  color: var(--text-primary);
  background: none;
  padding: 0;
  border-radius: 0;
}

/* Inline code */
code {
  background-color: var(--bg-code);
  color: var(--text-primary);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 85%;
}

/* Copy button */
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
  opacity: 0;
}

.code-block:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.copy-btn:active {
  transform: scale(0.95);
}

/* Footer */
footer {
  background-color: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 48px 0;
  margin-top: 64px;
}

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

.footer-content p {
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.footer-content a {
  color: var(--accent);
  font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }
  
  .header-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .brand {
    flex-direction: column;
    gap: 12px;
  }
  
  .hero {
    padding: 32px 24px;
  }
  
  .hero h2 {
    font-size: 32px;
  }
  
  .hero p {
    font-size: 16px;
  }
  
  .badges {
    justify-content: center;
  }
  
  h2 {
    font-size: 28px;
  }
  
  h3 {
    font-size: 20px;
  }
  
  .code-block pre {
    padding: 16px;
    font-size: 13px;
  }
  
  .copy-btn {
    position: static;
    margin-top: 12px;
    opacity: 1;
    display: block;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero h2 {
    font-size: 24px;
  }
  
  .logo {
    width: 40px;
    height: 40px;
  }
  
  .brand-text h1 {
    font-size: 20px;
  }
  
  main {
    padding: 32px 0;
  }
  
  section {
    margin-bottom: 48px;
  }
}

/* Smooth transitions */
* {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

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

/* Print styles */
@media print {
  .theme-toggle,
  .copy-btn {
    display: none;
  }
  
  .code-block pre {
    white-space: pre-wrap;
    word-break: break-word;
  }
}