/* ==========================================================================
   Case study template (Figma "case-study-*" frames, 1440 wide), used by the
   pages tools/build_cases.py generates. Light page, dark video hero.
   Builds on styles.css (nav, carousel, cursor) and pages.css (.cfg-strip,
   .w-contact, .page-wrap).
   ========================================================================== */

.case-page { --paper-2: #f4f3ef; --ink-2: #0b0b0b; --label: "Stack Sans Text", var(--text); background: var(--paper-2); color: var(--ink-2); }
.case-page .nav { color: #fff; } /* the header behaves as on every other page: white, turning dark over light sections (body.on-light) */
.case-page main { overflow-x: clip; }
.case-page main > section { position: relative; z-index: 1; } /* above the line pattern */
.cs-pattern { opacity: 1; }
.case-page .eyebrow { font-family: var(--label); font-weight: 300; font-size: 12px; line-height: 1; letter-spacing: 0; }
.case-page .eyebrow::before { background: radial-gradient(circle, transparent 1.5px, var(--blue) 1.75px); }

/* Shared type */
.cs-label { margin: 0; font-size: clamp(18px, 1.67vw, 24px); line-height: 1.4; letter-spacing: -0.04em; }
.cs-heading { margin: 0; font-family: var(--display); font-weight: 600; font-size: clamp(34px, 4.17vw, 60px); line-height: 1.4; letter-spacing: -0.05em; }
.cs-heading.tight { line-height: 1.1; }
.cs-heading.quote { line-height: 1.2; }
.cs-body, .cs-text p { margin: 0; font-size: 18px; line-height: 1.4; opacity: .6; }
.cs-text h2 { margin: 0 0 24px; font-size: 18px; font-weight: 600; line-height: 1.4; }
.cs-text p + p { margin-top: 1.4em; }
.cs-shot { position: relative; overflow: hidden; background: #e7e5df; }
.cs-shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cs-pad { padding-left: clamp(16px, 11.1vw, 160px); padding-right: clamp(16px, 11.1vw, 160px); }

/* Hero: full-bleed video, client + title bottom-left */
.cs-hero { position: relative; height: clamp(560px, 65.28vw, 1254px); overflow: hidden; background: #000; color: #fff;
  display: flex; flex-direction: column; justify-content: flex-end; padding: 0 clamp(16px, 11.1vw, 160px) clamp(32px, 3.5vw, 50px); }
.cs-hero > video, .cs-hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cs-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.35), transparent 25%, transparent 60%, rgba(0,0,0,.55)); pointer-events: none; }
.cs-hero-copy { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; max-width: 1189px; }
.cs-title { margin: 0; max-width: 17.45em; /* 1047px at 60px, as in Figma 1337:12937 */ font-family: var(--display); font-weight: 600; font-size: clamp(34px, 4.17vw, 60px); line-height: 1.1; letter-spacing: -0.05em; }
.cs-title .line-mask { padding-bottom: .1em; margin-bottom: -.1em; }

/* The Challenge: narrow centred column in a 940px band */
.cs-challenge { min-height: 940px; display: flex; align-items: center; justify-content: center; padding: clamp(100px, 18vw, 260px) clamp(16px, 27.8vw, 400px); }
.cs-challenge .cs-text { max-width: 651px; }

/* Full-width image with 48px gutters, or edge to edge (.bleed, aspect from the case file) */
.cs-full { padding: 0 var(--gutter); }
.cs-full .cs-shot { aspect-ratio: 1344 / 1254; }
.cs-full.bleed { padding: 0; }
.cs-full.pad { padding-top: clamp(80px, 13.9vw, 200px); padding-bottom: clamp(80px, 13.9vw, 200px); }
.cs-full.bleed .cs-shot { background: #0b0b0b; }

/* Copy block after the image (The Solution): the challenge band, but the Figma frame is 160px-padded */
.cs-copy .cs-text { max-width: 650px; }

/* The Vision / The Background */
.cs-columns { min-height: 940px; display: flex; align-items: center; padding: clamp(100px, 18vw, 260px) clamp(16px, 11.1vw, 160px); }
.cs-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 530px)); gap: 60px; }

/* Our Solution heading, then the overlapping collage */
.cs-solution { display: flex; flex-direction: column; gap: 8px; padding: clamp(80px, 13.9vw, 200px) clamp(16px, 11.1vw, 160px); }
.cs-solution .cs-heading { max-width: 1189px; }
.cs-collage { padding: clamp(80px, 13.9vw, 200px) clamp(16px, 11.1vw, 160px); }
.cs-collage-img { max-width: 1120px; }
.cs-collage-img img { width: 100%; height: auto; }

/* Feature: heading, framed image, caption in an 890 column */
.cs-feature { padding: clamp(80px, 13.9vw, 200px) clamp(16px, 11.1vw, 160px); }
.cs-feature-inner { max-width: 890px; margin: 0 auto; display: flex; flex-direction: column; gap: 60px; }
.cs-feature .cs-shot { border-radius: 13px; } /* width and aspect come from each case file */

/* Image grid: two columns, 8px gaps, cells placed per case in the JSON */
.cs-grid-sec { padding: clamp(80px, 13.9vw, 200px) clamp(16px, 11.1vw, 160px); }
.cs-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-width: 1115px; }
.cs-grid .cs-shot { border-radius: 8px; }
.cs-shot.cs-logo { display: grid; place-items: center; } /* SVG mark on a CSS fill (FAB DLS app icon) */
.cs-shot.cs-logo img { height: auto; }
.cs-grid-body { max-width: 890px; margin: 80px auto 0; } /* paragraph some cases carry straight after the grid */


/* Quote */
.cs-quote { padding: clamp(80px, 13.9vw, 200px) clamp(16px, 11.1vw, 160px); }
.cs-quote blockquote { margin: 0; max-width: 1189px; display: flex; flex-direction: column; gap: 48px; }
.cs-by { margin: 0; font-size: clamp(16px, 1.67vw, 24px); line-height: 1.4; letter-spacing: -0.04em; }

/* Graphic between quote and result (villa strip or an exported image) */
.cs-extra { margin: clamp(20px, 3vw, 40px) 0 0; }
.cfg-strip.cs-extra { margin-bottom: clamp(48px, 6.94vw, 100px); } /* Teyaseer's villa strip sits in a 228px band */
.cs-extra-img { padding: 0 clamp(16px, 11.1vw, 160px); }
.cs-extra-img img { width: 100%; max-width: var(--w); height: auto; margin: 0 auto; }
.cs-extra-img.bleed { padding: 0; }
.cs-extra-img.bleed img { max-width: none; }

/* Result */
.cs-result { padding: 100px clamp(16px, 11.1vw, 160px) 50px; }
.cs-result .cs-body { max-width: 890px; margin: 0 auto; }

/* A new frontier: the home carousel, recoloured for the light page */
.cs-frontier { color: var(--ink-2); }
.cs-frontier h2 { line-height: .95; }
.cs-frontier .counter i, .cs-frontier .progress .bar { background: rgba(11,11,11,.25); }
.cs-frontier .card { background: #e7e5df; }
.cs-arrows { display: flex; gap: 16px; margin: 24px 0 0 calc(var(--gutter) + 114px); }
.cs-arrows button { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.05); color: var(--ink-2); transition: background .3s, color .3s, transform .5s var(--ease-out); }
.cs-arrows button:hover { background: var(--ink-2); color: #fff; }
.cs-arrows button:last-child svg { transform: scaleX(-1); }

/* Get in touch on the light page */
.cs-contact h2 .dim a { color: #c9c7c1; }
.cs-contact h2 .dim a:hover { color: var(--ink-2); }
.case-page .foot-links { margin: 0; font-family: var(--label); font-weight: 300; font-size: 11px; }
.case-page .foot-links a { font-size: inherit; }
.case-page .foot-links .sep { background: rgba(11,11,11,.14); }

/* Home v2 contact + footer ("footer": "v2"), dark ink on the light page */
.cs-contact-v2 { color: var(--ink-2); }
.case-page .contact.cs-contact-v2 h2 .dim { color: #c9c7c1; } /* outranks home2.css, which loads after this file */
.cs-contact-v2 .site-foot { border-top-color: rgba(11,11,11,.24); }
.case-page .cs-contact-v2 .foot-links .sep { background: rgba(11,11,11,.24); }

@media (max-width: 900px) {
  .cs-challenge, .cs-columns { min-height: 0; }
  .cs-cols { grid-template-columns: 1fr; gap: 48px; }
  .cs-grid { grid-template-columns: 1fr; }
  .cs-grid .cs-shot { grid-column: auto !important; grid-row: auto !important; aspect-ratio: 4 / 3 !important; }
  .cs-feature-inner { gap: 32px; }
  .cs-quote blockquote { gap: 24px; }
  .cs-arrows { margin-left: var(--gutter); }
}

/* ---------- Alignment ----------
   The page keeps the Figma frame's proportions at every width: an 11.1% margin each side
   (160px at 1440). Main titles and the Vision column start on that margin; image blocks fill
   the space between; the narrower Figma columns (challenge, feature, result) stay centred.
   Title blocks get a shallower right margin so the 1189px Figma titles keep their line breaks. */
.case-page { --m: max(16px, 11.11vw); }
.case-page :is(.cs-collage, .cs-feature, .cs-grid-sec, .cs-result, .cs-extra-img:not(.bleed)) { padding-left: var(--m); padding-right: var(--m); }
/* Main titles (hero, Our Solution, quote) on the title margin; Vision / Background stay inside the page in the centred column */
.case-page :is(.cs-hero, .cs-solution, .cs-quote) { padding-left: var(--m); padding-right: max(16px, 5.56vw); }
.cs-hero-copy, .cs-solution .cs-heading, .cs-quote blockquote { width: 100%; max-width: 1189px; }
/* Quotes: Figma's 1189px column centred on the page, the text left-aligned at the heading size.
   The wider side margin of the title blocks (5.56%) on both sides leaves room for the full 1189px. */
.case-page .cs-quote { padding-left: max(16px, 5.56vw); padding-right: max(16px, 5.56vw); }
.case-page .cs-quote blockquote { margin: 0 auto; }
.cs-columns { justify-content: center; }
.cs-cols { margin-left: auto; margin-right: auto; }
.cs-collage-img, .cs-grid { max-width: none; }
.case-page .cs-challenge { padding-left: max(16px, 27.78vw); padding-right: max(16px, 27.78vw); }
.cs-result .cs-body { max-width: 79.5%; } /* 890 of the 1120 content width */
.case-page .cs-contact .page-wrap { max-width: none; padding-left: var(--m); padding-right: var(--m); }
/* Phones and small tablets: the Figma proportions squeeze the copy (the challenge column
   was 167px wide at 375px), so every text block takes a flat 24px margin instead */
@media (max-width: 900px) {
  .case-page { --m: 24px; }
  .case-page .cs-challenge, .case-page :is(.cs-hero, .cs-solution, .cs-quote) { padding-left: var(--m); padding-right: var(--m); }
  .case-page .cs-challenge { padding-top: 80px; padding-bottom: 80px; }
}
@media (min-width: 901px) {
  /* A new frontier: heading and first card on the same margin */
  .cs-frontier h2 { padding-left: var(--m); }
  .cs-frontier .carousel { padding-left: max(var(--gutter), calc(var(--m) - 114px)); }
  .cs-frontier .progress, .cs-arrows { margin-left: var(--m); }
}

/* ---------- Animated project graphics (below the quote; started by case.js) ----------
   Each starts when it scrolls into view (.is-in). Without JS or with reduced motion they show finished. */
.cs-x { display: flex; justify-content: center; padding: clamp(40px, 5vw, 72px) var(--m); color: var(--ink-2); }
.anim-ready .cs-x:not(.is-in) *, .anim-ready .cs-x:not(.is-in) *::before, .anim-ready .cs-x:not(.is-in) *::after, .anim-ready .cs-extra-img:not(.is-in) img { animation-play-state: paused; }

/* DLD: status cards. Numbers count up, the highlight moves card to card */
.x-status .x-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; width: 100%; max-width: 1066px; }
.x-card { display: flex; align-items: center; gap: 16px; padding: 22px 24px; border-radius: 16px; background: #fff; border: 1px solid #ecebe6;
  animation: x-up .9s var(--ease-out) calc(var(--i) * .12s) both, x-focus 8s ease-in-out calc(1.2s + var(--i) * 2s) infinite; }
.x-ico { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--tint); color: var(--tone); }
.x-ico svg { width: 24px; height: 24px; }
.x-card b { display: block; font-size: 24px; font-weight: 600; line-height: 1.2; color: #222; font-variant-numeric: tabular-nums; }
.x-card small { display: block; font-size: 15px; color: #777; }
@keyframes x-up { from { opacity: 0; transform: translateY(24px); } }
@keyframes x-focus { 0%, 30%, 100% { background: #fff; box-shadow: none; } 6%, 24% { background: var(--tint); box-shadow: 0 10px 30px rgba(0,0,0,.08); } }

/* FAB: quick actions. Tiles pop in, badges bounce, a tap ripple travels across */
.x-actions .x-grid { display: grid; grid-template-columns: repeat(4, 64px); gap: 24px 36px; }
.x-actions .x-tile:nth-child(n+5) { translate: 48px 0; }
.x-tile { position: relative; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #f6f6f4; color: #1d3240;
  animation: x-pop .6s cubic-bezier(.34,1.56,.64,1) calc(var(--i) * .07s) both; }
.x-tile svg { width: 26px; height: 26px; }
.x-tile::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #1d3240; opacity: 0; animation: x-tap 6.4s ease-out calc(1s + var(--i) * .8s) infinite; }
.x-badge { position: absolute; top: -10px; right: -8px; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px; display: grid; place-items: center;
  background: var(--b); color: #fff; font-style: normal; font-size: 13px; font-weight: 600; animation: x-pop .6s cubic-bezier(.34,1.56,.64,1) .8s both, x-nudge 3.2s ease-in-out 1.6s infinite; }
@keyframes x-pop { from { opacity: 0; transform: scale(.4); } }
/* FAB DLS: outline / filled icon pairs (Figma 1673:12517); pairs pop in, then each filled icon bumps in turn */
.cs-x.x-icons { padding-top: clamp(48px, 6.94vw, 100px); padding-bottom: clamp(48px, 6.94vw, 100px); }
.x-pairs { display: grid; grid-template-columns: repeat(4, 96px); gap: 16px 11px; }
.x-pair { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 12px; animation: x-pop .6s cubic-bezier(.22,1,.36,1) calc(var(--i) * .07s) both; }
.x-pair img { width: 24px; height: 24px; }
.x-pair img + img { animation: x-fill 6.4s ease-in-out calc(1.2s + var(--i) * .8s) infinite; }
@keyframes x-fill { 0%, 10%, 100% { transform: none; } 5% { transform: scale(1.25); } }
@keyframes x-tap { 0% { opacity: .5; transform: scale(.85); } 10%, 100% { opacity: 0; transform: scale(1.35); } }
@keyframes x-nudge { 0%, 80%, 100% { transform: none; } 86% { transform: translateY(-5px) scale(1.08); } 92% { transform: none; } }

/* Aldar: four-step timeline. The progress line fills step to step, the last step pulses */
.x-steps .x-track { position: relative; display: flex; justify-content: space-between; align-items: center; width: min(531px, 100%); height: 44px; }
.x-line { position: absolute; left: 22px; right: 22px; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: #e6e4de; overflow: hidden; }
.x-line i { position: absolute; inset: 0; background: #69b3ec; transform-origin: left; animation: x-fill 6s cubic-bezier(.65,0,.35,1) infinite; }
.x-dot { position: relative; width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 3px solid #e6e4de; box-shadow: 0 4px 14px rgba(0,0,0,.08);
  animation: x-step 6s linear calc(var(--i) * 1.4s) infinite; }
.x-dot:last-child { animation: x-step-last 6s linear 4.2s infinite; }
@keyframes x-fill { 0% { transform: scaleX(0); } 70%, 92% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
@keyframes x-step { 0%, 2% { border-color: #e6e4de; } 6%, 70% { border-color: #69b3ec; box-shadow: 0 0 0 6px rgba(105,179,236,.18); } 80%, 100% { border-color: #e6e4de; box-shadow: 0 4px 14px rgba(0,0,0,.08); } }
@keyframes x-step-last { 0%, 2% { border-color: #e6e4de; } 6%, 26% { border-color: #e8631c; box-shadow: 0 0 0 10px rgba(232,99,28,.16); } 16% { box-shadow: 0 0 0 4px rgba(232,99,28,.3); } 40%, 100% { border-color: #e6e4de; box-shadow: 0 4px 14px rgba(0,0,0,.08); } }

/* Museum of the Future: broken rings, each turning at its own speed and direction */
.x-rings svg { width: min(393px, 80vw); height: auto; overflow: visible; }
.x-ring { transform-box: view-box; transform-origin: 150px 150px; animation: x-turn 18s linear infinite; }
.x-ring.r1 { animation-duration: 26s; animation-direction: reverse; }
.x-ring.r2 { animation-duration: 34s; }
.x-ring.r3 { animation-duration: 48s; animation-direction: reverse; }
.x-core { transform-box: view-box; transform-origin: 150px 150px; animation: x-breathe 4s ease-in-out infinite; }
@keyframes x-turn { to { transform: rotate(360deg); } }
@keyframes x-breathe { 50% { transform: scale(1.12); } }

/* Al-Futtaim: brand bubbles floating on their own rhythm */
.x-bubbles .x-field { position: relative; width: 100%; }
.x-bub { position: absolute; width: 17.9%; height: auto; border-radius: 50%;
  animation: x-pop .7s cubic-bezier(.34,1.56,.64,1) calc(var(--i) * .1s) both, x-bob 4.6s ease-in-out calc(var(--i) * -.9s) infinite; }
@keyframes x-bob { 50% { translate: 0 -10px; } }

/* Blinx: category pills, the selected state moves pill to pill */
.x-pills .x-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.x-pill { position: relative; padding: 9px 20px; border-radius: 999px; font-size: 16px; line-height: 1.2; color: #0b0b0b; background: #fff; isolation: isolate;
  animation: x-pop .5s cubic-bezier(.34,1.56,.64,1) calc(var(--i) * .08s) both, x-select-text 8s ease-in-out calc(var(--i) * 2s) infinite; }
.x-pill::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; background: var(--g); z-index: -1;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.x-pill::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--g); z-index: -1; opacity: 0;
  animation: x-select 8s ease-in-out calc(var(--i) * 2s) infinite; }
@keyframes x-select { 0%, 28%, 100% { opacity: 0; } 4%, 24% { opacity: 1; } }
@keyframes x-select-text { 0%, 28%, 100% { color: #0b0b0b; } 4%, 24% { color: #fff; } }

/* DCT Events: the ribbon wipes in, then drifts */
.x-wipe img { animation: x-wipe 1.8s cubic-bezier(.65,0,.35,1) both, x-drift 9s ease-in-out 1.8s infinite; }
@keyframes x-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes x-drift { 50% { transform: translateY(-14px); } }

/* Emirates: a sheen sweeps across the floating card */
.x-shine img { border-radius: 12px;
  /* the mask is 3x the card so it always covers it; a lighter band in the middle travels across */
  -webkit-mask: linear-gradient(105deg, #000 0 44%, rgba(0,0,0,.6) 50%, #000 56% 100%) 100% 0 / 300% 100% no-repeat;
  mask: linear-gradient(105deg, #000 0 44%, rgba(0,0,0,.6) 50%, #000 56% 100%) 100% 0 / 300% 100% no-repeat;
  animation: x-card 6s ease-in-out infinite, x-sheen 4.5s ease-in-out 1s infinite; }
@keyframes x-card { 50% { transform: translateY(-8px) rotate(-1deg); } }
@keyframes x-sheen { 0% { -webkit-mask-position: 100% 0; mask-position: 100% 0; } 45%, 100% { -webkit-mask-position: 0% 0; mask-position: 0% 0; } }

/* PIF: the wayfinding notification slides in, then hovers */
.x-notify img { animation: x-in 1s cubic-bezier(.22,1,.36,1) both, x-hover 4s ease-in-out 1s infinite; }
@keyframes x-in { from { opacity: 0; transform: translateX(80px) scale(.96); } }
@keyframes x-hover { 50% { transform: translateY(-6px); } }

/* FAB Developer Portal: three headline figures in a 232px band (Figma 1699:5783); each rises in turn, its icon pops */
.cs-x.x-stats { margin-top: 0; padding-top: clamp(56px, 6.94vw, 100px); padding-bottom: clamp(56px, 6.94vw, 100px); } /* straight after the grid, as in Figma */
.x-stat-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 32px; opacity: .6; color: #000; font-size: 21.33px; line-height: 1.2; }
.x-stat { display: flex; align-items: center; gap: 10.67px; white-space: nowrap; animation: x-up .9s var(--ease-out) calc(var(--i) * .14s) both; }
.x-stat img { width: 32px; height: 32px; animation: x-pop .6s cubic-bezier(.34,1.56,.64,1) calc(.3s + var(--i) * .14s) both; }
/* FAB Home: the cost bar (Figma "Downpayment breakdown", 828px). Segments fill in left to right, then the legend fades in */
.cs-x.x-breakdown { padding-top: clamp(48px, 6.94vw, 100px); padding-bottom: clamp(48px, 6.94vw, 100px); }
.x-breakdown .x-chart { position: relative; width: min(828px, 100%); }
.x-breakdown .x-bar { position: relative; height: 34px; border-radius: 8px; background: #ebebeb; overflow: hidden; }
.x-breakdown .x-bar i { position: absolute; top: 0; bottom: 0; transform-origin: left; animation: x-grow .7s cubic-bezier(.22,1,.36,1) calc(var(--i) * .18s) both; }
.x-breakdown .x-key { position: absolute; top: calc(100% + 16px); margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 1.4; color: #1c2f3d;
  animation: x-up .6s var(--ease-out) 1.3s both; }
.x-breakdown .x-key span { width: 15px; height: 15px; border-radius: 50%; }
@keyframes x-grow { from { transform: scaleX(0); } }

@media (max-width: 900px) {
  .x-stat-row { gap: 12px 24px; font-size: 16px; }
  .x-stat { gap: 8px; }
  .x-stat img { width: 24px; height: 24px; }
  .x-status .x-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .x-actions .x-grid { grid-template-columns: repeat(4, 52px); gap: 20px 16px; }
  .x-actions .x-tile:nth-child(n+5) { translate: none; }
  .x-tile { width: 52px; height: 52px; }
  .x-pairs { grid-template-columns: repeat(4, 72px); }
  .x-pair { padding: 0 6px; }
}
@media (prefers-reduced-motion: reduce) { .cs-x *, .cs-x *::before, .cs-x *::after, .cs-extra-img img { animation: none !important; } }
