/* ═══════════════════════════════════════════════════════
   BASE.CSS — Variables, Reset, Typography, Animations
   DevOps Master — Dark Terminal Theme
═══════════════════════════════════════════════════════ */

/* ── GOOGLE FONTS ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,300;0,400;0,500;0,700;1,400&family=Unbounded:wght@400;700;900&family=Inter:wght@400;500;600&display=swap');

/* ── CSS VARIABLES ────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:           #07090a;
  --bg-2:         #0a0d0f;
  --surface:      #0d1114;
  --card:         #111619;
  --card-2:       #141c21;
  --card-hover:   #172028;

  /* Borders */
  --border:       #1a2530;
  --border-2:     #1f2e3d;
  --border-3:     #253545;

  /* Text */
  --text:         #a8c4d4;
  --text-bright:  #cce0ed;
  --text-dim:     #3d5c70;
  --text-muted:   #243545;

  /* Topic accent colors */
  --linux:        #3dff7a;
  --docker:       #2496ed;
  --kubernetes:   #326ce5;
  --aws:          #ff9900;
  --git:          #f05032;
  --shell:        #4ecdc4;
  --python:       #ffd43b;
  --terraform:    #7b42bc;
  --ansible:      #ee0000;
  --jenkins:      #d33833;
  --github:       #79c0ff;

  /* Semantic */
  --green:        #3dff7a;
  --green-dim:    #1a6632;

  /* Default accent (overridden per-topic via applyTopicAccent) */
  --accent:       #3dff7a;
  --accent-rgb:   61,255,122;
  --green-bg:     rgba(61,255,122,.07);
  --blue:         #4d9fff;
  --yellow:       #ffe566;
  --orange:       #ff8c42;
  --red:          #ff4d6a;
  --teal:         #3dffd2;
  --purple:       #b066ff;
  --star:         #ffc107;

  /* Difficulty colors */
  --d1: #3dff7a;
  --d2: #4d9fff;
  --d3: #ffe566;
  --d4: #ff8c42;
  --d5: #ff4d6a;

  /* Typography */
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
  --font-display: 'Unbounded', sans-serif;
  --font-body:    'Inter', sans-serif;

  /* Spacing */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap:    16px;
  --gap-lg: 24px;
  --gap-xl: 40px;

  /* Radius */
  --r-sm:  6px;
  --r:     10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
  --fast: 150ms;
  --med:  250ms;
  --mid:  250ms;   /* alias */
  --slow: 400ms;

  /* Shadows */
  --shadow:    0 4px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 48px rgba(0,0,0,.6);
  --glow:      0 0 20px rgba(61,255,122,.15);
}

/* ── RESET ────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0; padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea {
  font-family: inherit; font-size: inherit;
  color: inherit; border: none; outline: none;
  background: none;
}
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── SCROLLBAR ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-3); }

/* ── TYPOGRAPHY ───────────────────────────────────── */
.font-mono    { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); }
.font-body    { font-family: var(--font-body); }

.text-bright  { color: var(--text-bright); }
.text-dim     { color: var(--text-dim); }
.text-muted   { color: var(--text-muted); }

.text-xs  { font-size: .65rem; }
.text-sm  { font-size: .75rem; }
.text-md  { font-size: .875rem; }
.text-lg  { font-size: 1.1rem; }
.text-xl  { font-size: 1.4rem; }
.text-2xl { font-size: 1.8rem; }

.label {
  font-size: .62rem; letter-spacing: .12em;
  text-transform: uppercase; font-weight: 700;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* inline code */
code {
  font-family: var(--font-mono);
  font-size: .82em; color: var(--teal);
  background: var(--card);
  padding: 1px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}

/* ── BACKGROUND TEXTURE ───────────────────────────── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(13,34,20,.8) 0%, transparent 65%),
    radial-gradient(ellipse 40% 30% at 95% 95%, rgba(13,20,34,.6) 0%, transparent 50%),
    radial-gradient(ellipse 30% 20% at 5% 80%, rgba(13,13,34,.4) 0%, transparent 50%);
  pointer-events: none;
}

/* ── UTILITY CLASSES ──────────────────────────────── */
.flex       { display: flex; }
.flex-col   { display: flex; flex-direction: column; }
.flex-wrap  { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-xs { gap: var(--gap-xs); }
.gap-sm { gap: var(--gap-sm); }
.gap    { gap: var(--gap); }
.gap-lg { gap: var(--gap-lg); }
.w-full { width: 100%; }
.relative { position: relative; }
.hidden   { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── ANIMATIONS ───────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(.95); }
}
@keyframes starPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

.anim-fade-up  { animation: fadeUp  var(--med) var(--ease) both; }
.anim-fade-in  { animation: fadeIn  var(--med) var(--ease) both; }
.anim-slide-in { animation: slideIn var(--med) var(--ease) both; }

/* stagger children */
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 360ms; }
.stagger > *:nth-child(8) { animation-delay: 420ms; }
.stagger > *:nth-child(9) { animation-delay: 480ms; }

/* ── TOPIC ACCENT UTILITIES ───────────────────────── */
.accent-linux      { --accent: var(--linux); }
.accent-docker     { --accent: var(--docker); }
.accent-kubernetes { --accent: var(--kubernetes); }
.accent-aws        { --accent: var(--aws); }
.accent-git        { --accent: var(--git); }
.accent-shell      { --accent: var(--shell); }
.accent-python     { --accent: var(--python); }
.accent-terraform  { --accent: var(--terraform); }
.accent-ansible    { --accent: var(--ansible); }
.accent-jenkins    { --accent: var(--jenkins); }
.accent-github     { --accent: var(--github); }

/* ── DIFFICULTY UTILITIES ─────────────────────────── */
.diff-1 { --dc: var(--d1); }
.diff-2 { --dc: var(--d2); }
.diff-3 { --dc: var(--d3); }
.diff-4 { --dc: var(--d4); }
.diff-5 { --dc: var(--d5); }

/* ── RESPONSIVE BREAKPOINTS ───────────────────────── */
/* sm: 480px, md: 768px, lg: 1024px */
@media (max-width: 480px)  { .hide-sm { display: none !important; } }
@media (max-width: 768px)  { .hide-md { display: none !important; } }
@media (max-width: 1024px) { .hide-lg { display: none !important; } }
