/* Shared page and section typography, using About Us as the reference. */
:root {
  --cw-page-title-size: clamp(43px, calc(3vw + 7px), 65px);
  --cw-section-title-size: 34px;
  --cw-section-title-leading: 1.12;
}

/* SVG language dropdown shared by desktop and mobile. */
.site-language-select { position: relative; margin-left: 12px; flex-shrink: 0; }
.site-language-select summary {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 54px; height: 36px; cursor: pointer; list-style: none;
  border: 0; border-radius: 3px;
}
.site-language-select summary::-webkit-details-marker { display: none; }
.site-language-select summary img,
.site-language-flags__item img { display: block; width: 28px; height: 21px; object-fit: contain; }
.site-language-flags {
  position: absolute; right: 0; top: 100%; z-index: 1100;
  display: flex; flex-direction: column; gap: 4px; padding: 6px;
  background: #2d6342; border-radius: 4px; box-shadow: 0 6px 18px rgb(0 0 0 / 16%);
}
body .site-language-flags__item {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 36px; padding: 2px; border: 0; border-radius: 3px;
  transition: box-shadow 150ms ease;
  box-sizing: border-box; background: transparent;
}
body .site-language-flags__item:hover { box-shadow: 0 0 8px 1px rgb(255 255 255 / 16%); background: transparent; outline: none; }
.site-language-select summary:hover { box-shadow: none; background: transparent; outline: none; }
.site-language-select__chevron { display: block; flex-shrink: 0; }
body .site-language-flags__item:focus-visible,
.site-language-select summary:focus-visible { outline: none; box-shadow: 0 0 10px 3px rgb(255 255 255 / 55%); }
.site-language-flags__item.is-disabled { opacity: .4; }
.site-mobile-utility .site-language-select__chevron { color: #fff; }
.site-mobile-utility .site-language-select { margin: 12px 0 0; width: fit-content; }
.site-mobile-utility .site-language-flags { right: auto; left: 0; }
@media (max-width: 1024px) {
  .site-language-select summary, body .site-language-flags__item { min-height: 44px; }
}
@media (min-width: 1600px) { :root { --cw-section-title-size: 37px; } }
@media (min-width: 1920px) { :root { --cw-section-title-size: 40px; } }
@media (max-width: 767px) {
  :root {
    --cw-page-title-size: clamp(35px, calc(9vw + 7px), 45px);
    --cw-section-title-size: clamp(23px, 6.8vw, 27px);
    --cw-section-title-leading: 1.14;
  }
}

/* Every page H1 uses the same scale, including category and editorial pages. */
body :is(main, .site-main) h1 {
  font-family: var(--font-heading) !important;
  font-size: var(--cw-page-title-size) !important;
  font-weight: 700 !important;
  line-height: 1.05 !important;
  letter-spacing: normal !important;
  text-transform: uppercase;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

/* Section headings share a scale. Card and dialog titles keep their hierarchy. */
body :is(
  .cw-home-section-title,
  .cw-about-split h2, .cw-about-work > h2,
  .cw-why-wood-properties > h2, .cw-why-properties > h2,
  .cw-why-species-links h2, .cw-why-species-links__title,
  .cw-why-forests > h2, .cw-why-forests-builder > h2,
  .cw-why-sustainable__copy h2, .cw-why-cert__columns h2,
  .cw-species-panel__text h2, .cw-species-section-title,
  .cw-species-why-cta h2, .cw-why-gallery-cta h2,
  .cw-gallery-category__text h2, .cw-programs-list .cw-program-card h2,
  .cw-finishes-intro h2, .cw-resources-intro h2,
  .cw-resources-group__title, .cw-resources-suppliers > h2,
  .cw-program-single-intro h2, .cw-program-offer h2, .cw-program-benefits h2,
  .cw-contact-office h2, .cw-contact-people h2, .cw-contact-resources h2,
  .cw-media-builder-rich-text h2, .cw-media-builder-text-image h2,
  .privacy-policy-page__content h2
) {
  font-family: var(--font-heading) !important;
  font-size: var(--cw-section-title-size) !important;
  font-weight: 400 !important;
  line-height: var(--cw-section-title-leading) !important;
}

/* Longer translated page titles must grow rather than overflow fixed caps. */
.cw-news-featured__content,
.cw-media-single-head,
.cw-gallery-detail__header { min-width: 0; }
.cw-news-featured h1 { max-width: 100%; }
.cw-contact-office h2 {
  margin: 0;
  color: var(--cw-green-primary);
}

/* Featured News is an editorial card title, using its previous size scale. */
body main .cw-news-featured h1 {
  font-size: clamp(28px, 2.5vw, 42px) !important;
  line-height: 1.16 !important;
}
@media (max-width: 767px) {
  body main .cw-news-featured h1 {
    font-size: clamp(27px, 5vw, 34px) !important;
  }
}

.cw-event-card .cw-media-button {
  padding-inline: 12px !important;
  white-space: nowrap;
}

/* Programs listing: give the title a full row and widen its introduction. */
@media (min-width: 1025px) {
  .cw-programs-list .cw-program-card__content {
    width: 100%;
    max-width: none;
  }
  .cw-programs-list .cw-program-card h2 {
    width: 100%;
    max-width: none;
  }
  .cw-programs-list .cw-program-card p {
    width: min(100%, 810px);
    max-width: none;
  }
}

/* Desktop banners: captions use the complete shared container, not a narrow
 * editorial column. Keep the shared H1 scale while removing forced wrapping. */
@media (min-width: 1025px) {
  body main .cw-page-hero .cw-page-hero__content .cw-page-hero__caption {
    width: 100% !important;
    max-width: none !important;
  }
  body main :is(.cw-page-hero, .cw-species-hero, .cw-media-hero, .cw-media-single-hero, .cw-finishes-hero) h1 {
    width: 100% !important;
    max-width: none !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    text-wrap: nowrap !important;
  }
  body main :is(.cw-page-hero, .cw-species-hero, .cw-media-hero, .cw-media-single-hero, .cw-finishes-hero) h1 br {
    display: none;
  }
}
