/* Case study and brand partnership pages. Served inside the built Results / For Brands page, so the site's
   tokens, header, footer and closing band are already here; everything below is scoped to .cs. */

.cs {
  --cs-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --cs-hair: rgb(255 255 255 / 0.08);
  position: relative;
  padding-bottom: clamp(40px, 8vh, 96px);
}

/* ---------- Hero ---------- */
.cs-hero {
  padding-block: clamp(40px, 7vh, 84px) clamp(32px, 5vh, 56px);
}
.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px 0 12px;
  margin-bottom: clamp(28px, 5vh, 48px);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.05);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  transition:
    color 0.3s,
    background 0.3s;
}
.cs-back svg {
  transition: translate 0.4s var(--cs-ease);
}
.cs-back:is(:hover, :focus-visible) {
  color: var(--text);
  background: rgb(var(--accent-rgb) / 0.16);
}
.cs-back:is(:hover, :focus-visible) svg {
  translate: -4px 0;
}
.cs-kicker {
  display: block;
}
.cs-title {
  font-family: var(--heading);
  font-size: clamp(52px, 6.6vw, 108px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  max-width: 14ch;
  text-wrap: balance;
}
.cs-word {
  display: inline-block;
  overflow: hidden;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
  vertical-align: top;
}
.cs-word > span {
  display: inline-block;
}
.cs-lede {
  font-size: clamp(17px, 1.4vw, 20px);
  line-height: 1.6;
  color: #c9d1f0;
  max-width: 36em;
  margin: 0;
  text-wrap: pretty;
}
.cs-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px clamp(32px, 4vw, 64px);
  margin: clamp(32px, 5vh, 48px) 0 0;
}
.cs-facts dt {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
.cs-facts dd {
  margin: 0;
  font: 700 26px/1.1 var(--heading);
}

/* ---------- Cover ---------- */
.cs-cover {
  margin-block: 0 clamp(56px, 9vh, 112px);
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel);
  box-shadow:
    0 0 0 1px rgb(255 255 255 / 0.1),
    0 60px 120px -50px rgb(var(--accent-rgb) / 0.45),
    0 40px 80px -40px rgb(0 0 0 / 0.9);
}
.cs-cover img {
  width: 100%;
  height: 112%;
  margin-top: -6%;
  object-fit: cover;
  display: block;
  translate: 0 calc(var(--py, 0) * 1px);
  will-change: translate;
}
.cs-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgb(8 11 25 / 0.45));
  pointer-events: none;
}

/* ---------- Measured result ----------
   A patch of the site's night sky: stars come out as it arrives, a soft light follows the cursor, and the two
   figures rise as towers, the after tower lit in the brand blue with light running up through it. */
.cs-result {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: stretch;
  margin-bottom: clamp(56px, 9vh, 112px);
  padding: clamp(28px, 4.5vw, 64px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(420px circle at var(--mx, 75%) var(--my, 20%), rgb(var(--accent-rgb) / 0.22), transparent 70%),
    radial-gradient(70% 60% at 85% 110%, rgb(var(--accent-rgb) / 0.35), transparent 70%),
    linear-gradient(180deg, #0f1640, #090d26);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.08),
    0 60px 120px -60px rgb(var(--accent-rgb) / 0.7);
}
.cs-result > .closing-stars {
  z-index: -1;
  inset: 0;
}
.cs-result.is-risen > .closing-stars {
  opacity: 1;
}
.cs-result-copy {
  display: flex;
  flex-direction: column;
}
.cs-result-copy h2 {
  font-family: var(--heading);
  font-size: clamp(40px, 4.4vw, 72px);
  line-height: 0.95;
  margin: 0;
  text-wrap: balance;
}
.cs-delta {
  margin: clamp(28px, 5vh, 48px) 0 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.cs-delta b {
  font: 700 clamp(56px, 6.4vw, 104px) / 0.9 var(--heading);
  letter-spacing: -0.01em;
  background: linear-gradient(180deg, #fff 15%, #9fb2ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 12px 36px rgb(var(--accent-rgb) / 0.55));
}
.cs-delta span {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-text);
}
.cs-result-foot {
  margin-top: auto;
  padding-top: 32px;
  display: grid;
  gap: 6px;
}
.cs-result-foot p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.cs-towers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 32px);
  height: clamp(300px, 32vw, 420px);
}
.cs-tower {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 14px;
}
.cs-tower-col {
  position: relative;
  /* Room above the tallest tower for its figure. */
  margin-top: clamp(64px, 7vw, 104px);
}
.cs-tower i {
  position: absolute;
  inset: auto 0 0;
  height: calc(var(--h) * 100%);
  border-radius: 16px 16px 6px 6px;
  overflow: hidden;
  background: linear-gradient(180deg, #56628d, #2a3358);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25);
  transition:
    filter 0.4s,
    box-shadow 0.4s;
}
.cs-tower.is-after i {
  background: linear-gradient(180deg, #b4c2ff 0%, var(--accent) 35%, var(--accent-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.6),
    0 0 50px -6px rgb(var(--accent-rgb) / 0.8),
    0 30px 80px -20px rgb(var(--accent-rgb) / 0.9);
}
.cs-tower strong {
  position: absolute;
  left: 2px;
  bottom: calc(var(--h) * 100% + 12px);
  display: flex;
  align-items: baseline;
  gap: 0.08em;
  font: 700 clamp(48px, 5.4vw, 88px) / 0.9 var(--heading);
  font-variant-numeric: tabular-nums;
  color: #c3cbe8;
  white-space: nowrap;
  transition: scale 0.5s var(--cs-ease);
  transform-origin: 0 100%;
}
.cs-tower strong small {
  font-size: 0.42em;
  color: var(--muted);
}
.cs-tower.is-after strong {
  color: #fff;
  text-shadow: 0 0 40px rgb(var(--accent-rgb) / 0.8);
}
.cs-tower.is-after strong small {
  color: var(--accent-text);
}
.cs-tower:hover i {
  filter: brightness(1.2);
}
.cs-tower:hover strong {
  scale: 1.06;
}
.cs-tower-label {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.cs-tower-label time {
  font-weight: 400;
  color: var(--muted);
}
@media (prefers-reduced-motion: no-preference) {
  /* Light running up through the after tower, slowly and for as long as it is on screen. */
  html:not([data-motion="off"]) .cs-tower.is-after i::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, transparent 0%, rgb(255 255 255 / 0.28) 12%, transparent 24%) 0 0 / 100% 300%;
    animation: cs-climb 3.6s linear infinite;
  }
  .cs-animate .cs-tower i {
    height: 0;
    transition:
      height 1.6s var(--cs-ease),
      filter 0.4s,
      box-shadow 0.4s;
  }
  .cs-animate .cs-tower strong {
    bottom: 12px;
    opacity: 0;
    transition:
      bottom 1.6s var(--cs-ease),
      opacity 0.6s,
      scale 0.5s var(--cs-ease);
  }
  .cs-animate .cs-tower.is-after :is(i, strong) {
    transition-delay: 0.3s;
  }
  .cs-animate .cs-result.is-in .cs-tower i {
    height: calc(var(--h) * 100%);
  }
  .cs-animate .cs-result.is-in .cs-tower strong {
    bottom: calc(var(--h) * 100% + 12px);
    opacity: 1;
  }
  .cs-animate .cs-delta b {
    opacity: 0;
    translate: 0 16px;
    transition:
      opacity 0.6s,
      translate 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .cs-animate .cs-result.is-counted .cs-delta b {
    opacity: 1;
    translate: 0 0;
  }
}
@keyframes cs-climb {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 -300%;
  }
}

/* ---------- Gallery ---------- */
.cs-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.6vw, 24px);
  margin-bottom: clamp(56px, 9vh, 112px);
}
.cs-gallery figure {
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--panel);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08);
  transition: box-shadow 0.5s;
}
.cs-gallery figure:only-child,
.cs-gallery figure:nth-child(3n + 1):last-child {
  grid-column: 1 / -1;
}
.cs-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: scale 0.9s var(--cs-ease);
}
.cs-gallery figure:hover {
  box-shadow:
    0 0 0 1px rgb(var(--accent-rgb) / 0.5),
    0 30px 60px -30px rgb(var(--accent-rgb) / 0.5);
}
.cs-gallery figure:hover img {
  scale: 1.04;
}

/* ---------- The project, in three acts ----------
   Each act is a soft panel of the night with a light that follows the cursor. Inside, labelled fields flow in
   a grid; anything long takes the full width, so one line or several paragraphs both sit well. No rules. */
.cs-act {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(180px, 0.32fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  margin-bottom: clamp(16px, 2vw, 24px);
  padding: clamp(28px, 4vw, 56px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(380px circle at var(--mx, 0%) var(--my, 0%), rgb(var(--accent-rgb) / 0.16), transparent 70%),
    radial-gradient(60% 120% at 0% 0%, rgb(var(--accent-rgb) / 0.1), transparent 60%),
    rgb(255 255 255 / 0.025);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.06);
}
.cs-act:last-of-type {
  margin-bottom: clamp(16px, 2vw, 24px);
}
.cs-act > h2 {
  margin: 0;
  font-family: var(--heading);
  font-size: clamp(36px, 3.6vw, 56px);
  line-height: 0.95;
  background: linear-gradient(180deg, #fff 20%, #a9b8f2);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.cs-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 40px) clamp(24px, 3.4vw, 56px);
}
.cs-field.is-wide {
  grid-column: 1 / -1;
}
.cs-field h3 {
  margin: 0 0 10px;
  font: 600 14px/1.4 var(--body);
  color: var(--accent-text);
}
.cs-copy p {
  font-size: 17px;
  line-height: 1.7;
  color: #d2d8f2;
  max-width: 44em;
  margin: 0 0 0.9em;
  text-wrap: pretty;
}
.cs-copy p:last-child {
  margin-bottom: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .cs-animate .cs-act .cs-field {
    opacity: 0;
    translate: 0 18px;
    transition:
      opacity 0.8s var(--cs-ease),
      translate 0.8s var(--cs-ease);
    transition-delay: calc(250ms + var(--i) * 110ms);
  }
  .cs-animate .cs-act.is-in .cs-field {
    opacity: 1;
    translate: 0 0;
  }
}

.cs-footnotes {
  margin-top: clamp(16px, 2vw, 24px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 28px clamp(32px, 5vw, 72px);
  padding: clamp(28px, 4vw, 44px);
  margin-bottom: clamp(40px, 8vh, 96px);
  border-radius: 22px;
  background: radial-gradient(80% 140% at 0% 0%, rgb(var(--accent-rgb) / 0.1), transparent 60%), rgb(255 255 255 / 0.025);
}
.cs-footnotes h2 {
  margin: 0 0 8px;
  font: 600 14px/1.4 var(--body);
  color: var(--accent-text);
}
.cs-footnotes p {
  margin: 0 0 0.6em;
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
}
.cs-footnotes > p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
}

/* ---------- Motion ----------
   The hero plays on arrival (held while the brand intro is up); the rest rises in as it is reached. */
@media (prefers-reduced-motion: no-preference) {
  html:not([data-motion="off"]) .cs-word > span {
    animation: cs-rise 1s var(--cs-ease) both;
    animation-delay: calc(140ms + var(--i) * 70ms);
  }
  html:not([data-motion="off"]) :is(.cs-back, .cs-kicker, .cs-lede, .cs-facts) {
    animation: cs-fade 0.9s var(--cs-ease) both;
  }
  html:not([data-motion="off"]) .cs-kicker {
    animation-delay: 60ms;
  }
  html:not([data-motion="off"]) .cs-lede {
    animation-delay: 420ms;
  }
  html:not([data-motion="off"]) .cs-facts {
    animation-delay: 560ms;
  }
  html:not([data-motion="off"]) .cs-cover {
    animation: cs-wipe 1.4s var(--cs-ease) 380ms both;
  }
  html:not([data-motion="off"]) .cs-cover img {
    animation: cs-settle 1.8s var(--cs-ease) 380ms both;
  }
  html.intro-on .cs :is(.cs-word > span, .cs-back, .cs-kicker, .cs-lede, .cs-facts, .cs-cover, .cs-cover img) {
    animation-play-state: paused;
  }

  /* Scroll reveals only arm once the script is running, so nothing hides without it. */
  .cs-animate [data-cs-reveal] {
    opacity: 0;
    translate: 0 32px;
    transition:
      opacity 0.9s var(--cs-ease),
      translate 0.9s var(--cs-ease);
    transition-delay: calc(var(--i, 0) * 90ms);
  }
  .cs-animate [data-cs-reveal].is-in {
    opacity: 1;
    translate: 0 0;
  }
}
@keyframes cs-rise {
  from {
    transform: translateY(105%);
  }
}
@keyframes cs-fade {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes cs-wipe {
  from {
    clip-path: inset(18% 8% 18% 8% round 20px);
    opacity: 0.3;
  }
  to {
    clip-path: inset(0 0 0 0 round 20px);
    opacity: 1;
  }
}
@keyframes cs-settle {
  from {
    scale: 1.14;
  }
}
@media (max-width: 900px) {
  .cs-result,
  .cs-act {
    grid-template-columns: minmax(0, 1fr);
  }
  /* Stacked: title and change, then the towers, then the source line. */
  .cs-result {
    row-gap: 0;
  }
  .cs-result-copy {
    display: contents;
  }
  .cs-towers {
    order: 2;
    margin-top: 36px;
  }
  .cs-result-foot {
    order: 3;
  }
}
@media (max-width: 700px) {
  .cs-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .cs-act {
    border-radius: 20px;
  }
  .cs-towers {
    height: 300px;
  }
  .cs-gallery {
    grid-template-columns: minmax(0, 1fr);
  }
  .cs-cover,
  .cs-result {
    border-radius: 16px;
  }
}
/* With no sources or limits to show, the disclaimer is just a quiet line of text, not an empty card. */
.cs-footnotes.is-plain {
  padding: 0;
  background: none;
}
