/* Patch for legacy use of Pre on mobile with preview build of Docsify v5 theme */
.markdown-section pre {
  margin-top: 1rem;
  overflow: auto;
}
.markdown-section pre {
  white-space: pre-wrap !important;
  overflow-wrap: break-word;
}

/* Patch for legacy use of inline Code on mobile with preview build of Docsify v5 theme */
.markdown-section code {
  white-space: pre-wrap !important;
  overflow-wrap: break-word;
}

/* Patch for legacy use of non-Markdown long links to wrap */
.markdown-section a {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Keep table links intact instead of breaking character-by-character */
.markdown-section table a {
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
}

/* Same for `code`-wrapped link text - overrides the !important rule above */
.markdown-section table code {
  white-space: nowrap !important;
  overflow-wrap: normal;
  word-break: normal;
}

/* Give the column after a link-only cell more room to read, instead of an
   auto-layout split that squeezes it down to the link's leftover space */
/* The span form matches cells wrapped by the responsive tables plugin */
.markdown-section table td:has(> a:only-child, > span > a:only-child) + td {
  min-width: 14em;
}

/* Patch for Topics index links with Docsify v5 */
.markdown-section a[href$="?id=a"],
.markdown-section a[href$="?id=b"],
.markdown-section a[href$="?id=c"],
.markdown-section a[href$="?id=d"],
.markdown-section a[href$="?id=e"],
.markdown-section a[href$="?id=f"],
.markdown-section a[href$="?id=g"],
.markdown-section a[href$="?id=h"],
.markdown-section a[href$="?id=i"],
.markdown-section a[href$="?id=j"],
.markdown-section a[href$="?id=k"],
.markdown-section a[href$="?id=l"],
.markdown-section a[href$="?id=m"],
.markdown-section a[href$="?id=n"],
.markdown-section a[href$="?id=o"],
.markdown-section a[href$="?id=p"],
.markdown-section a[href$="?id=q"],
.markdown-section a[href$="?id=r"],
.markdown-section a[href$="?id=s"],
.markdown-section a[href$="?id=t"],
.markdown-section a[href$="?id=u"],
.markdown-section a[href$="?id=v"],
.markdown-section a[href$="?id=w"],
.markdown-section a[href$="?id=x"],
.markdown-section a[href$="?id=y"],
.markdown-section a[href$="?id=z"] {
  display: inline-flex;
  padding-top: 0px;
  padding-right: 4px;
  padding-bottom: 0px;
  padding-left: 4px;
  line-height: 1.4;
}

#page-actions-menu-dropdown .page-actions-menu-item {
  font-size: 1rem;
}

#page-actions-menu-dropdown .page-actions-menu-desc {
  font-size: .8rem;
}

/* Support for Docsify-This classes with preview build of Docsify v5 theme */

/* Target first paragraphs with 5+ links (reasonable index minimum), and a letter bar anywhere on the page
   (a paragraph whose fifth link jumps to a heading on the same page, such as [A](#a)|[B](#b)|…) */
.markdown-section :is(p:first-of-type:has(a[href^="#"]):has(a:nth-of-type(5)), p:has(> a[href*="?id="]:nth-of-type(5))) {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    font-size: var(--font-size-l);
    font-weight: 500;
    line-height: 1.4;
}

.markdown-section :is(p:first-of-type:has(a[href^="#"]):has(a:nth-of-type(5)), p:has(> a[href*="?id="]:nth-of-type(5))) a {
    color: var(--theme-color);
}

.markdown-section :is(p:first-of-type:has(a[href^="#"]):has(a:nth-of-type(5)), p:has(> a[href*="?id="]:nth-of-type(5))) a {
    padding: 0 2px;
    /* each letter is at least 18px wide: with the | between letters, a comfortable target to tap or click */
    min-width: 18px;
    justify-content: center;
}

.markdown-section #a,
.markdown-section #b,
.markdown-section #c,
.markdown-section #d,
.markdown-section #e,
.markdown-section #f,
.markdown-section #g,
.markdown-section #h,
.markdown-section #i,
.markdown-section #j,
.markdown-section #k,
.markdown-section #l,
.markdown-section #m,
.markdown-section #n,
.markdown-section #o,
.markdown-section #p,
.markdown-section #q,
.markdown-section #r,
.markdown-section #s,
.markdown-section #t,
.markdown-section #u,
.markdown-section #v,
.markdown-section #w,
.markdown-section #x,
.markdown-section #y,
.markdown-section #z {
  width: 2em;
  color: var(--color-mono-min);
  font-size: var(--font-size-l);
  font-weight: 700;
  margin-top: 1rem;
  padding-left: 0.25rem;
  background: color-mix(in srgb, var(--color-mono-max) 70%, transparent);
}

.markdown-section blockquote.announcement {
  background-color: var(--color-mono-1);
}

.markdown-section blockquote.announcement {
  overflow: visible;
  padding-top: .75em;
  padding-bottom: .75em;
  padding-right: 1em;
  color: var(--color-text);
}

.markdown-section blockquote.announcement ul {
  list-style: none;
  margin-top: 0.2em;
  margin-bottom: 0.8em;
}

.markdown-section blockquote.announcement ul li {
  margin: 2px 0;
}

.markdown-section blockquote.announcement ul li:before {
  position: absolute;
  content: "\2B29";
  margin-left: -18px;
}

.markdown-section blockquote.announcement hr {
  margin: 1em 0;
}

.markdown-section blockquote.announcement h1 {
  font-size: 1.45rem;
  line-height: 1.8rem;
  margin-top: 0.6rem;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.markdown-section blockquote.announcement h2 {
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.7rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-style: none;
}

.markdown-section blockquote.announcement h3 {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.5rem;
  margin-top: 0.4rem;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.markdown-section blockquote.announcement h4 {
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.3rem;
  margin-top: 0.3rem;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.markdown-section blockquote.announcement h5 {
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1.25rem;
  margin-top: 0.2rem;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.markdown-section blockquote.announcement h6 {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.1rem;
  margin-top: 0.1rem;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.markdown-section blockquote.announcement .button {
    background: var(--button-bg);
    color: var(--button-color);
    border-color: var(--button-bg);
}

.markdown-section .navpill {
  cursor: pointer;
  color: var(--color-mono-max) !important;
  height: auto;
  display: inline-block;
  border: 1px solid var(--color-mono-max);
  border-radius: 4rem;
  padding: 4px 14px 4px 14px;
  margin-bottom: 4px;
  margin-right: 6px;
  font-size: 0.8rem;
  line-height: 1.2;
  background-color: var(--color-mono-min);
  font-family: system-ui, sans-serif;
  font-weight: bold;
  text-decoration: none;
}

.markdown-section a.navpill {
  cursor: pointer;
  color: var(--color-mono-max);
  border: 1px solid var(--color-mono-max);
  text-decoration: none !important;
}

.markdown-section .badge {
  color: var(--badge-text-color, var(--color-mono-min));
  background-color: var(
    --badge-bg-color,
    color-mix(in srgb, var(--color-mono-max) 60%, transparent)
  );
  display: inline-block;
  padding: 0.25em 0.4em 0.25em 0.4em;
  font-family: system-ui, sans-serif;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  margin-top: -0.4em;
  border-radius: 0.25rem;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
    border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  text-decoration: none;
  
  /* Add maximum width and ellipsis */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.markdown-section .badge a {
  color: var(--badge-text-color, var(--color-mono-min)) !important;
  text-decoration: none !important;
}

.markdown-section .accordion {
  margin-top: 1.05rem;
  position: relative;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  min-width: 0;
  word-wrap: break-word;
  background-clip: border-box;
  border-top: 1px solid var(--color-mono-3);
  border-right: 1px solid var(--color-mono-3);
  border-left: 1px solid var(--color-mono-3);
  border-radius: 0.15rem;
}

.markdown-section .accordion details {
  padding: 0 1.25rem 1rem 1.25rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--color-mono-3);
}

.markdown-section .video-container-4by3 {
  position: relative;
  padding-bottom: 75%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.markdown-section .video-container-16by9 {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
}

.video-container-16by9 iframe,
.video-container-4by3 iframe,
.embed-container object,
.embed-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 93%;
}

.markdown-section .responsive-container iframe {
  max-width: 100%;
}

.markdown-section .responsive {
  max-width: 100%;
  height: auto;
}

aside#__sidebar .card-image-sidebar,
aside#__sidebar .card-image-sidebar-rounded {
  width: 100%; /* fills full width of sidebar */
  max-width: 240px; /* prevents it from getting too wide */
  height: auto;
  max-height: 175px; /* prevents it from getting too tall */
  object-fit: cover; /* crops image to fit dimensions */
  margin-right: 29px;
  display: block;
}

aside#__sidebar .card-image-sidebar-rounded {
  border-radius: 6px 6px 0 0;
}

/* Make sidebar a flex container when banner image exists */
aside#__sidebar:has(.sidebar-nav > [class*="card-image-sidebar"]:first-child) {
    display: flex;
    flex-direction: column;
}

/* Put sidebar-nav (with image) first */
aside#__sidebar:has(.sidebar-nav > [class*="card-image-sidebar"]:first-child) .sidebar-nav {
    order: 1;
}

/* Put app-nav-merged second */
aside#__sidebar:has(.sidebar-nav > [class*="card-image-sidebar"]:first-child) .app-nav-merged {
    order: 2;
}

/* An empty navbar (for example from an empty _navbar.md) takes no space, so the page starts as it would with no navbar.
   Docsify leaves room above the content whenever a navbar is loaded, even with nothing in it.
   var(--content-margin-inline) is Docsify's own top margin with no navbar; theme.css sets its own (1.4rem) */
.app-nav:empty {
    display: none;
}

body:has(.app-nav:empty) .markdown-section {
    margin-top: var(--content-margin-inline);
}

/* The sidebar stays hidden until the first page has been shown, so a page that hides its sidebar (with a <style> line
   in its Markdown) doesn't show it briefly while loading. Before then the page area holds only a comment, which :empty matches.
   (opacity, not visibility: Docsify checks whether the sidebar is visible when it starts, and would start it closed) */
body:has(.markdown-section:empty) :is(aside.sidebar, button.sidebar-toggle) {
    opacity: 0;
}

.markdown-section .banner-image {
  width: 100%;
  height: 125px;
  object-fit: cover;
  object-position: 50% 50%;
}

@media (min-width: 576px) {
  .markdown-section .banner-image {
    height: 250px;
  }
}

.markdown-section .banner-tall-image {
  width: 100%;
  height: 175px;
  object-fit: cover;
  object-position: 50% 50%;
}

@media (min-width: 576px) {
  .markdown-section .banner-tall-image {
    height: 350px;
  }
}

.markdown-section .header-image-fade {
  width: 100%;
  margin: 0px auto;
  position: absolute;
  top: 0px;
  left: 0;
  -webkit-mask-image: -webkit-gradient(
    linear,
    left top,
    left bottom,
    from(rgba(0, 0, 0, 1)),
    to(rgba(0, 0, 0, 0))
  );
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  opacity: 0.4;
  z-index: -1;
}

/* CSS currently only works with sidebar and standalone pages */
.markdown-section .header-image-fade-full-width {
  transform: none;
  margin-top: -3rem;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  position: absolute;
  width: 100vw;
  max-width: 100vw;
  -webkit-mask-image: -webkit-gradient(
    linear,
    left top,
    left bottom,
    from(rgba(0, 0, 0, 1)),
    to(rgba(0, 0, 0, 0))
  );
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 1), rgba(0, 0, 0, 0));
  opacity: 0.4;
  z-index: -1;
}

/* CSS currently only works with sidebar and standalone pages */
.markdown-section .header-image-full-width,
.markdown-section .header-image-full-width-headings-overlay {
  margin-top: -3rem;
  left: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  max-width: 100vw;
  position: relative;
  right: 50%;
  width: 100vw;
  height: 30dvh;
  object-fit: cover;
  object-position: center 50%;
}

.markdown-section .header-tall-image-full-width,
.markdown-section .header-tall-image-full-width-headings-overlay {
  margin-top: -3rem;
  left: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  max-width: 100vw;
  position: relative;
  right: 50%;
  width: 100vw;
  height: 40dvh;
  object-fit: cover;
  object-position: center 50%;
}

.markdown-section p:has(.header-tall-image-full-width, .header-image-full-width) + h1[tabindex="-1"],
.markdown-section p:has(.header-tall-image-full-width, .header-image-full-width) + * + h1[tabindex="-1"] {
  font-size: clamp(1.5rem, 5vw, 2.5rem); /* Scales between 2rem and 3.0rem */
  line-height: clamp(1.7rem, 5.5vw, 2.9rem);
  margin-left: -3px;
  font-weight: 600;
  letter-spacing: clamp(-0.02em, -0.5vw, -0.01em); /* Tighten large text */
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: clamp(0.75rem, 1.5vw, 1.25rem);
}

.markdown-section p:has(.header-tall-image-full-width, .header-image-full-width) + h1[tabindex="-1"] + h2[tabindex="-1"],
.markdown-section p:has(.header-tall-image-full-width, .header-image-full-width) + * + h1[tabindex="-1"] + h2[tabindex="-1"] {
  font-size: clamp(1.2rem, 3vw, 1.7rem); /* Scales between 1.2rem and 1.7rem */
  line-height: clamp(1.4rem, 3.5vw, 1.9rem);
  margin-left: -2px;
  font-weight: 500;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

/* CSS generated/assisted by Anthropic Claude AI */
.markdown-section p:has(.header-tall-image-full-width-headings-overlay,
.header-image-full-width-headings-overlay) + h1[tabindex="-1"] {
  position: absolute;
  top: calc(-3rem + 20dvh + 1rem); /* h1 center + spacing */
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  text-shadow:
    2px 2px 4px rgba(0,0,0,0.8),
    0 0 20px rgba(0,0,0,0.4);
  z-index: 10;
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.0rem); /* Scales between 2rem and 3.0rem */
  line-height: clamp(2.2rem, 5.5vw, 3.4rem);
  width: 100%;
  text-align: center;
  font-weight: 500;
  letter-spacing: -0.03em;
  backdrop-filter: blur(2px);
  background: linear-gradient(
    135deg,
    rgba(0,0,0,0.3) 0%,
    rgba(0,0,0,0.1) 100%
  );
  padding: clamp(0.5rem, 2vw, 1rem) clamp(1rem, 4vw, 2rem);
  border-radius: 8px;
  max-width: 90vw;
}

.markdown-section p:has(.header-image-full-width-headings-overlay) + h1[tabindex="-1"] {
  top: calc(-3rem + 15dvh + 1rem); /* h1 center + spacing for regular images */
}

.markdown-section p:has(.header-tall-image-full-width-headings-overlay,
.header-image-full-width-headings-overlay) + h1[tabindex="-1"] + h2[tabindex="-1"] {
  position: absolute;
  top: calc(-3rem + 20dvh + 3.5rem); /* h1 center + spacing */
  left: 50%;
  transform: translateX(-50%); /* Only center horizontally */
  color: rgba(255,255,255,0.95);
  text-shadow:
    1px 1px 3px rgba(0,0,0,0.7),
    0 0 15px rgba(0,0,0,0.3);
  z-index: 10;
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.8rem); /* Scales between 1.2rem and 1.8rem */
  line-height: clamp(1.4rem, 3.5vw, 2rem);
  width: 100%;
  text-align: center;
  font-weight: 300;
  letter-spacing: 0.05em;
  padding: clamp(0.25rem, 1vw, 0.5rem) clamp(0.75rem, 3vw, 1.5rem);
  max-width: 80vw;
  border: 0;
}

.markdown-section p:has(.header-image-full-width-headings-overlay) + h1[tabindex="-1"] + h2[tabindex="-1"] {
  top: calc(-3rem + 15dvh + 3.5rem); /* h2 center + spacing for regular images */
}

/* Keep text-shadow for links in h1 and h2 (same as parent) */
.markdown-section p:has(.header-tall-image-full-width-headings-overlay,
.header-image-full-width-headings-overlay) + h1[tabindex="-1"] a,
.markdown-section p:has(.header-tall-image-full-width-headings-overlay,
.header-image-full-width-headings-overlay) + h1[tabindex="-1"] + h2[tabindex="-1"] a {
  text-shadow: inherit; /* Inherit shadow from parent */
  text-decoration: none; /* Remove default underline */
}

/* Apply underline only on hover */
.markdown-section p:has(.header-tall-image-full-width-headings-overlay,
.header-image-full-width-headings-overlay) + h1[tabindex="-1"] a:hover,
.markdown-section p:has(.header-tall-image-full-width-headings-overlay,
.header-image-full-width-headings-overlay) + h1[tabindex="-1"] + h2[tabindex="-1"] a:hover {
  text-decoration: underline; /* Show underline on hover */
}

.markdown-section .image-75 {
  width: 75%;
  height: auto;
}

.markdown-section .image-50 {
  width: 50%;
  height: auto;
}

.markdown-section .image-25 {
  width: 25%;
  height: auto;
}

.markdown-section .image-75-border {
  width: 75%;
  height: auto;
  border: 1px solid var(--color-mono-3);
}

.markdown-section .image-50-border {
  width: 50%;
  height: auto;
  border: 1px solid var(--color-mono-3);
}

.markdown-section .image-25-border {
  width: 25%;
  height: auto;
  border: 1px solid var(--color-mono-3);
}

.markdown-section .image-border {
  border: 1px solid var(--color-mono-3);
}

.markdown-section .image-border-rounded {
  border-radius: 0.35em;
  border: 1px solid var(--color-mono-3);
}

.markdown-section .column {
  float: left;
  padding-right: 1rem;
  width: 50%;
}

.markdown-section .column-right {
  float: right;
  padding-left: 1rem;
  width: 50%;
}

.markdown-section .column img {
  margin-top: 0.35rem;
}

.markdown-section .column-right img {
  margin-top: 0.35rem;
}

.markdown-section .reverse-columns .column {
  float: right;
}

.markdown-section .row:after {
  content: "";
  display: table;
  clear: both;
}

@media screen and (max-width: 768px) {
  .markdown-section .column,
  .markdown-section .column-right {
    width: 100%;
    padding-right: 0rem;
    padding-left: 0rem;
  }

  .markdown-section .image-75,
  .markdown-section .image-50,
  .markdown-section .image-25,
  .markdown-section .image-75-border,
  .markdown-section .image-50-border,
  .markdown-section .image-25-border {
    width: 100%;
    height: auto;
  }
}

/* Responsive table layout - desktop */
.markdown-section .table-wrapper td::before {
    display: none;
}

/* Responsive table layout - mobile */
@media (max-width: 30em) {
    .markdown-section .table-wrapper {
        overflow-x: auto;
    }

    /* Convert to block layout */
    .markdown-section .table-wrapper tbody,
    .markdown-section .table-wrapper tr {
        display: block;
    }

    /* Hide original headers */
    .markdown-section .table-wrapper th {
        display: none;
    }

    /* Remove borders */
    .markdown-section .table-wrapper th,
    .markdown-section .table-wrapper td {
        border: none;
    }

    /* Cell styling with space for labels and increased vertical padding */
    /* Label column sizes to its own content, so an empty header takes ~0
       width instead of a fixed 8em gutter squeezing the value column */
    /* Capping it at 40% of the row lets a long header wrap instead of
       squeezing the value column */
    .markdown-section .table-wrapper td {
        display: grid; /* Contain the floated label so long headers stay inside the card */
        grid-template-columns: fit-content(40%) minmax(0, 1fr);
        column-gap: 0.5em; /* Keep long headers from touching the value */
        align-items: baseline;
        padding: .35em .5em; /* Increased from .15em to .35em for top/bottom */ /* Added space to the left of headers */
        text-align: left !important;
    }

    /* Add extra padding to first and last cells of each row */
    .markdown-section .table-wrapper td:first-child {
        padding-top: .7em; /* Extra space at top of each row */
    }

    .markdown-section .table-wrapper td:last-child {
        padding-bottom: .7em; /* Extra space at bottom of each row */
    }

    /* This is the KEY part - makes the generated labels visible and positioned */
    .markdown-section .table-wrapper td::before {
        display: block;
        font-weight: bold;
        text-align: left;
        /* The content is set by your JavaScript */
    }

    /* Hide labels on empty cells */
    .markdown-section .table-wrapper td:empty::before {
        display: none;
    }

    /* Stacked cards have room to wrap, so let long links and code wrap
       instead of the table nowrap rules pushing them past the card edge */
    .markdown-section .table-wrapper a,
    .markdown-section .table-wrapper code {
        white-space: normal !important;
    }
}

/* CSS generated/assisted by Anthropic Claude AI */
.markdown-section :is(.card-list, .card-list-guides, .card-list-sections) {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
  margin-top: 1rem;
}

.markdown-section .card:not(:is(.card-list, .card-list-guides, .card-list-sections) .card),
.markdown-section .card-rounded:not(:is(.card-list, .card-list-guides, .card-list-sections) .card-rounded) {
  margin-top: 2rem;
}

.markdown-section .card,
.markdown-section .card-rounded {
  border: 1px solid var(--color-mono-3);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* This ensures images respect border-radius */
}

.markdown-section .card-rounded {
  border-radius: 0.35em;
}

.markdown-section .card h2,
.markdown-section .card-rounded h2 {
  margin: 0 0 .1rem 0;
  padding-bottom: .5rem;
  font-size: 1.3rem;
  border-style: none;
}

/* Adjust space above and below h2 that follows edge-to-edge images */
.markdown-section .card p:has(img):first-child + h2,
.markdown-section .card-rounded p:has(img):first-child + h2 {
  margin-top: 1rem;
  padding-bottom: .25rem;
}

/* All images have normal padding by default */
.markdown-section .card p:has(img),
.markdown-section .card-rounded p:has(img) {
  margin: 0;
}

/* First images extend to card edges */
.markdown-section .card p:has(img):first-child,
.markdown-section .card-rounded p:has(img):first-child {
  margin: -1.6rem -1.5rem -1rem -1.5rem;
}

.markdown-section .card img,
.markdown-section .card-rounded img {
  width: 100%;
  height: 240px;
  object-fit: cover;
}

.markdown-section .card p,
.markdown-section .card-rounded p {
  flex-grow: 1;
  margin-bottom: .1rem;
}

/* Mobile */
@media screen and (max-width: 768px) {
  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .markdown-section .card,
  .markdown-section .card-rounded {
    padding: 1.25rem;
  }

  .markdown-section .card img,
  .markdown-section .card-rounded img {
    height: 200px;
  }

  .markdown-section .card p:has(img):first-child,
  .markdown-section .card-rounded p:has(img):first-child {
    margin: -1.35rem -1.25rem -0.75rem -1.25rem;
  }
}

/* A link button (":class=navpill", or Docsify's ":class=button") in its own paragraph at the end of a card sits at
   the bottom of the card, lined up with the buttons on the other cards in the row; the card's top image keeps its
   own height */
.markdown-section :is(.card, .card-rounded) > p:has(img):first-child {
  flex-grow: 0;
}

.markdown-section :is(.card, .card-rounded) > p:last-child:has(> :is(a.navpill, a.button):only-child) {
  flex-grow: 0;
  margin-top: auto;
  padding-top: .75rem;
}

/* Guide card lists – used on their own, as in <div class="card-list-guides">, like any card-list
   card-list-guides: a Guides page's list of guides; card-list-sections: a guide home's list of its sections (parts)
   Both show three cards in a row on wide screens (two on tablets, one on phones).
   Optional, with any card-list: card-lines-2 or card-lines-3 – each card's text is trimmed to two or three lines, so
   the cards stay a similar size (a paragraph with a link button is left whole, so the button always shows); leave
   both out for the full text */
.markdown-section :is(.card-list-guides, .card-list-sections) {
  grid-template-columns: repeat(3, 1fr);
}

.markdown-section :is(.card-list-guides, .card-list-sections) :is(.card, .card-rounded) img {
  height: 180px;
}

.markdown-section :is(.card-lines-2, .card-lines-3) :is(.card, .card-rounded) > p:not(:has(img)):not(:has(:is(a.navpill, a.button))) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  /* not stretched to fill a taller card, which would show part of the next line */
  flex-grow: 0;
}

.markdown-section .card-lines-2 :is(.card, .card-rounded) > p:not(:has(img)):not(:has(:is(a.navpill, a.button))) {
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

/* Cards in a list line up across each row: the image, title, text and button of every card start level, however long
   a card's title or text is. Each card shares its row's heights (subgrid), taking one row for each of its parts – the
   rules below give the count, for cards of two to eight parts. Browsers without subgrid, and cards of more than eight
   parts, keep the layout above. */
@supports (grid-template-rows: subgrid) {
  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):not(:has(> :nth-child(9))) {
    display: grid;
    grid-template-rows: subgrid;
    row-gap: 0;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(2):last-child) {
    grid-row: span 2;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(3):last-child) {
    grid-row: span 3;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(4):last-child) {
    grid-row: span 4;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(5):last-child) {
    grid-row: span 5;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(6):last-child) {
    grid-row: span 6;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(7):last-child) {
    grid-row: span 7;
  }

  .markdown-section :is(.card-list, .card-list-guides, .card-list-sections) > :is(.card, .card-rounded):has(> :nth-child(8):last-child) {
    grid-row: span 8;
  }
}

@media screen and (max-width: 1024px) {
  .markdown-section :is(.card-list-guides, .card-list-sections) {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 768px) {
  .markdown-section :is(.card-list-guides, .card-list-sections) {
    grid-template-columns: 1fr;
  }

  .markdown-section :is(.card-list-guides, .card-list-sections) :is(.card, .card-rounded) img {
    height: 200px;
  }
}

/* Guide cover – a small cover image with the guide's details beside it, at the top of a guide home, as in
   <div class="guide-cover"> with the image, then a <div> holding the # title, subtitle, author(s),
   <small>edition</small>, licence (":class=navpill") and Start Reading button. Stacks on phones. */
.markdown-section .guide-cover {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid color-mix(in srgb, var(--color-mono-max) 15%, transparent);
}

/* the cover: a 4:3 picture about as tall as the details beside it, trimmed to fill it */
.markdown-section .guide-cover > p:first-child {
  flex: 0 0 18rem;
  margin: 0;
}

.markdown-section .guide-cover > p:first-child img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0.5rem;
}

.markdown-section .guide-cover h1 {
  margin-top: 0;
}

.markdown-section .guide-cover p {
  margin: 0 0 0.4rem;
}

/* the subtitle, just below the title */
.markdown-section .guide-cover h1 + p {
  font-size: 1.2em;
  color: color-mix(in srgb, var(--color-mono-max) 65%, transparent);
}

.markdown-section .guide-cover small {
  font-size: 0.9em;
  color: color-mix(in srgb, var(--color-mono-max) 65%, transparent);
}

/* the Start Reading button, a little apart from the details */
.markdown-section .guide-cover p:last-child {
  margin-top: 1rem;
}

@media screen and (max-width: 600px) {
  .markdown-section .guide-cover {
    flex-direction: column;
  }

  .markdown-section .guide-cover > p:first-child {
    flex-basis: auto;
    width: 100%;
  }
}

/* Site title – the site's name at the top left of the navbar, as in a site header, on pages that hide the sidebar
   (where Docsify shows the name). Used as the navbar's first link: - [Site Name](home.md ":class=site-title").
   A page hides its sidebar with a <style> line in its own text, so .markdown-section > style finds those pages.
   On phones it shows on every page, since the sidebar starts closed there. */
.app-nav li:has(> a.site-title) {
  display: none;
}

.app-nav a.site-title {
  font-size: 1.4em;
  font-weight: 600;
  color: var(--color-mono-max);
  text-decoration: none;
}

/* No sliding: Docsify moves the navbar's left edge with a transition (for opening and closing the sidebar), which
   would slide it across when a page without the sidebar loads. It also stays hidden until the first page has been
   shown (as the sidebar does), so it appears in place. */
.app-nav:has(a.site-title) {
  transition: none;
}

body:has(.markdown-section:empty) .app-nav:has(a.site-title) {
  opacity: 0;
}

/* the navbar spans the page, lined up with the text, with the title on the left and the other links on the right */
body:has(.markdown-section > style) .app-nav:has(a.site-title) {
  left: 0;
}

body:has(.markdown-section > style) .app-nav:has(a.site-title) > ul {
  width: 100%;
  max-width: var(--content-max-width);
  margin: 0 auto;
  /* the title's text sits on the same line as the other links' text */
  align-items: baseline;
}

body:has(.markdown-section > style) .app-nav li:has(> a.site-title) {
  display: block;
  margin-right: auto;
}

@media screen and (max-width: 768px) {
  /* the title on its own line with the other links below it, at the top of the page (not over it) */
  .app-nav:has(a.site-title) {
    position: static;
    height: auto;
    padding-top: 1.25rem;
    padding-bottom: 0;
  }

  .app-nav:has(a.site-title) > ul {
    flex-wrap: wrap;
    justify-content: flex-start;
    column-gap: 1.1rem;
    row-gap: 0.2rem;
  }

  .app-nav:has(a.site-title) li {
    margin: 0;
  }

  body:has(.app-nav a.site-title) .markdown-section {
    margin-top: 1.4rem !important;
  }

  .app-nav li:has(> a.site-title) {
    display: block;
    flex-basis: 100%;
  }

  .app-nav a.site-title {
    font-size: 1.25em;
  }
}

@media only screen and (max-width: 480px) {
  .markdown-section blockquote.announcement h1 {
    font-size: 1.3rem;
    line-height: 1.5rem;
  }

  .markdown-section blockquote.announcement h2 {
    font-size: 1.2rem;
    line-height: 1.4rem;
  }

  .markdown-section blockquote.announcement h3 {
    font-size: 1.15rem;
    line-height: 1.4rem;
  }

  .markdown-section blockquote.announcement h4 {
    font-size: 1.1rem;
    line-height: 1.3rem;
  }

  .markdown-section blockquote.announcement h5 {
    font-size: 1.05rem;
    line-height: 1.3rem;
  }

  .markdown-section blockquote.announcement h6 {
    font-size: 1rem;
    line-height: 1.15rem;
  }
}

@media print {
  /* Hide UI elements */
  .cover,
  .app-nav,
  #__sidebar,
  .sidebar,
  aside,
  nav,
  .pagination-item,
  .docsify-pagination-container,
  .pagination {
    display: none !important;
  }

  /* Reset layout for full width */
  body,
  main,
  .content,
  .markdown-section {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    max-width: none !important;
    transform: none !important;
    position: static !important;
  }

  /* Page margins */
  @page {
    margin: 2cm;
  }

  /* Prevent bad page breaks */
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}
