/* TOC Page */

/* The hero is as tall as its image (full width, natural aspect ratio), so a
   short image gives a short hero. The image is kept between:
   - --hero-min: room for the fixed header, title and subtitle
   - --hero-max: the old fixed heights; taller images are cropped (cover)
   The overlay is absolute (inset: 0), so it follows the image's height. */
.site-hero--listing {
  position: relative; /* anchors the decorative squares */
  height: auto;       /* overrides the global .site-hero min(70vh, 600px) */
  --hero-min: 360px;
  --hero-max: 400px;
}

@media (min-width: 576px)  { .site-hero--listing { --hero-max: 450px; } }                     /* sm */
@media (min-width: 768px)  { .site-hero--listing { --hero-max: 550px; } }                     /* md */
@media (min-width: 992px)  { .site-hero--listing { --hero-min: 480px; --hero-max: 700px; } }  /* lg */
@media (min-width: 1200px) { .site-hero--listing { --hero-max: 800px; } }                     /* xl */
@media (min-width: 1400px) { .site-hero--listing { --hero-max: 900px; } }                     /* xxl */

/* Image-only style has no text over the image, so it can be as short as the image. */
.site-hero--listing.site-hero--image-only {
  --hero-min: 0px;
}

/* Two classes so this beats the global .site-hero__media img { height: 100% }
   whatever order the libraries load in. */
.site-hero--listing .site-hero__media img {
  display: block;
  width: 100%;
  height: auto;
  min-height: var(--hero-min);
  max-height: var(--hero-max);
  object-fit: cover;
}

/* Default style: dark gradient from the left so the white text reads.
   The alternative style doesn't print the overlay, so it gets none. */
.site-hero--listing .site-hero__overlay {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, #2f2f48 0%, rgba(23, 23, 35, 0.48) 34%, rgba(0, 0, 0, 0) 53%);
}

/* Title and subtitle sit left, in the container, over the hero image. */
.site-hero--listing .site-hero__content {
  max-width: 860px;
  align-items: flex-start;
  text-align: left;
}

.site-hero__title {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.33;
  color: #fff;
}

.site-hero__subtitle {
  font-size: clamp(32px, calc(32px + (72 - 32) * (100vw - 414px) / (1920 - 414)), 72px);
  font-weight: 300;
  line-height: 1.22;
  color: #fff;
}

/* Decorative squares (shared partial), right of centre at mid-height. */
.toc-hero__squares {
  top: 50%;
  right: 13vw;
  z-index: 1;
  opacity: 0.8;
}

@media (max-width: 992px) {
  .toc-hero__squares { display: none; } /* no design below 993px yet */
}

.listing-tagline {
  padding: 7rem 0 0;
  background-image: linear-gradient(51deg, #f2edea 0%, #f4f4fc 99%);
}

/* No hero image: clear the fixed header instead. */
.listing-tagline--no-hero {
  padding-top: calc(var(--header-height, 72px) + 5rem);
}

@media (max-width: 992px) {
  .listing-tagline--no-hero {
    padding-top: calc(var(--header-height, 72px) + 3rem);
  }
}

/* Alternative style: title, subtitle and bars move out of the hero. */
.listing-tagline__title {
  margin: 0 0 1.5rem;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.33;
  color: #24125f;
}

.listing-tagline__subtitle {
  margin: 0;
  font-size: clamp(32px, calc(32px + (72 - 32) * (100vw - 414px) / (1920 - 414)), 72px);
  font-weight: 300;
  line-height: 1.22;
  color: #24125f;
}

/* Purple and gold dashes. Colours sampled from the design; confirm. */
.listing-tagline__bars {
  display: flex;
  gap: 8px;
}

.listing-tagline--alt .listing-tagline__bars {
  margin-top: clamp(2rem, calc(2rem + (48 - 32) * (100vw - 414px) / (1920 - 414)), 3rem);
}

.listing-tagline__bars::before,
.listing-tagline__bars::after {
  content: "";
  height: 8px;
  border-radius: 4px;
}

.listing-tagline__bars::before {
  width: 72px;
  background: #a9a9d4;
}

.listing-tagline__bars::after {
  width: 24px;
  background: #ecbf81;
}

/* Section content (CKEditor). Editors set a size per paragraph with the
   Style dropdown; see the note at the top of the TOC template. */
.listing-tagline__body {
  margin-top: 1.25rem; /* below the bars */
  color: #24125f;
}

.listing-tagline--alt .listing-tagline__body {
  margin-top: clamp(2.5rem, calc(2.5rem + (64 - 40) * (100vw - 414px) / (1920 - 414)), 4rem);
}

.listing-tagline__body > * {
  margin: 0;
}

.listing-tagline__body > * + * {
  margin-top: 1.5rem;
}

/* Large: unclassed paragraphs in the default style, or picked in the editor. */
.listing-tagline__body p,
.listing-tagline__body p.listing-tagline__text {
  font-family: 'Merriweather', serif;
  font-size: clamp(28px, calc(28px + (56 - 28) * (100vw - 414px) / (1920 - 414)), 56px);
  font-weight: 300;
  line-height: 1.29;
  color: #24125f;
}

/* Small: unclassed paragraphs in the alternative style, or picked in the editor. */
.listing-tagline--alt .listing-tagline__body p,
.listing-tagline__body p.listing-tagline__text-small {
  font-family: 'Merriweather', serif;
  font-size: clamp(16px, calc(16px + (20 - 16) * (100vw - 414px) / (1920 - 414)), 20px);
  font-weight: 300;
  line-height: 1.6;
  color: #242935;
}

/* An explicit "large" still wins in the alternative style. */
.listing-tagline--alt .listing-tagline__body p.listing-tagline__text {
  font-size: clamp(28px, calc(28px + (56 - 28) * (100vw - 414px) / (1920 - 414)), 56px);
  line-height: 1.29;
  color: #24125f;
}

/* Text column narrows at desktop; full width below 992px. */
@media (min-width: 993px) {
  .listing-tagline__body {
    max-width: 80%;
  }
}

.linked-pages {
  padding: 7rem 0 5rem;
  background-image: linear-gradient(51deg, #f2edea 0%, #f4f4fc 99%);
}

.linked-pages__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.linked-card {
  position: relative;        /* anchor for the stretched link */
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2.5rem;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.linked-card:hover,
.linked-card:focus-within {
  border-color: #7e61de;
  box-shadow: 0 4px 16px rgba(36, 18, 95, 0.08);
}

.linked-card__title {
  margin: 0;
  font-size: clamp(24px, calc(24px + (32 - 24) * (100vw - 414px) / (1920 - 414)), 32px);
  font-weight: 500;
  line-height: 1;
  color: #242935;
}

.linked-card__link {
  color: inherit;
  text-decoration: none;
}

/* Stretches the title link over the whole card. */
.linked-card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.linked-card__link:focus-visible {
  outline: none;
}

.linked-card:focus-within {
  outline: 2px solid #7e61de;
  outline-offset: 2px;
}

.linked-card__excerpt {
  margin: 0;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.56;
  color: #242935;
}

/* Pushed to the bottom right, so arrows line up across cards of different heights. */
.linked-card__icon {
  margin-top: auto;
  align-self: flex-end;
  font-size: 2.5rem;
}

@media (max-width: 992px) {
  .linked-pages__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .linked-pages__grid { grid-template-columns: repeat(1, 1fr); }
}

@media (max-width: 414px) {
  .linked-pages__grid { grid-template-columns: repeat(1, 1fr); }
}