/* ══════════════════════════════════════════════════════════════════
   terminal.css — retro CLI / terminal output aesthetic

   Identity: dark, monospace-heavy, green-on-black vibes with cyan
   secondary accents. Minimal borders, low opacity, raw terminal feel.
   ══════════════════════════════════════════════════════════════════ */

/* ── Fonts ──
   Add to <head>:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
*/

/* ── Root Tokens (Dark Default) ── */
:root {
  color-scheme: light dark;

  /* Surface system — deep blacks */
  --bg:           #0c0c0c;     /* near-black */
  --surface:      #121212;     /* card bg */
  --surface2:     #1a1a1a;
  --border:       rgba(255,255,255,0.08);  /* low-opacity white */
  --border-bright: rgba(255,255,255,0.15);

  /* Text hierarchy — green/cyan tones */
  --text:         #4af626;     /* terminal green — primary */
  --text-muted:   #a8e6a3;     /* muted green — body */
  --text-dim:     #6b9e67;     /* dim green — metadata (4.7:1 on --bg, WCAG AA) */

  /* Accent — cyan secondary */
  --accent:       #00d4ff;     /* cyan */
  --accent-dim:   rgba(0,212,255,0.1);
  --accent-glow:  rgba(0,212,255,0.2);

  /* Shape — flat terminal, no rounding, no shadows */
  --radius:     0;
  --radius-sm:  0;
  --shadow:     none;
}

/* ── Light Mode Override (optional, keeps terminal feel) ── */
[data-theme="light"] {
  color-scheme: light;

  /* Surface system — inverted */
  --bg:           #ffffff;
  --surface:      #f5f5f5;
  --surface2:     #ebebeb;
  --border:       rgba(0,0,0,0.15);
  --border-bright: rgba(0,0,0,0.25);

  /* Text hierarchy — darker greens */
  --text:         #1a6b1a;     /* dark green */
  --text-muted:   #2d8a2d;     /* body green */
  --text-dim:     #4d6b4a;     /* metadata (5.2:1 on white, WCAG AA) */

  /* Accent — darker cyan */
  --accent:       #0891b2;     /* cyan-600 */
  --accent-dim:   rgba(8,145,178,0.1);
  --accent-glow:  rgba(8,145,178,0.15);
}

/* ── Semantic Color Tokens — Dark ── */
:root {
  --success:     #4af626;     /* green — same as text */
  --success-dim: rgba(74,246,38,0.1);
  --warning:     #ffd000;     /* amber-yellow */
  --warning-dim: rgba(255,208,0,0.1);
  --error:       #ff3333;     /* red */
  --error-dim:   rgba(255,51,51,0.1);
  --info:        #00d4ff;     /* cyan — same as accent */
  --info-dim:    rgba(0,212,255,0.1);
}

/* ── Semantic Color Tokens — Light ── */
[data-theme="light"] {
  --success:     #1a6b1a;
  --success-dim: rgba(26,107,26,0.1);
  --warning:     #b45309;
  --warning-dim: rgba(180,83,9,0.1);
  --error:       #b91c1c;
  --error-dim:   rgba(185,28,28,0.1);
  --info:        #0891b2;
  --info-dim:    rgba(8,145,178,0.1);
}

/* ── Terminal Light — OS preference (unless manually dark) ── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:           #ffffff;
    --surface:      #f5f5f5;
    --surface2:     #ebebeb;
    --border:       rgba(0,0,0,0.15);
    --border-bright: rgba(0,0,0,0.25);

    --text:         #1a6b1a;
    --text-muted:   #2d8a2d;
    --text-dim:     #4d6b4a;

    --accent:       #0891b2;
    --accent-dim:   rgba(8,145,178,0.1);
    --accent-glow:  rgba(8,145,178,0.15);

    --success:     #1a6b1a;
    --success-dim: rgba(26,107,26,0.1);
    --warning:     #b45309;
    --warning-dim: rgba(180,83,9,0.1);
    --error:       #b91c1c;
    --error-dim:   rgba(185,28,28,0.1);
    --info:        #0891b2;
    --info-dim:    rgba(8,145,178,0.1);
  }
}

/* ══════════════════════════════════════════════════════════════════
   OVERRIDES — terminal aesthetic
   ══════════════════════════════════════════════════════════════════ */

/* ── Typography Override — Monospace Everything ── */
body {
  font-family: 'JetBrains Mono', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3, h4 {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0;
}

h1 { font-size: 1.25rem; }
h2 { font-size: 1rem; }
h3 { font-size: 0.875rem; }

p, ul, ol, li, td, th, span, div {
  font-family: 'JetBrains Mono', monospace;
}

code, pre {
  font-family: 'JetBrains Mono', monospace;
}

/* Cards use --radius/--shadow tokens from :root above */

.card-label {
  color: var(--accent);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.card-title {
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
}

.card-body {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* ── Tables — Terminal Style ── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 0;
}

thead th {
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody td {
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: var(--surface);
}

/* ── Code Blocks — Raw Terminal ── */
code {
  font-family: 'JetBrains Mono', monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.15em 0.4em;
  font-size: 0.8125em;
  color: var(--accent);
}

pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 0.875rem;
  box-shadow: none;
  overflow-x: auto;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

/* ── Buttons & Controls ── */
.theme-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.625rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--text-muted);
  border-bottom-color: var(--border);
}

.tab-btn[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Navigation ── */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.nav-title {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text);
}

/* ── Terminal-Style Utilities ── */
.prompt::before {
  content: '$ ';
  color: var(--accent);
}

.cursor::after {
  content: '▌';
  color: var(--text);
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── Status Badges ── */
.badge-success {
  color: var(--success);
  font-size: 0.625rem;
}

.badge-warning {
  color: var(--warning);
  font-size: 0.625rem;
}

.badge-error {
  color: var(--error);
  font-size: 0.625rem;
}

.badge-info {
  color: var(--info);
  font-size: 0.625rem;
}

/* ── Glowing Text (optional accent) ── */
.glow {
  text-shadow: 0 0 8px var(--accent);
}

/* ══════════════════════════════════════════════════════════════════
   Slide mode — terminal aesthetic (used by forge-slides)
   CRT/code-heavy look: mono everything, cyan accent, scanline bg.
   ══════════════════════════════════════════════════════════════════ */

.deck .slide--title {
  background:
    repeating-linear-gradient(
      180deg,
      var(--bg) 0px, var(--bg) 2px,
      var(--surface) 2px, var(--surface) 3px
    ),
    radial-gradient(ellipse at 50% 30%, var(--accent-dim) 0%, transparent 50%);
}
.deck .slide--title .slide__display {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -1px;
  text-shadow: 0 0 20px var(--accent-glow, rgba(0,212,255,0.3));
}
.deck .slide--title .slide__subtitle::before {
  content: "$ ";
  color: var(--accent);
}
.deck .slide--title .slide__subtitle {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--text);
}
.deck .slide--content .slide__heading,
.deck .slide--section .slide__heading,
.deck .slide--diagram .slide__heading,
.deck .slide--table .slide__heading,
.deck .slide--comparison .slide__heading {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
.deck .slide--content .slide__label {
  color: var(--accent);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
.deck .slide--content li::before { content: ">"; color: var(--accent); font-weight: 700; }
.deck .slide--section .slide__number { color: var(--accent); font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.deck .slide--code .slide__code-block { border-color: var(--accent); }
.deck .slide--code .slide__code-filename { color: var(--accent); }
.deck .slide--closing {
  background:
    repeating-linear-gradient(
      180deg,
      var(--bg) 0px, var(--bg) 2px,
      var(--surface) 2px, var(--surface) 3px
    ),
    radial-gradient(ellipse at 50% 70%, var(--accent-dim) 0%, transparent 60%);
}
.deck .slide--closing .slide__heading {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--accent);
  text-shadow: 0 0 20px var(--accent-glow, rgba(0,212,255,0.3));
}
.deck .slide--closing .cta {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  border-color: var(--accent);
  color: var(--accent);
}
.deck .slide--quote blockquote {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
}
