/* ════════════════════════════════════════════
   CASE STUDY PAGE — matches globe home aesthetic
   ════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body.cs-page {
  width: 100%;
  min-height: 100%;
  background: #06061A;
}

/* The glow layer border-glow.js injects (.edge-light) is absolutely positioned
   at inset:-36px, so on the hero and summary cards it reaches ~17px past each
   viewport edge at phone widths and the page pans sideways by that much (the
   starfield's -10% bleed lands in the same margin).

   Both elements need the rule, which is not redundancy. Measured at 375px:
     html only  → content still shifts 17px, scrollWidth 392
     body only  → content still shifts 17px, scrollWidth 392
     both       → shift 0, scrollWidth 375
   html's value is propagated to the viewport — that stops the pan but leaves
   html itself computing `visible`, clipping nothing — so body has to carry its
   own clip to cut the absolutely-positioned glow out of scrollable overflow.

   `clip` rather than `hidden`: hidden leaves a scrollport that still pans
   programmatically, and pairing hidden-x with visible-y silently promotes
   overflow-y to `auto`, making body a second vertical scroll container.
   Only the off-screen tail of the glow is cut; the visible bleed is untouched,
   and fixed layers keep the viewport as their containing block. */
html, body.cs-page {
  overflow-x: hidden;   /* fallback: Safari < 16 */
  overflow-x: clip;
}

body.cs-page {
  position: relative;
  font-family: var(--sans);
  /* overflow-x is set on the html + body rule above — see the note there. */
}

/* ── Ambient backdrop (echoes globe atmosphere + starfield) ── */
body.cs-page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 38% at 50% -8%, rgba(130, 180, 255, 0.10), transparent 62%);
}
/* ── Starfield: fine dust (tiled) + sparkle stars (JS-generated children) ── */
.cs-stars {
  position: fixed;
  inset: -20% -10%;
  z-index: 0;
  pointer-events: none;
  transform: translateY(var(--star-shift, 0px));
  will-change: transform;
}
.cs-stars::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-repeat: repeat;
  background-size: 340px 340px;
  background-image:
    radial-gradient(0.6px 0.6px at 5%  10%, rgba(255,255,255,0.4), transparent),
    radial-gradient(0.8px 0.8px at 18% 4%,  rgba(255,255,255,0.5), transparent),
    radial-gradient(0.6px 0.6px at 32% 22%, rgba(255,255,255,0.25),  transparent),
    radial-gradient(0.6px 0.6px at 47% 8%,  rgba(255,255,255,0.35), transparent),
    radial-gradient(0.8px 0.8px at 61% 16%, rgba(255,255,255,0.45), transparent),
    radial-gradient(0.6px 0.6px at 74% 5%,  rgba(255,255,255,0.3), transparent),
    radial-gradient(0.6px 0.6px at 88% 20%, rgba(255,255,255,0.35),  transparent),
    radial-gradient(0.8px 0.8px at 95% 34%, rgba(255,255,255,0.4),  transparent),
    radial-gradient(0.6px 0.6px at 12% 38%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.6px 0.6px at 28% 48%, rgba(255,255,255,0.4),  transparent),
    radial-gradient(0.6px 0.6px at 41% 58%, rgba(255,255,255,0.25),  transparent),
    radial-gradient(0.8px 0.8px at 55% 44%, rgba(255,255,255,0.45), transparent),
    radial-gradient(0.6px 0.6px at 68% 52%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.6px 0.6px at 82% 60%, rgba(255,255,255,0.35),  transparent),
    radial-gradient(0.6px 0.6px at 6%  68%, rgba(255,255,255,0.25),  transparent),
    radial-gradient(0.8px 0.8px at 22% 78%, rgba(255,255,255,0.4),  transparent),
    radial-gradient(0.6px 0.6px at 36% 88%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.6px 0.6px at 50% 72%, rgba(255,255,255,0.35),  transparent),
    radial-gradient(0.6px 0.6px at 64% 84%, rgba(255,255,255,0.25), transparent),
    radial-gradient(0.8px 0.8px at 78% 92%, rgba(255,255,255,0.45), transparent),
    radial-gradient(0.6px 0.6px at 90% 78%, rgba(255,255,255,0.3), transparent),
    radial-gradient(0.6px 0.6px at 15% 92%, rgba(255,255,255,0.25),  transparent),
    radial-gradient(0.6px 0.6px at 45% 95%, rgba(255,255,255,0.3),  transparent),
    radial-gradient(0.6px 0.6px at 70% 30%, rgba(255,255,255,0.25),  transparent),
    radial-gradient(0.6px 0.6px at 85% 8%,  rgba(255,255,255,0.3), transparent);
}

.cs-star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
}
.cs-star.warm { background: #FFF2D8; }
.cs-star.cool { background: #D6E4FF; }
.cs-star.twinkle {
  animation: cs-twinkle var(--tw-dur, 3.2s) ease-in-out infinite;
  animation-delay: var(--tw-delay, 0s);
}
@keyframes cs-twinkle {
  0%, 100% { opacity: var(--tw-min, 0.2); transform: scale(0.8); }
  50%      { opacity: var(--tw-max, 0.9); transform: scale(1.2); }
}

/* ── Top nav (mirrors globe-nav pill buttons) ── */
/* Sticky frosted-glass bar so the buttons stay legible over page content
   as you scroll. Base layout (Home left · pill right) suits the About page;
   case studies add .has-center for the three-column centered layout. */
.cs-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 44px;
  background: rgba(8, 7, 22, 0.72);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid rgba(255, 154, 96, 0.1);
}

/* Case-study top nav: Home (left) · About / Resume / Get in touch (center) ·
   Next (right). The 1fr auto 1fr grid keeps the centre group truly centred
   in the viewport regardless of how wide the side buttons are. */
.cs-topnav.has-center {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
}
.cs-topnav-left   { justify-self: start; display: flex; align-items: center; }
.cs-topnav-right  { justify-self: end;   display: flex; align-items: center; }
.cs-topnav-center {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* On desktop the drawer is transparent to layout — its children (centre +
   right groups) act as direct grid items. It only becomes a real panel on
   mobile (see the max-width: 860px block). */
.cs-nav-drawer { display: contents; }

/* Hamburger toggle — bare icon (no outline), hidden on desktop, shown on mobile. */
.cs-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 26px;
  height: 34px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.cs-nav-toggle span {
  display: block;
  width: 24px;
  height: 1.5px;
  border-radius: 2px;
  background: rgba(255, 200, 150, 0.9);
  /* springy morph into the X */
  transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55),
              opacity 0.2s ease, background 0.22s ease;
}
.cs-nav-toggle:hover span { background: rgba(255, 222, 178, 1); }
/* Morph to an X while the menu is open */
.cs-topnav.menu-open .cs-nav-toggle span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.cs-topnav.menu-open .cs-nav-toggle span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.cs-topnav.menu-open .cs-nav-toggle span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* Meta footer inside the mobile menu — hidden on desktop (kept out of the grid). */
.cs-nav-meta { display: none; }

/* Lock page scroll behind the full-screen mobile menu. */
html.cs-menu-lock { overflow: hidden; }

/* Decrypt-in effect on the menu labels — scrambling glyphs glow accent-orange,
   settled characters keep the link's own colour (cream, or green for the CTA). */
.cs-nav-drawer .dt-visual { white-space: pre-wrap; }
.cs-nav-drawer .dt-encrypted { color: var(--c-accent); }
.cs-nav-drawer .dt-revealed { color: inherit; }

.cs-nav-btn {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.6);
  text-decoration: none;
  padding: 6px 15px;
  border-radius: 100px;
  border: 1px solid rgba(255, 154, 96, 0.2);
  background: none;
  transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cs-nav-btn:hover {
  color: rgba(255, 220, 170, 0.95);
  border-color: rgba(255, 154, 96, 0.5);
  background: rgba(255, 154, 96, 0.07);
  transform: translateY(-1px);
}
.cs-nav-btn.ghost {
  border-color: transparent;
  color: rgba(200, 144, 112, 0.85);
}
.cs-nav-btn.ghost:hover {
  color: rgba(255, 190, 130, 0.75);
  border-color: rgba(255, 154, 96, 0.2);
  background: rgba(255, 154, 96, 0.05);
}
/* "Get in touch" CTA — green accent, ties to the About page's contact pill */
.cs-nav-btn.cta {
  color: var(--c-shipped);
  border-color: rgba(128, 224, 160, 0.4);
  background: rgba(128, 224, 160, 0.08);
}
.cs-nav-btn.cta:hover {
  color: #d5f6e2;
  border-color: rgba(128, 224, 160, 0.7);
  background: rgba(128, 224, 160, 0.16);
  transform: translateY(-1px);
}

.cs-status-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-gate);
  padding: 6px 14px;
  border: 1px solid rgba(255, 154, 96, 0.2);
  border-radius: 100px;
}
.cs-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-gate);
  box-shadow: 0 0 8px rgba(255, 154, 96, 0.6);
  animation: cs-pulse 2.5s infinite;
}
@keyframes cs-pulse {
  0%, 100% { opacity: 1;    transform: scale(1);   }
  50%      { opacity: 0.3;  transform: scale(0.7); }
}

/* ── Green contact pill — "Get in touch" (about.html) ── */
.cs-status-pill.open { color: var(--c-shipped); border-color: rgba(128, 224, 160, 0.25); }
.cs-status-pill.open .cs-status-dot { background: var(--c-shipped); box-shadow: 0 0 8px rgba(128, 224, 160, 0.6); }
/* When it's a link (a "Get in touch" CTA), drop the underline and give it a hover */
a.cs-status-pill { text-decoration: none; transition: all 0.22s cubic-bezier(0.34, 1.56, 0.64, 1); }
a.cs-status-pill.open:hover {
  color: #d5f6e2;
  border-color: rgba(128, 224, 160, 0.55);
  background: rgba(128, 224, 160, 0.1);
  transform: translateY(-1px);
}

.cs-nav-btn svg { vertical-align: -1px; margin-right: 6px; }

/* ── Focus pill — project type/discipline, same neutral accent everywhere ── */
.cs-focus-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-gate);
  padding: 6px 14px;
  border: 1px solid rgba(255, 154, 96, 0.2);
  border-radius: 100px;
}

/* ── Main column ── */
.cs-main {
  position: relative;
  z-index: 1;
  max-width: 850px;
  margin: 0 auto;
  padding: 104px 24px 90px;
}

/* ── Hero ── */
.cs-hero {
  text-align: center;
  margin-bottom: 48px;
}
.cs-hero-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--c-meta);
  margin-bottom: 20px;
}
.cs-hero-meta .cs-sep { color: rgba(255, 190, 130, 0.25); }
.cs-hero-meta .cs-tag { color: rgba(200, 144, 112, 0.85); }
.cs-hero-title {
  font-family: var(--display);
  font-style: normal;
  font-weight: 700;
  font-size: clamp(36px, 5.5vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: rgba(255, 236, 210, 0.94);
  margin-bottom: 12px;
}
.cs-hero-title em {
  font-style: normal;
}
.cs-hero-title strong {
  font-weight: 700;
  color: var(--c-accent);
  text-shadow: 0 0 24px rgba(255, 154, 96, 0.5);
}
.cs-hero-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.65);
}

/* ── Hero photo — full-bleed image with the title overlaid ── */
.cs-hero-photo {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 8;
  margin-bottom: 40px;
  background: rgba(255, 154, 96, 0.04);
  border: 1px solid rgba(255, 154, 96, 0.16);
}
/* border-glow.js wraps a card's children in .border-glow-inner, and
   border-glow.css gives that wrapper overflow:auto. On a hero using data-zoom
   the scaled image then overflows it, turning the hero into a real scroll
   container — the reader can drag the photo around inside its own frame.
   Clip it here instead (the corner-clipping border-glow.css leaves opt-in).
   The glow is unaffected: it lives in a sibling .edge-light at inset:-36px,
   outside this wrapper, and the card itself stays overflow:visible for it. */
.cs-hero-photo > .border-glow-inner {
  overflow: hidden;        /* fallback */
  overflow: clip;          /* no scroll container at all, not merely hidden */
  border-radius: inherit;
}
.cs-hero-photo-frame {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(255, 190, 130, 0.3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
}
.cs-hero-photo-frame svg { opacity: 0.5; }
.cs-hero-photo-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-hero-photo-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(6, 6, 26, 0.95) 0%, rgba(6, 6, 26, 0.55) 42%, transparent 75%);
  pointer-events: none;
}
/* Ease the scrim when it would otherwise swallow the device screen. */
.cs-hero-photo.soft-scrim .cs-hero-photo-scrim {
  background: linear-gradient(0deg, rgba(6, 6, 26, 0.88) 0%, rgba(6, 6, 26, 0.34) 38%, transparent 66%);
}
/* Vertical framing, for heroes whose subject isn't centred in the source.
   Higher = show more of the image's lower half, pushing the subject up. */
.cs-hero-photo[data-focus="28"] .cs-hero-photo-img { object-position: center 28%; }
.cs-hero-photo[data-focus="35"] .cs-hero-photo-img { object-position: center 35%; }
.cs-hero-photo[data-focus="38"] .cs-hero-photo-img { object-position: center 38%; }
.cs-hero-photo[data-focus="45"] .cs-hero-photo-img { object-position: center 45%; }
.cs-hero-photo[data-focus="51"] .cs-hero-photo-img { object-position: center 51%; }
.cs-hero-photo[data-focus="57"] .cs-hero-photo-img { object-position: center 57%; }
.cs-hero-photo[data-focus="65"] .cs-hero-photo-img { object-position: center 65%; }
.cs-hero-photo[data-focus="78"] .cs-hero-photo-img { object-position: center 78%; }
.cs-hero-photo[data-focus="82"] .cs-hero-photo-img { object-position: center 82%; }
.cs-hero-photo[data-focus="84"] .cs-hero-photo-img { object-position: center 84%; }
/* Zoom past cover, anchored to the top edge so data-focus alone still governs
   the gap above the device. Desktop only — the portrait crop frames itself.
   data-anchor="left" pins the left edge instead of the centre, which crops the
   zoom off the right-hand side of the frame. */
.cs-hero-photo[data-zoom] .cs-hero-photo-img { transform-origin: center top; }
.cs-hero-photo[data-zoom][data-anchor="left"] .cs-hero-photo-img { transform-origin: left top; }
.cs-hero-photo[data-zoom="103"] .cs-hero-photo-img { transform: scale(1.03); }
.cs-hero-photo[data-zoom="109"] .cs-hero-photo-img { transform: scale(1.09); }
.cs-hero-photo[data-zoom="110"] .cs-hero-photo-img { transform: scale(1.1); }
.cs-hero-photo[data-zoom="120"] .cs-hero-photo-img { transform: scale(1.2); }
.cs-hero-photo[data-zoom="130"] .cs-hero-photo-img { transform: scale(1.3); }
.cs-hero-photo-caption {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 22px;
  text-align: left;
}
.cs-hero-photo-caption .cs-hero-title {
  font-size: clamp(28px, 4.2vw, 42px);
  margin-bottom: 6px;
}

/* ── Summary — quick TL;DR before the detailed sections ── */
.cs-summary {
  border: 1px solid rgba(255, 154, 96, 0.16);
  background: rgba(255, 154, 96, 0.03);
  border-radius: 14px;
  padding: 22px 26px;
  margin-bottom: 28px;
}
.cs-summary { scroll-margin-top: 100px; }
.cs-summary-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 10px;
}
.cs-summary-text {
  font-family: var(--sans);
  font-size: clamp(14px, 1.7vw, 16px);
  line-height: 1.65;
  color: rgba(255, 236, 218, 0.88);
}

/* Metrics nested inside the summary card read as one unified block —
   a divider line above, plain columns separated by rules (no boxes). */
.cs-summary .cs-metrics {
  margin: 20px 0 0;
  padding-top: 20px;
  border-top: 1px dashed rgba(255, 154, 96, 0.16);
}
.cs-summary .cs-metric {
  border: none;
  background: none;
  border-radius: 0;
  padding: 0 12px;
  border-right: 1px solid rgba(255, 154, 96, 0.14);
}
.cs-summary .cs-metric:last-child {
  border-right: none;
}
/* Impact stats read as "results" — green, matching the Outcome section. */
.cs-summary .cs-metric-val {
  color: var(--c-shipped);
  text-shadow: 0 0 14px rgba(128, 224, 160, 0.3);
}
.cs-summary .cs-metric-lbl {
  color: rgba(128, 224, 160, 0.65);
}

/* ── Metrics ── */
.cs-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 40px;
}
.cs-metric {
  padding: 17px 12px;
  text-align: center;
  border: 1px solid rgba(255, 154, 96, 0.14);
  border-radius: 12px;
  background: rgba(255, 154, 96, 0.02);
}
.cs-metric-val {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(19px, 2.4vw, 25px);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 5px;
  color: rgba(255, 236, 210, 0.94);
}
/* Leading ↑ / + on a stat. The display face draws both with very tight
   sidebearings — at this size the -0.02em tracking closes the last of it and
   the mark's ink touches the first digit, while digit-to-digit keeps 1-2px.
   Its own margin restores the rhythm. (→ is cut with normal sidebearings and
   doesn't need this.) */
.cs-metric-val .cs-metric-sign {
  display: inline-block;
  margin-right: 0.16em;
}
.cs-metric-lbl {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.65);
}

/* ── Route / waypoints ── */
.cs-route {
  /* Single source of truth for the dot geometry. The connector derives its
     position from these, so changing the top padding (as .cs-timeline does)
     can't leave the line floating off the dots. */
  --route-pad-top: 26px;
  --wdot: 8px;
  display: flex;
  padding: var(--route-pad-top) 10px 0;
  margin-bottom: 44px;
  position: relative;
}
.cs-route::before {
  content: '';
  position: absolute;
  /* Each dot is pinned to the top of its waypoint, which begins where the
     route's top padding ends — so the dots' centre axis is half a dot below
     that. The trailing 0.5px centres the hairline on the axis. */
  top: calc(var(--route-pad-top) + var(--wdot) / 2 - 0.5px);
  left: 36px;
  right: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 154, 96, 0.16) 8%, rgba(255, 154, 96, 0.16) 92%, transparent);
}
.cs-waypoint {
  flex: 1;
  text-align: center;
  position: relative;
  padding-top: 26px;
  min-width: 56px;
}
.cs-wdot {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: var(--wdot);
  height: var(--wdot);
  border-radius: 50%;
  background: var(--c-gate);
  box-shadow: 0 0 8px rgba(255, 154, 96, 0.45);
}
.cs-wdot.done {
  background: var(--c-shipped);
  box-shadow: 0 0 8px rgba(128, 224, 160, 0.45);
}
.cs-wname {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.65);
  margin-bottom: 4px;
}
.cs-wsub {
  font-family: var(--sans);
  font-size: 9.5px;
  color: rgba(255, 220, 200, 0.62);
  line-height: 1.35;
}

/* ── Content sections ── */
.cs-section {
  padding-top: 34px;
  margin-top: 34px;
  scroll-margin-top: 100px;
}
.cs-section:first-of-type {
  padding-top: 0;
  margin-top: 0;
}
.cs-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.65);
  margin-bottom: 16px;
}
.cs-num {
  color: var(--c-accent);
  font-weight: 700;
}
.cs-section-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 154, 96, 0.12);
}
.cs-body {
  font-family: var(--sans);
  font-size: clamp(13px, 1.5vw, 14.5px);
  line-height: 1.75;
  color: rgba(255, 224, 204, 0.62);
}
.cs-body p + p { margin-top: 12px; }
.cs-body strong {
  color: rgba(255, 236, 210, 0.94);
  font-weight: 500;
}
.cs-body ul {
  margin: 12px 0;
  padding-left: 0;
  list-style: none;
}
.cs-body ul li {
  padding: 4px 0 4px 18px;
  position: relative;
}
.cs-body ul li::before {
  content: '—';
  position: absolute;
  left: 0;
  color: var(--c-gate);
  font-family: var(--mono);
  font-size: 10px;
}

/* ── Image placeholders ── */
.cs-img {
  width: 100%;
  margin: 18px 0 6px;
  background: rgba(255, 154, 96, 0.025);
  border: 1px dashed rgba(255, 154, 96, 0.18);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: rgba(255, 190, 130, 0.65);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  aspect-ratio: 16 / 7;
  transition: background 0.2s, border-color 0.2s;
}
.cs-img:hover {
  background: rgba(255, 154, 96, 0.045);
  border-color: rgba(255, 154, 96, 0.32);
}
.cs-img.tall { aspect-ratio: 4 / 3; }
.cs-img.wide { aspect-ratio: 21 / 8; }
.cs-img.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  aspect-ratio: auto;
  background: none;
  border: none;
  padding: 0;
}
.cs-img.pair > .cs-img { margin: 0; aspect-ratio: 4 / 3; }
.cs-img-icon { opacity: 0.35; }

/* Real inline data figures — same frame as .cs-img, but holding an SVG chart
   instead of a placeholder. Height comes from the SVG's own aspect ratio. */
.cs-chart {
  width: 100%;
  margin: 18px 0 6px;
  background: rgba(255, 154, 96, 0.025);
  border: 1px solid rgba(255, 154, 96, 0.14);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.22s ease, background 0.22s ease;
}
/* Charts opt out of the Border Glow (see js/case-study-glow.js) and take the
   same plain hover as .cs-rec — identical resting values, so identical lift. */
.cs-chart:hover {
  border-color: rgba(255, 154, 96, 0.28);
  background: rgba(255, 154, 96, 0.045);
}
.cs-chart svg { display: block; width: 100%; height: auto; }
/* A portrait variant of a chart (the stacked .ab-mobile SVG) is hidden until
   the narrow breakpoint swaps it in. */
.cs-chart .ab-mobile { display: none; }
/* Below ~700px the 820-unit viewBox would scale labels down to ~5px, so the
   figure scrolls sideways inside its own frame instead of shrinking further. */
@media (max-width: 700px) {
  .cs-chart { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  .cs-chart svg { min-width: 640px; }
  /* Except a chart that ships a portrait variant: swap desktop→mobile and let
     it shrink to the frame, so it reads without a sideways scroll. The
     .ab-mobile min-width:0 (0,2,0) outranks the .cs-chart svg rule above. */
  .cs-chart--reflow { overflow-x: clip; }
  .cs-chart--reflow .ab-desktop { display: none; }
  .cs-chart--reflow .ab-mobile { display: block; min-width: 0; }
}
.cs-img-caption {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.65);
  text-align: center;
  margin-bottom: 6px;
}

/* ── Outcome highlights ── */
.cs-outcome {
  display: flex;
  margin-top: 18px;
  border: 1px solid rgba(128, 224, 160, 0.16);
  border-radius: 10px;
  overflow: hidden;
}
.cs-outcome-stat {
  flex: 1;
  padding: 14px 14px;
  text-align: center;
  border-right: 1px solid rgba(128, 224, 160, 0.14);
  background: rgba(128, 224, 160, 0.03);
}
.cs-outcome-stat:last-child { border-right: none; }
.cs-outcome-val {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(18px, 2.2vw, 22px);
  color: var(--c-shipped);
  text-shadow: 0 0 14px rgba(128, 224, 160, 0.3);
  line-height: 1;
  margin-bottom: 4px;
}
.cs-outcome-lbl {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(128, 224, 160, 0.65);
}

/* ════════════════════════════════════════════
   REAL-CONTENT COMPONENTS
   Added for the "From Directory to Marketplace" hero case study; reusable
   across every case study as real content replaces placeholders.
   ════════════════════════════════════════════ */

/* ── Project meta (quick facts: Role / Timeline / Launch) ──
   Sits in the summary card above the impact metrics. */
.cs-projmeta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.cs-summary .cs-projmeta {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed rgba(255, 154, 96, 0.16);
}
/* When meta precedes the metrics, it owns the divider — metrics just sit below. */
.cs-summary .cs-projmeta + .cs-metrics {
  margin-top: 16px;
  padding-top: 0;
  border-top: none;
}
.cs-projmeta-item {
  padding: 0 12px;
  border-right: 1px solid rgba(255, 154, 96, 0.14);
}
.cs-projmeta-item:last-child { border-right: none; }
.cs-projmeta-lbl {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 6px;
}
.cs-projmeta-val {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(255, 236, 210, 0.9);
}

/* ── Hero descriptive subtitle — sits between the short title and the meta
   line, over the hero photo. The short title doubles as the nav pill. ── */
.cs-hero-desc {
  font-family: var(--sans);
  font-size: clamp(13px, 1.7vw, 16px);
  line-height: 1.45;
  color: rgba(255, 236, 210, 0.85);
  margin: 2px 0 12px;
}

/* ── Project header — Role + Deliverables, a light metadata bar above the
   summary card ("who/what" before the narrative). ── */
.cs-projhead {
  display: grid;
  grid-template-columns: minmax(170px, 230px) 1fr;
  gap: 30px;
  margin: 0 0 30px;
  padding: 0 2px 24px;
  border-bottom: 1px dashed rgba(255, 154, 96, 0.14);
}
/* Inside the summary card, the Role/Deliverables block becomes a byline-style
   footer: divider on top, flush to the card's own padding, no extra chrome. */
.cs-summary .cs-projhead {
  margin: 24px 0 0;
  padding: 22px 0 0;
  border-bottom: none;
  border-top: 1px dashed rgba(255, 154, 96, 0.16);
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 28px;
  align-items: start;
}
.cs-projhead-lbl {
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 8px;
}
.cs-projhead-val {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 236, 210, 0.85);
}

/* ── In-section timeline wrapper (the process route, homed inside Context
   instead of floating under the summary). The waypoints carry their own dates,
   so the route needs no caption underneath. ── */
.cs-timeline { margin: 6px 0 30px; }
.cs-timeline .cs-route {
  margin-bottom: 0;
  /* Drives both the padding and the connector's position (see .cs-route). */
  --route-pad-top: 22px;
}

/* ── Callout / pull-quote — for the strong one-line statements ── */
.cs-callout {
  margin: 24px 0;
  padding: 18px 24px;
  border-left: 2px solid var(--c-accent);
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, rgba(255, 154, 96, 0.07), rgba(255, 154, 96, 0.01));
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.5;
  color: rgba(255, 236, 210, 0.93);
}
.cs-callout em {
  font-style: normal;
  color: var(--c-accent);
}

/* ── User-research pull quote — a verbatim respondent voice ── */
.cs-pullquote {
  margin: 22px 0;
  padding: 4px 0 4px 22px;
  border-left: 2px solid rgba(255, 255, 255, 0.18);
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}
.cs-pullquote span {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
}

/* ── Data table — outcome metrics + selective research tables ── */
.cs-table-wrap {
  margin: 18px 0 6px;
  overflow-x: auto;
  border: 1px solid rgba(255, 154, 96, 0.14);
  border-radius: 10px;
}
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 12.5px;
}
.cs-table th,
.cs-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 154, 96, 0.08);
  white-space: nowrap;
}
.cs-table thead th {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-accent);
  background: rgba(255, 154, 96, 0.03);
}
.cs-table tbody tr:last-child td { border-bottom: none; }
.cs-table td { color: rgba(255, 224, 204, 0.72); }
.cs-table td:first-child,
.cs-table th:first-child { white-space: normal; }
.cs-table td:first-child { color: rgba(255, 236, 210, 0.92); }
.cs-table .up {
  color: var(--c-shipped);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 11.5px;
}

/* Stacked prose tables (two text columns) wrap and share the width, unlike the
   metric tables where non-first columns stay nowrap to keep numbers on one line.
   Fixed layout so the column ratio is honored regardless of content length; a
   per-table <colgroup> can override the default even split. */
.cs-table-stack { table-layout: fixed; }
.cs-table-stack th,
.cs-table-stack td {
  white-space: normal;
  vertical-align: top;
}

/* ── Feature chips — "what shipped" ── */
.cs-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 6px;
}
.cs-feature {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 7px 13px;
  border-radius: 100px;
  border: 1px solid rgba(255, 154, 96, 0.18);
  color: rgba(255, 200, 150, 0.82);
  background: rgba(255, 154, 96, 0.03);
}
.cs-feature::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--c-shipped);
  box-shadow: 0 0 5px rgba(128, 224, 160, 0.6);
}

/* ── Real screenshots — framed captures (vs the .cs-img placeholders) ── */
.cs-shot {
  width: 100%;
  margin: 18px 0 6px;
  border-radius: 14px;
  overflow: hidden;
  background: #0C0A1A;
  /* Floating frame that matches the phone-mockup family (see .cs-device). */
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 2px 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 56px -24px rgba(0, 0, 0, 0.9),
    0 10px 22px -14px rgba(0, 0, 0, 0.7);
}
.cs-shot img,
.cs-shot video {
  display: block;
  width: 100%;
  height: auto;
}
/* Light "paper" panel — for captures that already sit on a white background
   (e.g. the Amba app screens). A full-width white surface with padding so the
   phones read as centred on a wide, intentional frame rather than a tight crop.
   The image's own pure-white bg blends seamlessly into the panel, and capping
   the image width keeps the phones crisp instead of upscaling to fill. */
.cs-shot.paper {
  background: #fff;
  padding: 30px 24px;
}
.cs-shot.paper img {
  max-width: 560px;
  margin: 0 auto;
}
/* Browser chrome for desktop captures whose content is the webpage only (no
   baked-in browser UI): a dark title bar with traffic lights. Shots that already
   include real browser chrome (e.g. a Safari/Chrome recording) use plain .cs-shot
   instead, so the chrome isn't doubled. */
/* Draw the chrome bar as a top strip of the element's own background (a thin
   28px band ending in a hairline), which frees both pseudo-elements for the
   traffic dots and a centred address pill. */
.cs-shot.browser {
  position: relative;
  background: linear-gradient(180deg,
    #1d1d23 0, #1a1a20 27px,
    rgba(0, 0, 0, 0.45) 27px, rgba(0, 0, 0, 0.45) 28px,
    #0C0A1A 28px);
}
.cs-shot.browser img,
.cs-shot.browser video { margin-top: 28px; }
/* Crop a shot's video sides to match its neighbour's aspect (here: the after
   video, 640x380). object-fit:cover trims the wider before video's sides. */
.cs-shot.crop-sides video { aspect-ratio: 640 / 380; object-fit: cover; }
/* Traffic lights — small and lightly muted. */
.cs-shot.browser::before {
  content: '';
  position: absolute;
  top: 11px; left: 14px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #e05650;
  box-shadow: 11px 0 0 #e0a838, 22px 0 0 #2eae55;
  z-index: 2;
}
/* Address pill. */
.cs-shot.browser::after {
  content: '';
  position: absolute;
  top: 8.5px; left: 50%;
  transform: translateX(-50%);
  width: 46%;
  max-width: 260px;
  height: 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.07);
  z-index: 2;
}
/* Two-up row of screenshots. */
.cs-shot-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 18px 0 6px;
  align-items: start;
}
.cs-shot-pair .cs-shot { margin: 0; }
/* A desktop capture beside a phone. .cs-device.sm caps the phone at 210px, so
   an even split stranded ~185px of empty cell next to it while the capture was
   squeezed to 395px — leaving the phone 163px taller. Giving the spare width to
   the capture closes most of that, and centring trades a long one-sided
   overhang for a small even one. */
.cs-shot-pair.mixed {
  grid-template-columns: 1fr 250px;
  align-items: center;
}
/* .cs-device ships an asymmetric 18px/6px margin, and centring centres the
   margin box — which threw the optical alignment off by exactly half that. */
.cs-shot-pair.mixed .cs-device { margin: 0 auto; }
/* Tall phone captures sit narrower and centered. */
.cs-shot.tall {
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}
/* Smaller phone slot — keeps a low-res portrait clip from being upscaled. */
.cs-shot.tall.sm { max-width: 190px; }

/* ── Screen-level recommendations — each app screen paired with the change it
   needed. The captures are white-on-white (same family as .cs-shot.paper), so
   each phone gets its own light panel and the recommendation sits below it in
   page type rather than in an overlaid callout. ── */
.cs-rec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 18px 0 6px;
}
.cs-rec {
  border: 1px solid rgba(255, 154, 96, 0.14);
  border-radius: 10px;
  background: rgba(255, 154, 96, 0.025);
  overflow: hidden;
  transition: border-color 0.22s ease, background 0.22s ease;
}
.cs-rec:hover {
  border-color: rgba(255, 154, 96, 0.28);
  background: rgba(255, 154, 96, 0.045);
}
/* White panel behind the capture — its own pure-white background blends in. */
.cs-rec-shot {
  background: #fff;
  padding: 10px 12px 6px;
}
.cs-rec-shot img { display: block; width: 100%; height: auto; }
.cs-rec-text {
  padding: 11px 13px 13px;
  font-family: var(--sans);
  font-size: 11.5px;
  line-height: 1.6;
  color: rgba(255, 224, 204, 0.62);
}
.cs-rec-text strong {
  display: block;
  margin-bottom: 3px;
  color: rgba(255, 236, 210, 0.94);
  font-weight: 500;
}

/* ── Device mockup — a clean CSS iPhone bezel wrapping a screen or recording.
   iOS screen recordings already bake in the status bar + dynamic island, so the
   frame is only the physical body: bezel, rounded screen, side buttons, and a
   soft floating shadow tuned for the dark background (#06061A). ── */
.cs-device {
  --bezel: 11px;
  --radius: 46px;
  position: relative;
  max-width: 300px;
  margin: 18px auto 6px;
  padding: var(--bezel);
  background: linear-gradient(150deg, #26262e 0%, #101015 42%, #08080b 100%);
  border-radius: var(--radius);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08),                /* crisp outer edge */
    0 2px 1px 0 rgba(255, 255, 255, 0.06) inset,        /* top rim catches light */
    0 34px 60px -24px rgba(0, 0, 0, 0.9),               /* ambient drop */
    0 10px 24px -14px rgba(0, 0, 0, 0.7);               /* contact shadow */
}
/* Smaller phone — for lower-res clips that would upscale (and go soft) at full
   size. Slightly thinner bezel keeps the proportions right at this scale. */
.cs-device.sm {
  --bezel: 8px;
  --radius: 34px;
  max-width: 210px;
}
.cs-device-screen {
  position: relative;
  border-radius: calc(var(--radius) - var(--bezel));
  overflow: hidden;
  background: #000;
}
.cs-device-screen > video,
.cs-device-screen > img {
  display: block;
  width: 100%;
  height: auto;
}
/* Clean dynamic island drawn over the screen. The default is the real hardware
   geometry of the 15/16 Pro island (125 x 36.7pt on a 393 x 852pt screen, centred),
   which is what a still screenshot needs — iOS never captures the island itself, so
   we draw it. Screen RECORDINGS are different: iOS expands the island while
   recording and bakes it into the frames, so those need .rec below to cover the
   wider pill and its red dot. Per-shot overrides via the CSS variables. */
.cs-device-island {
  position: absolute;
  top: var(--isl-top, 1.35%);
  left: var(--isl-left, 34.1%);
  width: var(--isl-w, 31.8%);
  height: var(--isl-h, 4.3%);
  background: #000;
  border-radius: 999px;
  pointer-events: none;
}
/* Screen recordings: iOS bakes an expanded island into the frames. */
.cs-device-island.rec { --isl-left: 27.7%; --isl-w: 43.7%; }

/* Right side: power button. */
.cs-device::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 27%;
  width: 3px;
  height: 62px;
  border-radius: 2px;
  background: linear-gradient(90deg, #08080b, #2e2e36);
}
/* Left side: volume rocker + mute switch (stacked via box-shadow clones). */
.cs-device::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 20%;
  width: 3px;
  height: 30px;
  border-radius: 2px;
  background: linear-gradient(270deg, #08080b, #2e2e36);
  box-shadow: 0 44px 0 0 currentColor, 0 88px 0 0 currentColor;
  color: #2a2a32;
}

/* ── Before / After comparison — side by side (stacks on mobile) ── */
.cs-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 20px 0 6px;
  align-items: start;
}
.cs-compare-item { min-width: 0; }
.cs-compare-item .cs-shot { margin: 8px 0 0; }
.cs-compare-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 100px;
}
.cs-compare-tag.before {
  color: rgba(255, 150, 120, 0.9);
  border: 1px solid rgba(255, 120, 90, 0.32);
  background: rgba(255, 120, 90, 0.06);
}
.cs-compare-tag.after {
  color: var(--c-shipped);
  border: 1px solid rgba(128, 224, 160, 0.32);
  background: rgba(128, 224, 160, 0.06);
}

/* ── Card stack (mobile) — a swipeable deck built from a flagged table ──
   Hidden by default; shown only on mobile, where the table is hidden. */
.cs-stack { display: none; margin: 18px 0 6px; }
.cs-stack-deck {
  position: relative;
  width: 100%;
  perspective: 1000px;
  touch-action: pan-y;          /* keep vertical page scroll; horizontal = drag */
}
.stack-card {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 154, 96, 0.2);
  border-radius: 14px;
  background: #120f1f;          /* opaque so cards behind don't bleed through */
  padding: 18px;
  box-shadow: 0 12px 32px -14px rgba(0, 0, 0, 0.75);
  backface-visibility: hidden;
  will-change: transform;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
.stack-card.is-top { cursor: grab; }
.stack-card.is-top:active { cursor: grabbing; }
/* While measuring, cards drop into normal flow so their natural height reads. */
.cs-stack-deck.measuring { height: auto !important; }
.cs-stack-deck.measuring .stack-card {
  position: static;
  inset: auto;
  transform: none !important;
  transition: none !important;
  margin-bottom: 10px;
}

/* Metric card */
.stack-metric-name {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  color: rgba(255, 236, 210, 0.95);
  padding-bottom: 10px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 154, 96, 0.12);
}
.stack-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
}
.stack-stat-lbl {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.6);
}
.stack-stat-val { font-family: var(--sans); font-size: 14px; color: rgba(255, 224, 204, 0.85); }
.stack-stat-val.up { font-family: var(--mono); font-weight: 600; color: var(--c-shipped); }

/* Feedback card */
.stack-block + .stack-block {
  margin-top: 11px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 154, 96, 0.1);
}
.stack-lbl {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-accent);
  margin-bottom: 5px;
}
.stack-text { font-family: var(--sans); font-size: 13px; line-height: 1.5; color: rgba(255, 224, 204, 0.8); }

/* Position dots + hint */
.cs-stack-dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.cs-stack-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255, 154, 96, 0.25);
  transition: background 0.3s ease, transform 0.3s ease;
}
.cs-stack-dot.active { background: var(--c-shipped); transform: scale(1.3); }
.cs-stack-hint {
  text-align: center;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.5);
  margin-top: 9px;
}

/* On mobile: show the stack, hide the flagged table it replaces. */
@media (max-width: 560px) {
  .cs-stack { display: block; }
  .cs-table-wrap.stacked { display: none; }
}

/* ── Bottom nav ── */
.cs-botnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 154, 96, 0.1);
}
/* Groups the right-hand actions (About + Get in touch) so they sit together */
.cs-botnav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Fade transition (mirrors globe nav-fade) ── */
.cs-fade {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #06061A;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.55s ease;
}
.cs-fade.fading { opacity: 1; pointer-events: all; }
/* Arrival fade. The overlay is opaque from the very first paint (a synchronous
   <head> script adds .cs-arriving before render → no content flash). It stays
   opaque through the page's heavy init work, then the module adds .cs-reveal to
   fade it out — so the fade animates on an idle main thread (smooth), with the
   init jank hidden behind the still-opaque overlay. */
html.cs-arriving .cs-fade { opacity: 1; will-change: opacity; }
html.cs-arriving.cs-reveal .cs-fade { opacity: 0; transition: opacity 0.55s ease; }

/* ── Responsive ── */
/* Below ~860px the buttons stop fitting on one line: collapse the centre +
   right groups into a hamburger dropdown, leaving Home + the toggle in the bar. */
@media (max-width: 860px) {
  .cs-topnav.has-center {
    display: flex;
    justify-content: space-between;
  }
  /* Pad the right by the scrollbar width so the hamburger lines up with the
     (scrollbar-inset) page content instead of the physical viewport edge. */
  .cs-topnav { padding-right: calc(44px + var(--sbw, 0px)); }
  .cs-nav-toggle { display: flex; }
  /* Hide the centre + right groups until the script moves them into the drawer.
     Prevents a flash of the full button row before the deferred module runs
     (the .cs-nav-drawer rule below re-shows them inside the panel). */
  .cs-topnav-center,
  .cs-topnav-right { display: none; }
  /* Keep Home + the toggle above the full-screen overlay. */
  .cs-topnav-left,
  .cs-nav-toggle { position: relative; z-index: 6; }

  /* ── Full-screen editorial takeover ── */
  .cs-nav-drawer {
    display: flex;              /* override display:contents → real panel */
    flex-direction: column;
    z-index: 5;
    /* 100vw/vh work even though the blurred nav is the containing block,
       because the nav sits at the viewport's top-left corner. */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    padding: 96px 44px calc(32px + env(safe-area-inset-bottom));
    background: rgba(6, 5, 18, 0.97);
    backdrop-filter: blur(26px) saturate(1.2);
    -webkit-backdrop-filter: blur(26px) saturate(1.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    pointer-events: none;
    /* visibility flips instantly (not transitioned) so it never gets stuck
       mid-animation and stays out of the tab order while closed. */
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .cs-topnav.menu-open .cs-nav-drawer {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
  /* Stack the groups into one continuous list of big editorial links. */
  .cs-nav-drawer .cs-topnav-center,
  .cs-nav-drawer .cs-topnav-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }
  /* Put "Next / View work" at the top of the menu (mobile only; desktop keeps
     it on the right of the bar via the untouched grid). */
  .cs-nav-drawer .cs-topnav-right { order: -1; }
  .cs-nav-drawer .cs-nav-btn {
    /* strip the pill → large left-aligned display link */
    position: relative;
    justify-content: flex-start;
    text-align: left;
    border: none;
    border-radius: 0;
    background: none;
    padding: 20px 0 20px 0;
    font-family: var(--display);
    font-weight: 600;
    /* Sized so the longest label ("Next: Search UX Redesign") stays on one line
       across phone widths. */
    font-size: clamp(21px, 6.4vw, 32px);
    letter-spacing: -0.015em;
    text-transform: none;
    color: rgba(255, 236, 210, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: color 0.22s ease, padding-left 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .cs-nav-drawer .cs-nav-btn.cta { color: var(--c-shipped); }   /* keep Get in touch green */

  /* Sliding accent bar + indent on hover/focus (row hover accent). */
  .cs-nav-drawer .cs-nav-btn::before {
    content: '';
    position: absolute;
    left: -18px;
    top: 50%;
    width: 3px;
    height: 0;
    background: var(--c-accent);
    border-radius: 2px;
    transform: translateY(-50%);
    box-shadow: 0 0 12px var(--c-accent);
    transition: height 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .cs-nav-drawer .cs-nav-btn.cta::before { background: var(--c-shipped); box-shadow: 0 0 12px var(--c-shipped); }
  .cs-nav-drawer .cs-nav-btn:hover,
  .cs-nav-drawer .cs-nav-btn:focus-visible {
    color: #fff;
    padding-left: 14px;
  }
  .cs-nav-drawer .cs-nav-btn.cta:hover,
  .cs-nav-drawer .cs-nav-btn.cta:focus-visible { color: #d5f6e2; }
  .cs-nav-drawer .cs-nav-btn:hover::before,
  .cs-nav-drawer .cs-nav-btn:focus-visible::before { height: 58%; }

  /* Meta footer pinned to the bottom of the overlay. */
  .cs-nav-meta {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: auto;
    padding-top: 26px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }
  .cs-nav-meta-status {
    display: flex;
    align-items: center;
    gap: 9px;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 190, 130, 0.65);
  }
  .cs-nav-meta-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--c-shipped);
    box-shadow: 0 0 9px rgba(128, 224, 160, 0.7);
    animation: cs-pulse 2.5s infinite;
  }
  .cs-nav-meta-links { display: flex; gap: 22px; }
  .cs-nav-meta-links a {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 190, 130, 0.6);
    text-decoration: none;
    transition: color 0.2s ease;
  }
  .cs-nav-meta-links a:hover { color: rgba(255, 220, 175, 0.95); }

  /* Items + footer cascade in as the menu opens (reduced-motion disables it). */
  .cs-topnav.menu-open .cs-nav-drawer .cs-nav-btn,
  .cs-topnav.menu-open .cs-nav-drawer .cs-nav-meta {
    animation: cs-menu-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }
  .cs-topnav.menu-open .cs-topnav-right  .cs-nav-btn { animation-delay: 0.06s; }
  .cs-topnav.menu-open .cs-topnav-center .cs-nav-btn:nth-child(1) { animation-delay: 0.11s; }
  .cs-topnav.menu-open .cs-topnav-center .cs-nav-btn:nth-child(2) { animation-delay: 0.16s; }
  .cs-topnav.menu-open .cs-topnav-center .cs-nav-btn:nth-child(3) { animation-delay: 0.21s; }
  .cs-topnav.menu-open .cs-nav-drawer .cs-nav-meta { animation-delay: 0.28s; }
}
@keyframes cs-menu-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 560px) {
  .cs-topnav { padding: 12px 20px; padding-right: calc(20px + var(--sbw, 0px)); }
  .cs-nav-drawer { padding-left: 20px; padding-right: 20px; }
  .cs-main { padding: 90px 18px 70px; }
  .cs-metrics { gap: 7px; }
  .cs-img.pair { grid-template-columns: 1fr; }
  .cs-hero-photo { aspect-ratio: 4 / 5; }
  /* The portrait crop reframes the shot entirely — recentre it, and drop the
     desktop zoom (it already fills the taller frame). */
  .cs-hero-photo[data-focus] .cs-hero-photo-img { object-position: center 50%; }
  .cs-hero-photo[data-zoom] .cs-hero-photo-img { transform: none; }
  /* Landscape sources crop horizontally here, so the axis that matters flips.
     data-mfocus slides that crop when centring would cut the device. */
  .cs-hero-photo[data-mfocus="95"] .cs-hero-photo-img { object-position: 95% 50%; }
  .cs-hero-photo-caption { left: 18px; right: 18px; bottom: 16px; }
  .cs-botnav { flex-wrap: wrap; gap: 12px; }
  /* Stack the real-content components so nothing gets crushed on a phone.
     (A pair holding a browser shot must stack — 164px of desktop capture is
     unreadable. A pair of two phones opts out below via .phones.) */
  .cs-compare,
  .cs-shot-pair { grid-template-columns: 1fr; }
  /* .mixed is (0,2,0) and would otherwise beat the rule above and stay two-up. */
  .cs-shot-pair.mixed { grid-template-columns: 1fr; }
  /* Two phone mockups stay side by side instead of stacking: each .cs-device
     otherwise hits its 300px cap and the pair runs ~1300px, 161% of a phone
     screen, for two supporting shots — five times the height of the desktop
     capture that leads the same section. Two-up puts each screen near 150px,
     matching .cs-rec-grid below and still readable. */
  .cs-shot-pair.phones { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cs-shot-pair.phones .cs-device {
    /* Chrome scales with the body — a 46px radius on a 164px phone reads as a
       fat bezel. The screen's radius is calc(--radius - --bezel), so both
       follow from these two. */
    --bezel: 6px;
    --radius: 26px;
    max-width: none;
    margin: 0;
  }
  /* The side buttons are fixed px, so they need the same ~0.55 scale. */
  .cs-shot-pair.phones .cs-device::after { height: 34px; }
  .cs-shot-pair.phones .cs-device::before {
    height: 16px;
    box-shadow: 0 24px 0 0 currentColor, 0 48px 0 0 currentColor;
  }
  /* Two-up keeps each phone around 150px — the same size the wider screen rows
     render at, and still readable. Four across would halve that. */
  .cs-rec-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cs-projmeta { grid-template-columns: 1fr; gap: 0; }
  .cs-projmeta-item {
    padding: 10px 0;
    border-right: none;
    border-bottom: 1px solid rgba(255, 154, 96, 0.12);
  }
  .cs-projmeta-item:last-child { border-bottom: none; }
  .cs-projhead,
  .cs-summary .cs-projhead { grid-template-columns: 1fr; gap: 16px; }

  /* ── Timeline goes vertical on mobile ──
     A horizontal row of steps squishes badly on narrow screens, so stack the
     waypoints down a left rail: dot on the rail, name + detail beside it. */
  .cs-route {
    /* x-axis the dots and the rail both sit on (see .cs-wdot below). */
    --rail-x: 5px;
    flex-direction: column;
    align-items: stretch;
    padding: 4px 0 0;
    /* Center the vertical timeline as a block instead of hugging the left edge. */
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
  }
  /* Turn the horizontal connector into a vertical rail through the dot column. */
  .cs-route::before {
    top: 12px;
    bottom: 12px;
    /* Back off half the hairline so the rail centres on the dot axis. */
    left: calc(var(--rail-x) - 0.5px);
    right: auto;
    width: 1px;
    height: auto;
    background: linear-gradient(180deg, transparent, rgba(255, 154, 96, 0.16) 6%, rgba(255, 154, 96, 0.16) 94%, transparent);
  }
  .cs-waypoint {
    text-align: left;
    min-width: 0;
    padding: 0 0 18px 22px;   /* room for the rail + gap between steps */
  }
  .cs-waypoint:last-child { padding-bottom: 0; }
  .cs-wdot {
    top: 4px;
    left: var(--rail-x);      /* sit on the rail */
  }
  .cs-wname { margin-bottom: 3px; }

  /* ── Metrics table shrinks to fit on mobile (no horizontal scroll) ──
     The feedback table becomes a swipeable stack (js/card-stack.js); if that
     script is unavailable it falls back to this compact table too. */
  .cs-table { font-size: 12.5px; }
  .cs-table th,
  .cs-table td { padding: 8px 7px; white-space: normal; }
  .cs-table thead th { font-size: 8px; letter-spacing: 0.06em; }
  /* Numeric columns shrink to their content and stay on one line; the first
     (name) column takes the remaining width and wraps. */
  .cs-table-metrics th:not(:first-child),
  .cs-table-metrics td:not(:first-child) {
    width: 1%;
    white-space: nowrap;
  }
  .cs-table-metrics .up { font-size: 12px; }
}

/* ── Reduced motion — stops the star twinkle and pulsing dots ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── Scroll-spy rail — section jump links with a scroll-driven progress
   fill; lives in the gutter beside the content, so it only fits on wide
   viewports (hidden below the breakout's own comfortable width). ── */
.cs-rail {
  position: fixed;
  left: 44px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  display: flex;
  gap: 16px;
}
.cs-rail-track {
  position: relative;
  width: 1px;
  background: rgba(255, 154, 96, 0.15);
}
.cs-rail-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 0%;
  background: var(--c-shipped);
  box-shadow: 0 0 6px rgba(128, 224, 160, 0.5);
}
.cs-rail-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.cs-rail-link {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 190, 130, 0.4);
  text-decoration: none;
  transition: color 0.25s ease, transform 0.25s ease;
}
.cs-rail-link:hover {
  color: rgba(255, 220, 170, 0.85);
}
.cs-rail-link.active {
  color: rgba(255, 236, 210, 0.95);
  transform: translateX(3px);
}

@media (max-width: 1200px) {
  .cs-rail { display: none; }
}

/* ── Border-glow retrofit ──
   The generic .border-glow-inner stacks children in a column; restore each
   host card's original layout and opt these two into corner-clipping so their
   edge-to-edge content rounds to match the card (the summary card is padded,
   so it must stay unclipped or its corner label gets cut). ── */
.cs-hero-photo.border-glow-card > .border-glow-inner {
  border-radius: inherit;          /* round the photo to the card's corners */
}
.cs-outcome.border-glow-card > .border-glow-inner {
  flex-direction: row;             /* restore the horizontal stat stack */
  border-radius: inherit;          /* round the stat block to the card's corners */
}
/* Image blocks: keep the placeholder icon+label centered, and let the glow be
   the hover feedback (the old orange recolor on hover is redundant now). */
.cs-img.border-glow-card > .border-glow-inner {
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: center;
  border-radius: inherit;
}
.cs-img.border-glow-card:hover {
  background: var(--card-bg);
  border-color: rgb(255 255 255 / 15%);
}
