/* =========================================================================
   pagina.css — the editorial content page.

   Layout families here are deliberately different from the homepage: an
   editorial opener rather than an image-behind-text hero, an offset value row
   rather than a bento, and a sticky chapter index rather than a card grid.
   ========================================================================= */

/* ---------- Editorial opener ----------
   Text first, image beside it and slightly lower, so the page opens like a
   feature rather than a banner. */
.pagina__open { padding-top: clamp(28px, 3vw, 48px); }
.pagina__open-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: clamp(28px, 5vw, 72px); align-items: end;
}
/* No picture, but a standfirst: split the opener across the measure instead —
   headline on the left, standfirst on the right, both sitting on one baseline.
   A headline alone against 600px of empty page reads as a page that failed to
   load, not as restraint. */
.pagina__open-grid--split,
.pagina__open-grid--solo { grid-template-columns: minmax(0, 1fr); }
.pagina__open-grid--split .pagina__open-text {
  display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: clamp(28px, 5vw, 76px); align-items: end;
}
/* The grid column is the measure here; a ch cap on top of it only wastes the
   left half on the pages whose headline is long. */
.pagina__open-grid--split .pagina__open-text h1 { max-width: 100%; margin-bottom: 0; }
.pagina__open-grid--split .pagina__open-text .lead { max-width: 48ch; margin-bottom: .35em; }
.pagina__open-grid--split .pagina__stat { grid-column: 1 / -1; }
.pagina__open-grid--solo .pagina__open-text h1 { max-width: 20ch; }
.pagina__open-grid--long .pagina__open-text h1 { font-size: clamp(1.7rem, 2.9vw, 2.55rem); }

.pagina__open-text h1 {
  font-size: clamp(2rem, 4.2vw, 3.6rem);
  max-width: 18ch; margin-bottom: .45em;
}
.pagina__open-text .lead { max-width: 46ch; }
.pagina__open-media {
  margin: 0; border-radius: var(--r-lg); overflow: hidden;
  aspect-ratio: 5 / 4; transform: translateY(clamp(0px, 2vw, 28px));
}
.pagina__open-media img { width: 100%; height: 100%; object-fit: cover; }

.pagina__stat { display: flex; align-items: baseline; gap: .9rem; margin: 2rem 0 0; flex-wrap: wrap; }
.pagina__stat-num {
  font-family: var(--font-display); font-size: clamp(2.4rem, 4.5vw, 3.6rem);
  font-weight: 600; letter-spacing: -0.05em; line-height: .9;
  font-variant-numeric: tabular-nums;
}
.pagina__stat-label { color: var(--faint); font-size: .95rem; max-width: 24ch; line-height: 1.4; }

/* ---------- Values: offset row, not three equal cards ----------
   The middle item sits lower than its neighbours. Three columns of identical
   boxes is the most templated shape on the web; a small vertical offset costs
   nothing and stops the row reading as a component demo. */
.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 48px); }
.values__item { padding-top: 1.6rem; border-top: 1px solid var(--rule); }
/* Offset with margin, not transform: the stagger reveal animates `transform`
   with fill-mode `both`, and an animation's final frame beats a declaration —
   a translate here is wiped the moment the row becomes visible. */
.values__item:nth-child(2) { margin-top: clamp(0px, 3vw, 40px); }
.values__icon {
  width: 36px; height: 36px; object-fit: contain;
  filter: brightness(0) invert(1); opacity: .5; margin-bottom: 1.2rem;
}
.values__item h3 { font-size: 1.08rem; font-weight: 500; margin-bottom: .5rem; }
.values__item p { margin: 0; color: var(--dim); font-size: .94rem; }

/* ---------- Body with chapter index ---------- */
.pagina__body--indexed {
  display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px); align-items: start;
}
.chapters { position: sticky; top: 108px; }
.chapters__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; counter-reset: none; }
/* One client H2 runs to 76 characters, so the label clamps to three lines.
   The heading itself is untouched — this is display only. */
.chapters__list a {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  padding: .55rem 0 .55rem 1rem;
  font-size: .88rem; line-height: 1.35; color: var(--faint);
  border-left: 1px solid var(--rule);
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.chapters__list a:hover { color: var(--dim); }
/* The active state is the point of the whole component: on a long page it
   answers "where am I" without the reader scrolling back up. */
.chapters__list a.is-current { color: var(--text); border-left-color: var(--accent); }

.pagina__prose { max-width: 68ch; }
.pagina__prose h2 { scroll-margin-top: 110px; }
/* An H2 inside the body gets a hairline above it, so chapters are visually
   separated without a heavy rule under every paragraph. */
.pagina__prose h2:not(:first-child) { padding-top: 1.6em; border-top: 1px solid var(--rule); }
.pagina__prose ul { list-style: none; padding-left: 0; }
.pagina__prose ul li {
  position: relative; padding-left: 1.5rem; margin-bottom: .55em;
}
.pagina__prose ul li::before {
  content: ""; position: absolute; left: 0; top: .72em;
  width: 7px; height: 1px; background: var(--accent-dk);
}

/* ---------- Closing band ---------- */
.pagina__cta { position: relative; overflow: hidden; }
.pagina__cta-media { position: absolute; inset: -8% 0; z-index: 0; }
.pagina__cta-media img { width: 100%; height: 100%; object-fit: cover; }
.pagina__cta-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 62%, transparent), color-mix(in srgb, var(--bg) 84%, transparent)),
    radial-gradient(120% 70% at 50% 50%, color-mix(in srgb, var(--bg) 55%, transparent), color-mix(in srgb, var(--bg) 88%, transparent));
}
.pagina__cta-inner { position: relative; z-index: 1; }
.pagina__cta h2 { max-width: 20ch; margin-inline: auto; }

@media (max-width: 1024px) {
  .pagina__open-grid { grid-template-columns: 1fr; }
  .pagina__open-media { transform: none; aspect-ratio: 16 / 9; }
  /* minmax(0,…), not 1fr: a grid item's automatic minimum is its content, so
     the nowrap chapter strip below would otherwise push the whole page wider
     than the phone instead of scrolling inside itself. */
  .pagina__body--indexed { grid-template-columns: minmax(0, 1fr); }
  .chapters { min-width: 0; max-width: 100%; }
  /* The index becomes a horizontal strip rather than disappearing: on a long
     page it is still the fastest way to reach a section. */
  .chapters { position: static; }
  .chapters__list { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; gap: .4rem; padding-bottom: .6rem; scrollbar-width: none; }
  .chapters__list::-webkit-scrollbar { display: none; }
  .chapters__list a { border-left: 0; border-bottom: 1px solid var(--rule); padding: .45rem .9rem; white-space: nowrap; }
  .chapters__list a.is-current { border-left: 0; border-bottom-color: var(--accent); }
}
@media (max-width: 1024px) {
  .pagina__open-grid--split .pagina__open-text { grid-template-columns: 1fr; align-items: start; }
  .pagina__open-grid--split .pagina__open-text h1 { max-width: 18ch; margin-bottom: .45em; }
}
@media (min-width: 1025px) {
  /* Pages with no chapter index keep the same text axis as the pages that have
     one, so the six read as one publication rather than six layouts. */
  .pagina__body:not(.pagina__body--indexed) .pagina__prose {
    margin-left: calc(220px + clamp(32px, 6vw, 88px));
  }
}
@media (max-width: 768px) {
  .values { grid-template-columns: 1fr; }
  .values__item:nth-child(2) { margin-top: 0; }
}

/* ---------- Sub-headings inside the body ----------
   Several of these pages are long runs of title + paragraph pairs. A short
   hairline above each one gives the eye a place to rest, and matches the full
   rule the H2s already carry rather than introducing a new device. */
.pagina__prose h3 { position: relative; padding-top: 1.15em; }
.pagina__prose h3::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 26px; height: 1px; background: var(--accent-dk);
}
.pagina__prose h2 + h3 { padding-top: 0; }
.pagina__prose h2 + h3::before { display: none; }

/* ---------- Partner logos inside the body ----------
   Supplied as dark-on-transparent artwork, so they need their own light plate
   to be legible on this background. */
.pagina__prose .logo-row {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(12px, 2vw, 20px); margin: 2.2rem 0; max-width: 460px;
}
.pagina__prose .logo-row figure { margin: 0; }
.pagina__prose .logo-row img {
  margin: 0; width: 100%; aspect-ratio: 5 / 2; object-fit: contain;
  background: linear-gradient(180deg, #FFFFFF 0%, #F1F3F6 100%);
  padding: 8% 12%; border-radius: var(--r);
}

/* ---------- Poster grid ----------
   Course posters: artwork with the title already set inside the image, so the
   grid stays silent and lets them speak. Light plates for the same reason the
   product cards use them — this artwork is drawn for white. */
.posters { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 1.8vw, 24px); }
.posters__item {
  margin: 0; border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, #FFFFFF 0%, #EEF1F5 100%);
  aspect-ratio: 4 / 3;
}
.posters__item img {
  width: 100%; height: 100%; object-fit: contain; padding: 6%;
  transition: transform .7s var(--ease);
}

@media (hover: hover) and (pointer: fine) {
  .posters__item:hover img { transform: scale(1.035); }
}
@media (max-width: 900px) { .posters { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .posters { grid-template-columns: 1fr; } }

/* The listings want columns to auto-fill; a strip under an article wants a
   fixed three, so six products land as two full rows instead of four and two. */
.pagina .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1024px) { .pagina .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px)  { .pagina .grid--3 { grid-template-columns: minmax(0, 1fr); } }
