/* ==========================================================================
   CMS pages: project detail, article detail, article index.
   Built from the homepage's tokens and components (no Figma frames yet).
   ========================================================================== */

/* right-hand content column = the homepage's 826px column (starts at 582 @1440) */
.page { --content-start: 40.42%; } /* 582 / 1440 — scales with the column grid */

/* ---------- Page hero ------------------------------------------------- */

.page-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: clamp(560px, 80vh, 900px);
  padding: 160px var(--gutter-sm) var(--sp-96);
  overflow: hidden;
  background: var(--color-black);
  color: var(--color-white);
}
.page-hero__bg { position: absolute; inset: 0; }
.page-hero__bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.1), rgb(0 0 0 / 0.55));
}
.page-hero--plain { min-height: 0; padding-top: clamp(180px, calc(220 * var(--px)), 280px); }

.page-hero__eyebrow,
.page-hero__title,
.page-hero__back { position: relative; }
.page-hero__eyebrow { color: var(--color-white-60); }
.page-hero__title {
  margin-top: var(--space-24);
  font-size: var(--fs-h1);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-tight);
}
.page-hero__title--article { max-width: 14em; font-size: var(--fs-s1); }
.page-hero__back { margin-top: var(--space-48); }

/* intro animation (same easing as the homepage hero) */
.page-hero__title,
.page-hero__eyebrow { transition: opacity 900ms ease, transform 1000ms var(--ease-out); }
.is-loading .page-hero__title,
.is-loading .page-hero__eyebrow { opacity: 0; transform: translateY(24px); }

/* ---------- Rich text from the CMS ------------------------------------ */

.prose {
  max-width: calc(var(--content-start) + 760px);
  padding: 0 var(--gutter) var(--sp-152) var(--content-start);
  font-size: var(--text-body-1);
  line-height: 1.5;
  letter-spacing: var(--tracking-body-1);
}
.prose > * + * { margin-top: 1.2em; }
.prose h2,
.prose h3 {
  margin-top: 2em;
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
}
.prose h2 { font-size: var(--fs-s3); }
.prose h3 { font-size: var(--fs-s6); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose ul { list-style: disc; padding-left: 1.2em; }
.prose ol { list-style: decimal; padding-left: 1.2em; }
.prose img,
.prose video { width: 100%; height: auto; }
.prose figcaption { margin-top: var(--space-8); font-size: var(--text-body-2); color: var(--color-black-60); }
.prose blockquote {
  padding-left: var(--space-24);
  border-left: 1px solid var(--color-black);
  font-size: var(--fs-s6);
  line-height: var(--leading-snug);
}

/* ---------- Article detail (Pencil: "Articles / Detail") ----------------
   At 1440: meta row + hairline, 88px title, 1376×744 cover, then two columns split by a
   vertical hairline at x=782 — pull quote (678px) left, body (500px text, 562px image) right. */

.story { padding: clamp(160px, calc(228 * var(--px)), 300px) var(--gutter) 0; }

.story__meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  padding-bottom: 13px;
  border-bottom: var(--border-hairline);
  font-size: var(--text-body-1);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body-1);
}
.story__meta > :nth-child(2) { text-align: center; }
.story__meta > :nth-child(3) { text-align: right; }
.story__meta > [hidden] { display: block; visibility: hidden; } /* keep the 3-column positions */

.story__title {
  max-width: 10.35em; /* 911px at 88px */
  margin-top: var(--space-64);
  font-size: var(--fs-h2);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-tight);
}

.story__cover {
  aspect-ratio: 1376 / 744;
  margin-top: clamp(44px, calc(60 * var(--px)), 80px);
  background: var(--color-surface-frame-light); /* empty slot until the image is exported */
}

.story__columns {
  --pad: var(--space-64);
  display: grid;
  grid-template-columns: minmax(0, 750fr) minmax(0, 626fr);
  margin-top: var(--pad);
  border-top: var(--border-hairline);
}
.story__aside { padding: var(--pad) var(--pad) 0 0; }
.story__quote {
  position: sticky;
  top: var(--pad);
  max-width: 14.1em; /* 678px at 48px */
  margin-bottom: var(--space-64); /* sticky stops 64px above the end of the column */
  font-size: var(--fs-s3);
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
}
.story__body {
  display: flex;
  flex-direction: column;
  gap: var(--pad);
  padding: var(--pad) 0 clamp(120px, calc(178 * var(--px)), 230px) var(--pad);
  border-left: var(--border-hairline);
}
.story__text {
  max-width: calc(500 / 562 * 100%);
  font-size: var(--text-body-1);
  line-height: var(--leading-body);
  letter-spacing: var(--tracking-body-1);
}
.story__text > * + * { margin-top: 1.3em; } /* one blank line, as in the design */
.story__text a { text-decoration: underline; text-underline-offset: 3px; }
.story__text[hidden] { display: none; }
.story__figure {
  aspect-ratio: 562 / 352;
  background: var(--color-surface-frame-light); /* empty slot until the image is exported */
}

/* Next Articles: the homepage's Latest Insights block, with the 620px cards of the Articles index */
.story__next .post { min-height: clamp(560px, calc(620 * var(--px)), 810px); }

/* intro animation, like the other page heads */
.story__head,
.story__cover { transition: opacity 900ms ease, transform 1000ms var(--ease-out); }
.story__cover { transition-delay: 150ms; }
.is-loading .story__head,
.is-loading .story__cover { opacity: 0; transform: translateY(24px); }

.insights--more { padding-top: var(--sp-96); }
.insights__title--sm { font-size: var(--fs-s1); }

/* grids longer than one row: separate rows with a hairline */
.insights__grid > li:nth-child(3n) { border-right: 0; }
.insights__grid > li:nth-child(n + 4) { border-top: var(--border-hairline); }

/* ---------- Articles index (Pencil: "Articles") ------------------------
   Same cards as the homepage's Latest Insights, 3 × 459px across the 1376px row,
   on white instead of the muted surface. */

.journal { padding: clamp(180px, calc(284 * var(--px)), 380px) var(--gutter) clamp(120px, calc(200 * var(--px)), 260px); }
.journal__title {
  font-size: var(--fs-h1);
  font-weight: var(--font-weight-regular);
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-tight);
}
.journal__grid { margin-block: clamp(48px, calc(64 * var(--px)), 84px) var(--sp-96); }
.journal .post { min-height: clamp(560px, calc(620 * var(--px)), 810px); }
.journal .post:hover { background: var(--color-surface-muted); }
.journal__more[hidden] { display: none; }

/* cards added by "Load More" fade up (--i staggers them, set in pages.js) */
.journal__grid > li.is-new { animation: journal-in 900ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes journal-in { from { opacity: 0; transform: translateY(24px); } }

.journal__title,
.journal__grid { transition: opacity 900ms ease, transform 1000ms var(--ease-out); }
.journal__grid { transition-delay: 150ms; }
.is-loading .journal__title,
.is-loading .journal__grid { opacity: 0; transform: translateY(24px); }

@media (prefers-reduced-motion: reduce) {
  .journal__grid > li.is-new { animation: none; }
}

/* ---------- Footer on CMS pages ---------------------------------------
   The homepage tucks the footer 250px under the CTA (main.js slides it out).
   These pages have no CTA, so the footer sits in normal flow. */
.page .site-footer { transform: none; }

/* ---------- Dark header (white pages) --------------------------------- */

.site-header--dark .site-header__logo img { filter: invert(1); }
.site-header--dark .site-header__notch { background: var(--color-black); }
.site-header--dark .menu-toggle { background: var(--color-black); }
.site-header--dark .menu-toggle__bar { background: var(--color-white); }
/* the menu panel is black, so flip back to the light header while it's open */
.site-header--dark.is-menu-open .site-header__logo img { filter: none; }
.site-header--dark.is-menu-open .site-header__notch,
.site-header--dark.is-menu-open .menu-toggle,
.site-header--dark.is-menu-open .btn--dark { background: var(--color-white); }
.site-header--dark.is-menu-open .btn--dark { color: var(--color-black); }
.site-header--dark.is-menu-open .menu-toggle__bar { background: var(--color-black); }
.site-header--dark .site-header__logo img,
.site-header--dark .site-header__notch,
.site-header--dark .menu-toggle,
.site-header--dark .menu-toggle__bar,
.site-header--dark .btn--dark { transition: filter 400ms ease, background-color 400ms ease, color 400ms ease; }

/* ---------- "Details" bubble ----------------------------------------
   Shared by the projects grid + list preview (projects.css) and the "Next Project" card (project.css).
   Grid cards move it with the pointer (--x/--y, set in pages.js); otherwise it sits centred. */
.details-bubble {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  z-index: 3;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  background: var(--color-white-40);
  backdrop-filter: blur(var(--blur-button));
  -webkit-backdrop-filter: blur(var(--blur-button));
  color: var(--color-white);
  pointer-events: none;
  opacity: 0;
  scale: 0.4;
  transition: opacity 300ms ease, scale 400ms var(--ease-out);
}
