/* ==========================================================================
   Case study template. Shared by every project page; each page sets its own
   colour with a class on <body> (see "Project colours" below).
   Sizes are the Figma XS (375px) → XL (1600px) values, interpolated.
   ========================================================================== */
:root {
  --cs-gap-l: clamp(40px, calc(40px + 60 * (100vw - 375px) / 1225), 100px);  /* spacer/L between blocks */
  --cs-gap-m: clamp(16px, calc(16px + 24 * (100vw - 375px) / 1225), 40px);
  --cs-gap-s: clamp(8px,  calc(8px  + 12 * (100vw - 375px) / 1225), 20px);
  --fs-cs-h1: clamp(36px, calc(36px + 24 * (100vw - 375px) / 1225), 60px);   /* headline/H1 */
  --fs-cs-h4: clamp(24px, calc(24px + 6  * (100vw - 375px) / 1225), 30px);   /* headline/H4 */
  --fs-cs-p1: clamp(20px, calc(20px + 4  * (100vw - 375px) / 1225), 24px);   /* text/P1 */
  --fs-cs-p3: clamp(16px, calc(16px + 2  * (100vw - 375px) / 1225), 18px);   /* text/P3 */
  --fs-cs-cap: clamp(12px, calc(12px + 2 * (100vw - 375px) / 1225), 14px);   /* text/P5 */
  --cs-edge: clamp(25px, calc(25px + 23 * (100vw - 375px) / 1225), 48px);    /* hero side padding */
  --radius-cs: clamp(3px, calc(3px + 3 * (100vw - 375px) / 1225), 6px);      /* core/border-radius/M: 3 at XS, 6 at XL */
}

/* ---------- Project colours ---------- */
.project--sunshine { --tint: var(--sunshine-light); --role: var(--lavender-dark); --star: #ebc994; }
.project--grass    { --tint: var(--grass-light);    --role: var(--grass-dark);    --star: #c9d3b3; }
.project--sky      { --tint: var(--sky-light);      --role: var(--sky-dark);      --star: #b9d7ee; }
.project--coral    { --tint: var(--coral-light);    --role: var(--coral-dark);    --star: #eeb9a2; }
.project--lavender { --tint: var(--lavender-main);  --role: var(--lavender-dark); --star: #cfa8d1; }

/* The project colour at 60% cream, used for the hero and the colour-flood section */
.tint { background: linear-gradient(rgba(252, 251, 249, 0.6), rgba(252, 251, 249, 0.6)), var(--tint); }

/* ---------- Hero ---------- */
.cs-hero {
  padding: var(--nav-height) 0 var(--cs-gap-l); /* 100px (L) under the credits on every case study */
}
.cs-hero__image {
  display: block;
  margin-inline: var(--cs-edge);
  aspect-ratio: 1504 / 846;
  overflow: hidden;
  border-radius: var(--radius-cs);
  background: #fff;
}
.cs-hero__image img, .cs-hero__image video { display: block; width: 100%; height: 100%; object-fit: cover; }

.cs-info {
  width: var(--page-width);
  margin: var(--cs-gap-l) auto 0;
}
.cs-info__title {
  margin: 0;
  font-size: var(--fs-cs-h1);
  font-weight: 250;
}
.cs-info .tags { margin-top: var(--cs-gap-s); }
.cs-info__intro { min-width: 0; }
.cs-info__body {
  margin: var(--cs-gap-m) 0 0;
  font-size: var(--fs-cs-p1);
  line-height: 1.6;
  max-width: 837px;
}
.cs-info__body p { margin: 0 0 1.6em; }
.cs-info__body p:last-child { margin-bottom: 0; }
.cs-info__body strong { font-weight: 600; }

/* ---------- Credits ---------- */
.credits {
  margin: calc(var(--cs-gap-l) * 0.64) 0 0; /* 64px at XS, matching the mobile design */
  display: flex;
  flex-direction: column;
  gap: var(--cs-gap-m);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  line-height: 1.6;
  font-feature-settings: "salt" 1;
}
.credits__group { display: flex; flex-direction: column; gap: 4px; }
.credits__role { margin: 0; font-size: inherit; font-weight: inherit; color: var(--role); }
.credits__people { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.credits__people li { display: flex; align-items: center; gap: 6px; }
.credits__star {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}
.credits__star::before {
  content: "";
  width: 16.648px;
  height: 16.231px;
  background: var(--star);
  /* inline data URI so the mask works on any host (and from file://) */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16.2304 15.8235%22%3E%3Cpath d=%22M8.1152 0L9.55261 5.33907L14.6231 3.13403L11.345 7.5867L16.2304 10.1761L10.7053 10.3895L11.7268 15.8235L8.1152 11.6368L4.50359 15.8235L5.52506 10.3895L0 10.1761L4.88535 7.5867L1.60731 3.13403L6.67778 5.33907L8.1152 0Z%22/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 16.2304 15.8235%22%3E%3Cpath d=%22M8.1152 0L9.55261 5.33907L14.6231 3.13403L11.345 7.5867L16.2304 10.1761L10.7053 10.3895L11.7268 15.8235L8.1152 11.6368L4.50359 15.8235L5.52506 10.3895L0 10.1761L4.88535 7.5867L1.60731 3.13403L6.67778 5.33907L8.1152 0Z%22/%3E%3C/svg%3E") center / contain no-repeat;
  transform: rotate(13.16deg);
}

/* ---------- Image sections ---------- */
.cs-images {
  position: relative;
  background: #fff;
  padding-bottom: var(--cs-gap-l);
}
/* A strip of the project colour continues under the top of the first photo (as in the design) */
.cs-images::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--cs-gap-l);
  background: linear-gradient(rgba(252, 251, 249, 0.6), rgba(252, 251, 249, 0.6)), var(--tint);
}
.cs-images .cs-flow { position: relative; }
.cs-flood { padding-top: var(--cs-gap-l); }
.cs-flow {
  width: var(--page-width);
  margin-inline: auto;
}
.cs-flow > :first-child { margin-top: 0; }
.cs-flow > * + * { margin-top: var(--cs-gap-l); }
.cs-flow > .cs-caption + * { margin-top: var(--cs-gap-l); }
.cs-flow > * + .cs-caption { margin-top: var(--cs-gap-s); }

.cs-img {
  display: block;
  margin-inline: 0;
  margin-bottom: 0;
  overflow: hidden;
  border-radius: var(--radius-cs);
}
.cs-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cs-img--wide { aspect-ratio: 1280 / 870.368; }
.cs-img--tall { aspect-ratio: 1280 / 864.689; }

.cs-caption {
  margin-block: 0;
  text-align: center;
  font-size: var(--fs-cs-cap);
  line-height: 1.6;
}

/* Text blocks sit in a 837px column */
.cs-text { max-width: 837px; margin-inline: auto; }
.cs-text__title { margin: 0; font-size: var(--fs-cs-h4); font-weight: 250; }
.cs-text__body { margin: var(--cs-gap-s) 0 0; font-size: var(--fs-cs-p3); line-height: 1.6; }
.cs-text__body p { margin: 0 0 1em; }
.cs-text__body p:last-child { margin-bottom: 0; }

/* 2-up grids stack on small screens */
.cs-grid { display: grid; gap: var(--cs-gap-l); margin-inline: auto; }
.cs-grid--narrow { max-width: 1059px; }
.cs-grid .cs-img { margin-block: 0; }
.cs-grid--a .cs-img:nth-child(1) { aspect-ratio: 503 / 590; }
.cs-grid--a .cs-img:nth-child(2) { aspect-ratio: 505 / 590; }
.cs-grid--b .cs-img { aspect-ratio: 616 / 500; }

/* ---------- Next project ---------- */
.cs-next {
  display: flex;
  justify-content: center;
  padding-block: var(--cs-gap-l);
}
.cs-next__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-cs-h1);
  font-weight: 250;
  color: var(--black);
  text-decoration: none;
}
.cs-next__arrow {
  width: calc(var(--fs-cs-h1) * 0.667);
  height: auto;
  aspect-ratio: 40 / 19.4286;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.cs-next__link:hover .cs-next__arrow,
.cs-next__link:focus-visible .cs-next__arrow { opacity: 1; transform: none; }

.page-case .site-footer { margin-top: 0; }

/* ==========================================================================
   Wider layouts
   ========================================================================== */
@media (min-width: 760px) {
  .cs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cs-grid--a { grid-template-columns: 503fr 505fr; justify-content: space-between; column-gap: 48px; }
  .cs-grid--b { column-gap: 48px; }
  .cs-grid { gap: 0 48px; }
}
/* Credits move beside the intro once there is room for them */
@media (min-width: 1100px) {
  .cs-info {
    display: grid;
    grid-template-columns: 65.39% 1fr;
    column-gap: 12.42%;
    align-items: start;
  }
  .credits { margin-top: 0; gap: var(--cs-gap-m); }
}

/* Images that keep their own proportions (Hoag Classic etc.) */
.cs-flow > .cs-img--half { width: 100%; max-width: 616px; margin-inline: auto; }
.cs-flow > .cs-img--narrow { width: 100%; max-width: 1060px; margin-inline: auto; }
.cs-flow .cs-img--wide.cs-img--auto,
.cs-grid .cs-img.cs-img--auto,
.cs-img--auto { aspect-ratio: auto; }
.cs-img--auto img { height: auto; }

/* Patient Room Experience: soft lavender tint with sunshine credit roles */
.project--patient { --tint: #f1e1ef; --role: var(--sunshine-dark); --star: #d7bdd8; }
.cs-hero__image--patient { aspect-ratio: 1504 / 1004; }
.cs-images--end { padding-bottom: 0; }

/* Door sign flow: five screens that cross-fade like the Figma prototype */
.cs-flowanim { position: relative; }
.cs-flowanim img + img { position: absolute; inset: 0; opacity: 0; }
.cs-flowanim img { transition: opacity .9s cubic-bezier(.45, 0, .25, 1); }
.cs-flowanim img.is-active { opacity: 1; z-index: 2; }
.cs-flowanim img.is-prev { opacity: 1; z-index: 1; transition: none; }
.cs-flowanim.is-playing img:first-child:not(.is-active):not(.is-prev) { opacity: 0; }

/* Help Scout Design System + Site: sky tint */
.project--sky { --star: #c8dfec; }
.cs-flow > .cs-img--text { width: 100%; max-width: 837px; margin-inline: auto; }
.cs-flood--closed { padding-bottom: var(--cs-gap-l); }
.cs-after { padding-top: var(--cs-gap-l); }
/* Screenshot exported with a soft drop shadow: the shadow bleeds past the 1280px column */
.cs-img--bleed { position: relative; overflow: visible; border-radius: 0; }
.cs-img--bleed img { position: absolute; max-width: none; width: 102.8125%; height: auto; left: -1.40625%; top: -.7656%; }

/* About In the Works: coral tint */
.project--coral { --star: #efa68a; }
.cs-info__link { margin-top: var(--cs-gap-m); font-size: var(--fs-cs-p1); line-height: 1.6; }
.cs-info__link .link { padding-bottom: 4px; }
.cs-info__link .link::after { opacity: 1; }
.cs-info__link .link:hover, .cs-info__link .link:focus-visible { color: var(--coral-dark); }
.cs-info__link .link { transition: color .25s ease; }
.cs-hero__image--itw { aspect-ratio: 1504 / 772; }

/* ---------- Odds & Ends ---------- */
.project--odds { --tint: #fcfbf9; --role: var(--sky-dark); --star: #e3e0d8; }
.cs-hero__image--odds { aspect-ratio: 1504 / 720.47; }
/* Images whose Figma frame carries a soft shadow wider than the 1280 column */
.cs-flow > .cs-img--over { width: calc(100% * var(--ow, 1)); margin-inline: calc((1 - var(--ow, 1)) * 50%); border-radius: 0; overflow: visible; }
/* Badge + stickers */
.cs-grid--swag { max-width: 1059px; gap: var(--cs-gap-l) 0; }
.cs-grid--swag .cs-img:nth-child(1) { aspect-ratio: 509.64 / 677.59; }
.cs-grid--swag .cs-img:nth-child(2) { aspect-ratio: 509.64 / 679.15; }
.cs-pair { display: grid; gap: var(--cs-gap-l); max-width: 1280px; margin-inline: auto; }
.cs-pair .cs-img { aspect-ratio: 616 / 346; margin-block: 0; }
@media (min-width: 720px) {
  .cs-grid--swag { column-gap: var(--cs-gap-m); }
  .cs-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 48px; row-gap: 0; }
}
/* Caption links */
.cs-caption__link {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px;
  transition: color .25s ease;
}
.cs-caption__link:hover, .cs-caption__link:focus-visible { color: var(--sky-dark); }
.old-design { position: relative; display: inline-block; }
.old-design__tip {
  position: absolute; left: 50%; bottom: calc(100% + 3px); z-index: 5;
  width: 200px; margin-left: -100px; border-radius: 5px; overflow: hidden;
  box-shadow: 0 2.5px 2.5px rgba(49,67,81,.02), -5px 5px 5px 1.2px rgba(49,67,81,.04), 0 10px 10px 2.5px rgba(49,67,81,.06);
  background: #fff; opacity: 0; transform: translateY(6px); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.old-design__tip img { display: block; width: 100%; height: auto; }
.old-design:hover .old-design__tip, .old-design:focus-within .old-design__tip, .old-design.is-open .old-design__tip { opacity: 1; transform: none; }
@media (max-width: 719px) {
  .old-design__tip { left: auto; right: 0; margin-left: 0; }
}

/* Founder Directory video sits exactly over the window in the still (which supplies the soft shadow) */
.cs-img--bleed .cs-bleed__video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: var(--radius-cs); background: #f5f3f1;
}

/* Hallway 2-ups (Hoag for Life) stay side by side on phones */
.cs-grid--keep { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--cs-gap-m); }

/* Hoag Classic's green page: deeper pill fills so the pale blue and white tags stand out from the background */
.project--grass .cs-info .tag--sky     { background: #cde4f7; color: #3d4852; }
