/* Manual Typography Enhancement - Terminus/Berkeley Mono Integration */
/* NON-BREAKING: Only enhances manual page typography */

/* Font Stack with Terminus preference */
:root {
  --font-mono-enhanced: 'Berkeley Mono', 'Terminus', 'Monaco', ui-monospace,
                        'JetBrains Mono', 'Consolas', 'Liberation Mono', 
                        'Courier New', monospace;
  
  /* Enhanced code block colors - adapt to theme */
  --code-bg-enhanced: var(--surface-raised);
  --code-text-enhanced: var(--text-secondary);
  --code-keyword: #66d9ef;
  --code-string: #a6e22e;
  --code-comment: #75715e;
  --code-number: #ae81ff;
  
  /* Light theme code block colors */
  --code-bg-light: #f8f8f8;
  --code-text-light: #333333;
  --code-border-light: #e0e0e0;
}

/* Manual Page Specific Styles (extracted from inline) */
.manual-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.manual-nav-item {
  background: var(--surface-panel);
  border: 2px solid var(--surface-border);
  padding: 20px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.manual-nav-item:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow-medium);
}

.manual-nav-item h3 {
  margin: 0 0 8px 0;
  font-size: 1.25rem;
}

.manual-nav-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Enhanced Command Reference Blocks */
.command-reference {
  display: grid;
  gap: 20px;
  margin: 20px 0;
}

.command-item {
  background: var(--surface-panel);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
}

.command-item h4 {
  margin: 0 0 10px 0;
  font-size: 1.1rem;
  color: var(--text-primary);
}

/* Enhanced Code Blocks with Better Typography */
.command-item pre,
pre {
  margin: 10px 0 0 0;
  padding: 16px 20px;
  background: var(--code-bg-enhanced);
  color: var(--code-text-enhanced);
  border-radius: 6px;
  overflow-x: auto;
  font-family: var(--font-mono-enhanced);
  font-size: 14px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  tab-size: 2;
}

.command-item code,
code {
  font-family: var(--font-mono-enhanced);
  font-size: 0.9em;
  background: var(--surface-raised);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 400;
  color: var(--accent-primary);
}

/* Pre > Code should not have background */
pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
}

/* Light theme code block overrides */
[data-theme="light"] .command-item pre,
[data-theme="light"] pre {
  background: var(--code-bg-light);
  color: var(--code-text-light);
  border: 1px solid var(--code-border-light);
}


/* Light theme inline code */
[data-theme="light"] code {
  background: var(--surface-raised);
  color: var(--accent-error); /* GitHub-style inline code color */
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

[data-theme="light"] .math-explanation pre {
  background: var(--code-bg-light);
  color: var(--code-text-light);
  border: 1px solid var(--code-border-light);
}

/* Workflow Visual Styles */
.workflow-visual {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 30px 0;
  overflow-x: auto;
  padding: 20px 0;
}

.workflow-step {
  background: var(--surface-panel);
  border: 2px solid var(--surface-border);
  padding: 20px;
  border-radius: 8px;
  min-width: 150px;
  text-align: center;
  position: relative;
}

.step-number {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-primary);
  color: var(--text-inverse);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 14px;
}

.workflow-arrow {
  color: var(--accent-primary);
  font-size: 24px;
  flex-shrink: 0;
}

/* Typography Demo Styles */
.typography-demo > * {
  margin: 10px 0;
}

.typography-demo code {
  font-family: var(--font-mono-enhanced);
  margin-left: 10px;
  opacity: 0.7;
}

/* F-stop typography classes for the demo */
.text-f4 {
  font-size: 64px;
  line-height: 1.1;
  font-weight: 700;
}

.text-f28 {
  font-size: 45px;
  line-height: 1.2;
  font-weight: 600;
}

.text-f2 {
  font-size: 32px;
  line-height: 1.3;
  font-weight: 500;
}

.text-f14 {
  font-size: 23px;
  line-height: 1.4;
  font-weight: 400;
}

.text-f1 {
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
}

/* Color Grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin: 20px 0;
}

.color-swatch {
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 100px;
  justify-content: center;
  border: 2px solid transparent;
  transition: all 0.2s;
}

.color-swatch:hover {
  transform: scale(1.05);
  border-color: var(--surface-border-hover);
}

.color-swatch code {
  font-family: var(--font-mono-enhanced);
  font-size: 14px;
  background: var(--overlay-dark);
  padding: 4px 8px;
  border-radius: 4px;
}

/* Component Showcase */
.component-showcase {
  margin: 30px 0;
}

.component-showcase h4 {
  margin: 20px 0 15px 0;
  font-size: 1.2rem;
}

.button-examples,
.form-examples {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
  margin: 15px 0;
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.metric {
  text-align: center;
  background: var(--surface-panel);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
}

.metric h4 {
  margin: 0 0 10px 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.metric-value {
  font-size: 32px;
  font-weight: bold;
  color: var(--accent-primary);
  margin: 10px 0;
  font-family: var(--font-mono-enhanced);
}

.metric-label {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Math Explanation Block */
.math-explanation {
  background: var(--surface-panel);
  padding: 25px;
  border-radius: 8px;
  margin: 20px 0;
  border: 1px solid var(--surface-border);
}

.math-explanation h4 {
  margin: 0 0 15px 0;
}

.math-explanation pre {
  background: var(--code-bg-enhanced);
  color: var(--code-text-enhanced);
  font-family: var(--font-mono-enhanced);
  line-height: 1.8;
}

/* Resource Links */
.resource-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.resource-item {
  background: var(--surface-panel);
  border: 2px solid var(--surface-border);
  padding: 20px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  text-align: center;
  transition: all 0.2s;
}

.resource-item:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.resource-item h4 {
  margin: 0 0 8px 0;
  font-size: 1.2rem;
}

.resource-item p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}


/* File Reference Table */
.file-reference table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
}

.file-reference th,
.file-reference td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--surface-border);
}

.file-reference th {
  background: var(--surface-panel);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.file-reference td code {
  font-family: var(--font-mono-enhanced);
}

.file-reference .edit-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.file-reference .edit-link:hover {
  text-decoration: underline;
}

/* Dark Theme Adjustments */
[data-theme="camera"] .manual-nav-item,
[data-theme="camera"] .command-item,
[data-theme="camera"] .workflow-step,
[data-theme="camera"] .metric,
[data-theme="camera"] .resource-item,
[data-theme="camera"] .file-reference th,
[data-theme="camera"] .math-explanation {
  background: var(--surface-depth);
  border-color: var(--surface-border);
}

[data-theme="camera"] .command-item pre,
[data-theme="camera"] pre {
  background: var(--surface-panel);
  color: var(--text-secondary);
}

[data-theme="camera"] code {
  background: var(--surface-raised);
}


/* Flynn Theme Adjustments */
[data-theme="flynn"] .manual-nav-item,
[data-theme="flynn"] .command-item,
[data-theme="flynn"] .workflow-step,
[data-theme="flynn"] .metric,
[data-theme="flynn"] .resource-item {
  background: var(--surface-base);
  border-color: var(--accent-primary);
}

[data-theme="flynn"] .manual-nav-item:hover,
[data-theme="flynn"] .resource-item:hover {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 10px var(--shadow-glow);
}

[data-theme="flynn"] .step-number {
  background: var(--accent-primary);
  color: var(--surface-base);
}

[data-theme="flynn"] .workflow-arrow {
  color: var(--accent-primary);
}

[data-theme="flynn"] .metric-value {
  color: var(--accent-primary);
  text-shadow: var(--shadow-glow);
}

[data-theme="flynn"] code {
  background: var(--overlay-light);
  color: var(--accent-primary);
}

[data-theme="flynn"] pre code {
  background: transparent;
  color: inherit;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .workflow-visual {
    flex-direction: column;
  }
  
  .workflow-arrow {
    transform: rotate(90deg);
  }
  
  .manual-nav-grid {
    grid-template-columns: 1fr;
  }
  
  .resource-links {
    grid-template-columns: 1fr;
  }
}

/* Print Styles */
@media print {
  .theme-toggle-demo,
  .edit-link,
  .manual-quick-access {
    display: none;
  }
  
  pre {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: 1px solid #ccc;
  }
  
  .color-swatch {
    border: 2px solid #000 !important;
  }
}