:root {
  color-scheme: light dark;

  /* Theme tokens */
  --bg-primary: light-dark(#f8f9fa, #0b0c10);
  --bg-surface: light-dark(#ffffff, #14161f);
  --bg-surface-translucent: light-dark(rgba(255, 255, 255, 0.75), rgba(20, 22, 31, 0.75));
  --bg-surface-elevated: light-dark(#f1f3f5, #1e212f);
  --bg-code: light-dark(#1a1d28, #0e1017);

  --text-primary: light-dark(#111827, #f3f4f6);
  --text-secondary: light-dark(#4b5563, #9ca3af);
  --text-muted: light-dark(#6b7280, #6b7280);

  --border-subtle: light-dark(rgba(0, 0, 0, 0.08), rgba(255, 255, 255, 0.08));
  --border-prominent: light-dark(rgba(0, 0, 0, 0.16), rgba(255, 255, 255, 0.16));

  --accent-apple: #0071e3;
  --accent-cyan: #00f5d4;
  --accent-purple: #9d4edd;
  --accent-orange: #ff9966;
  --accent-red: #ff5e62;
  --accent-metal: #5ac8fa;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 35px rgba(0, 245, 212, 0.18);

  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Fallback for older browsers without light-dark() */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0b0c10;
    --bg-surface: #14161f;
    --bg-surface-translucent: rgba(20, 22, 31, 0.75);
    --bg-surface-elevated: #1e212f;
    --bg-code: #0e1017;
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-prominent: rgba(255, 255, 255, 0.16);
  }
}

/* Explicit class-based override when user manually toggles */
[data-theme="dark"] {
  color-scheme: dark;
  --bg-primary: #0b0c10;
  --bg-surface: #14161f;
  --bg-surface-translucent: rgba(20, 22, 31, 0.75);
  --bg-surface-elevated: #1e212f;
  --bg-code: #0e1017;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-prominent: rgba(255, 255, 255, 0.16);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #f8f9fa;
  --bg-surface: #ffffff;
  --bg-surface-translucent: rgba(255, 255, 255, 0.75);
  --bg-surface-elevated: #f1f3f5;
  --bg-code: #1a1d28;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-prominent: rgba(0, 0, 0, 0.16);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 600px;
  background: radial-gradient(circle at 50% 10%, rgba(0, 245, 212, 0.12) 0%, rgba(157, 78, 221, 0.08) 40%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Header & Nav */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background-color: var(--bg-surface-translucent);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Theme Toggle */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform 100ms ease;
}

.theme-toggle-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-prominent);
}

.theme-toggle-btn:active {
  transform: scale(0.92);
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-github:hover {
  border-color: var(--border-prominent);
  box-shadow: var(--shadow-sm);
}

.btn-github:active {
  transform: scale(0.96);
}

/* Main Layout */
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 4.5rem 1rem 3.5rem;
}

.badge-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-cyan);
  box-shadow: 0 0 8px var(--accent-cyan);
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, #3a86ff 45%, var(--accent-purple) 90%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto 2.5rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.75rem;
  background: linear-gradient(135deg, #0071e3 0%, #0056b3 100%);
  color: #ffffff;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 113, 227, 0.35);
  transition: transform 100ms ease, box-shadow var(--transition-fast);
}

.btn-primary:hover {
  box-shadow: 0 6px 22px rgba(0, 113, 227, 0.45);
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.75rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: transform 100ms ease, border-color var(--transition-fast);
}

.btn-secondary:hover {
  border-color: var(--border-prominent);
}

.btn-secondary:active {
  transform: scale(0.96);
}

/* Quick Install Terminal Snippet */
.hero-code {
  max-width: 680px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal-body {
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: left;
}

.terminal-body code {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: #00f5d4;
  word-break: break-all;
}

.copy-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

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

/* Feature Grid */
.section {
  padding: 5rem 0 2rem;
}

.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3rem;
}

.section-tag {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-cyan);
  margin-bottom: 0.5rem;
}

.section-header h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-normal), transform 150ms ease, box-shadow var(--transition-normal);
}

.card:hover {
  border-color: var(--border-prominent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
}

.card h3 {
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.65rem;
}

.card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Models Matrix Table */
.filter-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-tab.active,
.filter-tab:hover {
  background: var(--text-primary);
  color: var(--bg-surface);
  border-color: var(--text-primary);
}

.table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th, td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: var(--bg-surface-elevated);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(125, 125, 125, 0.03);
}

.pill-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}
.pill-blue { background: rgba(0, 113, 227, 0.15); color: #0071e3; }
.pill-purple { background: rgba(157, 78, 221, 0.15); color: #9d4edd; }
.pill-green { background: rgba(0, 245, 212, 0.15); color: #00a896; }

/* Interactive Command Playground */
.playground-container {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  box-shadow: var(--shadow-md);
}

@media (max-width: 900px) {
  .playground-container {
    grid-template-columns: 1fr;
  }
}

.control-group {
  margin-bottom: 1.25rem;
}

.control-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.control-input,
.control-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.control-input:focus,
.control-select:focus {
  outline: none;
  border-color: var(--accent-apple);
}

.range-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.range-wrap input[type="range"] {
  flex: 1;
  accent-color: #0071e3;
}

.range-val {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  min-width: 40px;
  font-weight: 600;
}

.cli-preview-box {
  background: var(--bg-code);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cli-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.cli-preview-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cli-command-output {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: #00f5d4;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
  margin-bottom: 1.5rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 1.5rem;
  background: var(--bg-surface);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.footer-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}

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

.footer-copy {
  color: var(--text-muted);
  font-size: 0.85rem;
}
