/* Quiet, painterly accents for the Herbarium landing page.
   These layers are decorative only and intentionally stay away from copy. */

#main .collection-feature,
#main .preservation-story .workshop,
#main .poster-importance,
#main .herbarium-gallery-medical {
  isolation: isolate;
}

#main .collection-feature > *,
#main .preservation-story .workshop > *,
#main .poster-importance > *,
#main .herbarium-gallery-medical > * {
  position: relative;
  z-index: 1;
}

/* QBG -> preservation: one vertical composition around the two photographs. */
#main .collection-feature {
  position: relative;
  min-height: 460px;
  margin-top: clamp(140px, 12vw, 240px);
  padding-top: 18px;
  padding-bottom: 18px;
}

#main .collection-feature::before {
  content: '';
  position: absolute;
  z-index: 0;
  right: clamp(-76px, -4vw, -28px);
  top: 55%;
  width: clamp(390px, 42vw, 690px);
  aspect-ratio: 3 / 2;
  background: url('../img/herbarium-faded-botanical-print.png') center / contain no-repeat;
  opacity: .13;
  transform: translateY(-50%) rotate(4deg);
  filter: saturate(.65);
  pointer-events: none;
}

/* The curve sits inside the same cluster and points down to the equipment image. */
#main .collection-feature::after {
  content: '';
  position: absolute;
  z-index: 0;
  right: clamp(110px, 16vw, 260px);
  top: 77%;
  width: clamp(480px, 48vw, 720px);
  aspect-ratio: 900 / 760;
  background: url('../assets/decor/hero-line-swoosh.svg') center / contain no-repeat;
  opacity: .42;
  transform: translateY(-50%) rotate(-4deg);
  pointer-events: none;
}

/* QBG overview: enlarge the press-and-sheet composition without adding height. */
#main .collection-feature .qbg-story-visual {
  height: 420px;
}

#main .collection-feature .qbg-story-visual::before {
  width: 410px;
  height: 410px;
  left: 25px;
  top: 4px;
}

#main .collection-feature .qbg-press {
  width: 223px;
  height: 307px;
  left: 30px;
  top: 3px;
}

#main .collection-feature .qbg-sheet {
  width: 169px;
  height: 237px;
  right: 20px;
  bottom: 8px;
}

/* One watercolor leaf anchors each requested editorial section. */
#main .section-leaf {
  position: absolute;
  z-index: 0;
  display: block;
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: saturate(.72) drop-shadow(0 8px 12px rgba(60, 73, 47, .08));
}

#main .statistics > :not(.section-leaf),
#main .type-section > :not(.section-leaf) {
  position: relative;
  z-index: 1;
}

#main .statistics .section-leaf--qbg {
  z-index: 2;
  width: clamp(105px, 10vw, 150px);
  opacity: .72;
}

#main .statistics .section-leaf--qbg-sage {
  top: -22px;
  right: 12px;
  transform: rotate(8deg);
}

#main .statistics .section-leaf--qbg-cream {
  top: 22px;
  right: -42px;
  transform: rotate(29deg);
}

#main .type-section .section-leaf--types {
  z-index: 2;
  top: 18px;
  left: clamp(-46px, -2.5vw, -18px);
  width: clamp(116px, 13vw, 176px);
  opacity: .54;
  transform: rotate(-16deg);
}

/* Keep the preservation photograph clean; no decorative layer behind it. */
#main .preservation-story .workshop::before {
  content: none;
}

/* Keep the colour composition inside the importance section, away from Explore. */
#main .container > .poster-importance::after {
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: auto !important;
  height: auto;
  z-index: 0;
  transform: none !important;
  background:
    url('../assets/decor/hero-paint-speckles.svg') 83% 60% / 250px auto no-repeat,
    url('../img/herbarium-watercolor-wash.png') 79% 58% / min(620px, 46vw) auto no-repeat,
    url('../img/herbarium-pigment-cloud.png') 82% 56% / min(720px, 52vw) auto no-repeat;
  opacity: .26;
  background-position:
    83% 60%,
    79% 58%,
    82% 56% !important;
  background-attachment: scroll !important;
}

/* Readability: enlarge body copy and specimen labels by roughly 10–15%. */
#main .collection-feature .statistics p,
#main .preservation-story .workshop p,
#main .type-section li p,
#main .importance-grid p {
  font-size: 19px !important;
  line-height: 1.75;
}

#main .browse.herbarium-explore .browse-card-copy strong {
  font-size: 21px;
}

#main .browse.herbarium-explore .browse-card-copy small,
#main .medical-gallery-heading::after {
  font-size: 18px !important;
}

#main .specimen-concept-item em {
  min-height: 82px;
  font-size: 20px !important;
}

#main .specimen-concept-item em b {
  font-size: 13px;
}

/* Tighter vertical rhythm from QBG Herbarium through the gallery. */
#main .preservation-story {
  margin-top: 20px;
  margin-bottom: 20px;
}

#main .preservation-story .workshop {
  padding-top: 20px;
  padding-bottom: 20px;
}

#main .type-section {
  padding-top: 42px;
  padding-bottom: 46px;
}

#main .poster-importance {
  margin-top: 10px;
  margin-bottom: 30px;
  padding-top: 72px;
  padding-bottom: 78px;
}

/* Stronger importance section: clearer heading, icons and labels. */
#main .poster-importance > h2 {
  margin-bottom: 40px;
  font-size: clamp(32px, 3.35vw, 47px);
  font-weight: 600;
}

#main .importance-grid {
  row-gap: 30px;
  grid-auto-rows: minmax(112px, auto);
}

#main .importance-grid article,
#main .importance-grid article:nth-child(odd) {
  grid-template-columns: 84px minmax(0, 1fr);
  min-height: 112px;
  align-content: center;
}

#main .importance-grid article:nth-child(odd) {
  grid-template-columns: minmax(0, 1fr) 84px;
}

#main .importance-grid i {
  width: 84px;
  height: 84px;
  font-size: 34px;
  border-width: 2px;
  background: rgba(252, 251, 247, .66);
}

#main .importance-grid h3 {
  font-size: 22px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 6px;
}

#main .importance-grid p {
  margin-top: 0;
  margin-bottom: 0;
}

/* Equal specimen captions: two-line names and bottom-aligned accession badges. */
#main .specimen-concept-item em,
#main .specimen-concept-small em,
#main .specimen-concept-featured em {
  box-sizing: border-box;
  width: min(240px, 100%);
  max-width: 240px;
  min-height: 92px;
  align-self: start;
  justify-self: center;
  padding: 10px 13px 8px;
}

#main .specimen-concept-item em > span {
  display: -webkit-box;
  min-height: 2.6em;
  overflow: hidden;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#main .specimen-concept-item em > b {
  margin-top: auto;
  margin-bottom: 0;
}

/* Gold thread connecting the circular gallery specimens. */
#main .specimen-concept::before {
  border: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 345' preserveAspectRatio='none'%3E%3Cpath d='M-20 315 C145 165 290 140 455 205 C620 270 785 278 960 178 C1130 80 1270 135 1460 15' fill='none' stroke='%23c4932f' stroke-width='2.2'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: .42;
}

/* A pale blush wash anchors the largest specimen circle. */
#main .specimen-concept-featured::before {
  content: '';
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 42%;
  width: clamp(380px, 36vw, 550px);
  aspect-ratio: 512 / 276;
  background: url('../img/paint-blush.png') center / contain no-repeat;
  opacity: .24;
  transform: translate(-50%, -50%) rotate(-5deg);
  pointer-events: none;
}

/* Gallery stays clean; the closing wave remains below. */
#main .herbarium-gallery-medical {
  overflow: hidden;
  background: none;
}

/* A single sage paint mark sits beside the gallery title without touching it. */
#main .medical-gallery-heading {
  position: relative;
}

#main .medical-gallery-heading::before {
  content: '';
  position: absolute;
  right: 70%;
  top: 50%;
  width: clamp(280px, 28vw, 410px);
  aspect-ratio: 537 / 278;
  background: url('../img/paint-sage.png') center / contain no-repeat;
  opacity: .68;
  transform: translateY(-50%) rotate(-3deg);
  pointer-events: none;
}

#main .herbarium-gallery-medical::after {
  content: '';
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 92px;
  background: url('../img/gallery-bottom-curve.svg') center top / 100% 100% no-repeat;
  pointer-events: none;
}

/* The wash now belongs to the shared transition cluster above. */
#main .browse-heading {
  position: relative;
  isolation: isolate;
}

#main .browse-heading::before {
  content: none;
}

/* Three deliberate leaf accents, each tied to a heading or image. */
#main .botanical-leaf-accent {
  position: absolute;
  z-index: 2;
  display: block;
  width: 72px;
  aspect-ratio: 1;
  background: url('../img/leaf-loose-dark.png?v=2') center / contain no-repeat;
  opacity: .88;
  filter: drop-shadow(2px 4px 2px #4c49301c);
  pointer-events: none;
}

#main .botanical-leaf-accent--preservation {
  top: -14px;
  right: 2%;
  width: 64px;
  transform: rotate(22deg);
}

#main .type-section .botanical-leaf-accent--types {
  left: 16%;
  top: 58%;
  width: 66px;
  transform: rotate(-18deg);
}

#main .browse-heading .botanical-leaf-accent--explore {
  right: 3%;
  top: 50%;
  width: 76px;
  transform: translateY(-50%) rotate(28deg);
}

/* Editorial collection gateway: one primary route with three supporting routes. */
#main .browse.herbarium-explore--gateway {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  padding: 24px 0 18px;
}

#main .browse.herbarium-explore--gateway > a {
  position: relative;
  display: block;
  min-width: 0;
  height: auto;
  min-height: 220px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #e8ede3;
  box-shadow: 0 12px 30px rgba(52, 68, 44, .12);
}

#main .browse.herbarium-explore--gateway > .explore-gateway-featured {
  grid-column: 1;
  grid-row: 1 / 3;
  min-height: 458px;
}

#main .browse.herbarium-explore--gateway > .explore-gateway-type {
  grid-column: 2 / 4;
  grid-row: 1;
}

#main .browse.herbarium-explore--gateway .browse-card-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  aspect-ratio: auto;
  background-position: center;
  background-size: cover;
  transition: transform .45s ease, filter .45s ease;
}

#main .browse.herbarium-explore--gateway .explore-gateway-featured .browse-card-image {
  background-position: center 38%;
}

#main .browse.herbarium-explore--gateway .browse-card-copy {
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  height: auto;
  min-height: 0;
  padding: 54px 62px 24px 24px;
  flex-direction: column;
  justify-content: flex-end;
  color: #fff;
  background: linear-gradient(180deg, transparent 0%, rgba(23, 40, 31, .86) 64%, rgba(19, 34, 27, .96) 100%);
  transform: none;
}

#main .browse.herbarium-explore--gateway .browse-card-copy::after {
  content: none;
}

#main .browse.herbarium-explore--gateway .browse-card-copy strong {
  color: inherit;
  font-size: 22px;
  line-height: 1.35;
}

#main .browse.herbarium-explore--gateway .browse-card-copy small:not(.browse-card-kicker) {
  max-width: 620px;
  margin-top: 7px;
  color: rgba(255, 255, 255, .82);
  font-size: 16px;
  line-height: 1.55;
}

#main .browse.herbarium-explore--gateway .browse-card-copy .browse-card-kicker {
  margin: 0 0 6px;
  color: #e1bd70;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
}

#main .browse.herbarium-explore--gateway > a > b {
  position: absolute;
  z-index: 3;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: 34px;
  height: 34px;
  margin: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .52);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .08);
  opacity: 1;
  transform: none;
}

#main .browse.herbarium-explore--gateway > a:hover {
  background: #e8ede3;
  box-shadow: 0 17px 38px rgba(52, 68, 44, .18);
  transform: translateY(-4px);
}

#main .browse.herbarium-explore--gateway > a:hover .browse-card-image {
  filter: saturate(.92) contrast(1.03);
  transform: scale(1.035);
}

#main .browse.herbarium-explore--gateway > a:hover .browse-card-copy {
  height: auto;
  padding-top: 54px;
  transform: none;
}

/* Speckles no longer float in the type section; they join the transition below. */
#main .type-section::after {
  content: none;
}

@media (max-width: 991px) {
  #main .collection-feature {
    min-height: 0;
    margin-top: 105px;
  }

  #main .collection-feature::before {
    right: -120px;
    opacity: .1;
  }

  #main .collection-feature::after {
    right: -20px;
    opacity: .3;
  }

  #main .collection-feature .qbg-story-visual {
    height: 420px;
  }

  #main .browse.herbarium-explore--gateway {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(240px, auto));
  }

  #main .browse.herbarium-explore--gateway > .explore-gateway-featured,
  #main .browse.herbarium-explore--gateway > .explore-gateway-type {
    grid-column: auto;
    grid-row: auto;
    min-height: 240px;
  }

  #main .container > .poster-importance::after {
    background-size: 220px auto, 560px auto, 640px auto;
  }

  #main .medical-gallery-heading::before {
    right: 72%;
    width: 250px;
  }
}

@media (max-width: 760px) {
  #main .collection-feature {
    margin-top: 60px;
  }

  #main .collection-feature::before {
    right: -150px;
    width: 440px;
    opacity: .08;
  }

  #main .collection-feature::after {
    right: -105px;
    width: 430px;
    opacity: .2;
  }

  #main .statistics .section-leaf--qbg {
    width: 108px;
    opacity: .62;
  }

  #main .statistics .section-leaf--qbg-sage {
    top: -8px;
    right: 5px;
  }

  #main .statistics .section-leaf--qbg-cream {
    top: 24px;
    right: -44px;
  }

  #main .type-section .section-leaf--types {
    top: 8px;
    right: -24px;
    left: auto;
    width: 118px;
    opacity: .46;
    transform: rotate(12deg);
  }

  #main .container > .poster-importance::after {
    top: 0 !important;
    bottom: 0 !important;
    height: auto;
    background-position: 88% 68%, 84% 64%, 86% 62% !important;
    background-size: 170px auto, 440px auto, 500px auto;
    opacity: .22;
  }

  #main .herbarium-gallery-medical::after {
    bottom: 0;
    height: 58px;
  }

  #main .medical-gallery-heading::before {
    content: none;
  }

  #main .botanical-leaf-accent--preservation {
    top: -10px;
    right: 2%;
    width: 58px;
  }

  #main .type-section .botanical-leaf-accent--types {
    left: 8%;
    top: 26%;
    width: 50px;
  }

  #main .browse-heading .botanical-leaf-accent--explore {
    right: 0;
    width: 54px;
  }

  #main .specimen-concept-featured::before {
    width: min(440px, 125vw);
    opacity: .2;
  }

  #main .collection-feature .statistics p,
  #main .preservation-story .workshop p,
  #main .type-section li p,
  #main .importance-grid p {
    font-size: 17px !important;
  }

  #main .poster-importance {
    padding-top: 54px;
    padding-bottom: 58px;
  }

  #main .importance-grid article,
  #main .importance-grid article:nth-child(odd) {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  #main .importance-grid i {
    width: 72px;
    height: 72px;
    font-size: 29px;
  }

  #main .specimen-concept-item em {
    min-height: 78px;
    font-size: 17px !important;
  }

  #main .collection-feature .qbg-story-visual {
    width: min(100%, 430px);
    height: auto;
  }

  #main .collection-feature .qbg-story-visual::before {
    width: 90%;
    height: auto;
    left: 5%;
    top: 2%;
  }

  #main .collection-feature .qbg-press {
    width: 54%;
    height: 75%;
    left: 4%;
    top: 1%;
  }

  #main .collection-feature .qbg-sheet {
    width: 41%;
    height: 58%;
    right: 1%;
    bottom: 1%;
  }

  #main .specimen-concept-item em,
  #main .specimen-concept-small em,
  #main .specimen-concept-featured em {
    width: min(220px, 100%);
    min-height: 84px;
  }

  #main .browse.herbarium-explore--gateway {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    gap: 14px;
  }

  #main .browse.herbarium-explore--gateway > a,
  #main .browse.herbarium-explore--gateway > .explore-gateway-featured,
  #main .browse.herbarium-explore--gateway > .explore-gateway-type {
    grid-column: auto;
    grid-row: auto;
    min-height: 270px;
  }

  #main .browse.herbarium-explore--gateway .browse-card-copy {
    padding: 48px 58px 20px 20px;
  }

  #main .browse.herbarium-explore--gateway .browse-card-copy strong {
    font-size: 20px;
  }
}

@media (prefers-reduced-transparency: reduce) {
  #main .collection-feature::before,
  #main .preservation-story .workshop::before,
  #main .poster-importance::after {
    opacity: .04;
  }
}

/* Index section backgrounds share the QBG image circle sage. */
#main .preservation-story::before {
  background-image: url("../img/preservation-wave-index-sage.svg?v=20261116-sage-restored-01");
}
#main .poster-importance::before {
  background-image: url("../img/importance-wave-index-sage.svg?v=20261116-sage-restored-01");
}
