/* Clean reading layout: no GitHub/search blocks in the header, content width tuned for two indexes. */
.md-header__source, .md-search { display: none; }
@media screen and (min-width: 76.25em) {
  .md-content { flex: 1 1 auto; min-width: 0; }
}
/* Hidden indexes wait just off-screen so they can slide in and out smoothly. */
@media screen and (min-width: 60em) {
  html:not(.show-nav) .md-sidebar--primary,
  html:not(.show-toc) .md-sidebar--secondary {
    display: block;
    position: fixed;
    z-index: 5;
    top: var(--ssp-peek-top, 0px) !important;
    height: calc(100vh - var(--ssp-peek-top, 0px)) !important;
    padding-left: .3rem;
    padding-right: .3rem;
    background-color: var(--md-default-bg-color);
    background-color: color-mix(in srgb, var(--md-default-fg-color) 4%, var(--md-default-bg-color));
    box-shadow: 0 0 2.2rem rgba(0, 0, 0, .26);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: transform .5s cubic-bezier(.4, 0, .2, 1), opacity .28s ease, visibility 0s linear .5s;
  }
  html:not(.show-nav) .md-sidebar--primary { left: 0; transform: translateX(calc(-100% - 1.5rem)); }
  html:not(.show-toc) .md-sidebar--secondary { right: 0; transform: translateX(calc(100% + 1.5rem)); }
  html:not(.show-nav).peek-nav .md-sidebar--primary,
  html:not(.show-toc).peek-toc .md-sidebar--secondary {
    transform: none;
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: transform .55s cubic-bezier(.4, 0, .2, 1), opacity .22s ease, visibility 0s;
  }
  html:not(.show-nav).peek-nav .md-sidebar--primary .md-sidebar__scrollwrap,
  html:not(.show-toc).peek-toc .md-sidebar--secondary .md-sidebar__scrollwrap { max-height: 100%; }
}

/* Edge light: the whole window edge glows softly, so it reads as "pull anywhere here". */
.edge-hint { display: none; }
@media screen and (min-width: 60em) {
  .edge-hint {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 3;
    display: none;
    width: .9rem;
    pointer-events: none;
    opacity: .55;
    transition: opacity .3s ease, width .3s ease;
  }
  .edge-hint-nav {
    left: 0;
    background: linear-gradient(to right, color-mix(in srgb, var(--md-primary-fg-color) 55%, transparent), transparent);
  }
  .edge-hint-toc {
    right: 0; /* fixed already stops at the page scrollbar */
    background: linear-gradient(to left, color-mix(in srgb, var(--md-primary-fg-color) 55%, transparent), transparent);
  }
  /* the light grows as the pointer approaches, before the panel opens */
  html.near-nav:not(.show-nav):not(.peek-nav) .edge-hint-nav,
  html.near-toc:not(.show-toc):not(.peek-toc) .edge-hint-toc { opacity: 1; width: 1.6rem; }
  html:not(.show-nav):not(.peek-nav) .edge-hint-nav,
  html:not(.show-toc):not(.peek-toc) .edge-hint-toc { display: block; }
}
@media screen and (min-width: 60em) and (prefers-reduced-motion: no-preference) {
  html:not(.show-nav):not(.peek-nav) .edge-hint-nav,
  html:not(.show-toc):not(.peek-toc) .edge-hint-toc { animation: ssp-hint 6s ease-in-out infinite; }
  html:not(.show-nav):not(.peek-nav) .edge-hint-nav { animation-delay: .6s; }
  @keyframes ssp-hint {
    0%, 100% { opacity: .42; }
    50% { opacity: .7; }
  }
}
/* reduced motion still gets a soft fade instead of an abrupt pop */
@media screen and (prefers-reduced-motion: reduce) {
  html:not(.show-nav) .md-sidebar--primary,
  html:not(.show-toc) .md-sidebar--secondary,
  html:not(.show-nav).peek-nav .md-sidebar--primary,
  html:not(.show-toc).peek-toc .md-sidebar--secondary {
    transform: none;
    transition: opacity .2s ease, visibility 0s linear .2s;
  }
  html:not(.show-nav).peek-nav .md-sidebar--primary,
  html:not(.show-toc).peek-toc .md-sidebar--secondary { transition: opacity .2s ease, visibility 0s; }
  .edge-hint { animation: none; transition: none; }
}
.layout-btn { display: none; }
@media screen and (min-width: 60em) { .layout-btn { display: grid; } }
.layout-btn { place-items: center; flex: none; width: 2.3rem; height: 2.3rem; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #fff; opacity: .6; cursor: pointer; transition: opacity .15s, background .15s; }
.layout-btn:hover { opacity: 1; background: rgba(255, 255, 255, .15); }
.layout-btn.active { opacity: 1; background: rgba(255, 255, 255, .22); }
.layout-btn svg { width: 1.2rem; height: 1.2rem; display: block; }
/* slim footer: only previous / next, no copyright strip */
.md-footer-meta { display: none; }
.md-footer__inner { padding: 0; }
.md-footer__link { padding: .5rem 0; align-items: center; }
.md-footer__link .md-footer__button { margin: 0 .6rem; padding: .3rem; }
.md-footer__title { font-size: .8rem; line-height: 1.3; }
.md-footer__direction { display: none; }
/* no visible scrollbars on the two indexes; they still scroll */
.md-sidebar__scrollwrap { scrollbar-width: none; -ms-overflow-style: none; }
.md-sidebar__scrollwrap::-webkit-scrollbar { display: none; width: 0; height: 0; }
.md-sidebar--secondary .katex { font-size: 1em; }
/* no logo; the header only exists at the top of the page, it does not follow the scroll */
.md-header__button.md-logo { display: none; }
.md-header { position: relative; }
.md-header[data-md-state="shadow"] { box-shadow: none; }
.md-sidebar { top: 0 !important; padding-top: .5rem !important; padding-bottom: 0 !important; height: 100vh !important; }
.md-sidebar__scrollwrap { max-height: 100vh; }
.layout-btn-nav { margin-right: .3rem; }
.layout-btn-toc { margin-left: .3rem; }
/* header content flush left; indexes start higher */
.md-header__inner.md-grid { max-width: none; margin: 0; padding: 0 .5rem; }
.md-sidebar__scrollwrap { padding-top: 0; }
.md-sidebar__inner { padding-top: 0; }
/* breathing room on both sides on wide screens: content block is narrower than the window */
@media screen and (min-width: 76.25em) {
  .md-main__inner { max-width: 1280px; margin-left: auto; margin-right: auto; }
}

/* When a hidden index slides in, its entries follow with a light stagger. */
@media screen and (min-width: 60em) and (prefers-reduced-motion: no-preference) {
  .md-sidebar .md-nav__list > .md-nav__item { --ssp-i: 0; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(2) { --ssp-i: 1; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(3) { --ssp-i: 2; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(4) { --ssp-i: 3; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(5) { --ssp-i: 4; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(6) { --ssp-i: 5; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(7) { --ssp-i: 6; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(8) { --ssp-i: 7; }
  .md-sidebar .md-nav__list > .md-nav__item:nth-child(n + 9) { --ssp-i: 8; }
  html:not(.show-nav).peek-nav .md-sidebar--primary .md-nav--primary > .md-nav__list > .md-nav__item,
  html:not(.show-toc).peek-toc .md-sidebar--secondary .md-nav--secondary > .md-nav__list > .md-nav__item {
    animation: ssp-peek-item .5s cubic-bezier(.4, 0, .2, 1) backwards;
    animation-delay: calc(var(--ssp-i, 0) * 26ms);
  }
  html:not(.show-toc).peek-toc .md-sidebar--secondary .md-nav--secondary > .md-nav__list > .md-nav__item { animation-name: ssp-peek-item-r; }
  @keyframes ssp-peek-item { from { opacity: 0; transform: translateX(-.5rem); } }
  @keyframes ssp-peek-item-r { from { opacity: 0; transform: translateX(.5rem); } }
}
