/* Mobile safeguards for the Quarto book layout. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  overflow-x: clip;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

main.content,
#quarto-document-content,
.quarto-container,
.page-columns,
.column-body,
.column-page,
.column-screen,
.cell,
.cell-output,
.cell-output-display,
figure,
.quarto-figure,
.quarto-float,
div.callout,
.callout-body,
.callout-body-container,
.theorem,
.proof,
.remark {
  min-width: 0;
  max-width: 100%;
}

#quarto-sidebar,
#quarto-margin-sidebar,
#TOC,
nav[role="doc-toc"] {
  min-width: 0;
  max-width: 100%;
}

#quarto-content,
.page-columns {
  overflow-x: clip;
}

#quarto-sidebar .sidebar-link,
#quarto-sidebar .sidebar-item-text,
#quarto-sidebar .chapter-title,
#quarto-sidebar .menu-text,
nav[role="doc-toc"] .nav-link,
.toc-link,
.breadcrumb-item,
.nav-page-text,
.quarto-title .title,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: anywhere;
}

pre,
pre code,
div.sourceCode,
.sourceCode,
.cell-output,
.cell-output-display,
.cell-output-stdout,
.cell-output-stderr {
  max-width: 100%;
}

pre,
div.sourceCode,
.cell-output,
.cell-output-display,
.cell-output-stdout,
.cell-output-stderr {
  overflow-x: auto;
  contain: inline-size;
  -webkit-overflow-scrolling: touch;
}

p code,
li code,
td code,
figcaption code,
caption code {
  overflow-wrap: anywhere;
  white-space: break-spaces;
}

.table-responsive,
.cell-output-display:has(table),
.quarto-float:has(table) {
  max-width: 100%;
  overflow-x: auto;
  contain: inline-size;
  -webkit-overflow-scrolling: touch;
}

main.content table {
  max-width: 100%;
}

main.content table.table {
  display: block;
  width: max-content;
  min-width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

main.content table th,
main.content table td {
  overflow-wrap: normal;
}

.math.display,
span.math.display,
div.math,
.katex-display,
mjx-container[display="true"] {
  display: block;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box;
  justify-content: flex-start !important;
  overflow-x: auto !important;
  overflow-y: hidden;
  contain: inline-size;
  -webkit-overflow-scrolling: touch;
}

mjx-container {
  max-width: 100%;
}

mjx-container[display="true"] > mjx-math {
  min-width: max-content;
}

div.callout,
.theorem,
.proof,
.remark {
  overflow-wrap: break-word;
}

div.callout .callout-header,
div.callout .callout-title-container,
.theorem .theorem-title,
.proof .proof-title {
  min-width: 0;
  flex-wrap: wrap;
}

div.callout .callout-body,
div.callout .callout-body-container,
.theorem,
.proof,
.remark {
  overflow-x: auto;
  contain: inline-size;
  -webkit-overflow-scrolling: touch;
}

.nav-tabs,
.nav-pills {
  flex-wrap: wrap;
  gap: 0.25rem;
}

.nav-tabs .nav-link,
.nav-pills .nav-link {
  white-space: normal;
}

.quarto-secondary-nav,
.quarto-secondary-nav .container-fluid,
.quarto-secondary-nav .navbar,
.quarto-secondary-nav .navbar-nav {
  min-width: 0;
}

.quarto-secondary-nav .navbar-title,
.quarto-secondary-nav .breadcrumb,
.quarto-secondary-nav .navbar-brand {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quarto-btn-toggle,
.quarto-search-button {
  flex: 0 0 auto;
}

.sidebar-search,
#quarto-search,
#quarto-search .aa-Form {
  max-width: 100%;
  min-width: 0;
}

.page-footer,
.page-footer .container,
.page-footer .container-fluid {
  min-width: 0;
  max-width: 100%;
}

.page-footer a,
#refs a,
.references a,
.footnotes a {
  overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
  body.nav-sidebar.docked {
    overflow-x: clip;
  }

  main.content {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
  }

  #quarto-sidebar {
    width: min(88vw, 22rem);
    max-width: min(88vw, 22rem);
    box-shadow: 8px 0 24px rgba(16, 45, 110, 0.1);
  }

  #quarto-margin-sidebar,
  .margin-sidebar {
    display: none !important;
  }

  .sidebar-logo {
    width: min(136px, 72%);
    max-height: 112px;
  }

  .sidebar-menu-container {
    padding-right: 0.55rem;
    padding-left: 0.55rem;
  }

  .quarto-secondary-nav .navbar-title {
    max-width: min(62vw, 28rem);
  }

  #title-block-header {
    margin-bottom: 1rem;
    padding-top: 0.95rem;
  }

  h1.title,
  .quarto-title .title {
    font-size: clamp(1.75rem, 1.45rem + 1.2vw, 2.15rem);
    line-height: 1.18;
  }
}

@media (max-width: 767.98px) {
  body {
    line-height: 1.62;
  }

  main.content {
    padding-right: 0.85rem;
    padding-left: 0.85rem;
  }

  #title-block-header {
    border-top-width: 3px;
  }

  h1.title,
  .quarto-title .title {
    font-size: 1.85rem;
  }

  h2 {
    margin-top: 1.75rem;
    font-size: 1.42rem;
  }

  h3 {
    font-size: 1.18rem;
  }

  div.callout .callout-body-container {
    padding-right: 0.85rem;
    padding-left: 0.85rem;
  }

  .theorem:not(.example),
  .theorem.cc-definition-a,
  .theorem.cc-proposition-a,
  .theorem.cc-theorem-a,
  .theorem.cc-example-a,
  .theorem.cc-exercise-a,
  .theorem.cc-remark-a,
  .proof.cc-proof-a,
  .proof.cc-remark-a,
  .remark.cc-remark-a {
    padding-right: 0.85rem;
    padding-left: 0.85rem;
  }

  .math.display,
  span.math.display,
  div.math,
  .katex-display,
  mjx-container[display="true"] {
    padding-right: 0.35rem;
    padding-left: 0.35rem;
  }

  .page-navigation {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .nav-page a {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .nav-page a::after {
    display: none;
  }
}

@media (max-width: 575.98px) {
  main.content {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  h1.title,
  .quarto-title .title {
    font-size: 1.68rem;
  }

  h2 {
    font-size: 1.32rem;
  }

  #quarto-sidebar {
    width: min(92vw, 20rem);
    max-width: min(92vw, 20rem);
  }

  .quarto-secondary-nav .navbar-title {
    max-width: 58vw;
  }

  div.callout,
  .theorem:not(.example),
  .theorem.cc-definition-a,
  .theorem.cc-proposition-a,
  .theorem.cc-theorem-a,
  .theorem.cc-example-a,
  .theorem.cc-exercise-a,
  .theorem.cc-remark-a,
  .proof.cc-proof-a,
  .proof.cc-remark-a,
  .remark.cc-remark-a {
    border-radius: 8px;
  }

  pre,
  pre code {
    font-size: 0.82rem;
  }

  .page-footer {
    font-size: 0.92rem;
  }
}
