/* ==========================================================================
   Interactive figures: layout and controls (colours from the IE theme)
   ========================================================================== */
.viz {
  margin: 1.75rem 0;
  padding: 1rem 1.1rem 1.1rem;
  border: 1px solid var(--ie-border);
  border-radius: 12px;
  background: var(--ie-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 36, 0.05), 0 6px 22px rgba(0, 0, 36, 0.06);
  font-family: "Montserrat", Arial, Helvetica, sans-serif;
}

.viz__head {
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.viz__badge {
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  color: var(--ie-on-brand);
  background: var(--ie-brand);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.viz__title {
  color: var(--ie-heading);
  font-size: 1rem;
  font-weight: 700;
}

/* ---- controls ---- */
.viz__controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1.25rem;
  margin-bottom: 0.75rem;
}

.viz__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.viz__slider {
  display: grid;
  grid-template-columns: auto minmax(120px, 190px) 3.6em;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.viz__slider label,
.viz__select label {
  color: var(--ie-text);
  font-weight: 600;
}

.viz__slider input[type="range"] {
  width: 100%;
  accent-color: var(--ie-accent-strong);
  min-height: 24px;
}

.viz__slider.is-disabled {
  opacity: 0.5;
}

.viz__value {
  color: var(--ie-text);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.viz__select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.viz__select select {
  min-height: 32px;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--ie-border);
  border-radius: 6px;
  color: var(--ie-text);
  background: var(--ie-surface);
  font: inherit;
}

.viz__btn {
  min-height: 34px;
  padding: 0.3rem 0.95rem;
  border: 1px solid var(--ie-border);
  border-radius: 999px;
  color: var(--ie-text);
  background: var(--ie-surface);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.viz__btn:hover {
  border-color: var(--ie-accent-strong);
}

.viz__btn--primary {
  border-color: var(--ie-brand);
  color: var(--ie-on-brand);
  background: var(--ie-brand);
}

.viz__btn--primary:hover {
  background: var(--ie-accent-strong);
}

.viz__btn[aria-pressed="true"] {
  border-color: var(--ie-accent-strong);
  box-shadow: inset 0 0 0 1px var(--ie-accent-strong);
}

/* ---- panels ---- */
.viz__panels {
  display: grid;
  /* at most two columns, one on narrow screens */
  grid-template-columns: repeat(auto-fit, minmax(max(260px, calc(50% - 0.45rem)), 1fr));
  gap: 0.9rem;
}

.viz__panel {
  min-width: 0;
  margin: 0;
}

.viz__panel--wide {
  grid-column: 1 / -1;
}

#quarto-document-content .viz .viz__panel-title {
  margin: 0 0 0.3rem;
  color: var(--ie-text-muted);
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.35;
}

.viz__panel canvas {
  display: block;
  width: 100%;
  border-radius: 6px;
  touch-action: none;
}

.viz__panel canvas.is-clickable {
  cursor: crosshair;
}

#quarto-document-content .viz .viz__readout {
  font-family: "Montserrat", Arial, sans-serif;
  line-height: 1.45;
  min-height: 1.4em;
  margin: 0.7rem 0 0;
  color: var(--ie-text);
  font-size: 0.9rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- "Try this" guide (the Markdown written inside the div) ---- */
.viz__guide {
  margin-top: 0.9rem;
  padding: 0.75rem 1rem 0.2rem;
  border-left: 4px solid var(--ie-accent);
  border-radius: 4px 8px 8px 4px;
  background: var(--ie-surface);
}

.viz__guide-title {
  margin: 0 0 0.35rem !important;
  color: var(--ie-heading);
  font-family: "Montserrat", Arial, sans-serif !important;
  font-size: 0.78rem !important;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#quarto-document-content .viz__guide p,
#quarto-document-content .viz__guide li {
  font-size: 0.98rem;
}

@media (max-width: 600px) {
  .viz {
    padding: 0.8rem;
  }
  .viz__slider {
    grid-template-columns: auto 1fr 3.2em;
    width: 100%;
  }
}

/* ---- "Build this in Python" box, placed right after an interactive figure ----
   In a .qmd:
     ::: {.python-next}
     **Build this in Python.** In Lab 1 (Session 4) you … [Page](page.qmd).
     :::
*/
.python-next {
  position: relative;
  margin: -0.5rem 0 1.75rem;
  padding: 0.8rem 1rem 0.8rem 3.6rem;
  border: 1px dashed var(--ie-accent-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--ie-accent) 10%, var(--ie-bg));
}

.python-next::before,
.python-next::after {
  content: "";
  position: absolute;
  left: 1rem;
  top: 0.85rem;
  width: 30px;
  height: 30px;
}

.python-next::before {
  border: 2px solid var(--ie-brand);
  border-radius: 8px;
}

.python-next::after {            /* "</>" glyph in the brand colour */
  background-color: var(--ie-brand);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M12 10l-5 5 5 5M18 10l5 5-5 5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath d='M12 10l-5 5 5 5M18 10l5 5-5 5' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

#quarto-document-content .python-next p {
  margin: 0;
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 0.95rem;
  line-height: 1.5;
}

#quarto-document-content .python-next p + p {
  margin-top: 0.35rem;
}
