/* Shared editorial treatment for the existing CMS hero markup. */
body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) {
  --hero-rule: rgb(244 240 232 / 30%);
  --hero-title-size: clamp(3.5rem, 5.7vw, 6.25rem);
  position: relative;
  isolation: isolate;
  display: flex;
  min-height: clamp(34rem, calc(80svh - 5.5rem), 46rem);
  align-items: flex-end;
  padding-block: clamp(4.5rem, 7vw, 6rem) 5.25rem;
}

body[data-page="home"] main > section:first-child:has(.animate-fade-up) {
  --hero-title-size: clamp(3.75rem, 6.4vw, 7rem);
  min-height: clamp(36rem, calc(90svh - 5.5rem), 51rem);
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up)::after {
  position: absolute;
  z-index: 2;
  right: max(2rem, calc((100% - 76rem) / 2));
  bottom: 2rem;
  left: max(2rem, calc((100% - 76rem) / 2));
  height: 1px;
  background: var(--hero-rule);
  content: "";
  pointer-events: none;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > img {
  z-index: -2;
  opacity: 1;
  filter: none;
  transform: none;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > div.absolute {
  z-index: -1;
  pointer-events: none;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > img + .absolute {
  background: linear-gradient(90deg, rgb(17 17 17 / 88%) 0%, rgb(17 17 17 / 70%) 32%, rgb(17 17 17 / 28%) 62%, rgb(17 17 17 / 4%) 100%);
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > img + .absolute + .absolute {
  background: linear-gradient(0deg, rgb(17 17 17 / 60%), transparent 65%);
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > .relative {
  z-index: 1;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up {
  width: 100%;
  max-width: 49rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  animation: none;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) h1 {
  max-width: 17ch;
  margin: 0;
  font-size: var(--hero-title-size);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -.04em;
  text-wrap: balance;
  text-shadow: 0 2px 24px rgb(0 0 0 / 14%);
}

body[data-page="home"] main > section:first-child:has(.animate-fade-up) h1 {
  max-width: 15ch;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > p:first-child {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 1rem;
  margin: 0 0 1.75rem;
  color: var(--af-paper);
  font-size: .68rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .24em;
  opacity: 1;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > p:first-child::before {
  width: 2.75rem;
  flex: 0 0 2.75rem;
  background: var(--af-sand);
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > p:nth-of-type(2) {
  max-width: 43ch;
  margin-top: 1.65rem;
  color: rgb(251 249 244 / 90%);
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  line-height: 1.6;
  text-shadow: 0 1px 12px rgb(0 0 0 / 18%);
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: .85rem;
  margin-top: 2rem;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) a.inline-flex {
  min-height: 3.35rem;
  gap: 1.1rem;
  padding: .95rem 1.4rem !important;
  border-radius: .2rem;
  font-size: .71rem;
  line-height: 1.45;
  letter-spacing: .1em;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) a.inline-flex + a.inline-flex {
  border-color: rgb(251 249 244 / 65%) !important;
  color: var(--af-paper) !important;
  background: rgb(17 17 17 / 65%) !important;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) a.inline-flex + a.inline-flex:hover {
  border-color: var(--af-paper) !important;
  color: var(--af-ink) !important;
  background: var(--af-paper) !important;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > * {
  animation: af-hero-reveal .8s var(--af-ease) both;
}

body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > h1 { animation-delay: .06s; }
body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > p:nth-of-type(2) { animation-delay: .12s; }
body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > div { animation-delay: .18s; }

@keyframes af-hero-reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Text-only editorial openings retain a quieter reading hierarchy. */
body[data-page="insight-article"] .af-insight-hero {
  position: relative;
  padding-block: clamp(3.5rem, 6vw, 6rem) clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--af-line);
  background: linear-gradient(120deg, #171512, #302a23);
}

body[data-page="insight-article"] .af-insight-breadcrumb { margin-bottom: 2.75rem; }

body[data-page="insight-article"] .af-insight-kicker {
  display: flex;
  align-items: center;
  gap: 1rem;
}

body[data-page="insight-article"] .af-insight-kicker::before {
  width: 2.75rem;
  height: 1px;
  background: currentColor;
  content: "";
}

body[data-page="insight-article"] .af-insight-hero h1 {
  max-width: 22ch !important;
  margin-top: 1.5rem;
  font-size: clamp(3rem, 5vw, 5.5rem) !important;
  line-height: 1.06;
  letter-spacing: -.035em;
}

body[data-page="insight-article"] .af-insight-deck {
  max-width: 52ch;
  margin-top: 1.75rem;
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
}

@media (min-width: 768px) and (max-height: 800px) {
  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) {
    --hero-title-size: clamp(3.25rem, 5.2vw, 5.4rem);
    min-height: clamp(31rem, calc(100svh - 5.5rem), 42rem);
    padding-block: 3.25rem 4.5rem;
  }
}

@media (max-width: 1023px) {
  body.cms-hero-visible :is(.cms-mobile-cta, .af-chatbot[data-open="false"]) {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 767px) {
  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) {
    --hero-title-size: clamp(2.65rem, 10.8vw, 4rem);
    min-height: clamp(35rem, calc(100svh - 4.25rem), 47rem);
    padding-block: 5rem 5.75rem;
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up)::after {
    right: 1.25rem;
    bottom: 3.15rem;
    left: 1.25rem;
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > img + .absolute {
    background: linear-gradient(0deg, rgb(17 17 17 / 94%) 0%, rgb(17 17 17 / 78%) 30%, rgb(17 17 17 / 36%) 60%, rgb(17 17 17 / 8%) 100%);
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) > img + .absolute + .absolute {
    background: linear-gradient(90deg, rgb(17 17 17 / 22%), transparent 85%);
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) h1 {
    max-width: 17ch;
    line-height: 1.04;
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > p:first-child {
    gap: .8rem;
    margin-bottom: 1.35rem;
    font-size: .62rem;
    letter-spacing: .2em;
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > p:nth-of-type(2) {
    max-width: 35ch;
    margin-top: 1.25rem;
    font-size: 1.05rem;
    line-height: 1.6;
  }

  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > div:last-child {
    gap: .7rem;
    margin-top: 1.65rem;
  }

  body[data-page="insight-article"] .af-insight-hero { padding-block: 3.25rem; }
  body[data-page="insight-article"] .af-insight-breadcrumb { margin-bottom: 2rem; }
  body[data-page="insight-article"] .af-insight-hero h1 {
    max-width: 19ch !important;
    font-size: clamp(2.35rem, 9.75vw, 3.75rem) !important;
  }
}

@media (max-width: 480px) {
  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > div:last-child {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-cms-rendered="true"] main > section:first-child:has(.animate-fade-up) .animate-fade-up > * {
    animation: none;
  }
}
