/* ============================================
   🎮 CHOOSE YOUR OWN ADVENTURE
   Calm Incident Room Aesthetic
   Professional Cyberpunk - Restrained & Focused
   ============================================ */

:root {
  /* Backgrounds - Deep & Calm */
  --bg-main: #0b0f1a;
  --bg-panel: #111827;
  --bg-terminal: #0d1220;
  --bg-elevated: #1a1f2e;

  /* Text - Readable & Comfortable */
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;

  /* Accent - SINGLE NEON (Calm Mint) */
  --accent: #22f3aa;
  --accent-soft: #7eead3; /* desaturated mint for readable text */
  --accent-dim: rgba(34, 243, 170, 0.15);
  --accent-glow: rgba(34, 243, 170, 0.3);

  /* Status Colors - Muted */
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #34d399;
  --info: #60a5fa;

  /* Borders - Subtle */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(34, 243, 170, 0.3);

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

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

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

body {
  background: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
}

/* Subtle grid - barely visible */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(34, 243, 170, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 243, 170, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

/* ============================================
   ARTICLE CONTAINER
   ============================================ */

article {
  max-width: 800px;
  margin: 60px auto;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0)
  );
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 3rem 2.5rem;
  position: relative;
  z-index: 1;
  animation: fadeIn 0.4s ease-out;
}

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

/* Minimal terminal dots */
article::before {
  content: '● ● ●';
  position: absolute;
  top: 14px;
  left: 18px;
  color: var(--text-muted);
  font-size: 6px;
  letter-spacing: 3px;
  opacity: 0.5;
}

/* ============================================
   TYPOGRAPHY - HIERARCHY & RHYTHM
   ============================================ */

h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-top: 0;
  margin-bottom: 1rem;
  color: var(--text-primary);
  word-wrap: break-word;
}

h2 {
  font-size: 1.4rem;
  font-weight: 500;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

p {
  margin-bottom: 1.2em;
  color: var(--text-primary);
}

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

/* Semantic accent classes - use instead of strong for emphasis */
.emphasis {
  color: var(--accent-soft);
  font-weight: 500;
}

.stat {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.95em;
}

.stat.positive {
  color: var(--success);
}

.stat.negative {
  color: var(--danger);
}

.stat.neutral {
  color: var(--accent);
}

/* Ending blocks - structure over color */
.ending {
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  border-left: 3px solid transparent;
  background: var(--bg-panel);
  border-radius: 0 8px 8px 0;
}

.ending.victory {
  border-left-color: var(--success);
}

.ending.failure {
  border-left-color: var(--danger);
}

em, i {
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================
   LINKS - ACCESSIBLE & CLEAR
   ============================================ */

a {
  color: var(--accent);
  text-decoration: none;
  text-decoration-thickness: 1.5px;
  border-bottom: 1.5px solid var(--accent);
  transition: all 0.2s ease;
  display: inline-block;
}

a:hover {
  color: var(--accent);
  border-bottom-color: transparent;
  transform: translateY(-1px);
}

a:focus {
  outline: none;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

a:active {
  transform: translateY(0);
}

/* CTA Button - Prominent Start Button */
.cta-button {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, #1bc98e 100%);
  color: var(--bg-main);
  font-weight: 600;
  font-size: 1.1rem;
  padding: 1rem 2rem;
  border-radius: 8px;
  border: none;
  border-bottom: none;
  margin: 1.5rem 0;
  text-align: center;
  box-shadow: 
    0 4px 12px rgba(34, 243, 170, 0.3),
    0 0 0 1px rgba(34, 243, 170, 0.5);
  transition: all 0.2s ease;
  text-decoration: none;
}

.cta-button:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(34, 243, 170, 0.4),
    0 0 0 2px var(--accent);
  background: linear-gradient(135deg, #2affbb 0%, #22d89a 100%);
  color: var(--bg-main);
  border-bottom: none;
}

.cta-button:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 8px rgba(34, 243, 170, 0.3),
    0 0 0 1px var(--accent);
}

.cta-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

/* ============================================
   DECISION BUTTONS - VISUAL WEIGHT
   ============================================ */

h2 a {
  display: block;
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  transition: all 0.2s ease;
  position: relative;
  word-wrap: break-word;
}

h2 a:hover {
  transform: translateX(4px);
  border-color: var(--border-subtle);
  border-left-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-dim);
  background: var(--bg-elevated);
}

h2 a:focus {
  outline: none;
}

h2 a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h2 a:active {
  transform: translateX(2px);
}

/* Danger choice indicator */
h2:has(a[href*="panic"]) a,
h2:has(a[href*="force-push"]) a,
h2:has(a[href*="restart"]) a,
h2:has(a[href*="update-all"]) a,
h2:has(a[href*="blame"]) a,
h2:has(a[href*="run-away"]) a {
  border-left-color: var(--danger);
}

h2:has(a[href*="panic"]) a:hover,
h2:has(a[href*="force-push"]) a:hover,
h2:has(a[href*="restart"]) a:hover,
h2:has(a[href*="update-all"]) a:hover,
h2:has(a[href*="blame"]) a:hover,
h2:has(a[href*="run-away"]) a:hover {
  border-left-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.15);
}

/* Safe choice indicator */
h2:has(a[href*="investigate"]) a,
h2:has(a[href*="fix-yaml"]) a,
h2:has(a[href*="rollback"]) a,
h2:has(a[href*="admit"]) a {
  border-left-color: var(--success);
}

h2:has(a[href*="investigate"]) a:hover,
h2:has(a[href*="fix-yaml"]) a:hover,
h2:has(a[href*="rollback"]) a:hover,
h2:has(a[href*="admit"]) a:hover {
  border-left-color: var(--success);
  box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.15);
}

/* ============================================
   CODE BLOCKS - REALISTIC TERMINAL
   ============================================ */

code {
  background: var(--bg-terminal);
  color: #a7f3d0;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border: 1px solid rgba(34, 243, 170, 0.1);
}

pre {
  background: var(--bg-terminal);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 1.5rem 0;
  position: relative;
  max-width: 100%;
  border: 1px solid rgba(34, 243, 170, 0.2);
}

pre::before {
  content: '➜  prod ';
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: block;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: #a7f3d0;
  display: block;
  line-height: 1.6;
  font-size: 0.85rem;
}

/* ============================================
   BLOCKQUOTES - PRESSURE MOMENTS
   ============================================ */

blockquote {
  background: rgba(248, 113, 113, 0.08);
  border-left: 4px solid var(--danger);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
  color: var(--text-primary);
  font-style: normal;
}

blockquote strong {
  color: var(--danger);
}

/* ============================================
   LISTS - CLEAN & READABLE
   ============================================ */

ul, ol {
  margin: 1.25rem 0;
  padding-left: 2rem;
}

ul li, ol li {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  line-height: 1.7;
}

ul li::marker {
  color: var(--accent);
}

ol li::marker {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================
   SPECIAL ELEMENTS
   ============================================ */

hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--border-subtle) 50%, 
    transparent 100%);
  margin: 2.5rem 0;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  margin: 1.5rem 0;
}

/* ============================================
   ALERT BOXES - EMOTIONAL PACING
   ============================================ */

.alert {
  background: rgba(248, 113, 113, 0.1);
  border-left: 4px solid var(--danger);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}

/* ============================================
   COLLAPSIBLE SECTIONS - ENDINGS PAGE
   ============================================ */

details {
  background: var(--bg-panel);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.5rem;
  margin: 2rem 0;
  transition: all 0.2s ease;
}

details:hover {
  border-color: var(--accent-dim);
}

details[open] {
  background: var(--bg-elevated);
  padding: 1.5rem 2rem 2rem 2rem;
}

summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--accent);
  padding: 0.5rem 0;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

summary::-webkit-details-marker {
  display: none;
}

summary::before {
  content: '▶';
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.8em;
  color: var(--accent);
}

details[open] summary::before {
  transform: rotate(90deg);
}

summary:hover {
  color: var(--text-primary);
}

summary:focus {
  outline: none;
}

summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

details > *:not(summary) {
  margin-top: 1.5rem;
}

/* Endings page specific improvements */
details h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
}

details h3:first-of-type {
  margin-top: 1.5rem;
}

details ul {
  margin-top: 0.75rem;
  margin-bottom: 0;
  padding-left: 1.5rem;
}

details ul li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

details hr {
  margin: 2rem 0;
  opacity: 0.5;
}

/* Spoiler protection for story map */
details:not([open]) pre {
  filter: blur(8px);
  user-select: none;
  pointer-events: none;
  transition: filter 0.3s ease;
}

details[open] pre {
  filter: blur(0);
  transition: filter 0.3s ease;
}

/* Make summary look more like a button when it contains spoiler warning */
summary:has(*) {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

summary::after {
  content: '';
  font-size: 0.9rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  article {
    padding: 2.5rem 1.5rem;
    margin: 30px auto;
  }
  
  h1 {
    font-size: 1.75rem;
  }
  
  h2 {
    font-size: 1.25rem;
    margin-top: 2rem;
  }
  
  h2 a {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
  }
  
  pre {
    padding: 1rem;
    font-size: 0.8rem;
  }
  
  blockquote {
    padding: 0.875rem 1rem;
  }
}

/* ============================================
   SCROLLBAR - MINIMAL
   ============================================ */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent-glow);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) var(--bg-main);
}

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

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

/* Focus visible for keyboard navigation only */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

@media print {
  body {
    background: white;
    color: black;
  }
  
  article {
    border: 1px solid black;
    box-shadow: none;
  }
  
  a {
    color: blue;
    text-decoration: underline;
  }
  
  pre {
    border: 1px solid black;
  }
}
