/* ------------------------------------------------------------------ */
/* UQ-ish theme base                                                  */
/* ------------------------------------------------------------------ */

/* Light mode overrides */
[data-md-color-scheme="default"] {
  --md-primary-fg-color: #b39ddb;
  --md-primary-fg-color--light: #f4ecfb;
  --md-primary-fg-color--dark: #341852;
  --md-accent-fg-color: #f2a900;

  --uq-purple: #b39ddb;
  --uq-purple-light: #f4ecfb;
  --uq-purple-lighter: #faf5ff;
  --uq-purple-dark: #341852;
  --uq-gold: #f2a900;
}



/* Dark mode overrides */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #b39ddb;          /* softer purple */
  --md-primary-fg-color--light: #d1c4e9;
  --md-primary-fg-color--dark: #311b92;
  --md-accent-fg-color: #ffca28;

  --uq-purple: #b39ddb;
  --uq-purple-light: #21152f;
  --uq-purple-lighter: #140b20;
  --uq-purple-dark: #e0d7ff;
  --uq-gold: #ffca28;
}


/* Custom background / text colours per scheme */
[data-md-color-scheme="default"] {
  --uq-page-bg: #f7f3ff;   /* light lilac */
  --uq-page-fg: #111827;   /* dark text */
}

[data-md-color-scheme="slate"] {
  --uq-page-bg: #05030a;   /* very dark purple-ish */
  --uq-page-fg: #e5e7eb;   /* light text */
}


/* Make math a little nicer spaced */
mjx-container {
  margin: 0.5em 0;
}


:root {
  --uq-theme-transition: background-color 0.35s ease,
                         color 0.35s ease,
                         border-color 0.35s ease;
}

/* Smooth theme transition for main surfaces */
html[data-md-color-scheme] body {
  background-color: var(--uq-page-bg);
  color: var(--uq-page-fg);
  transition: var(--uq-theme-transition);
}

/* Main content area */
html[data-md-color-scheme] .md-main,
html[data-md-color-scheme] .md-content,
html[data-md-color-scheme] .md-sidebar {
  background-color: var(--uq-page-bg);
  transition: background-color 0.5s ease;
}

/* Header – keep whatever colour you like, but make it animate too */
html[data-md-color-scheme] .md-header {
  background-color: var(--md-primary-fg-color);
  transition: background-color 0.5s ease;
}


/* ------------------------------------------------------------------ */
/* Admonitions                                                        */
/* ------------------------------------------------------------------ */

.md-typeset .admonition {
  border-radius: 8px;
  border-left: 4px solid var(--uq-purple);
  background: var(--uq-purple-light);
}

.md-typeset .admonition > .admonition-title {
  font-weight: 600;
  color: var(--uq-purple-dark);
}

/* Admonition header + icon fully purple */
.md-typeset .admonition,
.md-typeset details {
  border-left: 4px solid var(--uq-purple);
  background: var(--uq-purple-light);
}

.md-typeset .admonition > .admonition-title,
.md-typeset details > summary {
  background: rgba(81, 36, 122, 0.06);
  color: var(--uq-purple-dark);
}

/* Icon color */
.md-typeset .admonition > .admonition-title::before,
.md-typeset details > summary::before {
  color: var(--uq-purple);
}


/* ------------------------------------------------------------------ */
/* Multiple-choice quizzes                                            */
/* ------------------------------------------------------------------ */

.mcq {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid rgba(81, 36, 122, 0.25);
  background: var(--uq-purple-lighter);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Question text */
.mcq > p {
  margin-top: 0;
}

/* Options list */
.mcq ul {
  list-style: none;
  padding-left: 0;
  margin: 0.75rem 0;
}

/* Individual option */
.mcq li[data-option] {
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

/* Hover effect */
.mcq li[data-option]:hover {
  background: rgba(81, 36, 122, 0.06);
}

/* Selected option */
.mcq li.selected,
.mcq li.mcq-selected {
  border-color: var(--uq-purple);
  background: rgba(81, 36, 122, 0.12);
  transform: translateY(-1px);
}

/* Check button */
.mcq .mcq-check {
  margin-top: 0.5rem;
}

/* Feedback text */
.mcq-feedback {
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Feedback states */
.mcq-feedback-correct {
  color: #2e7d32;
}

.mcq-feedback-wrong {
  color: #c62828;
}

.mcq-feedback-warn {
  color: #ff8f00;
}


/* When there's no feedback text, don't show the pill at all */
.mcq-feedback:empty {
  display: none;
  margin-top: 0;
  padding: 0;
}

/* ------------------------------------------------------------------ */
/* Edge demo layout                                                   */
/* ------------------------------------------------------------------ */

#edge-demo,
.edge-demo {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  margin-top: 1rem;
}

.edge-demo .controls {
  min-width: 220px;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: var(--uq-purple-lighter);
  border: 1px solid rgba(81, 36, 122, 0.18);
}

.edge-demo label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 500;
}

/* Slider tweaks */
.edge-demo input[type="range"] {
  width: 100%;
  accent-color: var(--uq-purple);
}

.edge-demo .preview {
  flex: 1;
  min-width: 260px;
}

.edge-demo #edge-image {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid rgba(81, 36, 122, 0.25);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transition: opacity 0.2s ease;
}

/* ------------------------------------------------------------------ */
/* Responsive video wrapper                                           */
/* ------------------------------------------------------------------ */

.lesson-video {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  margin: 1rem 0 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(81, 36, 122, 0.3);
}

.lesson-video iframe,
.lesson-video video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
}

/* ------------------------------------------------------------------ */
/* Python REPL                                                        */
/* ------------------------------------------------------------------ */

.python-repl {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.python-repl .repl-input-area textarea {
  width: 100%;
  min-height: 180px;
  font-family: var(--md-code-font, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
  font-size: 0.9rem;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  border: 1px solid rgba(81, 36, 122, 0.35);
  background: #090b10;
  color: #e5e7eb;
}

/* REPL controls */
.python-repl .repl-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.python-repl #repl-status {
  font-size: 0.9rem;
  opacity: 0.75;
}

/* REPL output layout */
.python-repl .repl-output-area {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}

.python-repl .repl-output-area h3 {
  margin-top: 0;
  margin-bottom: 0.25rem;
  color: var(--uq-purple-dark);
}

/* Output / error panes */
.python-repl .repl-output-area pre {
  background: var(--uq-purple-dark);
  color: #f4f4ff;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  overflow-x: auto;
  border: 1px solid rgba(242, 169, 0, 0.3);
}

/* ------------------------------------------------------------------ */
/* Buttons (used in quizzes, REPL, etc.)                              */
/* ------------------------------------------------------------------ */

.mcq .mcq-check,
#repl-run,
.edge-demo button {
  border: none;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--uq-purple);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(81, 36, 122, 0.35);
  transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.mcq .mcq-check:hover,
#repl-run:hover,
.edge-demo button:hover {
  background: var(--uq-purple-dark);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(81, 36, 122, 0.5);
}

.mcq .mcq-check:active,
#repl-run:active,
.edge-demo button:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(81, 36, 122, 0.25);
}

.circuit-figure {
  /* keep it narrow and centered */
  max-width: 260px;            /* tweak to taste */
  margin: 1.5rem auto;
  text-align: center;
}

.circuit-figure img {
  display: block;
  width: 100%;                 /* fill the small figure width */
  height: auto;
}

/* Figure captions – light mode */
[data-md-color-scheme="default"] .circuit-figure figcaption {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: rgba(0, 0, 0, 0.7);
  font-style: italic;
}

/* Figure captions – dark mode */
[data-md-color-scheme="slate"] .circuit-figure figcaption {
  margin-top: 0.3rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}


/* Circuit figure color handling */

/* Light mode: normal, no filter */
[data-md-color-scheme="default"] .circuit-figure img {
  filter: none;
}

/* Dark mode: invert so black lines become light */
[data-md-color-scheme="slate"] .circuit-figure img {
  filter: invert(0.9) brightness(1.1) contrast(1.05);
}

/* Wider primary sidebar on desktop */
@media screen and (min-width: 76.25em) {
  /* Width of the nav column */
  .md-nav--primary .md-nav__list {
    width: 16rem;
  }

  /* Actual sidebar element (comes in/out from the left) */
  .md-sidebar--primary {
    width: 17rem;
    left: -17rem;
  }
}
/* Base feedback area: always reserved space, even before answering */
.mcq-feedback {
  margin-top: 0.5rem;
  min-height: 1.5rem;
  font-size: 0.85rem;
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: transparent;
  color: inherit;
}

/* Correct answer */
.mcq-feedback--correct {
  background-color: rgba(76, 175, 80, 0.12); /* green-ish */
  color: #2e7d32;
}

/* Incorrect answer */
.mcq-feedback--incorrect {
  background-color: rgba(244, 67, 54, 0.12); /* red-ish */
  color: #c62828;
}

/* Incorrect answer */
.mcq-feedback--warn {
  background-color: rgba(244, 146, 54, 0.12); /* red-ish */
  color: #c6a428;
}

/* Global "Check all answers" button */
#quiz-check-all {
  display: block;
  margin: 1.5rem auto 0;           /* centre it under the quiz */
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--uq-purple);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(81, 36, 122, 0.35);
  transition: background 0.15s ease,
              transform 0.08s ease,
              box-shadow 0.15s ease,
              opacity 0.15s ease;
}

#quiz-check-all:hover:not([disabled]) {
  background: var(--uq-purple-dark);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(81, 36, 122, 0.5);
}

#quiz-check-all:active:not([disabled]) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(81, 36, 122, 0.25);
}

/* Disabled state */
#quiz-check-all[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}


/* ------------------------------------------------------------------ */
/* Inline "Even / Odd / Neither" MCQs                                 */
/* ------------------------------------------------------------------ */

.mcq.mcq-inline ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-left: 0;
  margin: 0.5rem 0;
}

/* Make the options look like compact radio chips */
.mcq.mcq-inline li[data-option] {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0;                 /* remove vertical stacking spacing */
  padding: 0.2rem 0.65rem;
  border-radius: 999px;             /* pill shape */
  font-size: 0.9rem;
}

/* Little circle in front to give 'radio button' vibes */
.mcq.mcq-inline li[data-option]::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  border: 2px solid var(--uq-purple);
  background: transparent;
  flex-shrink: 0;
}

/* Selected state – fill the circle + slightly stronger pill */
.mcq.mcq-inline li.selected::before,
.mcq.mcq-inline li.mcq-selected::before {
  background: var(--uq-purple);
}

.mcq.mcq-inline li.selected,
.mcq.mcq-inline li.mcq-selected {
  background: rgba(81, 36, 122, 0.10);
  border-color: var(--uq-purple);
  transform: none;    /* no jump for these tiny pills */
}
