/* Keep technique navigation links comfortably targetable on touch screens. */
.technique-links a {
  display: inline-block;
  padding-block: 0.25rem;
}

/* 13) Code tabs & containers */
.tab-group {
  margin-top: 10px;
}

.tabs {
  overflow: hidden;
  background-color: #eaeaea;
  display: inline-flex;
  border-radius: 5px 5px 0 0;
}
.tabs button {
  background-color: inherit;
  padding: 8px 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
  color: #333;
  border: none;
  font-size: 14px;
}
.tabs button:hover,
.tabs button.active {
  background-color: #d4d4d4;
}
.tabs button:focus-visible,
.copy-code-button:focus-visible {
  position: relative;
  z-index: 3;
  outline: 3px solid #7c3aed;
  outline-offset: 2px;
}
.tab-group.scrollable-code-tabs .code-container {
  max-height: 500px;
  overflow: auto;
  position: relative;
}

.tab-group.scrollable-code-tabs .copy-code-button {
  position: sticky;
  top: 6px;
  float: right;
  z-index: 2;
}
.code-container {
  vertical-align: top;         /* so multiple groups line up nicely */
  background-color: #fff;
  border-radius: 0 5px 5px 5px;
  border: 1px solid #ccc;
  overflow-x: auto;
}
.code-container.copyable-code {
  position: relative;
}

.copy-code-button {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  padding: 3px 8px;
  font-size: 0.8em;
  cursor: pointer;
  border: 1px solid #aaa;
  border-radius: 4px;
  background-color: #f2f2f2;
}

.copy-code-button:hover {
  background-color: #e2e2e2;
}

/* Download controls for runnable starter-code exercises. */
.starter-download-panel {
  margin: 1.25em 0;
  padding: 1em;
  border: 1px solid #9fb3c8;
  border-radius: 7px;
  background: #f8fbff;
}

.starter-download-panel > p:first-child {
  margin-top: 0;
}

.starter-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  margin: 0.9em 0;
}

.starter-download {
  display: inline-flex;
  flex: 1 1 125px;
  max-width: 150px;
  min-height: 2.8em;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  padding: 0.65em 1em;
  border: 2px solid #0a3974;
  border-radius: 6px;
  background: #0a3974;
  color: #fff !important;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.starter-download:hover {
  background: #fff;
  color: #0a3974 !important;
}

.starter-download:focus-visible {
  outline: 3px solid #d9822b;
  outline-offset: 2px;
}

.starter-download .file-type {
  font-size: 0.85em;
  font-weight: 400;
  opacity: 0.9;
}

.starter-run-instructions {
  margin-bottom: 0;
}

/* once JS runs, hide all panels by default� */
.js-enabled .code-container {
  display: none;
}
/* �but show only the one with �active� */
.js-enabled .code-container.active {
  display: block;
}

/* 9) Demo container & iframe styling */
.embeddedDemoContainer {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  box-sizing: border-box;
  border: 2px solid #888;       /* ? border around the whole demo block */
  padding: 0px;                 /* ? optional inner spacing */
  border-radius: 4px;           /* ? optional rounding */
  
  
}
.embeddedDemo {
  display: block;      /* so it always fills the full row */
  width: 100%;
  border: none;
}

/* Applied to any UL or OL with class="spaced" */
ul.spaced,
ol.spaced {
  margin: 1em 0;         /* space above & below the list */
  line-height: 1.25;      /* spacing within each item */
}

/* Add a bit of breathing room after each list item */
ul.spaced > li,
ol.spaced > li {
  margin-bottom: 0.5em;
}

pre {
  display: inline-block;
  white-space: pre; /* preserve line breaks and spacing */
}

.code-container.copyable-code pre {
  margin-top: 0;
  margin-bottom: 0;
}

.theorem, .lemma, .corollary {
  border: 2px solid #003366;
  background-color: #f0f8ff;
  padding: 1em;
  margin: 2em 0;
  border-left: 6px solid #003366;
  box-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.theorem::before {
  font-weight: bold;
  display: block;
  margin-bottom: 0.5em;
  color: #003366;
}
.corollary::before {
  font-weight: bold;
  display: block;
  margin-bottom: 0.5em;
  color: #003366;
}
.lemma::before {
  content: "Lemma";
  font-weight: bold;
  display: block;
  margin-bottom: 0.5em;
  color: #003366;
}

.proof {
  border-left: 4px solid #888;
  margin-top: 1em;
  padding-left: 1em;
  font-style: italic;
}

.proof::before {
  content: "Proof: ";
  font-weight: bold;
  font-style: normal;
}

/* 15) Example boxes & tables */
.example-box {
  display: inline-block;
  vertical-align: top;
  border: 1px solid #888;
  background-color: #f0f8ff;
  padding: 10px;
  margin-bottom: 10px;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}
.example-box strong.example-title {
  color: #1967d2;
  font-style: italic;
  display: block;
  margin-bottom: 0.75em;
}
.example-table {
  /*width: 100%;*/
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95rem;
  line-height: 1.4;
  max-width: 100%;
  overflow-x: auto;
}
.example-table th {
  background-color: #f2f2f2;
  font-weight: 600;
  padding: 0.75em;
  text-align: left;
  border-bottom: 2px solid #ddd;
}
.example-table td {
  border-bottom: 1px solid #eee;
  text-align: center;
  padding: 0.25em .5em;
}
.example-table tbody tr:nth-child(even) {
  background-color: #fafafa;
}
.example-table tbody tr:hover {
  background-color: #f5f5f5;
}
.example-table.left-align td {
  text-align: left;
}
.example-table.left-top-align th {
  text-align: center;
  vertical-align: top;
}

.example-table.left-top-align td {
  text-align: left;
  vertical-align: top;
}

/* From latex file translation: */

.latex-translation .box-title {
  margin-top: 0;
}
.definition-box, .remark-box, .exercise-box, .question-box, .evaluate-box,
.problem-box, .solution-block, .proof-block, .student-solution, .translation-box {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
}
.definition-box { border-left: 5px solid #2563eb; background: #eff6ff; }
.remark-box { border-left: 5px solid #64748b; background: #f8fafc; }
.exercise-box, .question-box { border-left: 5px solid #16a34a; background: #f0fdf4; }
.evaluate-box { border-left: 5px solid #d97706; background: #fffbeb; }
.problem-box { border-left: 5px solid #7c3aed; background: #f5f3ff; }
.solution-block, .proof-block { border-left: 5px solid #0f766e; background: #f0fdfa; }
.student-solution { border-left: 5px solid #b45309; background: #fff7ed; }
.latex-answer-toggle { margin: 0.5rem 0; }
.latex-answer {
  margin: 0.5rem 0 1rem 0;
  font-size: inherit;
}

.latex-answer p {
  font-size: inherit;
}

.latex-answer mjx-container {
  font-size: 100% !important;
}
.blank-line { display: inline-block; min-width: 6rem; border-bottom: 1px solid #64748b; }
.translation-footnote { display: inline-block; border-left: 3px solid #94a3b8; padding-left: 0.35rem; color: #475569; font-size: 0.92em; }
.translation-footnotes { margin: 0.5rem 0 1rem; color: #475569; font-size: 0.92rem; }
.translation-footnotes p { margin: 0.25rem 0; }
.translation-caption { display: block; color: #475569; font-size: 0.92rem; margin: 0.25rem 0 0.75rem; }
.placeholder-figure { margin: 1rem 0; }
.placeholder-figure svg { display: block; width: 100%; max-width: 520px; height: auto; border-radius: 6px; }
.placeholder-figure figcaption { color: #475569; font-size: 0.9rem; margin-top: 0.35rem; }
.placeholder-source { color: #64748b; }
.display-math {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

.display-math mjx-container[display="true"] {
  display: block;
  margin: 0.5em 0;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: none;
}

@media (max-width: 400px) {
  .example-table {
    display: block;
    overflow-x: auto;
  }
}

.translation-table-wrapper { overflow-x: auto; margin: 0.75rem 0 1rem; }
.translation-table { border-collapse: collapse; min-width: max-content; background: #ffffff; }
.translation-table th, .translation-table td { border: 1px solid #cbd5e1; padding: 0.05rem 0.55rem; text-align: center; vertical-align: middle; }
.translation-table th { background: #f8fafc; font-weight: 600; }
.translation-table th[scope="row"] { text-align: left; }
.translation-table-figure { margin: 1rem 0; }
.translation-table-figure figcaption { color: #475569; font-size: 0.9rem; margin-top: 0.25rem; }
.translation-table-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1rem; align-items: start; }
ol.student-solution-list > li { margin-bottom: 1rem; }
pre code { white-space: pre; }

