/* =========================================================================
   Case Studies — Index. The editorial directory above the three studies.
   Inherits tokens, typography, .nav, .footer, and surface system from
   ../styles.css. Component prefix: .ci- (case studies index) and .ci-row
   for the per-study list rows.
   Three sections: hero (drench) · index list (light) · cta (drench).
   ========================================================================= */

/* ============================================================
   Section grid overlay — same chrome as the studies and home.
   ============================================================ */
.s__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    repeating-linear-gradient(to right,
      var(--grid-line-drench) 0 1px,
      transparent 1px calc(100% / 12));
}
.s[data-surface="light"] .s__grid,
.s[data-surface="white"] .s__grid {
  background-image:
    repeating-linear-gradient(to right,
      var(--grid-line-light) 0 1px,
      transparent 1px calc(100% / 12));
}

/* ============================================================
   HERO — Drench. Shorter than a study hero; this is the directory,
   not a destination. Min-height tuned to the headline + lede.
   Backdrop layer: Europe map with city pins (additive — one per study).
   ============================================================ */
.ci-hero {
  min-height: 88vh;
  padding-top: calc(var(--section-y) + 60px);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
}
.ci-hero__inner {
  position: relative;
  z-index: 3;
  width: 100%;
  display: grid;
  gap: clamp(20px, 3vw, 36px);
  align-content: end;
}

/* ============================================================
   HERO MAP — Europe wireframe, right-anchored, low-opacity backdrop.
   The map sits behind the headline; pins land on editorial cities.
   The map-frame is sized to the SVG's intrinsic aspect ratio (680/520)
   so pin x/y percentages map directly to the SVG coordinate space.
   ============================================================ */
/* Two-layer composition: the map outline sits at z=1 (behind headline),
   the pin overlay sits at z=4 (above headline). Both share the same
   frame geometry so the pin %s land on the right cities. */
.ci-hero__map,
.ci-hero__pins {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: clamp(60px, 8vh, 110px);
}
.ci-hero__map  { z-index: 1; }
.ci-hero__pins { z-index: 4; }

.ci-hero__map-frame {
  position: relative;
  /* Sized to leave headline column unbothered on desktop, shrinking
     gracefully at narrower viewports. The frame matches the SVG's
     680/520 aspect ratio so pin %s map directly to map coordinates. */
  height: clamp(420px, 70vh, 720px);
  aspect-ratio: 680 / 520;
  /* Push significantly past the right edge — the SVG's central-Europe
     cluster (Germany / Switzerland) sits left-of-centre in the original
     map, so shifting the whole frame right lands the pin cluster well
     clear of the headline. */
  margin-right: clamp(-260px, -10vw, -80px);
  /* Cap how wide the frame can grow — keeps central Europe pin cluster
     within the visible right-side column without spilling left. */
  max-width: 60%;
}

.ci-hero__map-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Soft backdrop — the strokes are already white. Lift opacity for
     legibility around the city cluster. */
  opacity: 0.36;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.10));
}

/* Each pin sits at its CSS variable x/y inside the map-frame, which
   matches the SVG's coordinate space. The dot is the cartographic
   anchor; the label is a mono callout offset from it. */
.ci-hero__pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 0;
  height: 0;
  z-index: 2;
}

.ci-hero__pin-dot {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  background: var(--signal-coral);
  border: 2px solid var(--white);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(232, 78, 54, 0.4),
              0 4px 18px rgba(232, 78, 54, 0.45);
  z-index: 2;
}

.ci-hero__pin-pulse {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--signal-coral);
  opacity: 0.5;
  animation: ci-pin-pulse 2.8s var(--ease-out-quart) infinite;
  z-index: 1;
}
@keyframes ci-pin-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  70%  { transform: scale(3.6); opacity: 0;   }
  100% { transform: scale(3.6); opacity: 0;   }
}

.ci-hero__pin-label {
  position: absolute;
  /* Label sits to the upper-right of the dot by default */
  left: 14px;
  top: -26px;
  display: grid;
  gap: 2px;
  white-space: nowrap;
  color: var(--white);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  line-height: 1.15;
  /* Dark backplate so labels read against the drench AND against the
     white headline when they overlap. The plate is a near-ink tinted
     toward the brand hue so it sits inside the design system rather
     than feeling like a floating tooltip. */
  padding: 6px 9px;
  background: oklch(15% 0.10 264);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.ci-hero__pin-name {
  color: var(--white);
  font-weight: 500;
}
.ci-hero__pin-place {
  color: var(--signal-coral);
  font-weight: 500;
  opacity: 0.95;
  font-size: 0.65rem;
}

/* The Berlin pin sits right of Hamburg — push its label below the dot
   so the two clusters don't collide. */
.ci-hero__pin[data-city="Berlin"] .ci-hero__pin-label {
  left: 14px;
  top: 10px;
}
/* The Zürich pin sits south — keep label to the right of the dot. */
.ci-hero__pin[data-city="Zürich"] .ci-hero__pin-label {
  left: 14px;
  top: -22px;
}

/* At intermediate widths the headline gets too close to the pin cluster
   to fit labels cleanly — show dots only. The geographic story is still
   there; the textual one returns at desktop. */
@media (max-width: 1279px) {
  .ci-hero__map-frame {
    height: 88%;
    margin-right: -8%;
    max-width: 80%;
  }
  .ci-hero__map-img { opacity: 0.26; }
  .ci-hero__pin-label { display: none; }
}

@media (max-width: 720px) {
  /* On phones the headline must dominate — drop the map to a very soft
     watermark, no labels (the dots remain to anchor the geography). */
  .ci-hero__map-frame {
    height: 70%;
    margin-right: -16%;
    max-width: 130%;
  }
  .ci-hero__map-img { opacity: 0.14; }
  .ci-hero__pin-label { display: none; }
  .ci-hero__pin-dot,
  .ci-hero__pin-pulse {
    width: 8px;
    height: 8px;
    left: -4px;
    top: -4px;
  }
}

.ci-hero__ticker {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  opacity: 0.85;
  margin: 0;
}
.ci-hero__dot {
  width: 8px;
  height: 8px;
  background: var(--white);
  display: inline-block;
  animation: ci-pulse 2.4s var(--ease-out-quart) infinite;
}
.ci-hero__sep { opacity: 0.5; }

.ci-hero__display {
  font-size: clamp(2.5rem, 7vw, 6rem);
  line-height: 0.88;
  letter-spacing: -0.045em;
  max-width: 20ch;
}
.ci-hero__lede {
  max-width: 60ch;
  font-size: clamp(1.0625rem, 1.4vw, 1.375rem);
  line-height: 1.5;
  opacity: 0.92;
}

@keyframes ci-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(0.85); }
}

/* ============================================================
   INDEX — Light. Stacked editorial list. Each row is a single
   <a> wrapping the entire preview (the affordance is the row,
   not a tiny CTA button).
   ============================================================ */
.ci-index__inner {
  position: relative;
  z-index: 2;
  display: grid;
  gap: clamp(40px, 5vw, 72px);
}

.ci-index__head {
  display: grid;
  gap: 14px;
  max-width: 30ch;
}
.ci-index__eyebrow { color: var(--rocket-blue); margin: 0; }
.ci-index__title {
  color: var(--ink);
  font-size: clamp(1.75rem, 3.6vw, 3rem);
  line-height: 1.0;
}

.ci-index__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  /* Top hairline; row bottoms supply the rest. */
  border-top: 1px solid rgba(10, 10, 10, 0.18);
}
.ci-index__row {
  border-bottom: 1px solid rgba(10, 10, 10, 0.18);
  display: block;
}
.ci-index__more {
  margin: 0;
  color: var(--graphite);
  opacity: 0.75;
}
.ci-index__more a {
  color: var(--graphite);
  border-bottom: 1px solid rgba(10, 10, 10, 0.32);
  padding-bottom: 2px;
  transition: color 180ms var(--ease-out-quart),
              border-color 180ms var(--ease-out-quart);
}
.ci-index__more a:hover {
  color: var(--rocket-blue);
  border-bottom-color: var(--rocket-blue);
}

/* ============================================================
   ROW — A single case-study preview. Headline is the dominant
   element; logo is a small editorial mark in the top-right.
   ============================================================ */
.ci-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "head    head"
    "display display"
    "body    logo"
    "metrics logo"
    "cta     cta";
  gap: clamp(14px, 2vw, 22px) clamp(20px, 4vw, 56px);
  align-items: start;
  padding: clamp(36px, 5vw, 64px) 0 clamp(32px, 4vw, 52px);
  color: var(--ink);
  position: relative;
  transition: padding-left 320ms var(--ease-out-quart),
              background-color 240ms var(--ease-out-quart);
}
@media (max-width: 720px) {
  .ci-row {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "head"
      "logo"
      "display"
      "body"
      "metrics"
      "cta";
    gap: clamp(12px, 3vw, 18px);
  }
}

.ci-row__head {
  grid-area: head;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.ci-row__meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  opacity: 0.78;
}
.ci-row__brand { color: var(--ink); }
.ci-row__place { color: var(--graphite); }
.ci-row__angle {
  color: var(--rocket-blue);
  opacity: 1;
}
.ci-row__sep {
  opacity: 0.45;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Logo plate — small, top-right on desktop; under the meta line on
   mobile. The Mopo and Tamedia marks are mono-ish; the taz mark is
   the red-on-white plate. Both treatments keep the logo visually
   tight. We constrain height, not width. */
.ci-row__logo-frame {
  grid-area: logo;
  height: clamp(36px, 4vw, 56px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
@media (max-width: 720px) {
  .ci-row__logo-frame {
    justify-content: flex-start;
    height: clamp(32px, 9vw, 44px);
  }
}
.ci-row__logo {
  height: 100%;
  width: auto;
  max-width: 220px;
  display: block;
  opacity: 0.92;
}

.ci-row__display {
  grid-area: display;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.875rem, 4.4vw, 3.5rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-wrap: balance;
  max-width: 18ch;
  transition: transform 320ms var(--ease-out-quart),
              color 220ms var(--ease-out-quart);
}

.ci-row__body {
  grid-area: body;
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  line-height: 1.55;
  color: var(--graphite);
  max-width: 56ch;
  text-wrap: pretty;
}

.ci-row__metrics {
  grid-area: metrics;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  /* Pipe separators between metrics — no chip chrome, no card grid. */
}
.ci-row__metrics li {
  color: var(--graphite);
  display: inline-flex;
  align-items: center;
}
.ci-row__metrics li + li::before {
  content: "·";
  margin: 0 14px;
  color: var(--rocket-blue);
  opacity: 0.8;
}

.ci-row__cta {
  grid-area: cta;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--rocket-blue);
  margin-top: clamp(4px, 1vw, 12px);
}
.ci-row__arrow {
  display: inline-block;
  transition: transform 240ms var(--ease-out-quart);
}

/* Hover / focus — the whole row signals "go". The headline drifts
   right a touch; the arrow chases; a faint indicator line draws on
   the left so the reader knows the row is the affordance. */
.ci-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 0;
  height: 2px;
  background: var(--rocket-blue);
  transform: translateY(-50%);
  transition: width 280ms var(--ease-out-quart);
  pointer-events: none;
}
.ci-row:hover,
.ci-row:focus-visible {
  outline: none;
  padding-left: 24px;
}
.ci-row:hover::before,
.ci-row:focus-visible::before {
  width: 14px;
}
.ci-row:hover .ci-row__display,
.ci-row:focus-visible .ci-row__display {
  color: var(--rocket-blue);
}
.ci-row:hover .ci-row__arrow,
.ci-row:focus-visible .ci-row__arrow {
  transform: translateX(6px);
}
.ci-row:focus-visible {
  outline: 2px solid var(--rocket-blue);
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .ci-row:hover,
  .ci-row:focus-visible {
    padding-left: 16px;
  }
  .ci-row:hover::before,
  .ci-row:focus-visible::before {
    width: 10px;
  }
}

/* ============================================================
   CTA — Drench. Talk to Andrey. Same pattern as the studies.
   ============================================================ */
.ci-cta {
  min-height: 60vh;
  display: flex;
  align-items: center;
}
.ci-cta__inner {
  position: relative;
  z-index: 2;
  display: grid;
  gap: clamp(18px, 2.5vw, 32px);
  max-width: 30ch;
}
.ci-cta__eyebrow { opacity: 0.7; margin: 0; }
.ci-cta__display {
  font-size: clamp(3rem, 10vw, 7.5rem);
  line-height: 0.86;
  letter-spacing: -0.045em;
}
.ci-cta__lede { max-width: 40ch; }
.ci-cta__actions {
  margin-top: clamp(8px, 2vw, 24px);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.ci-cta__btn {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 14px 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background-color 180ms var(--ease-out-quart),
              color 180ms var(--ease-out-quart),
              transform 240ms var(--ease-out-quart);
}
.ci-cta__btn--primary {
  background: var(--white);
  color: var(--rocket-blue);
  border: 1px solid var(--white);
}
.ci-cta__btn--primary:hover {
  background: transparent;
  color: var(--white);
  transform: translateY(-1px);
}
.ci-cta__btn--ghost {
  background: transparent;
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.ci-cta__btn--ghost:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}
.ci-cta__btn:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 3px;
}

/* ============================================================
   ENTRANCE CHOREOGRAPHY — same one-shot pattern as the studies.
   ============================================================ */
.reveal { opacity: 1; transform: none; }
html.has-js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 720ms var(--ease-out-quint),
    transform 720ms var(--ease-out-quint);
  transition-delay: calc(var(--i, 0) * 80ms);
  will-change: opacity, transform;
}
html.has-js .reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .ci-hero__dot { animation: none; }
  .ci-cta__btn,
  .ci-row,
  .ci-row__display,
  .ci-row__arrow,
  .ci-row::before { transition: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
