/* OEFF Documentation Design System v4
   Multi-gate navigation + Support system styling
   ================================================== */

:root {
  /* Brand Colors */
  --oeff-black: #231F20;
  --oeff-blue: #3960AC;
  --oeff-aqua: #42A7C2;
  --oeff-aqua-light: #BAE1E2;
  --oeff-sage: #92BEAA;
  --oeff-ivory: #FFF3DF;
  
  /* Extended Palette */
  --sage-deep: #6a9a84;
  --sage-whisper: #EEF3F0;
  --sage-light: #d4e5dc;
  
  /* Escalation Colors */
  --level-green: #4a9a6a;
  --level-green-bg: #e8f5ec;
  --level-yellow: #c9a227;
  --level-yellow-bg: #fef9e7;
  --level-red: #c94a4a;
  --level-red-bg: #fdf2f2;
  
  /* Text */
  --text: #231F20;
  --text-soft: #4a4542;
  --text-muted: #7a746f;
  
  /* Surfaces */
  --ground: #FAFAF8;
  --ground-soft: #F5F8F6;
  --border: #e5e2dc;
  
  /* Typography */
  --font-display: 'Avenir Next', 'Avenir', 'Segoe UI', system-ui, sans-serif;
  --font-body: Georgia, 'Times New Roman', serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* Radius */
  --radius: 6px;
  --radius-lg: 10px;
  --radius-organic: 10px 12px 9px 11px;
  --radius-organic-sm: 5px 7px 6px 8px;
  
  /* Shadows */
  --shadow-soft: 
    0 1px 2px rgba(146, 190, 170, 0.08),
    0 4px 8px rgba(146, 190, 170, 0.06),
    0 8px 16px rgba(35, 31, 32, 0.03);
  --shadow-elevated:
    0 2px 4px rgba(146, 190, 170, 0.10),
    0 8px 16px rgba(146, 190, 170, 0.08),
    0 16px 32px rgba(35, 31, 32, 0.04);
  
  /* Motion */
  --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
}

/* ===================
   RESET & BASE
   =================== */

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

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--ground);
  margin: 0;
  padding: var(--space-xl);
  max-width: 800px;
  margin: 0 auto;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

/* ===================
   ACCESSIBILITY
   =================== */

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-md);
  background: var(--oeff-black);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.9rem;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.2s var(--ease-standard);
}

.skip-link:focus {
  top: var(--space-md);
}

:focus-visible {
  outline: 2px solid var(--oeff-aqua);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

/* ===================
   TYPOGRAPHY
   =================== */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin: 0;
}

h1 {
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 var(--space-md);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--space-xs);
}

h4 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 var(--space-sm);
}

p { margin: 0 0 var(--space-md); }

.subtitle {
  font-family: var(--font-display);
  color: var(--text-soft);
  font-size: 0.95rem;
}

/* ===================
   HEADER & FOOTER
   =================== */

header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-md);
  border-bottom: 2px solid var(--oeff-black);
}

footer {
  margin-top: var(--space-3xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* ===================
   CONTENT SECTIONS
   =================== */

.content-section {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  scroll-margin-top: var(--space-xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  margin: 0;
  border: none;
  padding: 0;
}

.change-path {
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius);
  transition: all var(--duration-fast) var(--ease-standard);
}

.change-path:hover {
  color: var(--oeff-blue);
  background: var(--sage-whisper);
}

/* ===================
   GATE PATTERN
   =================== */

.gate {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  background: linear-gradient(135deg, var(--sage-whisper) 0%, var(--ground-soft) 100%);
  border-radius: var(--radius-organic);
  margin-bottom: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-standard);
}

.gate-minimal {
  padding: var(--space-sm) var(--space-md);
  background: var(--ground-soft);
  margin-bottom: var(--space-md);
}

.gate-minimal .gate-prompt,
.gate-minimal .gate-btn-desc {
  display: none;
}

.gate-minimal .gate-buttons {
  gap: var(--space-sm);
}

.gate-minimal .gate-btn {
  padding: var(--space-xs) var(--space-md);
  min-width: auto;
}

.gate-back {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  margin-bottom: var(--space-md);
  padding: var(--space-xs);
  transition: color var(--duration-fast);
}

.gate-back:hover {
  color: var(--oeff-blue);
}

.gate-prompt {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-soft);
  margin: 0 0 var(--space-lg);
}

.gate-buttons {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

.gate-buttons-vertical {
  flex-direction: column;
  align-items: center;
}

.gate-btn {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-organic);
  padding: var(--space-lg) var(--space-xl);
  cursor: pointer;
  text-align: left;
  min-width: 200px;
  max-width: 300px;
  box-shadow: var(--shadow-soft);
  transition: 
    transform var(--duration-normal) var(--ease-spring),
    box-shadow var(--duration-normal) var(--ease-standard);
}

.gate-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-elevated);
}

.gate-btn:active {
  transform: translateY(0) scale(0.98);
}

.gate-btn-role {
  width: 100%;
  max-width: 350px;
}

.gate-btn-title {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: var(--space-xs);
}

.gate-btn-desc {
  display: block;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-soft);
}

/* ===================
   ONBOARDING STEPS
   =================== */

.onboarding-steps {
  margin-top: var(--space-lg);
}

.step {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.step-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--oeff-sage);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-line {
  width: 2px;
  flex-grow: 1;
  background: linear-gradient(to bottom, var(--oeff-sage), var(--border));
  margin-top: var(--space-xs);
  min-height: 40px;
}

.step-content {
  flex-grow: 1;
  padding-bottom: var(--space-md);
}

.step-content p {
  margin-bottom: var(--space-sm);
  color: var(--text-soft);
}

.step-note {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-muted);
}

.step-link {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--oeff-blue);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.step-link:hover {
  color: var(--sage-deep);
  text-decoration: underline;
}

/* ===================
   PILL NAVIGATION
   =================== */

.pill-nav {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-lg);
  padding: var(--space-xs);
  background: var(--ground-soft);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.pill {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  background: transparent;
  border: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-normal) var(--ease-spring);
}

.pill:hover {
  color: var(--text);
  background: white;
}

.pill.active {
  color: var(--sage-deep);
  background: white;
  box-shadow: var(--shadow-soft);
}

.pill-content {
  display: none;
  animation: fadeInUp 0.3s var(--ease-standard);
}

.pill-content.active {
  display: block;
}

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

/* ===================
   GUIDE SECTION TITLES
   =================== */

.guide-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: var(--space-lg) 0 var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.guide-section-title:first-child {
  margin-top: 0;
}

/* ===================
   NAVIGATION CARDS
   =================== */

nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

nav li {
  margin-bottom: var(--space-sm);
}

nav a {
  display: block;
  padding: var(--space-md) var(--space-lg);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-organic);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-soft);
  transition: 
    transform var(--duration-normal) var(--ease-spring),
    box-shadow var(--duration-normal) var(--ease-standard);
}

nav a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
}

nav .nav-title {
  font-family: var(--font-display);
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

nav .nav-desc {
  font-size: 0.9rem;
  color: var(--text-soft);
}

.admin-links a {
  padding: var(--space-sm) var(--space-md);
}

.admin-links .nav-title {
  margin: 0;
  font-size: 0.95rem;
}

/* ===================
   CHEAT SHEET
   =================== */

.cheatsheet {
  display: grid;
  gap: var(--space-md);
}

@media (min-width: 600px) {
  .cheatsheet {
    grid-template-columns: repeat(2, 1fr);
  }
}

.cheat-group {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-organic-sm);
  padding: var(--space-md);
}

.cheat-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cheat-group li {
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.cheat-group li:last-child {
  border-bottom: none;
}

/* ===================
   ESCALATION LEVELS
   =================== */

.level-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--space-xs);
  vertical-align: middle;
}

.level-dot.green { background: var(--level-green); }
.level-dot.yellow { background: var(--level-yellow); }
.level-dot.red { background: var(--level-red); }

.escalation-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.9rem;
}

.escalation-table th,
.escalation-table td {
  padding: var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.escalation-table th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: var(--ground-soft);
}

.escalation-table tr.level-green td:first-child { border-left: 3px solid var(--level-green); }
.escalation-table tr.level-yellow td:first-child { border-left: 3px solid var(--level-yellow); }
.escalation-table tr.level-red td:first-child { border-left: 3px solid var(--level-red); }

.level-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
}

.level-badge.green { background: var(--level-green-bg); color: var(--level-green); }
.level-badge.yellow { background: var(--level-yellow-bg); color: var(--level-yellow); }
.level-badge.red { background: var(--level-red-bg); color: var(--level-red); }

/* ===================
   FAQ ACCORDION
   =================== */

.faq {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.faq-item {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-organic-sm);
  overflow: hidden;
}

.faq-item summary {
  font-family: var(--font-display);
  font-weight: 500;
  padding: var(--space-md);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--text-muted);
}

.faq-item[open] summary::after { content: '−'; }

.faq-item summary:hover { background: var(--sage-whisper); }

.faq-answer {
  padding: 0 var(--space-md) var(--space-md);
}

.faq-answer p {
  margin: 0;
  color: var(--text-soft);
}

/* ===================
   CALLOUTS
   =================== */

.callout {
  background: linear-gradient(135deg, var(--sage-whisper) 0%, var(--ground-soft) 100%);
  border-left: 3px solid var(--oeff-sage);
  padding: var(--space-md) var(--space-lg);
  border-radius: 0 var(--radius-organic-sm) var(--radius-organic-sm) 0;
  margin: var(--space-lg) 0;
}

.callout strong {
  color: var(--text);
}

/* ===================
   DECISION TREE
   =================== */

.decision-tree {
  background: var(--ground-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.8;
  overflow-x: auto;
}

.decision-tree code {
  background: none;
  padding: 0;
}

/* ===================
   EMAIL TEMPLATE BLOCK
   =================== */

.email-template {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: var(--space-md) 0;
  overflow: hidden;
}

.email-template-header {
  background: var(--ground-soft);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 0.85rem;
}

.email-template-body {
  padding: var(--space-md);
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.template-var {
  background: var(--oeff-aqua-light);
  color: var(--oeff-blue);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ===================
   CATEGORY SECTIONS
   =================== */

.category-section {
  margin: var(--space-xl) 0;
  padding: var(--space-lg);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.category-section h3 {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border);
}

/* ===================
   LINKS
   =================== */

a {
  color: var(--oeff-blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--sage-deep);
}

/* ===================
   CODE
   =================== */

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: #f0eeea;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

pre {
  background: var(--oeff-black);
  color: #f0eeea;
  padding: var(--space-md);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  overflow-x: auto;
  margin: var(--space-md) 0;
}

pre code {
  background: none;
  padding: 0;
}

/* ===================
   TABLES
   =================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: 0.9rem;
}

th, td {
  padding: var(--space-sm);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  background: var(--ground-soft);
}

/* ===================
   PRINT STYLES
   =================== */

@media print {
  body {
    padding: 1rem;
    font-size: 12pt;
    background: white;
  }
  
  .skip-link, .gate, .pill-nav, .change-path, .gate-back {
    display: none !important;
  }
  
  .hidden { display: block !important; }
  .pill-content { display: block !important; }
  
  nav a {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ===================
   REDUCED MOTION
   =================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
