/* ===========================================================================
   CASE STUDY · mobile-first design (V27.1)
   Base styles target mobile (320-640px). Media queries scale up.
   Applied to every case study uniformly.
   =========================================================================== */

/* ============ FOUNDATION ============ */
.cs-app {
  background: var(--bg-1);
  color: var(--fg-1);
  font-family: var(--font-sans);
}

/* Reveal on scroll — keep but softer translate for mobile */
.cs-reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity .8s cubic-bezier(.2, .7, .2, 1),
    transform .8s cubic-bezier(.2, .7, .2, 1);
}
.cs-reveal.is-in { opacity: 1; transform: translateY(0); }

/* ============ TOP NAV — sticky, slim on mobile ============ */
.cs-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: rgba(5, 5, 5, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--noir-700);
}
.cs-nav img { height: 22px; width: auto; }
.cs-nav .back {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-2);
  text-decoration: none;
  /* Touch target — at least 44×44 invisible padding */
  padding: 12px 4px;
  min-height: 44px;
  display: inline-flex; align-items: center;
}
.cs-nav .back:hover, .cs-nav .back:focus-visible { color: var(--accent); }

/* ============ HERO — vertical-first, full-bleed image, taller on desktop ============ */
.cs-hero {
  position: relative;
  /* Mobile: shorter so the user lands on the title quickly */
  height: 70vh;
  min-height: 480px;
  overflow: hidden;
}
.cs-hero-img {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center;
  /* Subtle parallax-feel scale */
  transform: scale(1.06);
}
.cs-hero-scrim {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(5,5,5,0) 0%, rgba(5,5,5,0.4) 70%),
    linear-gradient(180deg, rgba(5,5,5,0.15) 0%, rgba(5,5,5,0.5) 55%, rgba(5,5,5,0.96) 100%);
}
.cs-hero-copy {
  position: absolute;
  left: 16px; right: 16px; bottom: 28px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.cs-hero-copy .caption {
  font-size: 10px;
  letter-spacing: 0.18em;
}
.cs-hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(38px, 11vw, 60px);
  line-height: 0.95;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: var(--fg-1);
  margin: 0;
}
.cs-hero .lead {
  font-size: 15px;
  line-height: 1.55;
  color: var(--fg-2);
  max-width: 640px;
}

/* ============ BODY — stacked on mobile, side-by-side on desktop ============ */
.cs-body {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding: 48px 16px;
  max-width: 1240px;
  margin: 0 auto;
}

/* Facts: pill row on mobile, sidebar column on desktop */
.cs-facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 2px solid var(--accent);
}
.cs-fact {
  display: flex; flex-direction: column;
  gap: 4px;
  padding: 12px;
  background: rgba(14, 13, 12, 0.55);
  border: 1px solid var(--noir-700);
  border-radius: 4px;
}
.cs-fact dt {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0;
}
.cs-fact dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--fg-1);
  text-wrap: pretty;
}

/* Prose */
.cs-prose {
  display: flex; flex-direction: column;
  gap: 20px;
  max-width: 680px;
}
.cs-prose h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 7vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--fg-1);
  text-transform: uppercase;
  margin: 16px 0 0;
}
.cs-prose h2:first-child { margin-top: 0; }
.cs-prose h3 {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.25;
  margin: 8px 0 0;
}
.cs-prose p {
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg-2);
  margin: 0;
  text-wrap: pretty;
}
.cs-divider {
  border: 0;
  height: 1px;
  background: var(--noir-700);
  margin: 8px 0;
}

/* Block image inside prose */
.cs-block-image {
  margin: 16px 0;
}
.cs-block-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
}
.cs-block-image figcaption {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-3);
  text-transform: uppercase;
}

/* ============ GALLERIES — photos + videos, mobile-first grids ============ */
.cs-gallery-section {
  padding: 20px 16px;
}
.cs-gallery-section + .cs-gallery-section {
  padding-top: 8px;
  padding-bottom: 56px;
}

/* Photos: 2-col base on mobile, more cols on larger screens */
.cs-photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-flow: dense;
  gap: 4px;
}
.cs-photo {
  aspect-ratio: 1/1;
  position: relative;
  overflow: hidden;
  background-color: var(--noir-800);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
}

/* Videos: full-width single column on mobile */
.cs-videos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.cs-video {
  position: relative;
  overflow: hidden;
  background: var(--noir-800);
  aspect-ratio: 16/9;
  -webkit-user-select: none; user-select: none;
}
.cs-video video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}
.cs-video::after {
  content: "▶";
  position: absolute;
  bottom: 8px; right: 10px;
  color: var(--accent);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.6);
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 999px;
  pointer-events: none;
}

.cs-gallery-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin: 0 0 12px;
  padding-left: 4px;
}

/* ============ QUOTE ============ */
.cs-quote {
  padding: 64px 16px;
  max-width: 1000px;
  margin: 0 auto;
  text-align: left;
}
.cs-quote-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 6vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg-1);
  margin: 0;
}
.cs-quote-author {
  margin-top: 18px;
  font-size: 13px;
  color: var(--fg-2);
}

/* ============ RESULTS — saffron band ============ */
.cs-results {
  padding: 56px 16px;
  background: var(--accent);
  color: var(--noir-1000);
}
.cs-results .eyebrow { color: var(--noir-1000); }
.cs-results-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--noir-1000);
}
.cs-stat-n {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 8vw, 44px);
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--noir-1000);
}
.cs-stat-label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--noir-1000);
  margin-top: 4px;
}

/* ============ CTA BOTTOM ============ */
.cs-cta {
  padding: 64px 16px;
  text-align: center;
  border-top: 1px solid var(--noir-700);
}
.cs-cta h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 8vw, 56px);
  line-height: 1;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  color: var(--fg-1);
  margin: 0;
}
.cs-cta a {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 22px;
  padding: 16px 24px;
  background: var(--accent);
  color: var(--noir-1000);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 2px;
  min-height: 48px;
  transition: transform .2s, background .2s;
}
.cs-cta a:hover { background: var(--saffron-600); transform: translateY(-2px); }
.cs-cta a img { width: 14px; height: auto; }

/* ============ CURSOR (desktop only, kept as-is) ============ */
.cs-cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.cs-has-cursor, html.cs-has-cursor body, html.cs-has-cursor * { cursor: none !important; }
  .cs-cursor { display: block; position: fixed; top: 0; left: 0; width: 30px; height: 38px; pointer-events: none; z-index: 9999; will-change: transform; }
  .cs-cursor::before { content: ""; position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; transform: translate(-50%, -50%); background: radial-gradient(circle, rgba(248,209,52,0.12) 0%, rgba(248,209,52,0.05) 40%, rgba(248,209,52,0) 70%); z-index: -1; transition: opacity .2s, width .2s, height .2s, background .2s; }
  .cs-cursor img { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.65)); transition: transform .2s cubic-bezier(.2,.7,.2,1), filter .2s; transform-origin: 0 0; z-index: 1; }
  .cs-cursor.is-link img { transform: scale(1.22); filter: drop-shadow(0 3px 10px rgba(248,209,52,0.9)); }
  .cs-cursor.is-link::before { width: 112px; height: 112px; background: radial-gradient(circle, rgba(248,209,52,0.22) 0%, rgba(248,209,52,0.08) 45%, rgba(248,209,52,0) 75%); }
  .cs-cursor.is-down img { transform: scale(0.86); }
}

/* ===========================================================================
   TABLET — min-width: 720px
   =========================================================================== */
@media (min-width: 720px) {
  .cs-nav { padding: 14px 28px; }
  .cs-hero { height: 80vh; min-height: 560px; }
  .cs-hero-copy { left: 28px; right: 28px; bottom: 40px; gap: 14px; }
  .cs-hero-title { font-size: clamp(56px, 9vw, 96px); }
  .cs-hero .lead { font-size: 17px; }
  .cs-body { gap: 56px; padding: 72px 28px; }
  .cs-facts { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .cs-prose { gap: 24px; }
  .cs-photos { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .cs-videos { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cs-gallery-section { padding: 24px 28px; }
  .cs-quote { padding: 80px 28px; }
  .cs-results { padding: 72px 28px; }
  .cs-results-grid { grid-template-columns: repeat(4, 1fr); gap: 22px; }
  .cs-cta { padding: 80px 28px; }
}

/* ===========================================================================
   DESKTOP — min-width: 1024px
   =========================================================================== */
@media (min-width: 1024px) {
  .cs-nav { padding: 16px 40px; }
  .cs-hero { height: 88vh; min-height: 640px; }
  .cs-hero-copy { left: 40px; right: 40px; bottom: 56px; gap: 18px; max-width: 900px; }
  .cs-hero-title { font-size: clamp(72px, 8vw, 132px); }

  /* Body returns to two-column layout: facts sidebar + prose */
  .cs-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 64px;
    padding: 96px 40px;
    align-items: start;
  }
  .cs-facts {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding-top: 8px;
    border-top: 2px solid var(--accent);
  }
  .cs-fact {
    flex-direction: column;
    background: transparent;
    border: none;
    border-top: 1px solid var(--noir-700);
    border-radius: 0;
    padding: 14px 0 0;
  }
  .cs-fact:first-of-type { border-top: none; }
  .cs-fact dd { font-size: 15px; }

  .cs-prose h2 { font-size: 36px; }
  .cs-prose p { font-size: 17px; line-height: 1.7; }

  .cs-photos { grid-template-columns: repeat(6, 1fr); }
  /* Rhythmic variations only kick in on larger screens */
  .cs-photo:nth-child(7n+1) { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
  .cs-photo:nth-child(7n+4) { grid-column: span 2; aspect-ratio: 2/1; }
  .cs-photo:nth-child(7n+6) { grid-row: span 2; aspect-ratio: 1/2; }
  .cs-videos { grid-template-columns: repeat(3, 1fr); }
  .cs-gallery-section { padding: 24px 40px; }
  .cs-quote { padding: 96px 40px; }
  .cs-results { padding: 96px 40px; }
  .cs-cta { padding: 96px 40px; }
}

/* ===========================================================================
   DESERT DUNES — ambient background (kept identical to root site)
   =========================================================================== */
:root { --wind: 0; --gust: 1; --dunes-opacity: 0.65; }
.fn-bg-dunes { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; opacity: var(--dunes-opacity, 0); transition: opacity 240ms cubic-bezier(.4, 0, .2, 1); }
.fn-bg-dunes__far,
.fn-bg-dunes__near {
  position: absolute; inset: -8% -8% -8% -8%;
  background-image: url('../assets/desert-dunes.jpg');
  background-size: cover;
  background-position: center 60%;
  background-repeat: no-repeat;
  will-change: transform, filter;
  transition: filter 600ms linear;
}
.fn-bg-dunes__far {
  filter: brightness(calc(0.42 + var(--wind, 0) * 0.18)) saturate(calc(0.7 + var(--wind, 0) * 0.18)) blur(3px);
  transform: scale(1.08) translateX(calc(var(--wind, 0) * -28px)) skewX(calc(var(--wind, 0) * -0.7deg));
  opacity: 0.85;
}
.fn-bg-dunes__near {
  inset: 35% -8% -8% -8%;
  filter: brightness(calc(0.34 + var(--wind, 0) * 0.16)) saturate(calc(0.65 + var(--wind, 0) * 0.15)) blur(1.5px);
  transform: scale(1.04) translateY(calc(var(--wind, 0) * -24px)) translateX(calc(var(--wind, 0) * -42px)) skewX(calc(var(--wind, 0) * -0.5deg));
  opacity: 0.78;
}
.fn-bg-dunes__sand {
  position: absolute; inset: 30% 0 0 0;
  background-image:
    radial-gradient(circle at 12% 32%, rgba(248,209,52,0.22) 0, transparent 1.5px),
    radial-gradient(circle at 78% 50%, rgba(248,209,52,0.14) 0, transparent 1px),
    radial-gradient(circle at 48% 80%, rgba(248,209,52,0.18) 0, transparent 1.5px),
    radial-gradient(circle at 32% 18%, rgba(248,209,52,0.12) 0, transparent 1px),
    radial-gradient(circle at 88% 92%, rgba(248,209,52,0.16) 0, transparent 1.2px);
  background-size: 260px 260px, 200px 200px, 340px 340px, 220px 220px, 180px 180px;
  mix-blend-mode: screen;
  opacity: calc(0.4 + var(--wind, 0) * 0.5);
  animation: fnSandDrift calc(18s / max(0.4, var(--gust))) linear infinite;
}
@keyframes fnSandDrift {
  from { background-position: 0 0, 0 0, 0 0, 0 0, 0 0; }
  to   { background-position: -260px 4px, -200px -3px, -340px 2px, -220px -2px, -180px 1px; }
}
.fn-bg-dunes__streaks {
  position: absolute; inset: 25% 0 10% 0;
  background:
    repeating-linear-gradient(88deg, transparent 0 60px, rgba(248,209,52,0.04) 60px 62px, transparent 62px 140px);
  mix-blend-mode: screen;
  opacity: calc(var(--wind, 0) * 0.7);
  transform: translateX(calc(var(--wind, 0) * -120px));
  transition: transform 200ms linear;
}
.fn-bg-dunes__shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 25%, transparent 0%, rgba(5,5,5,0.25) 70%),
    linear-gradient(to bottom, rgba(5,5,5,0.30) 0%, rgba(5,5,5,0.55) 50%, rgba(5,5,5,0.85) 100%);
}
