/* ============================================================
   AI SAFETY LAB — Course Stylesheet
   Sibling of the Human Data Lead Lab. Same dark theme,
   distinct "safety lab" accent (cyan + violet). Adds theory and
   curated-resource components for world-class lessons.
   ============================================================ */

:root {
  /* Core palette — matches the DVP course family */
  --bg-primary: #0f1117;
  --bg-secondary: #161822;
  --bg-card: #1c1f2e;
  --bg-code: #1a1d2e;
  --bg-highlight: #232740;
  --bg-success: rgba(52, 211, 153, 0.08);
  --bg-warning: rgba(251, 191, 36, 0.08);
  --bg-info: rgba(96, 165, 250, 0.08);
  --bg-action: rgba(139, 92, 246, 0.08);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #f1f5f9;
  --text-code: #e2e8f0;

  --accent-blue: #60a5fa;
  --accent-purple: #a78bfa;
  --accent-green: #34d399;
  --accent-orange: #fb923c;
  --accent-yellow: #fbbf24;
  --accent-red: #f87171;
  --accent-pink: #f472b6;
  --accent-cyan: #22d3ee;       /* track accent */
  --accent-violet: #818cf8;     /* track accent 2 */

  --border-subtle: #2a2d3e;
  --border-card: #2e3148;
  --border-accent: #3b3f5c;

  /* Code syntax */
  --syntax-keyword: #c084fc;
  --syntax-string: #34d399;
  --syntax-comment: #64748b;
  --syntax-function: #60a5fa;
  --syntax-number: #fb923c;
  --syntax-operator: #94a3b8;
  --syntax-builtin: #f472b6;

  /* Sizing */
  --max-width: 800px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --grad-track: linear-gradient(135deg, var(--accent-cyan), var(--accent-violet));
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* ---- Layout ---- */
.course-container { max-width: var(--max-width); margin: 0 auto; padding: 2rem 1.5rem 5rem; }

/* ---- Course Header ---- */
.course-header {
  text-align: center;
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 3rem;
}
.course-badge {
  display: inline-block;
  background: var(--grad-track);
  color: #04121a;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.3rem 1rem; border-radius: 100px; margin-bottom: 1.2rem;
}
.course-header h1 {
  font-size: 2.2rem; font-weight: 800; color: var(--text-heading);
  letter-spacing: -0.03em; line-height: 1.2; margin-bottom: 0.6rem;
}
.course-header .subtitle { font-size: 1.05rem; color: var(--text-secondary); font-weight: 400; }

/* ---- Day Meta ---- */
.day-meta { display: flex; align-items: center; gap: 1rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.day-number {
  background: var(--grad-track); color: #04121a;
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.35rem 1rem; border-radius: 100px;
}
.day-duration { color: var(--text-muted); font-size: 0.85rem; display: flex; align-items: center; gap: 0.4rem; }
.day-type { color: var(--text-muted); font-size: 0.85rem; padding: 0.2rem 0.7rem; border: 1px solid var(--border-subtle); border-radius: 100px; }

/* ---- Section Headers ---- */
h2 {
  font-size: 1.5rem; font-weight: 700; color: var(--text-heading); letter-spacing: -0.02em;
  margin: 2.5rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-subtle);
}
h3 { font-size: 1.15rem; font-weight: 600; color: var(--text-heading); margin: 2rem 0 0.8rem; }
h4 {
  font-size: 0.95rem; font-weight: 600; color: var(--accent-cyan); text-transform: uppercase;
  letter-spacing: 0.06em; margin: 1.8rem 0 0.6rem;
}

/* ---- Text ---- */
p { margin-bottom: 1rem; color: var(--text-primary); }
strong { color: var(--text-heading); font-weight: 600; }
em { color: var(--text-secondary); }
a { color: var(--accent-cyan); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color 0.2s; }
a:hover { border-bottom-color: var(--accent-cyan); }
ul, ol { margin: 0.5rem 0 1.2rem 1.5rem; color: var(--text-primary); }
li { margin-bottom: 0.5rem; line-height: 1.6; }
li::marker { color: var(--accent-violet); }
blockquote {
  border-left: 3px solid var(--border-accent); margin: 1.2rem 0; padding: 0.4rem 0 0.4rem 1.2rem;
  color: var(--text-secondary); font-style: italic;
}

/* ---- Cards & Callouts ---- */
.card { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-lg); padding: 1.5rem; margin: 1.5rem 0; }
.callout { border-radius: var(--radius-md); padding: 1.2rem 1.4rem; margin: 1.5rem 0; border-left: 3px solid; }
.callout-title { font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }
.callout.watch  { background: var(--bg-action);  border-left-color: var(--accent-purple); } .callout.watch .callout-title  { color: var(--accent-purple); }
.callout.do     { background: var(--bg-success); border-left-color: var(--accent-green);  } .callout.do .callout-title     { color: var(--accent-green); }
.callout.info   { background: var(--bg-info);    border-left-color: var(--accent-blue);   } .callout.info .callout-title   { color: var(--accent-blue); }
.callout.warning{ background: var(--bg-warning); border-left-color: var(--accent-yellow); } .callout.warning .callout-title{ color: var(--accent-yellow); }
.callout.tip    { background: rgba(52,211,153,.06); border-left-color: var(--accent-green); } .callout.tip .callout-title { color: var(--accent-green); }
.callout.danger { background: rgba(248,113,113,.08); border-left-color: var(--accent-red); } .callout.danger .callout-title { color: var(--accent-red); }
.callout.key    { background: rgba(34,211,238,.06); border-left-color: var(--accent-cyan); } .callout.key .callout-title { color: var(--accent-cyan); }
.callout.lead   { background: rgba(129,140,248,.07); border-left-color: var(--accent-violet); } .callout.lead .callout-title { color: var(--accent-violet); }
.callout p:last-child { margin-bottom: 0; }

/* ---- Theory Box (core teaching) ---- */
.theory {
  background: linear-gradient(180deg, rgba(129,140,248,.05), rgba(34,211,238,.03));
  border: 1px solid rgba(129,140,248,.22);
  border-radius: var(--radius-lg); padding: 1.5rem 1.7rem; margin: 1.5rem 0;
}
.theory-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-violet); margin-bottom: 0.7rem; }
.theory h3 { margin-top: 0; }

/* ---- Curated Resources ---- */
.resources { margin: 1.5rem 0; }
.resource-list { display: grid; gap: 0.7rem; }
.resource {
  display: flex; align-items: flex-start; gap: 0.9rem;
  background: var(--bg-card); border: 1px solid var(--border-card);
  border-radius: var(--radius-md); padding: 0.9rem 1.1rem; transition: border-color 0.2s, transform 0.15s;
}
.resource:hover { border-color: var(--border-accent); transform: translateY(-1px); }
.resource .rtype {
  flex-shrink: 0; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.25rem 0.5rem; border-radius: 5px; margin-top: 0.15rem; min-width: 64px; text-align: center;
}
.rtype.paper { background: rgba(167,139,250,.14); color: var(--accent-purple); }
.rtype.video { background: rgba(248,113,113,.14); color: var(--accent-red); }
.rtype.article{ background: rgba(96,165,250,.14); color: var(--accent-blue); }
.rtype.docs  { background: rgba(52,211,153,.14); color: var(--accent-green); }
.rtype.tool  { background: rgba(34,211,238,.14); color: var(--accent-cyan); }
.rtype.book  { background: rgba(251,191,36,.14); color: var(--accent-yellow); }
.resource .rbody { flex: 1; }
.resource .rtitle { font-weight: 600; color: var(--text-heading); font-size: 0.95rem; display: block; }
.resource .rtitle a { border-bottom: none; }
.resource .rmeta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.resource .rwhy { font-size: 0.85rem; color: var(--text-secondary); margin-top: 0.35rem; }
.resource .rtime { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.resource-note { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.6rem; }

/* ---- Code Blocks ---- */
pre {
  background: var(--bg-code); border: 1px solid var(--border-card); border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem; margin: 1rem 0 1.5rem; overflow-x: auto; font-size: 0.88rem; line-height: 1.7; position: relative;
}
code { font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace; font-size: 0.88rem; }
p code, li code, td code {
  background: var(--bg-highlight); padding: 0.15rem 0.45rem; border-radius: 4px; font-size: 0.85rem;
  color: var(--accent-pink); border: 1px solid var(--border-subtle);
}
.kw { color: var(--syntax-keyword); font-weight: 500; }
.str { color: var(--syntax-string); }
.cmt { color: var(--syntax-comment); font-style: italic; }
.fn { color: var(--syntax-function); }
.num { color: var(--syntax-number); }
.op { color: var(--syntax-operator); }
.bi { color: var(--syntax-builtin); }

/* ---- Annotated Code Block ---- */
.code-explained { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-lg); margin: 1.5rem 0; overflow: hidden; }
.code-explained .code-header { padding: 0.8rem 1.2rem; background: var(--bg-highlight); border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; justify-content: space-between; }
.code-explained .code-header .filename { font-family: 'JetBrains Mono', 'Consolas', monospace; font-size: 0.8rem; color: var(--text-secondary); }
.code-explained .code-header .lang { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.code-explained pre { margin: 0; border: none; border-radius: 0; }
.code-annotation { padding: 0.8rem 1.2rem; border-top: 1px solid var(--border-subtle); background: var(--bg-secondary); font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }
.code-annotation strong { color: var(--accent-cyan); }

/* ---- Step List ---- */
.steps { counter-reset: step-counter; list-style: none; margin-left: 0; padding-left: 0; }
.steps li { counter-increment: step-counter; position: relative; padding-left: 3.2rem; margin-bottom: 1.5rem; }
.steps li::before {
  content: counter(step-counter); position: absolute; left: 0; top: 0.05rem; width: 2rem; height: 2rem;
  background: var(--grad-track); color: #04121a; font-size: 0.85rem; font-weight: 700; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---- Checklist ---- */
.checklist { list-style: none; margin-left: 0; padding-left: 0; }
.checklist li { position: relative; padding-left: 2rem; margin-bottom: 0.8rem; }
.checklist li::before {
  content: ''; position: absolute; left: 0; top: 0.35rem; width: 1.1rem; height: 1.1rem;
  border: 2px solid var(--border-accent); border-radius: 4px; background: var(--bg-secondary);
}
.checklist li.checked::before { background: var(--accent-green); border-color: var(--accent-green); }
.checklist li.checked::after {
  content: ''; position: absolute; left: 0.25rem; top: 0.45rem; width: 0.6rem; height: 0.35rem;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}

/* ---- Terminal Block ---- */
.terminal { background: #0a0c10; border: 1px solid #1e2030; border-radius: var(--radius-md); margin: 1rem 0 1.5rem; overflow: hidden; }
.terminal-header { background: #151820; padding: 0.5rem 1rem; display: flex; align-items: center; gap: 0.5rem; }
.terminal-dot { width: 10px; height: 10px; border-radius: 50%; }
.terminal-dot.red { background: #f87171; } .terminal-dot.yellow { background: #fbbf24; } .terminal-dot.green { background: #34d399; }
.terminal-title { font-size: 0.72rem; color: var(--text-muted); margin-left: 0.5rem; }
.terminal pre { background: transparent; border: none; margin: 0; padding: 1rem 1.2rem; color: #a0aec0; }
.terminal .prompt { color: var(--accent-green); }
.terminal .output { color: var(--text-secondary); }

/* ---- Progress Bar ---- */
.progress-bar { background: var(--bg-highlight); border-radius: 100px; height: 6px; margin: 1rem 0 0.5rem; overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 100px; background: var(--grad-track); transition: width 0.5s ease; }
.progress-label { font-size: 0.78rem; color: var(--text-muted); text-align: right; }

/* ---- Concept / Exercise / Takeaways ---- */
.concept { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-lg); padding: 1.5rem; margin: 1.5rem 0; }
.concept-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-violet); margin-bottom: 0.8rem; }
.exercise { background: var(--bg-card); border: 2px solid var(--accent-green); border-radius: var(--radius-lg); padding: 1.5rem; margin: 2rem 0; }
.exercise-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent-green); margin-bottom: 0.3rem; }
.exercise h3 { margin-top: 0.3rem; margin-bottom: 1rem; }
.takeaways { background: rgba(34,211,238,.05); border: 1px solid rgba(34,211,238,.22); border-radius: var(--radius-lg); padding: 1.3rem 1.6rem; margin: 2rem 0; }
.takeaways-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-cyan); margin-bottom: 0.7rem; }
.takeaways ul { margin-bottom: 0; }

/* ---- Glossary chips ---- */
.term { border-bottom: 1px dotted var(--accent-violet); cursor: help; }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.9rem; }
th { background: var(--bg-highlight); color: var(--text-heading); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0.7rem 1rem; text-align: left; border-bottom: 2px solid var(--border-accent); }
td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); vertical-align: top; }
tr:hover td { background: var(--bg-secondary); }

/* ---- Day Navigation Footer ---- */
.day-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border-subtle); gap: 1rem; }
.day-nav a { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.3rem; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-md); color: var(--text-primary); font-size: 0.9rem; font-weight: 500; text-decoration: none; transition: background 0.2s, border-color 0.2s; }
.day-nav a:hover { background: var(--bg-highlight); border-color: var(--border-accent); }
.day-nav .next { margin-left: auto; background: var(--grad-track); border: none; color: #04121a; font-weight: 700; }
.day-nav .next:hover { opacity: 0.92; }
.day-nav .home { color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  html { font-size: 15px; }
  .course-container { padding: 1.5rem 1rem 3rem; }
  .course-header h1 { font-size: 1.7rem; }
  .day-nav { flex-direction: column; }
  .day-nav a { width: 100%; justify-content: center; }
  .day-meta { gap: 0.6rem; }
  .resource { flex-direction: column; gap: 0.5rem; }
}

/* ---- Print ---- */
@media print {
  body { background: #fff; color: #1a1a2e; }
  .course-container { max-width: 100%; }
  .day-nav { display: none; }
  pre { border: 1px solid #ddd; }
}
