/* --- Layout & page chrome --- */

/* Comfortable measure for math-heavy reading; align-self stops the article
   column from stretching to grid height when the sidebar is taller than the
   content, which would otherwise leave empty space below the byline. */
main.content {
  max-width: 760px;
  align-self: start;
}

/* Lock navbar height and matching body offset so neither Quarto's nav JS nor
   theme toggles can shift content vertically. !important on the body padding
   beats the inline style Quarto's JS would otherwise set. */
.navbar {
  height: 60px !important;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

body.nav-fixed {
  padding-top: 60px !important;
}

/* Quarto's sticky-footer min-height pushes the footer to the bottom of the
   viewport even when content is short, creating large empty bands. Disable
   it so the footer sits right below the content. */
body, #quarto-content {
  min-height: 0 !important;
}


/* --- Light / dark backgrounds & overscroll --- */

/* Inline noise overlay (in paper-noise-overlay.html). Fixed to the viewport,
   sits behind all content, and shows only in light mode. Includes the
   overscroll bounce area since it's an actual element rather than a canvas
   paint. */
#paper-noise {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  display: none;
}
html.quarto-light #paper-noise {
  display: block;
}

/* Let the noise overlay show through the body in light mode. The visible
   page color comes from html.quarto-light's bg-color below. */
body.quarto-light {
  background-color: transparent;
}

/* Match the html background color to the active body theme so the
   overscroll bounce shows the right color behind the fixed noise overlay. */
html.quarto-light {
  background-color: #f4ecd6;
}
html.quarto-dark {
  background-color: #1a1816;
}

/* Let the body's noise texture show through the footer in light mode */
body.quarto-light .footer,
body.quarto-light .nav-footer {
  background: transparent;
}


/* --- Quarto component fixups --- */

/* Quarto's search input is injected by JS into an empty div; pre-style the
   container at the same 180px width as the injected aa-Form so the bar
   doesn't pop in from nothing and there's no dead space around it. */
#quarto-search:empty {
  display: inline-block;
  width: 180px;
  height: 36px;
  background: rgba(127, 127, 127, 0.08);
  border: 1px solid rgba(127, 127, 127, 0.18);
  border-radius: 4px;
}
#quarto-search:empty::before {
  content: "Search";
  display: block;
  padding: 0.5rem 0.75rem;
  color: rgba(127, 127, 127, 0.7);
  font-size: 0.875rem;
}

/* The navbar has data-bs-theme="dark" set unconditionally, so style the search
   to read against a dark background regardless of which body theme is active. */
.aa-Form {
  background-color: rgba(127, 127, 127, 0.12) !important;
  border: 1px solid rgba(127, 127, 127, 0.25) !important;
  color: rgba(255, 255, 255, 0.85) !important;
}
.aa-Input {
  color: rgba(255, 255, 255, 0.85) !important;
  background: transparent !important;
}
.aa-Input::placeholder {
  color: rgba(255, 255, 255, 0.5) !important;
}
.aa-SubmitIcon,
.aa-DetachedSearchButtonIcon,
.aa-LoadingIcon {
  color: rgba(255, 255, 255, 0.7) !important;
}
.aa-Form svg,
.aa-Form svg * {
  fill: currentColor !important;
}

/* Replace Quarto's toggle-switch icon with bootstrap-icons sun/moon glyphs.
   The icon shows the destination, so dark-active shows a sun (click for light)
   and light-active shows a moon (click for dark). */
.quarto-color-scheme-toggle .bi::before {
  background-image: none !important;
  background: none !important;
  font-family: "bootstrap-icons" !important;
  font-size: 1rem;
  line-height: 1;
  width: auto !important;
  height: auto !important;
}
.quarto-color-scheme-toggle:not(.alternate) .bi::before {
  content: "\f5a1" !important;
}
.quarto-color-scheme-toggle.alternate .bi::before {
  content: "\f494" !important;
}


/* --- Math rendering --- */

/* Hide math expressions until KaTeX has replaced the raw LaTeX with its
   rendered output (which contains a .katex element). Eliminates the
   raw-text-to-rendered reflow flash. */
.math:not(:has(.katex)) {
  visibility: hidden;
}

/* Display math gets a touch more breathing room */
.math.display {
  margin: 1em 0;
}


/* --- Theorem environments & code blocks --- */

/* Theorem-style environments. Apply with ::: {.theorem} ... :::
   div.sourceCode is included here so code blocks render with identical
   border, padding, and background treatment as math callouts. */
.theorem,
.proposition,
.lemma,
.corollary,
.definition,
.example,
.remark,
div.sourceCode {
  margin: 1.25em 0;
  padding: 0.75em 1em;
  border-left: 3px solid var(--bs-primary);
  background: rgba(127, 127, 127, 0.06);
  border-radius: 0 4px 4px 0;
}

/* Reset the inner <pre> so Quarto's defaults don't double up on padding/bg. */
div.sourceCode pre,
div.sourceCode pre.sourceCode {
  background: transparent;
  border: none;
  margin: 0;
  padding: 0;
}

.definition,
.example,
.remark {
  border-left-color: var(--bs-secondary, #6c757d);
}

.proof {
  margin: 1.25em 0;
  padding: 0 0 0 1em;
  border-left: 1px solid rgba(127, 127, 127, 0.4);
}

.proof::before {
  content: "Proof. ";
  font-style: italic;
  font-weight: 600;
}

.proof::after {
  content: " ∎";
  font-weight: bold;
  margin-left: 0.25em;
}


/* --- Page footer components --- */

/* Author byline appended to every rendered post */
.page-byline {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
  border-bottom: 1px solid rgba(127, 127, 127, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
  color: rgba(127, 127, 127, 0.85);
}
.page-byline-text {
  flex: 0 1 auto;
}
.page-byline-text strong {
  color: var(--bs-body-color);
  font-weight: 600;
}
.page-byline-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(201, 152, 106, 0.18);
  color: #c9986a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.95rem;
  flex-shrink: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.page-byline-links {
  display: flex;
  gap: 0.4rem;
}
.page-byline-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: inherit;
  background: rgba(127, 127, 127, 0.1);
  text-decoration: none;
  border-bottom: none;
  font-size: 0.95rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.page-byline-links a:hover {
  background: rgba(var(--bs-primary-rgb), 0.18);
  color: var(--bs-primary);
}

/* Prev / All-posts / Next row below the byline */
.page-nav {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
}
.page-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(127, 127, 127, 0.85);
  text-decoration: none;
  border-bottom: none;
}
.page-nav a:hover {
  color: var(--bs-primary);
}
.page-nav-prev {
  justify-self: start;
}
.page-nav-next {
  justify-self: end;
  text-align: right;
}
.page-nav-all {
  justify-self: center;
  font-weight: 500;
}
.page-nav-placeholder {
  display: block;
}
.page-nav span {
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Visually hidden but kept in the rendered text so scrapers still extract
   the UUID. Standard sr-only pattern. */
.page-uuid {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
