/* mdbook-components — unified presentation stylesheet.
   Load after mdbook-components-devicon.css via [output.html] additional-css.
   No legacy workbook-component cards; code rendering is independent. */
:root {
  --wc-radius: 12px;
  --wc-code-radius: 9px;
  --wc-code-border-intensity: 18%;
  --wc-code-font-size: 1em;
  --wc-code-line-height: 1.6;
  --wc-code-bg: color-mix(in srgb, var(--fg) 4%, var(--bg));
  --wc-code-border: color-mix(in srgb, var(--fg) var(--wc-code-border-intensity), var(--bg));
}

/* Shared inline code colour (not a legacy card). */
:not(pre) > code:not(.ec-code) {
  color: var(--inline-code-color, var(--fg));
}

/* ==========================================================
   Steps — neutral marker, centred connectors, content-height tail
   ========================================================== */
.workbook-steps {
  --step-marker-size: 2.5rem;
  --step-marker-gap: 1rem;
  --step-line-width: 2px;
  --step-line-gap: .175rem;
  --step-tail-min: .75rem;
  --step-item-spacing: 1rem;
  --step-marker-bg: color-mix(in srgb, var(--fg) 9%, var(--bg));
  --step-marker-border: color-mix(in srgb, var(--fg) 30%, var(--bg));
  --step-marker-text: var(--fg);
  margin: 1.5rem 0;
  color: var(--fg);
}
.workbook-steps > ol {
  list-style: none;
  counter-reset: workbook-step var(--step-counter-start, 0);
  margin: 0;
  padding: 0;
}
.workbook-steps > ol > li {
  counter-increment: workbook-step;
  position: relative;
  box-sizing: border-box;
  min-height: calc(var(--step-marker-size) + var(--step-tail-min));
  margin: 0;
  padding: 0 0 var(--step-item-spacing) calc(var(--step-marker-size) + var(--step-marker-gap));
  border: 0;
}
.workbook-steps > ol > li::before {
  content: counter(workbook-step);
  position: absolute;
  top: 0;
  inset-inline-start: 0;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: var(--step-marker-size);
  height: var(--step-marker-size);
  margin: 0;
  padding: 0;
  border: 1px solid var(--step-marker-border);
  border-radius: 50%;
  background: var(--step-marker-bg);
  color: var(--step-marker-text);
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.workbook-steps > ol > li::after {
  content: "";
  position: absolute;
  top: calc(var(--step-marker-size) + var(--step-line-gap));
  bottom: var(--step-line-gap);
  inset-inline-start: calc((var(--step-marker-size) - var(--step-line-width)) / 2);
  width: var(--step-line-width);
  background: var(--step-marker-border);
  pointer-events: none;
}
.workbook-steps > ol > li:last-child {
  padding-bottom: max(var(--step-item-spacing), var(--step-tail-min));
}
.workbook-steps > ol > li:last-child::after {
  bottom: 0;
  min-height: var(--step-tail-min);
}
.workbook-steps > ol > li > :first-child { margin-top: 0; }
.workbook-steps > ol > li > :is(h2,h3,h4,h5,h6):first-child {
  padding-top: .2rem;
  line-height: 1.45;
}
.workbook-steps > ol > li > :last-child { margin-bottom: 0; }

/* Nested ordered lists are substeps, not new top-level steps.
   The parent counter retains `start=` and `continue` numbering. */
.workbook-steps > ol > li {
  counter-reset: workbook-substep;
}
.workbook-steps > ol > li > ol {
  list-style: none;
  margin: .65rem 0 .4rem;
  padding: 0;
}
.workbook-steps > ol > li > ol > li {
  counter-increment: workbook-substep;
  position: relative;
  list-style: none;
  margin: 0 0 .65rem;
  padding: 0 0 0 4.5rem;
  border: 0;
  min-height: 1.8rem;
}
.workbook-steps > ol > li > ol > li::before {
  content: counter(workbook-step) "." counter(workbook-substep);
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 2.8rem;
  padding: .2rem .4rem;
  border: 1px solid var(--step-marker-border);
  border-radius: .45rem;
  background: var(--step-marker-bg);
  color: var(--step-marker-text);
  font-size: .9em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}
.workbook-steps > ol > li > ol > li::after { content: none; }
.workbook-steps > ol > li > ol > li > :first-child { margin-top: 0; }
.workbook-steps > ol > li > ol > li > :last-child { margin-bottom: 0; }

/* ==========================================================
   File Tree — compact hierarchy with code-block background
   Uses the DOM generated by theme/js/mdbook-components.js.
   ========================================================== */
.workbook-filetree {
  --ft-icon-size: 1.125em;
  --ft-chevron-slot: .85em;
  --ft-chevron-size: .65em;
  --ft-label-gap: .4em;
  --ft-row-height: 1.7em;
  --ft-indent: 1.85em;
  --ft-guide-width: 1px;
  --ft-guide-color: color-mix(in srgb, var(--fg) 20%, transparent);
  /* Icon centre measured from the beginning of the folder row. */
  --ft-guide-position: calc(var(--ft-chevron-slot) + var(--ft-label-gap) + var(--ft-icon-size) / 2);
  margin: 1.5rem 0;
  padding: .85rem 1rem;
  box-sizing: border-box;
  border: 1px solid var(--wc-code-border, var(--table-border-color));
  border-radius: var(--wc-code-radius, 9px);
  background: var(--wc-code-bg, var(--code-bg, var(--bg)));
  color: var(--fg);
  font-family: var(--mono-font, ui-monospace, monospace);
  font-size: .92em;
  line-height: 1.5;
  overflow-x: auto;
}
.workbook-filetree ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.workbook-filetree li {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.workbook-filetree li::before,
.workbook-filetree li::after { content: none; }
.workbook-filetree li > p {
  display: flex;
  align-items: center;
  gap: var(--ft-label-gap);
  min-height: var(--ft-row-height);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: var(--ft-row-height);
  white-space: nowrap;
}
.workbook-filetree li > ul {
  /* Guide follows the centre of the folder icon, not the UL's left edge. */
  margin-inline-start: var(--ft-guide-position);
  padding-inline-start: max(0px, calc(var(--ft-indent) - var(--ft-guide-position)));
  border-inline-start: var(--ft-guide-width) solid var(--ft-guide-color);
}
.workbook-filetree ul[hidden] { display: none !important; }
.workbook-filetree li strong { color: inherit; font-weight: 650; }
.workbook-filetree li a { color: inherit; }

/* Folder labels are plain text, never buttons with an mdBook/theme pill. */
.workbook-filetree .workbook-filetree__toggle {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  gap: var(--ft-label-gap);
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline-offset: 2px;
  background: transparent;
  background-image: none;
  box-shadow: none;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  text-align: start;
  text-decoration: none;
  text-transform: none;
  cursor: pointer;
}
.workbook-filetree .workbook-filetree__toggle:hover,
.workbook-filetree .workbook-filetree__toggle:active,
.workbook-filetree .workbook-filetree__toggle:focus:not(:focus-visible) {
  background: transparent;
  background-image: none;
  border: 0;
  box-shadow: none;
  color: inherit;
}
.workbook-filetree .workbook-filetree__toggle:focus-visible {
  outline: 2px solid var(--links, currentColor);
}
.workbook-filetree__chevron,
.workbook-filetree__spacer {
  display: inline-grid;
  place-items: center;
  flex: 0 0 var(--ft-chevron-slot);
  width: var(--ft-chevron-slot);
  height: var(--ft-icon-size);
  color: inherit;
}
.workbook-filetree__chevron::before {
  content: '';
  display: block;
  width: var(--ft-chevron-size);
  height: var(--ft-chevron-size);
  background: currentColor;
  opacity: .65;
  clip-path: polygon(17% 8%, 88% 50%, 17% 92%);
  transform: rotate(90deg);
  transition: transform 140ms ease;
}
.workbook-filetree__toggle[aria-expanded="false"] .workbook-filetree__chevron::before {
  transform: rotate(0);
}
.workbook-filetree__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 var(--ft-icon-size);
  width: var(--ft-icon-size);
  height: var(--ft-icon-size);
  margin: 0;
  padding: 0;
  color: var(--fg);
  opacity: .85;
  vertical-align: middle;
}
.workbook-filetree__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

/* No file icons => no icon slot, no empty-file chevron slot, no margin.
   Folder chevrons remain usable for expanding/collapsing folders. */
.workbook-filetree[data-icon-set="none"] {
  --ft-guide-position: calc(var(--ft-chevron-slot) / 2);
  --ft-indent: 1.2em;
}
.workbook-filetree[data-icon-set="none"] .workbook-filetree__icon,
.workbook-filetree[data-icon-set="none"] .workbook-filetree__spacer {
  display: none;
  flex: none;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
}
.workbook-filetree[data-icon-set="none"] li > p,
.workbook-filetree[data-icon-set="none"] .workbook-filetree__toggle {
  gap: 0;
}

/* ==========================================================
   Tabs — keyboard-focusable, progressively enhanced
   ========================================================== */
.workbook-tabs {
  --tab-icon-size: 1.5em;
  margin: 1.5rem 0;
  min-width: 0;
  color: var(--fg);
}

.workbook-tab-list {
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--table-border-color, currentColor);
  scrollbar-width: thin;
}

.workbook-tab {
  display: inline-flex;
  flex: 0 0 auto;
  justify-content: center;
  align-items: center;
  gap: .45rem;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: .7rem .95rem;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: 1.35;
  opacity: .77;
  cursor: pointer;
}

.workbook-tab:hover {
  opacity: 1;
  background: var(--quote-bg, transparent);
}

.workbook-tab[aria-selected="true"] {
  color: var(--links);
  border-bottom-color: var(--links);
  opacity: 1;
}

.workbook-tab:focus-visible {
  outline: 2px solid var(--links);
  outline-offset: -3px;
}

/* Generic SVG icon sizing; font glyphs are styled separately. */
.workbook-tab .workbook-tab-icon {
  display: inline-block;
  box-sizing: border-box;
  width: var(--tab-icon-size);
  height: var(--tab-icon-size);
  flex: 0 0 var(--tab-icon-size);
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  vertical-align: middle;
}

/* Optional icon wrappers used by some tab renderers. */
.workbook-tab__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tab-icon-size);
  height: var(--tab-icon-size);
  flex: 0 0 var(--tab-icon-size);
}

.workbook-tab__icon > svg,
.workbook-tab__icon > .mdc-brand-icon {
  display: block;
  width: 100%;
  height: 100%;
}

.workbook-tab-panel {
  padding: 1rem .25rem .25rem;
  min-width: 0;
}
.workbook-tab-panel[hidden] { display: none !important; }
.workbook-tab-panel > :first-child { margin-top: 0; }
.workbook-tab-panel > :last-child { margin-bottom: 0; }
.workbook-tab-panel pre { max-width: 100%; overflow-x: auto; }

.highcontrast .workbook-tab-list { border-bottom-color: currentColor; }
.highcontrast .workbook-tab[aria-selected="true"] { border-bottom-width: 3px; }

/* Without JavaScript, show every panel with its label. */
.workbook-tabs:not([data-tabs-ready="true"]) > .workbook-tab-panel::before {
  content: attr(data-label);
  display: block;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--links);
}

/* ==========================================================
   Asides — no legacy card; body tint is half the border tint
   ========================================================== */
.mdc-aside {
  --aside-accent: #4c9af1;
  --aside-border-intensity: 28%;
  --aside-body-intensity: 14%;
  box-sizing: border-box;
  margin: 1.25rem 0;
  padding: .85rem 1.15rem;
  border: 0;
  border-inline-start: 4px solid color-mix(in srgb, var(--aside-accent) var(--aside-border-intensity), var(--bg));
  border-radius: .35rem;
  background: color-mix(in srgb, var(--aside-accent) var(--aside-body-intensity), var(--bg));
  color: var(--fg);
  box-shadow: none;
}
.mdc-aside--note { --aside-accent: #458bc9; }
.mdc-aside--important { --aside-accent: #a47ad5; }
.mdc-aside--example { --aside-accent: #8063c8; }
.mdc-aside--tip { --aside-accent: #45a789; }
.mdc-aside--caution { --aside-accent: #e99828; }
.mdc-aside--success { --aside-accent: #299c61; }
.mdc-aside--explanation { --aside-accent: #32a5b6; }
.mdc-aside--bug { --aside-accent: #e86969; }
.mdc-aside--danger { --aside-accent: #e86969; }
.mdc-aside--goal { --aside-accent: #c19225;}
.mdc-aside--lo { --aside-accent: #bc8155; }
.mdc-aside--checklist { --aside-accent: #e5622a; }
.mdc-aside__title {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin: 0 0 .45rem;
  padding: 0;
  color: var(--aside-accent);
  font-weight: 700;
  font-size: 1em;
  line-height: 1.35;
}
.mdc-aside__icon {
  display: inline-flex;
  flex: 0 0 1.2em;
  width: 1.2em;
  height: 1.2em;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.mdc-aside__icon > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
.mdc-aside__label { min-width: 0; }
.mdc-aside > summary.mdc-aside__title {
  cursor: pointer;
  list-style: none;
}
.mdc-aside > summary.mdc-aside__title::-webkit-details-marker { display: none; }
.mdc-aside > summary.mdc-aside__title::after {
  content: "";
  width: .48rem;
  height: .48rem;
  margin-inline-start: auto;
  border-inline-end: 1.5px solid currentColor;
  border-block-end: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.mdc-aside[open] > summary.mdc-aside__title::after { transform: rotate(225deg); }
.mdc-aside__body { margin: 0; padding: 0; }
.mdc-aside__body > :first-child { margin-top: 0; }
.mdc-aside__body > :last-child { margin-bottom: 0; }
.mdc-aside > summary.mdc-aside__title:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Accessibility and responsive adjustments. */
@media (prefers-contrast: more) {
  .workbook-steps {
    --step-marker-bg: var(--bg);
    --step-marker-border: var(--fg);
    --step-line-width: 2px;
  }
  .workbook-filetree { border-width: 2px; }
  .mdc-aside { --aside-border-intensity: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .workbook-tab { scroll-behavior: auto; }
  .mdc-aside > summary.mdc-aside__title::after { transition: none; }
}

/* ==========================================================
   Workbook introduction — hero, tags and feature cards
   Included in mdbook-components' shared stylesheet.
   ========================================================== */

.workbook-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 2rem;
  box-sizing: border-box;
  min-width: 0;
  padding: 2rem;
  margin: 1rem 0 2rem;
  border: 1px solid color-mix(in srgb, var(--table-border-color) 65%, var(--bg));
  border-radius: var(--wc-radius, 12px);
  background: var(--table-alternate-bg, var(--quote-bg, var(--bg)));
}

/* Two independent content regions; widths are validated in Rust. */
.workbook-hero--columns .workbook-hero__columns {
  display: grid;
  grid-template-columns: minmax(0, var(--hero-primary, 1fr)) minmax(0, var(--hero-secondary, 1fr));
  align-items: center;
  gap: 1.5rem;
}

.workbook-hero__column {
  min-width: 0;
}

.workbook-hero__column > :first-child { margin-top: 0; }
.workbook-hero__column > :last-child { margin-bottom: 0; }

@media (max-width: 700px) {
  .workbook-hero--columns .workbook-hero__columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

.workbook-hero-content,
.workbook-hero .intro {
  min-width: 0;
}

.workbook-eyebrow {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--links);
}

.workbook-eyebrow i { margin-right: 0.35em; }

.workbook-hero h2 {
  margin: 0.75rem 0 1rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.2;
}

.workbook-hero p { max-width: 65ch; }
.workbook-hero .intro > :first-child { margin-top: 0; }
.workbook-hero .intro > :last-child { margin-bottom: 0; }

.workbook-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.workbook-tags span {
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--table-border-color);
  border-radius: 999px;
  font-size: 0.8rem;
  line-height: 1.4;
}

/* Optional separate access layout for workbook pages. */
.workbook-access {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.workbook-access-info {
  box-sizing: border-box;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid var(--table-border-color);
  border-radius: var(--wc-radius, 12px);
}

.workbook-access-info h3 { margin-top: 0; }

.workbook-button {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  margin-top: 1rem;
  border-radius: 7px;
  background: var(--links);
  color: var(--bg) !important;
  text-decoration: none !important;
  font-weight: 600;
}

.workbook-button:hover { filter: brightness(1.12); }
.workbook-button:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.workbook-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.workbook-features > div {
  box-sizing: border-box;
  min-width: 0;
  padding: 1.25rem;
  border: 1px solid var(--table-border-color);
  border-radius: 10px;
  background: color-mix(in srgb, var(--quote-bg, var(--bg)) 35%, var(--bg));
}

.workbook-features i {
  display: block;
  margin-bottom: 0.8rem;
  font-size: 1.3rem;
  color: var(--links);
}

.workbook-features strong { display: block; margin-bottom: 0.4rem; }
.workbook-features p:last-child { margin-bottom: 0; }

@media (max-width: 650px) {
  .workbook-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.25rem;
  }
  .workbook-access,
  .workbook-features { grid-template-columns: minmax(0, 1fr); }
}

/* Independent hero and feature icons (no legacy component-card dependency). */
.workbook-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}
.workbook-eyebrow > .workbook-hero__icon {
  width: 1.2rem;
  height: 1.2rem;
  flex-basis: 1.2rem;
}
.workbook-features .workbook-feature > .workbook-component__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 1.6rem;
  height: 1.6rem;
  flex: 0 0 1.6rem;
  margin-bottom: .65rem;
  color: var(--links);
  opacity: 1;
}
.workbook-features .workbook-feature > .workbook-component__icon > svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}
.workbook-feature__body > :first-child { margin-top: 0; }
.workbook-feature__body > :last-child { margin-bottom: 0; }


/* Expressive Code source-line renderer (numbering optional).
 * One line = one row. The gutter is part of that row, not a separate column.
 */
pre.ec-pre {
  --ec-line-height: var(--wc-code-line-height, 1.6);
  --ec-gutter-width: 3.4em;
  box-sizing: border-box;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  margin: .9rem 0;
  padding: 0;
  border: 1px solid var(--wc-code-border, var(--table-border-color));
  border-radius: var(--wc-code-radius, 9px);
  background: var(--wc-code-bg, var(--code-bg, var(--bg)));
  font-family: var(--mono-font, monospace);
  font-size: var(--wc-code-font-size, 1em);
  line-height: var(--ec-line-height);
}

pre.ec-pre > code.ec-code,
pre.ec-pre > code.ec-code.hljs {
  box-sizing: border-box;
  display: block;
  width: max-content;
  min-width: 100%;
  padding: .75rem 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  line-height: inherit;
  white-space: pre;
}

/* Preserve source newlines for DOM-based consumers without adding rows. */
pre.ec-pre .ec-line-separator { display: none !important; }

pre.ec-pre .ec-line {
  display: flex;
  align-items: stretch;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--ec-line-height);
  margin: 0;
  padding: 0;
  line-height: inherit;
  white-space: pre;
}

pre.ec-pre .ec-line::before {
  content: none;
}

pre.ec-pre .ec-numbered .ec-line::before {
  content: attr(data-line-number);
  display: block;
  box-sizing: border-box;
  flex: 0 0 var(--ec-gutter-width);
  width: var(--ec-gutter-width);
  padding: 0 .75em 0 .25em;
  border-right: 1px solid var(--wc-code-border, var(--table-border-color));
  /* mdBook/highlight.js themes may set --fg differently from code text. */
  color: var(--wc-code-gutter-fg, var(--theme-hover, var(--fg)));
  opacity: .75;
  -webkit-text-fill-color: currentColor;
  text-align: right;
  font: inherit;
  line-height: inherit;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

pre.ec-pre .ec-source {
  display: block;
  flex: 1 0 auto;
  min-width: 0;
  padding: 0 1rem;
  box-sizing: border-box;
  line-height: inherit;
  white-space: pre;
}


/* Opt-in visual wrapping. Each .ec-line is still one logical source line,
   so wrapped continuations receive no duplicate gutter number. */
pre.ec-pre.ec-wrap {
  overflow-x: auto; /* retain a fallback for non-wrappable embedded content */
}
pre.ec-pre.ec-wrap > code.ec-code,
pre.ec-pre.ec-wrap > code.ec-code.hljs {
  width: 100%;
  min-width: 0;
  white-space: pre-wrap;
}
pre.ec-pre.ec-wrap .ec-line {
  white-space: pre-wrap;
}
pre.ec-pre.ec-wrap .ec-source {
  flex: 1 1 0%;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre.ec-pre .ec-line.ec-highlight {
  background: color-mix(in srgb, var(--sidebar-fg, var(--fg)) 16%, transparent);
}

pre.ec-pre details.ec-collapse {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

pre.ec-pre details.ec-collapse > summary.ec-collapse-summary {
  display: list-item;
  box-sizing: border-box;
  padding: .25em 1rem;
  margin: 0;
  cursor: pointer;
  color: var(--links, var(--fg));
  font: inherit;
  line-height: inherit;
  white-space: normal;
  background: color-mix(in srgb, var(--fg) 6%, transparent);
}

pre.ec-pre .ec-collapse-content {
  display: block;
  width: 100%;
  box-sizing: border-box;
}

pre.ec-pre details.ec-collapse:not([open]) .ec-collapse-content {
  display: none;
}

pre.ec-pre details.ec-collapse summary:focus-visible {
  outline: 2px solid var(--links, var(--fg));
  outline-offset: -2px;
}

@media (prefers-contrast: more) {
  pre.ec-pre .ec-line.ec-highlight {
    outline: 1px solid currentColor;
    outline-offset: -1px;
  }
}

/* End mode keeps the disclosure at the bottom when expanded. */
pre.ec-pre details.ec-collapse[data-mode="end"][open] {
  display: flex;
  flex-direction: column;
}
pre.ec-pre details.ec-collapse[data-mode="end"][open] > summary {
  order: 2;
}
pre.ec-pre details.ec-collapse[data-mode="end"][open] > .ec-collapse-content {
  order: 1;
}

/* Hide complete Rust Playground setup rows, not only .boring source spans.
   When mdBook toggles hide-boring off, these lines become visible again. */
pre.ec-pre > code.ec-code.hide-boring > span.ec-line.ec-playground-hidden {
    display: none !important;
}
/* ==========================================================
   Devicon font — foreground-only icons, independent component sizes
   Glyph CSS is loaded separately via mdbook-components-devicon.css.
   ========================================================== */
.mdc-devicon {
  display: inline-block;
  color: currentColor;
  line-height: 1;
  font-weight: normal;
  font-style: normal;
  vertical-align: middle;
  flex-shrink: 0;
}
.workbook-tab .mdc-devicon {
  font-size: var(--tab-icon-size, 1.5em);
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
  text-align: center;
}
.workbook-filetree__icon .mdc-devicon {
  font-size: var(--ft-icon-size, 1.125em);
  width: 1em;
  height: 1em;
  text-align: center;
}
/* Devicon font glyphs and generic icons inherit the active mdBook text colour. */


/* ==========================================================
   Tables — native Markdown/HTML tables, styled with mdBook tokens.
   JS adds only an overflow wrapper; table semantics stay unchanged.
   ========================================================== */
.content main .mdc-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin-block: 1.5rem;
  border: 1px solid var(--table-border-color, var(--wc-code-border));
  border-radius: .55rem;
  background: var(--bg);
  scrollbar-width: thin;
}
.content main .mdc-table-scroll:focus-visible {
  outline: 2px solid var(--links, var(--fg));
  outline-offset: 2px;
}
.content main .mdc-table-scroll > table {
  width: 100%;
  margin: 0;
  border: 0;
  border-collapse: separate;
  border-spacing: 0;
  line-height: 1.5;
  font-size: .95em;
}
.content main .mdc-table-scroll > table caption {
  caption-side: bottom;
  padding: .55rem .85rem;
  color: var(--fg);
  font-size: .875em;
  text-align: start;
}
.content main .mdc-table-scroll > table :is(th, td) {
  padding: .7rem .9rem;
  border: 0;
  border-block-end: 1px solid var(--table-border-color, var(--wc-code-border));
  vertical-align: middle;
  /* Do not override text-align: mdBook Markdown alignment uses inline styles. */
}
.content main .mdc-table-scroll > table thead th {
  font-weight: 600;
  background: var(--table-header-bg, var(--quote-bg, var(--bg)));
}
.content main .mdc-table-scroll > table tbody tr:nth-child(even) {
  background: var(--table-alternate-bg, var(--bg));
}
.content main .mdc-table-scroll > table tbody tr:hover {
  background: color-mix(in srgb, var(--fg) 5%, var(--bg));
}
.content main .mdc-table-scroll > table tr:last-child > :is(td, th) {
  border-block-end: 0;
}
.content main .mdc-table-scroll > table :is(th, td) > :first-child { margin-block-start: 0; }
.content main .mdc-table-scroll > table :is(th, td) > :last-child { margin-block-end: 0; }
@media (prefers-contrast: more) {
  .content main .mdc-table-scroll { border-color: var(--fg); }
  .content main .mdc-table-scroll > table caption {
  caption-side: bottom;
  padding: .55rem .85rem;
  color: var(--fg);
  font-size: .875em;
  text-align: start;
}
.content main .mdc-table-scroll > table :is(th, td) { border-block-end-color: var(--fg); }
}

/* ==========================================================
   Global chapter header and footer
   Controlled by [preprocessor.components.header/footer].
   ========================================================== */
.workbook-header,
.workbook-footer {
  box-sizing: border-box;
  margin-block: 1.25rem;
  padding-block: .75rem;
  color: var(--fg);
  font-family: inherit;
  font-size: .875em;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-align: center;
}
/* Keep paragraph wrappers introduced by Markdown unobtrusive. */
.workbook-header > p,
.workbook-footer > p {
  margin: 0;
}
.workbook-header > p + p,
.workbook-footer > p + p {
  margin-block-start: .5rem;
}
.workbook-header a,
.workbook-footer a {
  color: var(--links);
}
.workbook-header { margin-block-start: 0; }
.workbook-footer { margin-block-end: 0; }
.workbook-header[data-align="left"],
.workbook-footer[data-align="left"] { text-align: left; }
.workbook-header[data-align="right"],
.workbook-footer[data-align="right"] { text-align: right; }
.workbook-header.workbook-chrome--separator {
  border-block-end: 1px solid var(--table-border-color, color-mix(in srgb, var(--fg) 20%, transparent));
}
.workbook-footer.workbook-chrome--separator {
  border-block-start: 1px solid var(--table-border-color, color-mix(in srgb, var(--fg) 20%, transparent));
}


/* Feature card arrangements. Layout is selected on the parent ::: features.
 * grid (default): two-column cards with icon above the heading;
 * horizontal: full-width rows with the icon beside the text;
 * vertical: full-width stacked cards with icon above the heading.
 * All three layouts use mdBook's own colours. */
.workbook-features--horizontal,
.workbook-features--vertical {
  grid-template-columns: minmax(0, 1fr);
}

.workbook-features--horizontal > .workbook-feature {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  column-gap: 1rem;
  align-content: center;
}

.workbook-features--horizontal > .workbook-feature > .workbook-component__icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0;
  align-self: start;
}

.workbook-features--horizontal > .workbook-feature > strong,
.workbook-features--horizontal > .workbook-feature > .workbook-feature__body {
  grid-column: 2;
  min-width: 0;
}

/* When a card has no icon, its heading and body use the full width. */
.workbook-features--horizontal > .workbook-feature:not(:has(> .workbook-component__icon)) {
  grid-template-columns: minmax(0, 1fr);
}
.workbook-features--horizontal > .workbook-feature:not(:has(> .workbook-component__icon)) > strong,
.workbook-features--horizontal > .workbook-feature:not(:has(> .workbook-component__icon)) > .workbook-feature__body {
  grid-column: 1;
}

/* Narrow screens: horizontal cards keep their icon left but reduce spacing. */
@media (max-width: 650px) {
  .workbook-features--horizontal > .workbook-feature { column-gap: .75rem; }
}

/* Mixed feature card layouts: card attributes override parent defaults.
 * width=full spans both grid columns; width=half occupies one.
 * An explicitly horizontal card is full-width unless width=half is set. */
.workbook-features > .workbook-feature--full,
.workbook-features--grid > .workbook-feature--horizontal:not(.workbook-feature--half) {
  grid-column: 1 / -1;
}
.workbook-features--grid > .workbook-feature--half {
  grid-column: span 1;
}

.workbook-features > .workbook-feature.workbook-feature--horizontal {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  column-gap: 1rem;
  align-content: center;
}
.workbook-features > .workbook-feature.workbook-feature--horizontal > .workbook-component__icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0;
  align-self: start;
}
.workbook-features > .workbook-feature.workbook-feature--horizontal > strong,
.workbook-features > .workbook-feature.workbook-feature--horizontal > .workbook-feature__body {
  grid-column: 2;
  min-width: 0;
}
.workbook-features > .workbook-feature.workbook-feature--horizontal:not(:has(> .workbook-component__icon)) {
  grid-template-columns: minmax(0, 1fr);
}
.workbook-features > .workbook-feature.workbook-feature--horizontal:not(:has(> .workbook-component__icon)) > strong,
.workbook-features > .workbook-feature.workbook-feature--horizontal:not(:has(> .workbook-component__icon)) > .workbook-feature__body {
  grid-column: 1;
}

/* Override a horizontal parent for explicitly vertical individual cards. */
.workbook-features > .workbook-feature.workbook-feature--vertical {
  display: block;
}
.workbook-features > .workbook-feature.workbook-feature--vertical > .workbook-component__icon,
.workbook-features > .workbook-feature.workbook-feature--vertical > strong,
.workbook-features > .workbook-feature.workbook-feature--vertical > .workbook-feature__body {
  grid-column: auto;
  grid-row: auto;
}
.workbook-features > .workbook-feature.workbook-feature--vertical > .workbook-component__icon {
  margin-bottom: .65rem;
}

@media (max-width: 650px) {
  .workbook-features > .workbook-feature--half { grid-column: 1 / -1; }
}

/* Feature card height is a grid-row span, independent of width and icon layout.
 * Natural-height cards remain unchanged when no height is specified.
 * height=full spans two implicit rows, height=half spans one row. */
.workbook-features:has(> .workbook-feature--height-full) {
  grid-auto-rows: minmax(5rem, auto);
}
.workbook-features > .workbook-feature--height-full {
  grid-row: span 2;
}
.workbook-features > .workbook-feature--height-half {
  grid-row: span 1;
}

/* Single-column displays should not reserve extra empty height. */
@media (max-width: 650px) {
  .workbook-features:has(> .workbook-feature--height-full) {
    grid-auto-rows: auto;
  }
  .workbook-features > .workbook-feature--height-full,
  .workbook-features > .workbook-feature--height-half {
    grid-row: auto;
  }
}

/* Hero eyebrow icon uses the shared SVG wrapper. */
.workbook-eyebrow > .workbook-component__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 1.2rem;
}
.workbook-eyebrow > .workbook-component__icon > svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* A single-column hero should occupy the complete content width. */
.workbook-hero:not(.workbook-hero--columns) > .workbook-hero-content {
  width: 100%; max-width: none; grid-column: 1 / -1;
}
.workbook-hero:not(.workbook-hero--columns) .intro,
.workbook-hero:not(.workbook-hero--columns) p { max-width: none; }

/* Theme-aware code gutters. Both the Expressive Code renderer and the older
   highlightjs-line-numbers markup must follow mdBook's active theme.

   Resolve --fg/--bg on the PRE itself rather than hard-coding light/dark colours:
   this also works for pages with nested steps/tabs and for theme changes made
   after page load. A book may have older highlightjs line-number markup while
   another chapter has the newer .ec-line renderer. */
pre.ec-pre,
pre:has(.hljs-ln-numbers) {
  --wc-code-gutter-fg: color-mix(in srgb, var(--fg) 70%, var(--bg));
}

/* Current code renderer (numbers are ::before pseudo-elements). */
pre.ec-pre code.ec-numbered .ec-line::before {
  color: var(--wc-code-gutter-fg, var(--fg)) !important;
  -webkit-text-fill-color: var(--wc-code-gutter-fg, var(--fg)) !important;
}

/* Legacy highlightjs-line-numbers plugin (numbers are real table cells). */
pre .hljs-ln-numbers,
pre .hljs-ln-numbers .hljs-ln-n {
  color: var(--wc-code-gutter-fg, color-mix(in srgb, var(--fg) 70%, var(--bg))) !important;
  -webkit-text-fill-color: var(--wc-code-gutter-fg, color-mix(in srgb, var(--fg) 70%, var(--bg))) !important;
}

/* Image component: dimensions are validated by the Rust renderer. */
.mdc-image { display: block; box-sizing: border-box; width: var(--mdc-image-width, fit-content); margin: 1.25rem auto; max-width: 100%; }
.mdc-image--left { margin-inline: 0 auto; }
.mdc-image--center { margin-inline: auto; }
.mdc-image--right { margin-inline: auto 0; }
.mdc-image img { display: block; width: 100%; max-width: 100%; height: var(--mdc-image-height, auto); object-fit: contain; }
.mdc-image figcaption { font-size: .9em; color: var(--fg); opacity: .85; margin-top: .5rem; text-align: center; }

/* Opt-in column-major feature layout. Two rows per column: two half-height
 * features stack in the first column, and one full-height feature occupies
 * the second. The original grid layout and width/height modifiers remain
 * unchanged for all existing books. */
@media (min-width: 651px) {
  .workbook-features--columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, auto));
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }
  .workbook-features--columns > .workbook-feature--height-full {
    grid-row: span 2;
  }
  .workbook-features--columns > .workbook-feature--height-half {
    grid-row: span 1;
  }
}
@media (max-width: 650px) {
  .workbook-features--columns { grid-auto-flow: row; grid-template-rows: none; }
}
