/* SyncDNA Custom Theme for mdBook */
:root {
  /* Main colors from SyncDNA console */
  --sdna-background: #191919;
  --sdna-primary: #202123;
  --sdna-secondary: #252628;
  --sdna-tertiary: #2B2C2E;
  --sdna-border: #323232;
  --sdna-contrast: #D6D6D6;
  --sdna-gray: #919191;
  
  /* SyncDNA brand colors */
  --sdna-red: #C43E3E;
  --sdna-orange: #F2711C;
  --sdna-yellow: #CBB64D;
  --sdna-olive: #A3B430;
  --sdna-green: #6D9B46;
  --sdna-grass: #668246;
  --sdna-teal: #00A19A;
  --sdna-blue: #1A98C7;
  --sdna-deepblue: #3268A5;
  --sdna-violet: #7E4682;
  --sdna-purple: #A333C8;
  --sdna-pink: #BB327F;
  --sdna-brown: #A56737;
  
  /* Base theme customization */
  --fg: var(--sdna-contrast);
  --bg: var(--sdna-background);
  
  /* Sidebar colors */
  --sidebar-bg: var(--sdna-primary);
  --sidebar-fg: var(--sdna-contrast);
  --sidebar-non-existant: var(--sdna-gray);
  --sidebar-active: var(--sdna-orange);
  --sidebar-spacer: var(--sdna-border);
  
  /* Content colors */
  --content-bg: var(--sdna-background);
  --content-fg: var(--sdna-contrast);
  
  /* Header colors */
  --header-bg: var(--sdna-primary);
  --header-fg: var(--sdna-contrast);
  
  /* Text and link colors */
  --links: var(--sdna-blue);
  
  /* Search colors */
  --search-bg: var(--sdna-tertiary);
  --search-fg: var(--sdna-contrast);
  --search-active-bg: var(--sdna-secondary);
  --search-active-fg: var(--sdna-contrast);
  --search-border: var(--sdna-border);
  
  /* Code colors */
  --code-bg: var(--sdna-tertiary);
  --code-fg: var(--sdna-contrast);
  
  /* Border colors */
  --theme-popup-bg: var(--sdna-secondary);
  --theme-popup-border: var(--sdna-border);
  --table-border-color: var(--sdna-border);
  --table-header-bg: var(--sdna-tertiary);
  --table-alternate-bg: var(--sdna-primary);
  
  /* Font sizes */
  --content-max-width: 88ch;
  --mono-font: 'Consolas', 'Source Code Pro', Consolas, 'Ubuntu Mono', Menlo, 'DejaVu Sans Mono', monospace, monospace;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.light {
  /* Keep the dark theme even in "light" mode for consistency */
  --fg: var(--sdna-contrast);
  --bg: var(--sdna-background);
  --sidebar-bg: var(--sdna-primary);
  --sidebar-fg: var(--sdna-contrast);
  --sidebar-active: var(--sdna-orange);
  --content-bg: var(--sdna-background);
  --content-fg: var(--sdna-contrast);
  --links: var(--sdna-blue);
}

/* Typography */
body {
  font-family: var(--font-family);
  color: var(--fg);
  background-color: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.03em;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

h1 { font-size: 2rem; color: var(--sdna-contrast); }
h2 { font-size: 1.8rem; color: var(--sdna-teal); }
h3 { font-size: 1.4rem; color: var(--sdna-blue); }
h4 { font-size: 1.2rem; color: var(--sdna-grass); }
h5 { font-size: 1.1rem; color: var(--sdna-contrast); }
h6 { font-size: 1rem; color: var(--sdna-gray); }

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

a:hover {
  text-decoration: underline;
}

/* Code blocks */
pre {
  background-color: var(--code-bg);
  border: 1px solid var(--sdna-border);
  border-radius: 4px;
  padding: 1rem;
  font-family: var(--mono-font);
  overflow-x: auto;
}

code {
  font-family: var(--mono-font);
  background-color: var(--code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
}

table th {
  background-color: var(--table-header-bg);
  padding: 0.5em 1em;
  text-align: left;
  border-bottom: 2px solid var(--table-border-color);
}

table td {
  padding: 0.5em 1em;
  border-bottom: 1px solid var(--table-border-color);
}

table tr:nth-child(even) {
  background-color: var(--table-alternate-bg);
}

/* Sidebar customization */
.sidebar .sidebar-scrollbox {
  padding: 1rem;
}

.sidebar .chapter {
  margin-bottom: 0.5rem;
}

.sidebar .chapter li a {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.sidebar .chapter li a:hover {
  background-color: var(--sdna-tertiary);
  text-decoration: none;
}

.sidebar .chapter li.active a {
  color: var(--sdna-orange);
  font-weight: 600;
}

/* Section headers in sidebar */
.sidebar .chapter li.chapter-item {
  margin-top: 0.5rem;
}

.sidebar .section {
  font-weight: 600;
  margin-top: 1.5rem;
  color: var(--sdna-gray);
}

/* Header customization */
.menu-bar {
  background-color: var(--header-bg);
  color: var(--header-fg);
}

/* Buttons */
button, .menu-bar button {
  background-color: var(--sdna-tertiary);
  border: 1px solid var(--sdna-border);
  color: var(--fg);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

button:hover, .menu-bar button:hover {
  background-color: var(--sdna-secondary);
}

/* Search customization */
#searchbar {
  background-color: var(--search-bg);
  border: 1px solid var(--search-border);
  color: var(--search-fg);
  border-radius: 4px;
}

/* Images and Media */
img, video, iframe {
  max-width: 100%;
  border-radius: 4px;
  border: 1px solid var(--sdna-border);
}

/* Specific image size constraints */
img[src*="invite-email"] {
  max-width: 500px;
  display: block;
  margin: 0 auto;
}

figure {
  margin: 1.5rem 0;
}

figcaption {
  font-size: 0.9rem;
  color: var(--sdna-gray);
  text-align: center;
  margin-top: 0.5rem;
}

/* Blockquotes */
blockquote {
  border-left: 3px solid var(--sdna-blue);
  padding-left: 1rem;
  margin-left: 0;
  color: var(--sdna-gray);
}

/* Lists */
ul, ol {
  padding-left: 2rem;
  margin: 1rem 0;
}

li {
  margin-bottom: 0.3rem;
}

/* Print styling */
@media print {
  body {
    background-color: white;
    color: black;
  }
  
  pre, code {
    border: 1px solid #ddd;
  }
}

/* Hide theme selector */
#theme-toggle {
  display: none !important;
}

#theme-list {
  display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    font-size: 13px;
  }
  
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.6rem; }
  h3 { font-size: 1.3rem; }
}