/* Shared case study template: project title, brief, sections, headings,
   body text and figures. Used by every case study page. See DESIGN-SYSTEM.md. */

.cs-page {
  /* Theme: dark by default, .cs-page--light for light case studies */
  --cs-bg: var(--black);
  --cs-text-strong: var(--text-white);
  --cs-text-muted: var(--text-muted);
  --cs-section-heading: var(--text-grey);
  --cs-brief-bg: var(--surface-darkgrey);
  --cs-nav: var(--text-grey);
  --cs-nav-active: var(--text-blue);
  background: var(--cs-bg);
}
.cs-page--light {
  --cs-bg: var(--surface-offwhite);
  --cs-text-strong: var(--text-black);
  --cs-text-muted: var(--text-lightgrey);
  --cs-section-heading: var(--text-lightgrey);
  --cs-brief-bg: var(--surface-offwhite);
  --cs-nav: var(--cs-text-muted);
  --cs-nav-active: var(--lego-blue);
}
.cs-page--light .project-brief { border-top: 1px solid var(--border-lightgrey); }

/* Body Section */
.cs-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 80px;
}
.cs-column {
  width: 800px;
  max-width: 100%;
}

/* Project Title Section */
.project-title {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 40px 0;
  font-feature-settings: "salt" 1;
}
/* Title Label */
.project-title__label {
  max-width: 260px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.32px;
  color: var(--cs-text-muted);
}
/* Title */
.project-title__title {
  max-width: 360px;
  margin: 0;
  font-size: 26px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--cs-text-muted);
}
.project-title__title strong { font-weight: 400; color: var(--cs-text-strong); }

/* Project Brief Section */
.project-brief {
  display: flex;
  justify-content: center;
  padding: 20px;
  background: var(--cs-brief-bg);
  font-feature-settings: "salt" 1;
}
.project-brief__inner {
  display: flex;
  align-items: flex-start;
  gap: 48px;
  margin: 0;
}
.project-brief__item {
  display: flex;
  flex-direction: column;
  gap: 10.667px;
  font-size: 16px;
  line-height: 1.4;
  letter-spacing: -0.32px;
}
.project-brief__item dt { color: var(--cs-text-strong); }
.project-brief__item dd { margin: 0; color: var(--cs-text-muted); }

/* Project Body Section */
.cs-sections {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 120px;
}
.cs-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
}
/* Section Heading */
.section-heading {
  width: 100%;
  margin: 0;
  font-size: 18px;
  font-weight: 300;
  line-height: 1.4;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--cs-section-heading);
  font-feature-settings: "salt" 1;
}

.text-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
/* Heading 1 */
.cs-heading {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.48px;
  color: var(--cs-text-strong);
  font-feature-settings: "salt" 1;
}
/* Muted lead-in inside a heading, e.g. "Working with Xfinity to …" */
.cs-heading .muted { color: var(--cs-text-muted); }
.cs-heading--numbered {
  width: 100%;
  padding: 0;
  list-style: decimal;
}
.cs-heading--numbered li { margin-inline-start: 36px; }

/* Body: Regular by default; key phrases in white. Semibold is the emphasis variant. */
.body-text {
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: -0.36px;
  color: var(--cs-text-muted);
}
.body-text strong { font-weight: 400; color: var(--cs-text-strong); }
.body-text--white { color: var(--cs-text-strong); }
.body-text--emphasis,
.body-text strong.em { font-weight: 600; }

/* Heading 2: strong lead + muted remainder */
.cs-heading-2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.44px;
  color: var(--cs-text-muted);
  font-feature-settings: "salt" 1;
}
.cs-heading-2 strong { font-weight: 400; color: var(--cs-text-strong); }

/* Video waiting for its file: keeps the exact size */
.cs-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px dashed var(--border-lightgrey);
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  color: var(--cs-text-muted);
}

/* Design sub-sections: text then image */
.cs-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 36px;
  width: 100%;
}
.cs-figure {
  position: relative;
  width: 800px;
  max-width: 100%;
  margin: 0;
}
.cs-figure img { display: block; width: 100%; height: auto; }

@media (max-width: 900px) {
  .cs-column { width: calc(100% - 2 * var(--gutter)); }
  .cs-sections { gap: 80px; }
  .project-brief__inner { flex-wrap: wrap; gap: 24px 32px; }
}
@media (max-width: 600px) {
  .project-title__title { font-size: 22px; }
  .cs-heading { font-size: 20px; }
  .cs-heading-2 { font-size: 19px; }
  .body-text { font-size: 16px; }
  .section-heading { font-size: 14px; }
}

/* Page entry (settings and keyframes live in styles.css): content blocks fade and slide up in turn */
.cs-enter .cs-body > * {
  animation: cs-enter var(--enter-duration) var(--enter-ease) both;
  animation-delay: var(--enter-delay);
}
.cs-enter .cs-body > :nth-child(2) { animation-delay: calc(var(--enter-delay) + var(--enter-stagger)); }
.cs-enter .cs-body > :nth-child(3) { animation-delay: calc(var(--enter-delay) + 2 * var(--enter-stagger)); }
.cs-enter .cs-body > :nth-child(n + 4) { animation-delay: calc(var(--enter-delay) + 3 * var(--enter-stagger)); }
@media (prefers-reduced-motion: reduce) {
  .cs-enter .cs-body > * { animation-name: cs-enter-fade; animation-duration: 300ms; }
}

/* Side menu ("On this page"): screens wider than 1200px only.
   Grey by default; blue for the section you're on and on hover. Driven by js/case-nav.js. */
.cs-nav { display: none; }
@media (min-width: 1201px) {
  .cs-nav {
    display: block;
    position: fixed;
    top: 50%;
    transform: translateY(-50%); /* vertically centred in the window */
    /* Pinned to the left edge of the screen (48px), so wide screens get lots of space
       before the content; nudged closer to the edge only when the window is just over 1200px */
    left: clamp(4px, calc(50% - 602px), 48px);
    z-index: 3;
    transition: opacity 0.3s ease;
    font-feature-settings: "salt" 1;
  }
  .cs-enter .cs-nav {
    /* backwards (not both) so the footer fade-out can still change opacity afterwards */
    animation: cs-enter var(--enter-duration) var(--enter-ease) backwards;
    animation-delay: var(--enter-delay);
  }
  .cs-nav.is-hidden { opacity: 0; pointer-events: none; }
}
.cs-nav ul { display: flex; flex-direction: column; gap: 12px; margin: 0; padding: 0; list-style: none; }
.cs-nav li ul { gap: 8px; margin-top: 8px; padding-left: 16px; }
.cs-nav a {
  display: block;
  white-space: nowrap; /* labels never wrap */
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.3px;
  color: var(--cs-nav);
  transition: color 0.2s ease;
}
.cs-nav a:hover,
.cs-nav a:focus-visible,
.cs-nav a[aria-current="true"],
.cs-nav a.is-parent { color: var(--cs-nav-active); }

/* Jumping to a section: smooth, landing 40px below the top */
html:has(.cs-nav) { scroll-behavior: smooth; }
.cs-body [id] { scroll-margin-top: 40px; }
@media (prefers-reduced-motion: reduce) {
  html:has(.cs-nav) { scroll-behavior: auto; }
}
