/* AI Engineering Course — client-side gamification (static GitHub Pages safe) */

:root {
  --xp-accent: #14b8a6;
  --xp-warn: #f59e0b;
  --xp-bad: #ef4444;
  --xp-ok: #22c55e;
  --xp-panel: rgba(15, 23, 42, 0.92);
  --xp-border: rgba(20, 184, 166, 0.35);
  --course-navy: #0b1220;
  --course-indigo: #4f46e5;
  --course-indigo-light: #818cf8;
  --course-line: rgba(148, 163, 184, 0.28);
}

/* Site-wide polish */
.md-header {
  box-shadow: 0 1px 0 rgba(148, 163, 184, 0.2);
}

.md-header__title {
  font-weight: 700;
  letter-spacing: -0.015em;
}

.md-tabs__link {
  font-weight: 600;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  letter-spacing: -0.025em;
}

.md-typeset h2 {
  margin-top: 3.2rem;
  font-weight: 750;
}

/* Landing page */
.md-content:has(.course-hero) .md-content__inner {
  max-width: 72rem;
  margin: 0 auto;
  padding-top: 1.5rem;
}

.course-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  margin: 0 -1rem;
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 4vw, 4rem);
  overflow: hidden;
}

.course-hero::before {
  content: "";
  position: absolute;
  width: 30rem;
  height: 30rem;
  right: -12rem;
  top: -14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.18), transparent 68%);
  pointer-events: none;
}

.course-eyebrow {
  display: inline-block;
  color: var(--course-indigo);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.course-hero h1 {
  max-width: 15ch;
  margin: 0.8rem 0 1.2rem;
  color: var(--course-navy);
  font-size: clamp(2rem, 3.2vw, 3.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.course-hero h1 span {
  color: var(--course-indigo);
}

.course-hero__lead {
  max-width: 38rem;
  margin: 0;
  color: #475569;
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.7;
}

.course-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.8rem;
}

.md-typeset .course-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.8rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.md-typeset .course-button:hover {
  transform: translateY(-1px);
}

.md-typeset .course-button--primary {
  background: var(--course-indigo);
  color: #fff;
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.22);
}

.md-typeset .course-button--secondary {
  border-color: #cbd5e1;
  background: rgba(255, 255, 255, 0.7);
  color: #1e293b;
}

.md-typeset .course-button--coffee {
  border-color: #ffdd00;
  background: #ffdd00;
  color: #0b1220;
  box-shadow: 0 8px 24px rgba(255, 221, 0, 0.28);
}

.md-typeset .course-button--coffee:hover {
  background: #ffe94d;
  border-color: #ffe94d;
}

.course-hero__note {
  margin: 1rem 0 0;
  color: #64748b;
  font-size: 0.72rem;
}

.course-terminal {
  position: relative;
  border: 1px solid rgba(129, 140, 248, 0.25);
  border-radius: 0.85rem;
  background: #101827;
  color: #dbeafe;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.72rem;
  overflow: hidden;
  transform: perspective(1000px) rotateY(-2deg) rotateX(1deg);
}

.course-terminal__bar {
  display: flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: #0b1220;
}

.course-terminal__bar i {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 50%;
  background: #fb7185;
}

.course-terminal__bar i:nth-child(2) { background: #fbbf24; }
.course-terminal__bar i:nth-child(3) { background: #34d399; }
.course-terminal__bar span { margin-left: 0.4rem; color: #64748b; }
.course-terminal__body { padding: 1rem 1.1rem 1.2rem; }
.course-terminal__body p { margin: 0.7rem 0; }
.terminal-muted { margin-right: 0.65rem; color: #6366f1; }
.terminal-status { margin-top: 1.2rem; padding-top: 0.9rem; border-top: 1px solid rgba(148, 163, 184, 0.14); color: #94a3b8; }
.terminal-status span { display: inline-block; width: 0.45rem; height: 0.45rem; margin-right: 0.4rem; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.1); }

.course-proof {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 0 4rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--course-line);
  border-bottom: 1px solid var(--course-line);
}

.course-proof > div { padding: 0.2rem 1.2rem; border-right: 1px solid var(--course-line); text-align: center; }
.course-proof > div:last-child { border-right: 0; }
.course-proof strong { display: block; color: var(--course-navy); font-size: 1.25rem; }
.course-proof span { display: block; margin-top: 0.12rem; color: #64748b; font-size: 0.68rem; }

.path-grid,
.curriculum-grid,
.method-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.6rem;
}

.path-grid { grid-template-columns: repeat(3, 1fr); align-items: stretch; }
.md-typeset .path-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 18rem;
  padding: 1.35rem;
  border: 1px solid var(--course-line);
  border-radius: 0.85rem;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.md-typeset .path-card:hover { transform: translateY(-3px); border-color: rgba(79, 70, 229, 0.45); box-shadow: 0 16px 36px rgba(15, 23, 42, 0.08); }
.path-card--featured { background: linear-gradient(145deg, rgba(79, 70, 229, 0.07), transparent 68%); border-color: rgba(79, 70, 229, 0.35) !important; }
.path-card__tag { position: absolute; right: 1rem; top: 1rem; padding: 0.2rem 0.5rem; border-radius: 999px; background: rgba(79, 70, 229, 0.1); color: var(--course-indigo); font-size: 0.58rem; font-weight: 800; text-transform: uppercase; }
.path-card__icon { display: grid; place-items: center; width: 2.3rem; height: 2.3rem; margin-bottom: 1.2rem; border-radius: 0.55rem; background: #eef2ff; color: var(--course-indigo); font-size: 0.72rem; font-weight: 800; }
.path-card__time { color: #64748b; font-size: 0.67rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.path-card h3 { margin: 0.55rem 0 0.6rem; font-size: 1.15rem; }
.path-card p { margin: 0; color: #64748b; font-size: 0.78rem; line-height: 1.65; }
.path-card__link { margin-top: auto; padding-top: 1.2rem; color: var(--course-indigo); font-size: 0.72rem; font-weight: 700; }

.curriculum-grid { grid-template-columns: repeat(2, 1fr); }
.curriculum-stage { padding: 1.3rem 1.4rem; border: 1px solid var(--course-line); border-radius: 0.75rem; }
.curriculum-stage__head { display: flex; align-items: center; gap: 0.7rem; }
.curriculum-stage__head span { color: var(--course-indigo); font-size: 0.64rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.curriculum-stage__head strong { font-size: 1rem; }
.curriculum-stage p { margin: 0.65rem 0 0.8rem; color: #64748b; font-size: 0.75rem; }
.curriculum-stage ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem 1rem; margin: 0; padding: 0; list-style: none; }
.curriculum-stage li { margin: 0; }
.curriculum-stage li a { font-size: 0.7rem; font-weight: 600; }
.course-inline-link { margin: 1rem 0 0; text-align: right; font-size: 0.75rem; font-weight: 700; }

.method-grid { grid-template-columns: repeat(3, 1fr); }
.method-grid > div { padding: 0.5rem 1.2rem 0.5rem 0; }
.method-grid > div > span { color: var(--course-indigo); font-size: 1.4rem; }
.method-grid h3 { margin: 0.65rem 0 0.45rem; font-size: 0.9rem; }
.method-grid p { margin: 0; color: #64748b; font-size: 0.75rem; line-height: 1.65; }

.course-cta { display: flex; align-items: center; justify-content: space-between; gap: 2rem; margin-top: 4.5rem; padding: clamp(1.5rem, 4vw, 2.5rem); border-radius: 0.9rem; background: #101827; color: #e2e8f0; }
.course-cta h2 { margin: 0.35rem 0; color: #fff; font-size: clamp(1.35rem, 3vw, 2rem); }
.course-cta p { margin: 0; color: #94a3b8; font-size: 0.78rem; }
.course-cta .course-eyebrow { color: var(--course-indigo-light); }
.course-footnote { margin: 1.2rem 0 3rem; color: #64748b; text-align: center; font-size: 0.66rem; }

[data-md-color-scheme="slate"] .course-hero h1,
[data-md-color-scheme="slate"] .course-proof strong { color: #f8fafc; }
[data-md-color-scheme="slate"] .course-hero__lead,
[data-md-color-scheme="slate"] .path-card p,
[data-md-color-scheme="slate"] .curriculum-stage p,
[data-md-color-scheme="slate"] .method-grid p { color: #94a3b8; }
[data-md-color-scheme="slate"] .course-button--secondary { border-color: #475569; background: rgba(15, 23, 42, 0.5); color: #e2e8f0; }
[data-md-color-scheme="slate"] .path-card__icon { background: rgba(99, 102, 241, 0.16); }

@media (max-width: 1100px) {
  .course-hero { grid-template-columns: 1fr; padding-top: 2.5rem; }
  .course-hero h1 { max-width: none; }
  .course-terminal { max-width: 34rem; transform: none; }
}

@media (max-width: 800px) {
  .path-grid { grid-template-columns: 1fr; }
  .md-typeset .path-card { min-height: 0; }
  .course-proof { grid-template-columns: repeat(2, 1fr); }
  .course-proof > div:nth-child(2) { border-right: 0; }
  .course-proof > div:nth-child(-n+2) { padding-bottom: 0.9rem; }
  .course-proof > div:nth-child(n+3) { padding-top: 0.9rem; border-top: 1px solid var(--course-line); }
}

@media (max-width: 560px) {
  .course-hero h1 { font-size: 2.2rem; }
  .course-actions { flex-direction: column; }
  .course-actions .course-button { width: 100%; }
  .curriculum-grid, .method-grid { grid-template-columns: 1fr; }
  .curriculum-stage ul { grid-template-columns: 1fr; }
  .course-cta { align-items: flex-start; flex-direction: column; }
}

[data-md-color-scheme="default"] {
  --xp-panel: rgba(255, 255, 255, 0.96);
  --xp-text: #0f172a;
  --xp-muted: #475569;
  --xp-card: #f8fafc;
  --xp-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
}

[data-md-color-scheme="slate"] {
  --xp-text: #e2e8f0;
  --xp-muted: #94a3b8;
  --xp-card: #1e293b;
  --xp-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

/* Fixed progress HUD */
#aieng-hud {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  width: min(280px, calc(100vw - 2rem));
  background: var(--xp-panel);
  color: var(--xp-text);
  border: 1px solid var(--xp-border);
  border-radius: 12px;
  box-shadow: var(--xp-shadow);
  font-size: 0.78rem;
  line-height: 1.35;
  backdrop-filter: blur(8px);
  overflow: hidden;
}

#aieng-hud.collapsed .aieng-hud-body {
  display: none;
}

#aieng-hud .aieng-hud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  user-select: none;
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.18), transparent);
}

#aieng-hud .aieng-hud-title {
  font-weight: 700;
  letter-spacing: 0.02em;
}

#aieng-hud .aieng-hud-body {
  padding: 0 0.75rem 0.75rem;
}

#aieng-hud .aieng-row {
  display: flex;
  justify-content: space-between;
  margin: 0.25rem 0;
  color: var(--xp-muted);
}

#aieng-hud .aieng-row strong {
  color: var(--xp-text);
}

#aieng-hud .aieng-bar {
  height: 8px;
  background: rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.45rem 0 0.2rem;
}

#aieng-hud .aieng-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0d9488, var(--xp-accent));
  transition: width 0.35s ease;
}

#aieng-hud .aieng-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

#aieng-hud .aieng-badge-chip {
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid var(--xp-border);
  color: var(--xp-text);
}

#aieng-hud .aieng-links {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.55rem;
}

#aieng-hud a {
  color: var(--xp-accent);
  text-decoration: none;
  font-weight: 600;
}

#aieng-hud a:hover {
  text-decoration: underline;
}

/* Toast */
#aieng-toast {
  position: fixed;
  left: 50%;
  bottom: 5.5rem;
  transform: translateX(-50%) translateY(20px);
  z-index: 110;
  background: var(--xp-panel);
  color: var(--xp-text);
  border: 1px solid var(--xp-border);
  border-radius: 10px;
  padding: 0.65rem 1rem;
  box-shadow: var(--xp-shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: min(420px, calc(100vw - 2rem));
  text-align: center;
  font-size: 0.85rem;
}

#aieng-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Think / Explainer cards */
.aieng-think,
.aieng-explainer,
.aieng-lab,
.aieng-quiz,
.aieng-complete,
.aieng-intuition {
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin: 1.1rem 0;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: var(--xp-card, #f8fafc);
}

.aieng-intuition {
  border-left: 4px solid #a855f7;
  background: linear-gradient(
    135deg,
    rgba(168, 85, 247, 0.08),
    transparent 55%
  );
}

.aieng-intuition > .label {
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.4rem;
  color: var(--xp-muted);
}

.aieng-intuition .kill {
  margin-top: 0.55rem;
  padding-top: 0.45rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.4);
  font-size: 0.92rem;
}

.aieng-story {
  font-style: italic;
  opacity: 0.95;
  margin: 0.35rem 0 0.75rem;
  padding-left: 0.75rem;
  border-left: 3px solid rgba(245, 158, 11, 0.7);
}

[data-md-color-scheme="slate"] .aieng-think,
[data-md-color-scheme="slate"] .aieng-explainer,
[data-md-color-scheme="slate"] .aieng-lab,
[data-md-color-scheme="slate"] .aieng-quiz,
[data-md-color-scheme="slate"] .aieng-complete {
  background: rgba(30, 41, 59, 0.65);
}

.aieng-think {
  border-left: 4px solid var(--xp-warn);
}

.aieng-explainer {
  border-left: 4px solid #6366f1;
}

.aieng-lab {
  border-left: 4px solid var(--xp-accent);
}

.aieng-think > .label,
.aieng-explainer > .label,
.aieng-lab > .label,
.aieng-quiz > .label {
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.4rem;
  color: var(--xp-muted);
}

.aieng-think details,
.aieng-explainer details {
  margin-top: 0.4rem;
}

.aieng-think summary,
.aieng-explainer summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--xp-accent);
}

/* Interactive quiz */
.aieng-quiz {
  border-left: 4px solid #ec4899;
}

.aieng-quiz .quiz-prompt {
  font-weight: 600;
  margin: 0.2rem 0 0.7rem;
}

.aieng-quiz .quiz-options {
  display: grid;
  gap: 0.45rem;
}

.aieng-quiz button.quiz-opt {
  text-align: left;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.aieng-quiz button.quiz-opt:hover:not(:disabled) {
  border-color: var(--xp-accent);
  background: rgba(20, 184, 166, 0.08);
}

.aieng-quiz button.quiz-opt.correct {
  border-color: var(--xp-ok);
  background: rgba(34, 197, 94, 0.12);
}

.aieng-quiz button.quiz-opt.wrong {
  border-color: var(--xp-bad);
  background: rgba(239, 68, 68, 0.1);
}

.aieng-quiz button.quiz-opt:disabled {
  cursor: default;
  opacity: 0.95;
}

.aieng-quiz .quiz-feedback {
  margin-top: 0.65rem;
  font-size: 0.9rem;
  color: var(--xp-muted);
  min-height: 1.2em;
}

.aieng-quiz .quiz-feedback.ok {
  color: var(--xp-ok);
}

.aieng-quiz .quiz-feedback.bad {
  color: var(--xp-bad);
}

.aieng-quiz .quiz-meta {
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--xp-muted);
}

/* Module complete */
.aieng-complete {
  border-left: 4px solid var(--xp-ok);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.aieng-complete p {
  margin: 0;
  flex: 1 1 200px;
}

.aieng-complete button {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: #fff;
  font: inherit;
}

.aieng-complete button:disabled {
  opacity: 0.65;
  cursor: default;
  background: #64748b;
}

/* Progress dashboard page */
.aieng-dash {
  display: grid;
  gap: 1rem;
}

.aieng-dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.aieng-stat {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 0.85rem;
  background: var(--xp-card, #f8fafc);
}

[data-md-color-scheme="slate"] .aieng-stat {
  background: rgba(30, 41, 59, 0.65);
}

.aieng-stat .k {
  font-size: 0.75rem;
  color: var(--xp-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.aieng-stat .v {
  font-size: 1.45rem;
  font-weight: 800;
  margin-top: 0.2rem;
}

.aieng-module-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.aieng-module-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.aieng-module-list .dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: #94a3b8;
  flex: 0 0 auto;
}

.aieng-module-list .dot.done {
  background: var(--xp-ok);
}

.aieng-module-list .dot.partial {
  background: var(--xp-warn);
}

.aieng-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
}

.aieng-badge-card {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  padding: 0.75rem;
  opacity: 0.45;
  filter: grayscale(0.8);
}

.aieng-badge-card.earned {
  opacity: 1;
  filter: none;
  border-color: var(--xp-border);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.15);
}

.aieng-badge-card .icon {
  font-size: 1.4rem;
}

.aieng-badge-card .name {
  font-weight: 700;
  margin-top: 0.25rem;
}

.aieng-badge-card .desc {
  font-size: 0.8rem;
  color: var(--xp-muted);
}

.aieng-reset {
  margin-top: 1rem;
}

.aieng-reset button {
  border: 1px solid rgba(239, 68, 68, 0.5);
  background: transparent;
  color: var(--xp-bad);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

@media (max-width: 720px) {
  #aieng-hud {
    right: 0.5rem;
    bottom: 0.5rem;
  }
}
