/* Style fixes */
/* ----------- */

/* Avoid having a too large admonition box, because the last child
   adds bottom margin in addition to its mother */
.admonition *:last-child {
    margin-bottom: 0 !important;
}

/* Workaround for sidebar issues, especially together with toggle buttons:
   If we place toggle admonition next to a sidebar, the layout will be messed
   up. By adding this class to the admonition box (if it's an exercise-solution
   pair, the exercise admonition), we enforce vertical space that pushes the
   admonition after the sidebar.
*/
.clear {
    clear: both;
}


/* Styling specific admonitions */
/* ---------------------------- */

/* Unified styling for exercise/hint/solution boxes, using theme colors */
.admonition.dropdown.task,
.admonition.dropdown.exercise,
.admonition.dropdown.xhint,
.admonition.dropdown.solution {
    border-left: 4px solid var(--pst-color-info);
}

.admonition.dropdown.task > summary.admonition-title,
.admonition.dropdown.exercise > summary.admonition-title,
.admonition.dropdown.xhint > summary.admonition-title,
.admonition.dropdown.solution > summary.admonition-title {
    background-color: var(--pst-color-info-bg);
    color: var(--pst-color-info-text);
    font-weight: 600;
}

.key-points .admonition-title {
    background: #f7f0ff;
}

.key-points {
    border-left-color: #9c9ff4;
}

.key-points .admonition-title:before {
    content: "\f0d7";
    width: 15px;
}

.overview p, .overview ul, .overview blockquote {
    margin-bottom: 5px;
}

.overview .admonition-title:before, .overview .sidebar-title:before {
    content: "\f013";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    width: 15px;
}

/* Admonition stacking for QA groups */
/* --------------------------------- */

/* QUESTION: start of the group, no margin below */
.admonition.exercise.stacked,
.admonition.hint.stacked {
  margin-bottom: 0;
  border-radius: 0; /* square when stacked inside a group */
}

/* HINT(S): appear in the middle, no top/bottom margin, square edges */
.admonition.xhint {
  margin-top: 0;
  margin-bottom: 0;
  border-radius: 0;
  border-top: none;   /* merge into previous */
}

/* SOLUTION: bottom of the group, flush to hints/exercise */
.admonition.solution {
  margin-top: 0;
  margin-bottom: 1rem;  /* gap after the whole block */
  border-radius: 0;
  border-top: none;
}

/* Rounded corners:
   - The very first Question gets top rounding
   - The final Solution gets bottom rounding */
.admonition.exercise.stacked:first-of-type,
.admonition.hint.stacked:first-of-type {
  border-top-left-radius: .25rem;
  border-top-right-radius: .25rem;
}
.admonition.solution {
  border-bottom-left-radius: .25rem;
  border-bottom-right-radius: .25rem;
}

/* Prevent double borders if multiple hints/solutions in a row */
.admonition.xhint + .admonition.xhint,
.admonition.xhint + .admonition.solution,
.admonition.solution + .admonition.solution {
  border-top: none;
}

/* Admonition toggle: support BOTH toggle systems
   (old sphinx-togglebutton + newer <details> markup)
*/

/* --- Old sphinx-togglebutton system ---
   Hide everything except the title when .toggle-hidden is active */
.admonition.toggle.toggle-hidden > *:not(.admonition-title) {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* --- New <details> / <summary> system ---
   By default <summary> is visible, collapse body when [open] missing */
.admonition.dropdown:not([open]) > .admonition-body {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* Optional polish: remove bottom margin leakage from last child in closed state */
.admonition.dropdown:not([open]) .admonition-body > *:last-child {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
}

/* Stack consecutive standard hints */
/* -------------------------------- */

/* When one stacked hint follows another, merge seamlessly */
.admonition.hint.stacked + .admonition.hint.stacked {
  margin-top: 0;        /* no extra space between them */
  border-top: none;     /* remove double border */
}

/* Rounded corners:
   - First stacked hint gets rounded top corners
   - Last stacked hint gets rounded bottom corners */
.admonition.hint.stacked:last-of-type {
  border-bottom-left-radius: .25rem;
  border-bottom-right-radius: .25rem;
}

/* Textbox that looks like the ROOT TEve GUI */
/* ----------------------------------------- */

.gui-highlight-style {
    color: black;
    background-color: #e7e7e7; /* Grey */
    border: none;
    padding: 1px 2px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.var-source-link {
    float: right;
    font-size: 0.9em;
    margin-left: 1em;
}
