/*
 * Agent-Gantry Documentation Site Styles
 * Modern, clean, responsive design inspired by best-in-class documentation sites
 */

/* ==================== CSS Variables ==================== */
:root {
  /* Colors - Professional blue/gray palette */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary-color: #64748b;
  --accent-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;

  /* Neutral colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Code block colors (dark theme) */
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --code-comment: #94a3b8;
  --code-keyword: #60a5fa;
  --code-string: #34d399;
  --code-function: #f472b6;
  --code-number: #fbbf24;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', 'Fira Mono', 'Roboto Mono', 'Courier New', monospace;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Layout */
  --sidebar-width: 280px;
  --header-height: 64px;
  --max-content-width: 1200px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode variables (optional future enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
  }
}

/* ==================== Base Styles ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

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

/* ==================== Typography ==================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2rem;
  letter-spacing: -0.01em;
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--border-color);
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 1rem;
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

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

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

strong, b {
  font-weight: 600;
  color: var(--text-primary);
}

em, i {
  font-style: italic;
}

/* ==================== Layout Structure ==================== */
.site-container {
  display: flex;
  min-height: 100vh;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-lg);
  box-shadow: var(--shadow-sm);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: var(--max-content-width);
  margin: 0 auto;
}

.site-logo {
  display: flex;
  align-items: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
  color: var(--primary-color);
}

.logo-icon {
  width: 32px;
  height: 32px;
  margin-right: var(--spacing-sm);
  color: var(--primary-color);
}

/* Search Bar */
.search-container {
  flex: 1;
  max-width: 400px;
  margin: 0 var(--spacing-xl);
}

.search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Header Actions */
.header-actions {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.github-link {
  display: flex;
  align-items: center;
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--bg-secondary);
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color var(--transition-fast);
}

.github-link:hover {
  background-color: var(--bg-tertiary);
  text-decoration: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-sm);
  color: var(--text-primary);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: var(--spacing-lg);
  z-index: 50;
}

.sidebar-nav {
  list-style: none;
}

.nav-section {
  margin-bottom: var(--spacing-xl);
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.nav-item {
  margin-bottom: var(--spacing-xs);
}

.nav-link {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.nav-link:hover {
  background-color: var(--bg-primary);
  color: var(--primary-color);
  text-decoration: none;
}

.nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-submenu {
  list-style: none;
  padding-left: var(--spacing-md);
  margin-top: var(--spacing-xs);
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  flex: 1;
  padding: var(--spacing-2xl);
  max-width: var(--max-content-width);
}

.content-wrapper {
  max-width: 800px;
}

/* ==================== Components ==================== */

/* Callouts / Admonitions */
.callout {
  padding: var(--spacing-md) var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  border-left: 4px solid;
  border-radius: 6px;
  background-color: var(--bg-secondary);
}

.callout-title {
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.callout.note {
  border-color: var(--primary-color);
  background-color: var(--primary-light);
}

.callout.warning {
  border-color: var(--warning-color);
  background-color: #fef3c7;
}

.callout.tip {
  border-color: var(--accent-color);
  background-color: #d1fae5;
}

.callout.danger {
  border-color: var(--danger-color);
  background-color: #fee2e2;
}

/* Code Blocks */
pre {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: var(--spacing-lg);
  border-radius: 8px;
  overflow-x: auto;
  margin: var(--spacing-lg) 0;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
  position: relative;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background-color: var(--bg-secondary);
  padding: 0.2em 0.4em;
  border-radius: 3px;
  color: var(--primary-color);
}

pre code {
  background: none;
  padding: 0;
  color: var(--code-text);
  font-size: 0.875rem;
}

/* Copy Button for Code Blocks */
.code-block-wrapper {
  position: relative;
}

.copy-button {
  position: absolute;
  top: var(--spacing-sm);
  right: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: var(--code-text);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.copy-button.copied {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-lg) 0;
  font-size: 0.9rem;
}

thead {
  background-color: var(--bg-secondary);
}

th {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
}

td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

tr:hover {
  background-color: var(--bg-secondary);
}

/* Lists */
ul, ol {
  margin: var(--spacing-md) 0;
  padding-left: var(--spacing-xl);
}

li {
  margin-bottom: var(--spacing-sm);
  color: var(--text-secondary);
}

/* Blockquotes */
blockquote {
  padding: var(--spacing-md) var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  border-left: 4px solid var(--border-color);
  background-color: var(--bg-secondary);
  font-style: italic;
  color: var(--text-secondary);
}

/* Horizontal Rules */
hr {
  border: none;
  height: 1px;
  background-color: var(--border-color);
  margin: var(--spacing-2xl) 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: var(--spacing-lg) 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.new {
  background-color: var(--accent-color);
  color: white;
}

.badge.deprecated {
  background-color: var(--danger-color);
  color: white;
}

.badge.beta {
  background-color: var(--warning-color);
  color: white;
}

/* Navigation Arrows (Previous/Next) */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--spacing-2xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-md);
  background-color: var(--bg-secondary);
  border-radius: 8px;
  transition: all var(--transition-base);
  max-width: 45%;
}

.page-nav-link:hover {
  background-color: var(--bg-tertiary);
  text-decoration: none;
  box-shadow: var(--shadow-md);
}

.page-nav-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: var(--spacing-xs);
}

.page-nav-title {
  font-weight: 600;
  color: var(--text-primary);
}

/* ==================== Responsive Design ==================== */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 240px;
  }

  .main-content {
    padding: var(--spacing-lg);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: var(--spacing-md);
  }

  .mobile-menu-toggle {
    display: block;
  }

  .search-container {
    display: none;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .page-nav {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .page-nav-link {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  :root {
    --spacing-xl: 1.25rem;
    --spacing-2xl: 2rem;
  }

  .site-header {
    padding: 0 var(--spacing-md);
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.25rem;
  }
}

/* ==================== Print Styles ==================== */
@media print {
  .sidebar,
  .site-header,
  .page-nav {
    display: none;
  }

  .main-content {
    margin-left: 0;
    margin-top: 0;
  }
}

/* ==================== Accessibility ==================== */

/* Focus styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
  position: absolute;
  top: -100px;
  left: 0;
  background-color: var(--primary-color);
  color: white;
  padding: var(--spacing-sm) var(--spacing-md);
  z-index: 200;
  transition: top var(--transition-fast);
}

.skip-to-main:focus {
  top: 0;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==================== Animations ==================== */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

/* Smooth scroll offset for fixed header */
html {
  scroll-padding-top: calc(var(--header-height) + var(--spacing-lg));
}
