/* Momentum First: restrained HTML polish. */

main.content {
  max-width: 760px;
  line-height: 1.62;
}

main.content h2 {
  margin-top: 2.1rem;
}

main.content h3 {
  margin-top: 1.7rem;
}

/* Chapter-grouped appendix navigation ------------------------------------ */

.mf-appendix-group {
  margin-left: 0.25rem;
}

.mf-appendix-details > summary {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  padding: 0.22rem 0.15rem;
  color: var(--bs-body-color);
  cursor: pointer;
  list-style: none;
}

.mf-appendix-details > summary::-webkit-details-marker {
  display: none;
}

.mf-appendix-details > summary::before {
  content: "›";
  flex: 0 0 auto;
  color: var(--bs-secondary-color);
  font-size: 1.05em;
  transform-origin: center;
  transition: transform 120ms ease;
}

.mf-appendix-details[open] > summary::before {
  transform: rotate(90deg);
}

.mf-appendix-details > summary:hover,
.mf-appendix-details > summary:focus-visible {
  color: var(--bs-link-color);
}

.mf-appendix-details > .sidebar-section {
  margin-left: 0.65rem;
}

/* Home / HTML front page -------------------------------------------------- */

body.mf-home #title-block-header,
body.mf-home main.content > h1:first-of-type {
  display: none;
}

body.mf-home main.content {
  max-width: 980px;
}

.mf-home-hero {
  position: relative;
  min-height: min(54vh, 540px);
  margin: 0 0 2.25rem;
  padding: clamp(3rem, 8vw, 6rem) clamp(2rem, 6vw, 5rem);
  border: 1px solid rgba(70, 79, 88, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.82) 0%, rgba(255, 255, 255, 0.68) 52%, rgba(255, 255, 255, 0.2) 100%),
    url("../../assets/backgrounds/pdf/title-background.png") center / cover no-repeat;
  box-shadow: 0 18px 48px rgba(35, 45, 55, 0.08);
  overflow: hidden;
}

.mf-home-title {
  display: block;
  max-width: 14ch;
  margin: 0 0 1rem;
  color: #20242a;
  font-size: clamp(3rem, 7.5vw, 5.8rem);
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 0.92;
}

.mf-home-hero p {
  max-width: 42rem;
  color: #404852;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  line-height: 1.45;
}

.mf-primary-link {
  display: inline-block;
  margin-top: 1.35rem;
  padding: 0.72rem 1rem;
  border: 1px solid rgba(49, 95, 124, 0.34);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #254f69;
  font-weight: 620;
  text-decoration: none;
}

.mf-primary-link:hover {
  background: #fff;
  border-color: rgba(49, 95, 124, 0.58);
  color: #193f56;
}

.mf-path-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 2.5rem;
}

.mf-path-card {
  min-height: 12rem;
  padding: 1.15rem 1.2rem;
  border: 1px solid rgba(70, 79, 88, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.72)),
    url("../../assets/backgrounds/pdf/part-separator-background.png") center / cover no-repeat;
}

.mf-card-title {
  display: block;
  margin-top: 0;
  color: #27323a;
  font-size: 1.02rem;
  letter-spacing: 0.015em;
}

.mf-path-card p {
  color: #56616b;
  font-size: 0.94rem;
  line-height: 1.45;
}

.mf-action-grid .mf-path-card {
  min-height: 10rem;
}

.mf-card-link {
  color: #254f69;
  font-weight: 620;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

@media (max-width: 900px) {
  .mf-path-grid {
    grid-template-columns: 1fr;
  }

  .mf-home-hero {
    min-height: auto;
  }
}

/* Keep part labels visually distinct without overpowering chapter numbers. */
#quarto-sidebar .sidebar-item-section > .sidebar-item-container > a,
#quarto-sidebar .sidebar-item-section > .sidebar-item-container > .sidebar-item-text {
  color: #5f6670;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.045em;
  line-height: 1.25;
  margin-top: 0.75rem;
  text-transform: uppercase;
}

#quarto-sidebar .sidebar-item .chapter-title,
#quarto-sidebar .sidebar-item .chapter-number {
  line-height: 1.25;
}

#quarto-sidebar .sidebar-item .chapter-number {
  color: #4b5560;
  font-variant-numeric: tabular-nums;
  margin-right: 0.25rem;
}

figure,
.quarto-figure,
div.cell-output-display {
  margin-top: 1.4rem;
  margin-bottom: 1.4rem;
}

figcaption,
.figure-caption,
.table-caption {
  color: #5f6670;
  font-size: 0.92rem;
}

/* Captionless editorial illustrations in reflective front matter. */
.mf-preface-float-right {
  float: right;
  width: min(52%, 410px);
  margin: -0.35rem 0 1rem 1.25rem;
}

.mf-preface-float-right p {
  margin: 0;
}

.mf-preface-float-right img {
  display: block;
  width: 100%;
  height: auto;
}

.mf-preface-float-left {
  float: left;
  width: min(40%, 340px);
  margin: -0.15rem 1.25rem 0.8rem 0;
}

.mf-preface-float-left p {
  margin: 0;
}

.mf-preface-float-left img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 640px) {
  .mf-preface-float-right,
  .mf-preface-float-left {
    float: none;
    width: 100%;
    margin: 1rem 0 1.25rem;
  }
}
