/* ============================================
   CSS Variables for Theme Support
   ============================================ */

:root {
  /* Light theme (default) */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --bg-tertiary: #e8e8e8;
  --bg-code: #f0f0f0;
  --bg-code-block: #fafafa;
  
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-tertiary: #888888;
  
  --border-color: #e0e0e0;
  --border-color-strong: #d0d0d0;
  
  --accent-color: mediumslateblue;
  --accent-hover: #7b68ee;
  
  --link-color: mediumslateblue;
  --code-inline: deeppink;
  
  --nav-hover: #f0f0f0;
  --nav-active-bg: mediumslateblue;
  --nav-active-text: #ffffff;
  
  --alert-info-bg: #e3f2fd;
  --alert-info-border: deepskyblue;
  --alert-info-text: deepskyblue;
  
  --alert-warning-bg: #fff3cd;
  --alert-warning-border: gold;
  --alert-warning-text: #856404;
  
  --alert-success-bg: #d4edda;
  --alert-success-border: limegreen;
  --alert-success-text: #155724;
  
  --shadow-color: rgba(0, 0, 0, 0.1);
}

/* Dark theme */
[data-theme="dark"] {
  --bg-primary: #0f0f12;
  --bg-secondary: #16161d;
  --bg-tertiary: #1e1e24;
  --bg-code: #1e1e24;
  --bg-code-block: #16161d;
  
  --text-primary: #eaeaea;
  --text-secondary: #cccccc;
  --text-tertiary: #888888;
  
  --border-color: #2a2a32;
  --border-color-strong: #3a3a42;
  
  --accent-color: mediumslateblue;
  --accent-hover: #9a88ff;
  
  --link-color: mediumslateblue;
  --code-inline: deeppink;
  
  --nav-hover: #1e1e24;
  --nav-active-bg: mediumslateblue;
  --nav-active-text: #ffffff;
  
  --alert-info-bg: #1a2332;
  --alert-info-border: deepskyblue;
  --alert-info-text: deepskyblue;
  
  --alert-warning-bg: #2e2416;
  --alert-warning-border: gold;
  --alert-warning-text: gold;
  
  --alert-success-bg: #1a2e1a;
  --alert-success-border: limegreen;
  --alert-success-text: limegreen;
  
  --shadow-color: rgba(0, 0, 0, 0.4);
}

/* ============================================
   Base Styles with Variables
   ============================================ */

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================
   Theme Toggle Button
   ============================================ */

.theme-toggle {
  position: fixed;
  top: 1rem;
  right: calc((100vw - 900px) / 2);
  z-index: 1000;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

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

.theme-icon {
  font-size: 1.2rem;
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 2rem 1.5rem;
  transition: background-color 0.3s ease;
}

.sidebar h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--accent-color);
}

.nav-section {
  margin-bottom: 2rem;
}

.nav-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 0.5rem;
}

.nav-section ul {
  list-style: none;
}

.nav-section li {
  margin: 0.25rem 0;
}

.nav-section a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s;
  font-size: 0.95rem;
}

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

.nav-section a.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
}

/* ============================================
   Main Content
   ============================================ */

.main-content {
  margin-left: 280px;
  padding: 3rem 4rem;
  max-width: 1200px;
}

.header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.header .tagline {
  font-size: 1.2rem;
  color: var(--text-tertiary);
}

.badges {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ============================================
   Content Sections
   ============================================ */

section {
  margin-bottom: 4rem;
  scroll-margin-top: 2rem;
}

h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--accent-color);
}

h3 {
  font-size: 1.5rem;
  margin: 2rem 0 1rem;
  color: var(--text-primary);
}

h4 {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
  color: var(--text-primary);
  display: flex;
  align-items: center; 
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

/* ============================================
   Code Blocks
   ============================================ */

code {
  background: var(--bg-code);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  color: var(--code-inline);
}

pre {
  background: var(--bg-code-block);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--border-color);
  transition: background-color 0.3s ease;
}

pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.6;
}

pre.cmd {
  position: relative;
}

pre.out {
  background: var(--bg-tertiary);
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 0.7rem;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  opacity: 1;
  transition: color 0.2s ease;
}

pre.cmd:hover .copy-btn {
  opacity: 1;
}

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

.code-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: -0.5rem;
  margin-top: 1rem;
}

details.terminal-output summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-tertiary);
  list-style: none;
  user-select: none;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

/* Hide all default markers */
details.terminal-output summary::-webkit-details-marker {
  display: none;
}

details.terminal-output summary::marker {
  display: none;
}

/* Custom arrow indicator - now in front */
details.terminal-output summary::before {
  content: "→";
  font-size: 1.2rem;
  font-weight: bold;
  color: deepskyblue;
  transition: transform 0.2s ease, color 0.2s ease;
  display: inline-block;
}

/* Rotate arrow when open */
details.terminal-output[open] summary::before {
  transform: rotate(90deg);
}

/* Hover effects */
details.terminal-output summary:hover {
  color: var(--text-primary);
}

details.terminal-output summary:hover::before {
  color: lightskyblue;
}

/* Style the content when expanded */
details.terminal-output pre {
  margin-top: 0.5rem;
}

/* ============================================
   Icon Rows
   ============================================ */

.icon-row img {
  height: 64px;
  margin-left: 16px;
}

.icon-row img:first-child {
  margin-left: 0;
}

.icon-row {
  display: flex;
  align-items: center;
}

.icon-row::after {
  content: "";
  display: block;
  width: 100%;
  height: 1px;
  background-color: var(--border-color-strong);
  opacity: 0.85;
  margin-top: 2rem; /* Space above the hr (32px = 2rem) */
}

/* Optional: Remove hr after the last icon-row in a section */
section > .icon-row:last-child::after,
article > .icon-row:last-child::after {
  display: none;
}

/* Command article separators: use instead of <hr> for semantic grouping */
article.cmd-article {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

/* ============================================
   Demo Section
   ============================================ */

.demo {
  margin: 2rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px var(--shadow-color);
  background: var(--bg-tertiary);
}

.demo-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   Parameter Tables
   ============================================ */

.params-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--bg-secondary);
  border-radius: 8px;
  overflow: hidden;
}

.params-table th,
.params-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.params-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--accent-color);
}

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

.params-table code {
  font-size: 0.85em;
}

/* ============================================
   Example Cards
   ============================================ */

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.example-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  transition: background-color 0.3s ease;
}

.example-card h4 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--accent-color);
}

/* ============================================
   Links
   ============================================ */

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

a:hover {
  text-decoration: underline;
}

/* ============================================
   Lists
   ============================================ */

ul, ol {
  margin: 1rem 0 1rem 2rem;
  color: var(--text-secondary);
}

li {
  margin: 0.5rem 0;
}

li code {
  font-size: 0.85em;
}

/* ============================================
   Alert Boxes
   ============================================ */

.alert {
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin: 1.5rem 0;
  border-left: 4px solid;
  display: flex;
  align-items: center; 
  gap: 1.4rem;
  transition: background-color 0.3s ease;
}

.alert-info {
  background: var(--alert-info-bg);
  border-color: var(--alert-info-border);
  color: var(--alert-info-text);
}

.alert-warning {
  background: var(--alert-warning-bg);
  border-color: var(--alert-warning-border);
  color: var(--alert-warning-text);
}

.alert-success {
  background: var(--alert-success-bg);
  border-color: var(--alert-success-border);
  color: var(--alert-success-text);
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .main-content {
    margin-left: 0;
    padding: 2rem 1.5rem;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .example-grid {
    grid-template-columns: 1fr;
  }
  
  .theme-toggle {
    top: 0.5rem;
    right: 0.5rem;
  }
}

/* ============================================
   Syntax Highlighting (works in both themes)
   ============================================ */

/* ============================================
  Footer
  ============================================ */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color-strong);
  text-align: center;
  color: var(--text-secondary);
}


.keyword { color: deeppink; }
.string { color: gold; }
.comment { color: #6272a4; }
.function { color: #50fa7b; }