/* A precomposed Brand cover shares the editorial cover-to-title spacing. */
body.single-portfolio #main-wrapper .es-brand-static-cover[data-es-brand-cover="composed"] {
  --es-editorial-cover-ratio: inherit;
  max-width: none;
  margin-block-end: var(--es-editorial-cover-title-gap) !important;
}

body.single-portfolio #main-wrapper .es-brand-static-cover[data-es-brand-cover="composed"] img {
  aspect-ratio: var(--es-editorial-cover-ratio) !important;
}

body.single-portfolio #main-wrapper [data-wrapper-id="portfolio_single"]:has([data-es-brand-cover="composed"]) .single-portfolio__title h1 {
  text-wrap: balance;
  white-space: pre-line;
}

body.single-portfolio #main-wrapper [data-wrapper-id="portfolio_single"]:has([data-es-brand-cover="composed"]) .single-portfolio__title__subtitle p {
  margin: 14px 0 0;
  color: #004e70;
  font-size: clamp(17px, 1.6vw, 21px);
  font-weight: 550;
  line-height: 1.3;
}

/* The narrative uses the same editorial column as its opening and closing. */
body.single-portfolio #main-wrapper [data-wrapper-id="portfolio_single"]:has(.es-brand-narrative)
  :is(.single-portfolio__title, .es-brand-narrative) {
  max-inline-size: none;
}

.es-brand-narrative {
  --brand-ink: #004e70;
  --brand-tint: #eaf2f4;
  --brand-paper: #f4f4ee;
  --brand-rule: #c7d5d8;
}

.es-brand-narrative .es-brand-narrative__intro {
  margin-block-start: 34px;
}

.es-brand-narrative .es-brand-narrative__copy p {
  max-inline-size: none;
}

.es-brand-narrative .es-brand-narrative__construction {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  grid-template-areas: "copy compare" "study compare";
  gap: 18px clamp(24px, 3vw, 44px);
  align-items: start;
  border-block-start: 1px solid var(--brand-rule);
  margin-block-start: var(--es-editorial-section-gap);
  padding-block-start: 24px;
}

.es-brand-narrative__construction .es-brand-narrative__copy { grid-area: copy; }

html body.single-portfolio #main-wrapper .entry-content .es-brand-narrative .es-brand-narrative__construction h2 {
  margin-block-start: 0 !important;
}

.es-brand-narrative .es-brand-narrative__compare {
  grid-area: compare;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
  align-items: center;
  min-width: 0;
  background: var(--brand-tint);
  padding: clamp(16px, 3vw, 34px);
}

.es-brand-narrative__compare label {
  display: flex;
  align-items: flex-start;
  align-self: start;
  gap: 9px;
  min-height: 44px;
  width: fit-content;
  margin: 0;
  padding: 0;
  line-height: 18px;
  color: var(--brand-ink);
  font-weight: 600;
  cursor: pointer;
}

.es-brand-narrative .es-brand-narrative__compare input[type="checkbox"] {
  position: absolute !important;
  inline-size: 1px !important;
  block-size: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  appearance: none !important;
  clip-path: inset(50%) !important;
  overflow: hidden;
}

.es-brand-narrative .es-brand-narrative__compare label::before,
.es-brand-narrative .es-brand-narrative__compare label::after {
  display: none !important;
  content: none !important;
}

.es-brand-narrative__indicator {
  position: relative;
  box-sizing: border-box;
  flex: 0 0 18px;
  block-size: 18px;
  border: 1px solid currentColor;
  border-radius: 3px;
}

.es-brand-narrative__compare input:checked + label .es-brand-narrative__indicator {
  color: white;
  border-color: var(--brand-ink);
  background: var(--brand-ink);
}

.es-brand-narrative__compare input:checked + label .es-brand-narrative__indicator::before {
  content: "";
  position: absolute;
  inset: 50% auto auto 50%;
  inline-size: 5px;
  block-size: 9px;
  box-sizing: border-box;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -58%) rotate(45deg);
}

.es-brand-narrative__compare input:focus-visible + label .es-brand-narrative__indicator {
  outline: 2px solid var(--brand-ink);
  outline-offset: 2px;
}

.es-brand-narrative__states {
  grid-column: 1 / -1;
  align-self: center;
  min-width: 0;
  translate: 0 -6px;
}
.es-brand-narrative .es-brand-narrative__states img { display: block; inline-size: 100%; block-size: auto; margin: 0; }
.es-brand-narrative .es-brand-narrative__states .es-brand-narrative__guides,
.es-brand-narrative__switch:checked ~ .es-brand-narrative__states .es-brand-narrative__mark { display: none; }
.es-brand-narrative__switch:checked ~ .es-brand-narrative__states .es-brand-narrative__guides { display: block; }

.es-brand-narrative .es-brand-narrative__study { grid-area: study; max-inline-size: 13rem; }
.es-brand-narrative .es-brand-narrative__study span { display: block; margin-block: 6px 0; font-size: 14px; color: var(--brand-ink); text-decoration: underline; line-height: 20px; }
.es-brand-narrative .es-brand-narrative__study a,
.es-brand-narrative .es-brand-narrative__study img { display: block; }
.es-brand-narrative .es-brand-narrative__study img { margin: 0; background: white; border: 1px solid var(--brand-rule); }

.es-brand-narrative .es-brand-narrative__wordmark {
  margin-block: 24px 0;
  background: var(--brand-paper);
  padding: clamp(26px, 5.2vw, 72px) clamp(16px, 4vw, 52px);
}

.es-brand-narrative .es-brand-narrative__wordmark img,
.es-brand-narrative .es-brand-narrative__render img {
  display: block;
  inline-size: 100%;
  block-size: auto;
  margin: 0;
}

.es-brand-narrative .es-brand-narrative__render {
  margin-block: 24px 0;
  inline-size: 100%;
  max-inline-size: none;
}

@media (min-width: 768px) {
  .es-brand-narrative .es-brand-narrative__construction { padding-block-end: 26px; }
  .es-brand-narrative .es-brand-narrative__compare { align-self: stretch; }
  .es-brand-narrative .es-brand-narrative__study { align-self: end; }
  .es-brand-narrative .es-brand-narrative__study a { position: relative; }
  .es-brand-narrative .es-brand-narrative__study span {
    position: absolute;
    inset-block-start: 100%;
    inset-inline-start: 0;
    width: max-content;
  }
}

@media (max-width: 767px) {
  .es-brand-narrative .es-brand-narrative__construction {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "copy" "compare" "study";
    row-gap: 20px;
  }
}
