:root {
  --folio-rule: url('/assets/wallpaper/folio-rule.svg');
  --folio-rule-ink: #9a7548;
  --folio-rule-size: clamp(88px, 10vw, 124px);
  --folio-hairline: rgb(154 117 72 / 38%);
}

/* The line continues into the stem, at the same scale throughout the journal. */
:is(header.masthead, nav.journal-return, header.top, footer.footer, footer.foot) {
  position: relative;
  --folio-rule-height: calc(var(--folio-rule-size) * 22 / 144);
  --folio-rule-gap: calc(var(--folio-rule-size) / 2 - .5px);
}

:is(header.masthead, nav.journal-return, header.top) {
  border-block-end-color: transparent;
}

:is(footer.footer, footer.foot) {
  border-block-start-color: transparent;
}

:is(header.masthead, nav.journal-return, header.top)::after,
:is(footer.footer, footer.foot)::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  height: var(--folio-rule-height);
  background:
    var(--folio-rule) center / var(--folio-rule-size) auto no-repeat,
    linear-gradient(90deg,
      transparent,
      var(--folio-rule-ink) calc(50% - var(--folio-rule-gap)),
      transparent calc(50% - var(--folio-rule-gap)) calc(50% + var(--folio-rule-gap)),
      var(--folio-rule-ink) calc(50% + var(--folio-rule-gap)),
      transparent) center / 100% 1px no-repeat;
  opacity: .5;
  pointer-events: none;
}

:is(header.masthead, nav.journal-return, header.top)::after {
  inset-block-end: calc(var(--folio-rule-height) / -2);
}

:is(footer.footer, footer.foot)::before {
  inset-block-start: calc(var(--folio-rule-height) / -2);
}

main:is(.page, .article-page) .section-title {
  border-block-start-color: var(--folio-hairline);
}

:is(.project-series-card, .collection-card) {
  position: relative;
  isolation: isolate;
}

:is(.project-series-card, .collection-card)::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: auto 0 0 auto;
  width: clamp(92px, 14vw, 155px);
  height: 100%;
  background: url('/assets/wallpaper/folio-palmette.webp') right bottom / 90% auto no-repeat;
  opacity: .115;
  pointer-events: none;
}

body:has(> :is(nav.journal-return, header.top)) {
  background-image: radial-gradient(ellipse 40rem 18rem at 50% 0, #b4986321, transparent);
}

@media (forced-colors: active) {
  :is(header.masthead, nav.journal-return, header.top) {
    border-block-end-color: CanvasText;
  }

  :is(footer.footer, footer.foot, main .section-title) {
    border-block-start-color: CanvasText;
  }
}
