/*
 * An Insights article (single.php), as in the Article wireframe:
 *
 * 1. The heading band on the darkest teal: the breadcrumb, the eyebrow after a teal rule, the title in white, the
 *    excerpt and the byline, with the key date card beside them at the foot. On tablets and phones the card
 *    follows the byline.
 * 2. "In a nutshell" in a pale teal band of its own, when the article has one.
 * 3. The article beside "In this article" and the free call box. On tablets and phones they follow the article.
 * 4. Related articles on pale teal, three side by side, or one above another on tablets and phones.
 *
 * The Explainer layout (insight-article--explainer) is at the end: a light heading with "Myth and fact" beside the
 * title, "Jump to" pills, and the article the full width of the page, its sections as bands.
 *
 * Each band runs the width of the page; the words inside keep to 1200px, centred, so lines stay readable. The
 * ready-made pieces inside the article are styled in assets/css/components/insight-pieces.css.
 */

.insight-article {
  --insight-article-side: max(clamp(24px, 5vw, 64px), calc((100% - 1200px) / 2));

  margin: 0;
  background: var(--white);
}

/* 1. The heading band */

.insight-article__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px 56px;
  padding: 36px var(--insight-article-side) 48px;
  background: #0d3d39;
}

.insight-article__head-main {
  display: flex;
  flex: 999 1 620px;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.insight-article__breadcrumb {
  color: #9fded7;
  font-size: 14px;
}

.insight-article__breadcrumb a {
  color: var(--teal-light);
}

.insight-article__breadcrumb a:hover,
.insight-article__breadcrumb a:focus-visible {
  color: var(--white);
}

/* The eyebrow, after a short teal rule */

.insight-article__eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--teal);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
}

.insight-article__eyebrow::before {
  flex-shrink: 0;
  width: 32px;
  height: 2px;
  background: var(--teal);
  content: "";
}

.insight-article__title {
  max-width: 820px;
  margin: 0;
  color: var(--white);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(36px, 5vw, 52px);
  font-weight: 400;
  line-height: 1.06;
  text-transform: none;
}

.insight-article__standfirst {
  max-width: 720px;
  margin: 0;
  color: var(--teal-light);
  font-size: 18px;
  line-height: 1.6;
}

.insight-article__byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  color: #9fded7;
  font-size: 14px;
}

/* The key date card, outlined in pale teal */

.insight-article__key-date {
  display: flex;
  flex: 0 0 300px;
  flex-direction: column;
  gap: 6px;
  padding: 24px;
  border: 1px solid rgba(223, 245, 242, 0.25);
  border-radius: 16px;
}

.insight-article__key-date p {
  margin: 0;
}

.insight-article__key-label {
  color: var(--teal);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.insight-article__key-value {
  color: var(--white);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(30px, 3vw, 38px);
  line-height: 1.05;
}

.insight-article__key-note {
  color: var(--teal-light);
  font-size: 14px;
  line-height: 1.5;
}

/* 2. "In a nutshell": the piece loses its own box, as the band is its background */

.insight-article__nutshell {
  padding: 40px var(--insight-article-side);
  border-bottom: 1px solid var(--border);
  background: var(--teal-pale);
}

.insight-article__nutshell .wp-block-group.insight-piece--nutshell {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.insight-article__nutshell [id] {
  scroll-margin-top: clamp(96px, 12vw, 132px);
}

/* 3. The article and its aside */

.insight-article__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
  gap: 48px;
  padding: 44px var(--insight-article-side) 56px;
}

.insight-article__content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  font-size: 17px;
  line-height: 1.7;
}

.insight-article__content > * {
  margin: 0;
}

/* The opening paragraph leads, a little larger */

.insight-article__content > p:first-child {
  color: #0d3d39;
  font-size: 19px;
  line-height: 1.65;
}

/* Headings land below the sticky header when picked from "In this article" */

.insight-article__content [id] {
  scroll-margin-top: clamp(96px, 12vw, 132px);
}

.insight-article__content h2:not(.insight-piece__title, .insight-piece__heading) {
  margin-top: 8px;
  color: #0d3d39;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(26px, 3vw, 30px);
  font-weight: 400;
  line-height: 1.2;
  text-transform: none;
}

.insight-article__content h3 {
  color: #0d3d39;
  font-size: 22px;
  line-height: 1.3;
}

.insight-article__content a {
  color: var(--teal-darker);
}

.insight-article__content ul:not([class*="insight-piece__"]),
.insight-article__content ol:not([class*="insight-piece__"]) {
  padding-left: 1.25em;
}

.insight-article__content img {
  max-width: 100%;
  height: auto;
  border-radius: 14px;
}

.insight-article__note {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}

.insight-article__aside {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.insight-article__help {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border-radius: 18px;
  background: #0d3d39;
  color: #f4f3ee;
}

.insight-article__help-title {
  margin: 0;
  color: var(--white);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  text-transform: none;
}

.insight-article__help-text {
  margin: 0;
  color: var(--teal-light);
  font-size: 15px;
  line-height: 1.55;
}

.insight-article__help-button {
  padding: 14px 18px;
  border-radius: 8px;
  background: var(--teal);
  color: #0d3d39;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.insight-article__help-button:hover,
.insight-article__help-button:focus-visible {
  background: var(--white);
}

.insight-article__contents {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
}

.insight-article__contents-title {
  margin: 0;
  color: #0d3d39;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  text-transform: none;
}

.insight-article__contents a {
  color: var(--teal-darker);
  font-size: 15px;
}

/* 4. Related articles */

.insight-article__related {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 44px var(--insight-article-side);
  background: var(--teal-pale);
}

.insight-article__related-title {
  margin: 0;
  color: #0d3d39;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 28px;
  font-weight: 400;
  text-transform: none;
}

.insight-article__related-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-article__related-cards > li {
  display: flex;
  margin: 0;
}

.insight-article__related-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--white);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.insight-article__related-card:hover,
.insight-article__related-card:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 10px 24px rgba(21, 89, 82, 0.1);
}

.insight-article__related-label {
  color: var(--teal-darker);
  font-size: 12px;
  font-weight: 600;
}

.insight-article__related-name {
  color: #0d3d39;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.35;
}

/*
 * The Explainer layout. The heading on cream, "Myth and fact" beside the title (below it once there's no room),
 * then "Jump to" pills. The article runs the full width: loose paragraphs keep to a readable 760px; each section is
 * a band, alternately white and pale teal; the plan is a deep teal band; the bottom line and the sources are
 * centred.
 */

.insight-article--explainer .insight-article__head {
  align-items: center;
  gap: 32px 48px;
  padding-bottom: 52px;
  background: #f4f3ee;
}

.insight-article--explainer .insight-article__breadcrumb,
.insight-article--explainer .insight-article__byline {
  color: var(--text-muted);
}

.insight-article--explainer .insight-article__breadcrumb a {
  color: var(--teal-darker);
}

.insight-article--explainer .insight-article__breadcrumb a:hover,
.insight-article--explainer .insight-article__breadcrumb a:focus-visible {
  color: #0d3d39;
}

.insight-article--explainer .insight-article__eyebrow {
  color: var(--teal-dark);
}

.insight-article--explainer .insight-article__eyebrow::before {
  background: var(--teal-dark);
}

.insight-article--explainer .insight-article__title {
  color: #0d3d39;
}

.insight-article--explainer .insight-article__standfirst {
  max-width: 620px;
  color: var(--text);
}

.insight-article__myth {
  flex: 0 1 440px;
  min-width: 0;
}

/* "Jump to": a pill for each section */

.insight-article__jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 16px var(--insight-article-side);
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.insight-article__jump-title {
  margin-right: 6px;
  color: #0d3d39;
  font-weight: 600;
}

.insight-article__jump a {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--teal-darker);
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.insight-article__jump a:hover,
.insight-article__jump a:focus-visible {
  border-color: var(--teal);
  background: var(--teal-pale);
}

/* The article, the full width */

.insight-article--explainer .insight-article__body {
  display: block;
  padding: 0;
}

.insight-article--explainer .insight-article__content {
  gap: 0;
  padding-bottom: 48px;
}

.insight-article--explainer .insight-article__content > * {
  margin: 0 0 24px;
  padding-right: max(var(--insight-article-side), calc(100% - 760px - var(--insight-article-side)));
  padding-left: var(--insight-article-side);
}

.insight-article--explainer .insight-article__content > :first-child {
  margin-top: 48px;
}

/* Sections as bands, alternately white and pale teal */

.insight-article--explainer .insight-article__content > .insight-piece--section,
.insight-article--explainer .insight-article__content > .insight-piece--plan,
.insight-article--explainer .insight-article__content > .insight-piece--bottom {
  margin: 0;
  padding: 56px var(--insight-article-side);
  border-radius: 0;
}

.insight-article--explainer .insight-article__content > .insight-piece--section:nth-of-type(even) {
  background: var(--teal-pale);
}

.insight-article--explainer .insight-article__content > .insight-piece--plan {
  gap: 14px;
}

.insight-article--explainer .insight-article__content > .insight-piece--bottom {
  padding-top: 64px;
  padding-bottom: 40px;
}

.insight-article--explainer .insight-article__content [id] {
  scroll-margin-top: clamp(80px, 10vw, 112px);
}

/* A section holding only cards: its heading beside them, on laptops */

@media (min-width: 1024px) {
  .insight-article--explainer .insight-piece--section:has(.insight-piece--cards):not(:has(.insight-piece--hours, .insight-piece--compare)) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    align-content: center;
    align-items: center;
    gap: 12px 48px;
  }

  .insight-article--explainer .insight-piece--section:has(.insight-piece--cards):not(:has(.insight-piece--hours, .insight-piece--compare)) .insight-piece__eyebrow,
  .insight-article--explainer .insight-piece--section:has(.insight-piece--cards):not(:has(.insight-piece--hours, .insight-piece--compare)) .insight-piece__heading,
  .insight-article--explainer .insight-piece--section:has(.insight-piece--cards):not(:has(.insight-piece--hours, .insight-piece--compare)) .insight-piece__intro {
    grid-column: 1;
  }

  .insight-article--explainer .insight-piece--section:has(.insight-piece--cards):not(:has(.insight-piece--hours, .insight-piece--compare)) .insight-piece--cards {
    grid-row: 1 / span 3;
    grid-column: 2;
  }
}

/* The sources and the guidance note, centred under the bottom line */

.insight-article--explainer .insight-article__content > .insight-piece--sources,
.insight-article--explainer .insight-article__content > .insight-article__note {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 24px 0;
  border-top: 1px solid var(--border);
  box-sizing: border-box;
}

/* Small laptops and tablets: once there's no room beside the heading, the key date card runs its full width */

@media (max-width: 1099px) {
  .insight-article__key-date {
    flex: 1 1 100%;
  }
}

/* Tablets: the aside follows the article, its two boxes side by side; related articles one above another */

@media (max-width: 1023px) {
  .insight-article__body {
    grid-template-columns: minmax(0, 1fr);
  }

  .insight-article__aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .insight-article__related-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones */

@media (max-width: 700px) {
  .insight-article {
    --insight-article-side: 16px;
  }

  .insight-article__head {
    gap: 24px;
    padding-top: 28px;
    padding-bottom: 36px;
  }

  .insight-article__standfirst {
    font-size: 17px;
  }

  .insight-article__key-date {
    padding: 20px;
  }

  .insight-article__nutshell {
    padding-top: 32px;
    padding-bottom: 32px;
  }

  .insight-article--explainer .insight-article__content > .insight-piece--section,
  .insight-article--explainer .insight-article__content > .insight-piece--plan {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .insight-article__myth {
    flex-basis: 100%;
  }

  .insight-article__body {
    gap: 36px;
    padding-top: 32px;
    padding-bottom: 44px;
  }

  .insight-article__aside {
    display: flex;
    align-items: stretch;
  }
}
