/* Shared stylesheet for tech-learning: lessons and reference docs.
   Follows DESIGN.md (MongoDB-derived system): Euclid Circular A, brand
   green CTA/link accent, deep-teal dark surfaces, pill/12px radii. */

:root {
  --bg: #ffffff;
  --text: #001e2b;
  --text-muted: #5c6c7a;
  --accent: #00684a;
  --accent-soft: #c3f0d2;
  --line: #e1e5e8;
  --code-bg: #f9fbfa;
  --success: #00684a;
  --error: #fa6e39;
  --code-keyword: #00684a;
  --code-string: #00a35c;
  --code-comment: #7c8c9a;
  --code-type: #3d4f9f;
  --code-func: #7b3ff2;
  --code-number: #fa6e39;
  --font-ui: "Euclid Circular A", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-code: "Source Code Pro", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #001e2b;
    --text: #ffffff;
    --text-muted: #a8b3bc;
    --accent: #00ed64;
    --accent-soft: #003d4f;
    --line: #1c2d38;
    --code-bg: #003d4f;
    --success: #00ed64;
    --error: #fa6e39;
    --code-keyword: #00ed64;
    --code-string: #00b545;
    --code-comment: #a8b3bc;
    --code-type: #7b9bf2;
    --code-func: #b98cf7;
    --code-number: #fa9066;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  max-width: 42em;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

h1, h2, h3 {
  font-family: var(--font-ui);
  font-weight: 500;
  line-height: 1.25;
  color: var(--text);
}

h1 {
  font-size: 2rem;
  margin: 0 0 0.25rem;
}

.kicker {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.4rem;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

h3 {
  font-size: 1.1rem;
  margin: 1.75rem 0 0.5rem;
}

p { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

code, pre {
  font-family: var(--font-code);
  font-size: 0.85em;
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: var(--code-bg);
  padding: 1rem 1.2rem;
  border-radius: 6px;
  overflow-x: auto;
  line-height: 1.5;
}
pre code { background: none; padding: 0; }

/* ---- Syntax highlighting (assets/highlight.js) ---- */
.tok-keyword { color: var(--code-keyword); font-weight: 600; }
.tok-string { color: var(--code-string); }
.tok-comment { color: var(--code-comment); font-style: italic; }
.tok-type { color: var(--code-type); }
.tok-func { color: var(--code-func); }
.tok-number { color: var(--code-number); }

blockquote {
  margin: 1.5rem 0;
  padding-left: 1rem;
  border-left: 3px solid var(--accent);
  color: var(--text-muted);
}

ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.4rem; }

.note {
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  font-size: 0.95em;
}

.note-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  display: block;
  margin-bottom: 0.35rem;
}

.sidenote {
  float: right;
  clear: right;
  width: 0;
  margin-right: -14rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.sources {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.9em;
  color: var(--text-muted);
}

.sources h2 { border: none; margin-top: 0; }

.nav-links {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.ask-teacher {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 1rem 1.25rem;
  margin: 2.5rem 0;
  font-size: 0.95em;
}

/* ---- Quiz widget ---- */

.quiz {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.quiz-question {
  font-family: var(--font-ui);
  font-weight: 600;
  margin-bottom: 1rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.quiz-option {
  font-family: var(--font-ui);
  text-align: left;
  width: 100%;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
}

.quiz-option:hover { background: var(--accent-soft); }

.quiz-option.correct {
  background: color-mix(in srgb, var(--success) 18%, var(--code-bg));
  border-color: var(--success);
}

.quiz-option.incorrect {
  background: color-mix(in srgb, var(--error) 18%, var(--code-bg));
  border-color: var(--error);
}

.quiz-option:disabled { cursor: default; }

.quiz-feedback {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  min-height: 1.4em;
}

.quiz-feedback.correct { color: var(--success); }
.quiz-feedback.incorrect { color: var(--error); }

/* ---- Interview questions ---- */

.interview-q {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.1rem 1.4rem;
  margin: 1.25rem 0;
}

.interview-q > summary {
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.interview-q > summary::-webkit-details-marker { display: none; }

.interview-q > summary::before {
  content: "▸ ";
  color: var(--accent);
}

.interview-q[open] > summary::before {
  content: "▾ ";
}

.interview-q .answer-guide {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  font-size: 0.95em;
}

.interview-q .answer-guide p:last-child { margin-bottom: 0; }

/* ---- Exercise / solution guide ---- */

.exercise {
  background: var(--code-bg);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
}

.exercise h3:first-child { margin-top: 0; }

.solution-guide {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.25rem 1.5rem 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

.solution-guide h3 { border-bottom: 1px solid var(--line); padding-bottom: 0.35rem; }

.approach-wrong {
  border-left: 3px solid var(--error);
  padding: 0.1rem 1.1rem;
  margin: 1.25rem 0;
}

.approach-wrong > .approach-label {
  color: var(--error);
}

.approach-right {
  border-left: 3px solid var(--success);
  padding: 0.1rem 1.1rem;
  margin: 1.25rem 0;
}

.approach-right > .approach-label {
  color: var(--success);
}

.approach-label {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: block;
  margin: 1rem 0 0.35rem;
}

@media print {
  body { font-size: 12pt; max-width: 100%; }
  .ask-teacher, .quiz-option { border: 1px solid #999; }
  a { color: inherit; text-decoration: underline; }
}

@media (max-width: 700px) {
  .sidenote { display: none; }
}
