/* Small engraved plates are backgrounds, so they never join the reading or tab order. */
:root {
  --ct-water: url("assets/motive/ape.svg");
  --ct-olive: url("assets/motive/ramura.svg");
  --ct-stones: url("assets/motive/echilibru.svg");
  --ct-horizon: url("assets/motive/rasarit.svg");
}

.opening::before {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: -1;
  left: 47%;
  top: 10%;
  width: clamp(5rem, 9.5vw, 11rem);
  aspect-ratio: 174 / 68;
  background: url("assets/motive/zbor.svg") center / contain no-repeat;
  opacity: .8;
}

.footer-end {position: relative}
.footer-end::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: -10px auto auto 50%;
  width: 66px;
  height: 18px;
  transform: translateX(-50%);
  background: #f1ede2 var(--ct-horizon) center / 49px auto no-repeat;
}

.booking-page > .wrap {position: relative}
.booking-page > .wrap::before {
  content: "";
  position: absolute;
  pointer-events: none;
  top: -.65rem;
  right: 0;
  width: 5.2rem;
  aspect-ratio: 360 / 172;
  background: var(--ct-water) center / contain no-repeat;
}

.ca-focus::after, .md-group h2.md-heading::after {
  content: "";
  display: block;
  pointer-events: none;
  width: 5rem;
  height: 1.2rem;
  margin-top: .8rem;
  background: var(--ct-horizon) left center / contain no-repeat;
}

@media (min-width: 861px) {
  .booking-page > .wrap::before {
    top: clamp(2rem,4.2vw,4.7rem);
    right: 1%;
    width: clamp(13.5rem,28%,24.5rem);
  }
  .booking-page h1, .booking-intro {max-width: 68%}
  .booking-intro {max-width: min(60%, 570px)}

  .ed-clinical-intro, .if-bio-work .if-columns > :first-child,
  .if-directory-group:nth-child(3) > h2, .sv-family-grid > h2,
  .pg-themes .pg-section-intro, .if-message .if-columns > :first-child {
    --ct-plate: var(--ct-olive);
  }
  .if-bio-body .if-columns > :first-child, .pg-overview .pg-section-intro,
  .if-directory-group:first-child > h2, .sv-focus-grid > :first-child {
    --ct-plate: var(--ct-stones);
  }
  .ed-directory-head, .if-directory-group:nth-child(2) > h2 {--ct-plate: var(--ct-water)}

  :is(.ed-clinical-intro, .ed-directory-head,
      .if-bio-body .if-columns > :first-child, .if-bio-work .if-columns > :first-child,
      .if-message .if-columns > :first-child,
      .if-directory-group:nth-child(-n+3) > h2,
      .sv-family-grid > h2, .sv-focus-grid > :first-child,
      .pg-overview .pg-section-intro, .pg-themes .pg-section-intro)::after {
    content: "";
    display: block;
    pointer-events: none;
    width: min(92%, var(--ct-plate-width, 15rem));
    height: var(--ct-plate-height, 8rem);
    margin-top: clamp(.85rem,2vw,1.8rem);
    background: var(--ct-plate) left center / contain no-repeat;
  }

  .ed-clinical-intro {--ct-plate-width: 10.5rem; --ct-plate-height: 6rem}
  .ed-clinical-intro::after {filter: brightness(1.65) saturate(.75)}
  .ed-directory-head {--ct-plate-width: 17.5rem; --ct-plate-height: min(8.35rem,15vh)}
  .sv-family-grid > h2, .sv-focus-grid > :first-child {--ct-plate-height: 6.7rem}
  .pg-themes .pg-section-intro {--ct-plate-height: min(8rem, 15vh)}
  .if-directory-group:nth-child(-n+3) h2 {--ct-plate-height: 7rem}
  .if-bio-body .if-columns > :first-child, .if-bio-work .if-columns > :first-child {
    --ct-plate-width: clamp(12rem,19vw,17rem);
    --ct-plate-height: clamp(7rem,10vw,9.7rem);
  }

  .sv-faq-grid > :first-child::after, .jr-contents::after, .lg-toc::after,
  .jr-mast-content > p::before {
    content: "";
    display: block;
    pointer-events: none;
    width: 7rem;
    height: 1.7rem;
    background: var(--ct-horizon) left center / contain no-repeat;
    margin-block: 1.3rem .1rem;
  }
  .jr-mast-content > p::before {margin: 0 0 1rem; filter: brightness(1.55)}
  .md-group h2.md-heading {display: flex; align-items: baseline; flex-wrap: wrap; column-gap: .2em}
  .md-group h2.md-heading::after {align-self: center; margin: 0 0 0 auto; width: 6.6rem; height: 1.65rem}
}

@media (min-width: 1100px) {
  .jr-post-mast > .wrap {position: relative}
  .jr-post-heading {max-width: 76%}
  .jr-post-mast > .wrap::after {
    content: "";
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 24%;
    width: 20%;
    aspect-ratio: 254 / 164;
    background: var(--ct-olive) center / contain no-repeat;
    filter: brightness(1.65) saturate(.74);
  }
  .ct-entry:has(> h1:first-child) > h1::after {
    content: "";
    display: block;
    pointer-events: none;
    width: 6rem;
    height: 1.5rem;
    margin-block: .6rem;
    background: var(--ct-horizon) center / contain no-repeat;
  }
}

@media (max-width: 700px) {
  .opening::before {left: 31%; top: 5%; width: clamp(3.2rem, 14vw, 5rem)}
  .sv-faq-grid .sv-label, .if-message .if-kicker, .jr-mast-content .jr-label {
    display: flex;
    align-items: center;
  }
  .sv-faq-grid .sv-label::after, .if-message .if-kicker::after, .jr-mast-content .jr-label::after {
    content: "";
    pointer-events: none;
    flex: 0 0 3.8rem;
    height: .95rem;
    margin-inline-start: auto;
    background: var(--ct-horizon) right center / contain no-repeat;
  }
  .jr-mast-content .jr-label::after {filter: brightness(1.55)}
  .pg-themes .pg-section-intro::after {
    content: "";
    pointer-events: none;
    display: block;
    width: 4.65rem;
    height: 1.1rem;
    margin: .65rem 0 -.5rem;
    background: var(--ct-horizon) left center / contain no-repeat;
  }
  .if-bio-body .if-columns > :first-child, .if-bio-work .if-columns > :first-child {
    display: grid;
    grid-template-columns: minmax(0,1fr) clamp(3.25rem,19vw,5.75rem);
    align-items: center;
    gap: .55rem;
  }
  .if-bio-body .if-columns > :first-child::after, .if-bio-work .if-columns > :first-child::after {
    content: "";
    display: block;
    pointer-events: none;
    width: 100%;
    aspect-ratio: 1.6;
    background: var(--ct-stones) right center / contain no-repeat;
  }
  .if-bio-work .if-columns > :first-child::after {background-image: var(--ct-olive)}
  .ca-focus::after {width: 4.1rem; height: 1rem; margin-top: .55rem}
  .md-group h2.md-heading::after {width: 4.1rem; height: 1rem; margin-top: .45rem}
}

@media (min-width: 861px) and (max-height: 650px) {
  .ed-directory-head::after, .lg-toc::after, .jr-contents::after,
  .pg-themes .pg-section-intro::after {display: none}
}
@media (prefers-reduced-motion: no-preference) {
  .opening::before {animation: ct-birds-arrive 3.6s cubic-bezier(.15,.55,.18,1) both}
  @keyframes ct-birds-arrive {
    from {opacity: .3; transform: translate(-12px,4px)}
    to {opacity: .8; transform: none}
  }
  @supports (animation-timeline: view()) {
    :is(.if-bio-body, .if-bio-work) .if-columns > :first-child::after,
    .pg-overview .pg-section-intro::after, .ed-clinical-intro::after {
      animation: ct-plate-arrive linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 100%;
    }
    @keyframes ct-plate-arrive {
      from {opacity: .66; transform: translateY(5px)}
      to {opacity: 1; transform: none}
    }
  }
}

@media print, (forced-colors: active) {
  :is(.opening, .booking-page > .wrap, .footer-end, .ca-focus, .md-group h2.md-heading,
    .ed-clinical-intro, .ed-directory-head, .if-bio-body .if-columns > :first-child,
    .if-bio-work .if-columns > :first-child, .if-message .if-columns > :first-child,
    .if-directory-group > h2, .sv-family-grid > h2, .sv-focus-grid > :first-child,
    .pg-section-intro, .sv-faq-grid > :first-child, .jr-contents, .lg-toc,
    .jr-mast-content > p, .jr-post-mast > .wrap, .ct-entry > h1,
    .sv-faq-grid .sv-label, .if-message .if-kicker, .jr-mast-content .jr-label)::after,
  .opening::before, .booking-page > .wrap::before, .footer-end::before, .jr-mast-content > p::before {content: none}
}
