/* =========================================================
   Case study pages: Cuervos look, black, Cuervos orange,
   sun yellow, cream type. Ported from the old portfolio's first case
   journey, restyled.
   ========================================================= */
:root {
  --orange: #FF5400;
  --yellow: #FFC600;
  --cream: #f2ece2;
  --muted: rgba(242, 236, 226, .66);
  --line: rgba(242, 236, 226, .14);
  --ink: #000;
  --display: "Archivo", "Arial Narrow", sans-serif;
  --body: "Montserrat", system-ui, sans-serif;
  --wide: min(1180px, 88vw);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); color: var(--cream); font: 400 17px/1.6 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--orange); color: var(--ink); }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }

/* ---------- top bar ---------- */
.cs-bar { position: fixed; inset: 0 0 auto; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(16px, 4vw, 48px); transition: background .3s ease; }
.cs-bar.is-solid { background: rgba(0, 0, 0, .8); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.cs-bar__logo img { width: 130px; height: auto; filter: invert(1); }
.cs-bar__back { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 14px/1 var(--body);
  letter-spacing: .08em; text-transform: uppercase; padding: 12px 18px; background: var(--orange); color: var(--ink); transition: background .2s, transform .2s; }
.cs-bar__back:hover { background: var(--yellow); transform: translateY(-2px); }

/* ---------- cover ---------- */
.cs-cover { position: relative; min-height: 100svh; display: grid; align-items: end; overflow: hidden; }
.cs-cover__media { position: absolute; inset: 0; }
.cs-cover__media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); animation: cs-settle 2.4s cubic-bezier(.2,.8,.2,1) forwards; }
.cs-cover__media::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,.35) 60%, #000 100%); }
@keyframes cs-settle { to { transform: none; } }
.cs-cover__text { position: relative; width: var(--wide); margin: 0 auto; padding-bottom: clamp(48px, 9vh, 100px); }
.cs-eyebrow { font: 600 13px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--orange); margin: 0 0 16px; }
.cs-title { font: 900 clamp(64px, 10vw, 150px)/.9 var(--display); font-stretch: 62%; text-transform: uppercase; margin: 0; letter-spacing: -.005em; }
.cs-title span { display: block; color: var(--orange); }

/* ---------- intro ---------- */
.cs-intro { width: var(--wide); margin: clamp(56px, 9vh, 110px) auto 0; display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(28px, 5vw, 80px); align-items: start; }
.cs-intro p { margin: 0 0 16px; color: var(--muted); max-width: 56ch; }
.cs-intro p:first-child { color: var(--cream); font-size: clamp(19px, 1.6vw, 23px); line-height: 1.5; }
.cs-tags { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cs-tags li { font: 700 13px/1 var(--body); padding: 11px 18px; border-radius: 999px; background: var(--orange); color: var(--ink); }
.cs-facts { margin: 0; display: grid; gap: 18px; }
.cs-facts div { border-top: 1px solid var(--line); padding-top: 12px; }
.cs-facts dt { font: 600 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--orange); margin-bottom: 8px; }
.cs-facts dd { margin: 0; font-weight: 500; }

/* ---------- credits ---------- */
.cs-credits { width: var(--wide); margin: clamp(80px, 12vh, 140px) auto 0; }
.cs-h2 { font: 900 clamp(40px, 5.5vw, 76px)/1 var(--display); font-stretch: 62%; text-transform: uppercase; color: var(--orange); margin: 0 0 clamp(28px, 4vw, 48px); text-align: center; }
.credits__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 28px 32px; }
.credits__group dl { margin: 0; }
.credits__head { font: 700 12px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); background: var(--orange);
  display: inline-block; padding: 7px 10px; margin: 0 0 14px; }
.credits__row { display: grid; gap: 2px; margin: 0 0 11px; }
.credits__row dt { font: 500 12px/1.2 var(--body); color: var(--muted); }
.credits__row dd { margin: 0; font: 600 14px/1.35 var(--body); overflow-wrap: anywhere; }
.credits__row a { text-decoration: none; border-bottom: 1.5px solid transparent; transition: color .2s, border-color .2s; }
.credits__row a:hover { color: var(--orange); border-bottom-color: currentColor; }

/* ---------- the journey: three stops ---------- */
.trip { list-style: none; padding: 0; margin: clamp(100px, 14vh, 170px) auto 0; }
.stop { position: relative; text-align: center; padding: 0 0 clamp(110px, 16vh, 180px); }
.stop:not(:last-child)::after { content: ""; position: absolute; left: 50%; bottom: 24px; height: clamp(50px, 9vh, 100px); border-left: 2px dashed rgba(255, 84, 0, .6); }
.stop__num { display: inline-flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 6px 18px 6px 6px; border: 1.5px solid var(--line); border-radius: 999px;
  font: 600 13px/1 var(--body); letter-spacing: .14em; text-transform: uppercase; }
.stop__num span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: var(--ink); font: 900 15px/1 var(--display); letter-spacing: 0; }
.stop__title { font: 900 clamp(44px, 6vw, 88px)/.95 var(--display); font-stretch: 62%; text-transform: uppercase; margin: 0 auto 16px; max-width: 16ch; }
.stop__text { color: var(--muted); max-width: 54ch; margin: 0 auto 30px; }
.sub { font: 900 clamp(26px, 3vw, 40px)/1.05 var(--display); font-stretch: 70%; text-transform: uppercase; color: var(--cream); margin: clamp(64px, 9vh, 100px) auto 20px; }
.sub em { font-style: normal; color: var(--orange); }

/* video + its timeline */
.demo, .tl { width: var(--wide); margin: 0 auto; }
.demo video { width: 100%; height: auto; border-radius: 6px; background: #111; }
.tl { margin-top: 12px; }
.pair { width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 2.4vw, 32px); align-items: start; }
.pair .demo, .pair .tl, .pair .ba { width: 100%; }
@media (max-width: 860px) { .pair { grid-template-columns: 1fr; } }

/* before / after wipe */
.ba { --x: 50%; position: relative; width: var(--wide); margin: 0 auto; border-radius: 6px; overflow: hidden; cursor: ew-resize; touch-action: pan-y; background: #111; user-select: none; }
.ba img, .ba video { display: block; width: 100%; height: auto; pointer-events: none; }
.ba--video video { aspect-ratio: 1600 / 1098; object-fit: cover; }
.ba__before { position: absolute; inset: 0; height: 100%; clip-path: inset(0 calc(100% - var(--x)) 0 0); }
.ba__line { position: absolute; top: 0; bottom: 0; left: var(--x); width: 3px; margin-left: -1.5px; background: var(--cream); }
.ba__knob { position: absolute; top: 50%; left: var(--x); translate: -50% -50%; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: var(--orange); color: var(--ink); font: 700 20px/1 var(--body); box-shadow: 0 6px 20px rgba(0,0,0,.45); transition: scale .2s; }
.ba:hover .ba__knob, .ba:focus-visible .ba__knob { scale: 1.1; }
.ba__tag { position: absolute; top: 14px; font: 700 12px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; padding: 7px 10px; background: rgba(0,0,0,.7); color: var(--cream); }
.ba__tag--before { left: 14px; } .ba__tag--after { right: 14px; background: var(--orange); color: var(--ink); }

/* the AI shot */
.ai__lede { color: var(--muted); max-width: 56ch; margin: -4px auto 24px; }
.ai__inputs { list-style: none; padding: 0; width: var(--wide); margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.ai__inputs img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #111; }
.ai__inputs span, .ai__result figcaption { display: block; margin-top: 8px; font: 600 12px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.ai__result { width: var(--wide); margin: 18px auto 0; display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; }
.ai__result figure { margin: 0; }
.ai__result video { width: 100%; height: auto; border-radius: 6px; background: #111; }
.ai__arrow { font: 900 36px/1 var(--display); color: var(--orange); }
@media (max-width: 760px) { .ai__inputs { grid-template-columns: 1fr 1fr; } .ai__result { grid-template-columns: 1fr; } .ai__arrow { rotate: 90deg; justify-self: center; } }

/* campaign posts as a fan — shown whole, in their real 3:4 shape (720×960), nothing cropped */
.posts { --card: clamp(240px, 28vw, 420px); list-style: none; padding: 0; position: relative; width: var(--wide);
  height: calc(var(--card) * 4 / 3 + 30px); margin: 10px auto 0; }
.posts li { position: absolute; left: 50%; top: 0; width: var(--card); translate: -50% 0; cursor: pointer;
  transition: transform .7s cubic-bezier(.22,1,.36,1), opacity .5s ease, filter .5s ease; }
.posts img { width: 100%; height: auto; aspect-ratio: 720 / 960; object-fit: contain; border-radius: 8px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.8); }
.posts li[data-o="0"]  { z-index: 5; transform: none; }
.posts li[data-o="1"]  { z-index: 4; transform: translateX(62%) scale(.84) rotate(6deg); filter: brightness(.55); }
.posts li[data-o="-1"] { z-index: 4; transform: translateX(-62%) scale(.84) rotate(-6deg); filter: brightness(.55); }
.posts li[data-o="2"]  { z-index: 3; transform: translateX(105%) scale(.7) rotate(10deg); filter: brightness(.35); opacity: .8; }
.posts li[data-o="-2"] { z-index: 3; transform: translateX(-105%) scale(.7) rotate(-10deg); filter: brightness(.35); opacity: .8; }

/* ---------- reveal on scroll ---------- */
.rv { opacity: 0; translate: 0 32px; transition: opacity .8s ease, translate 1s cubic-bezier(.22,1,.36,1); }
.rv.is-in { opacity: 1; translate: 0 0; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; translate: none; } .cs-cover__media img { animation: none; transform: none; } }

/* ---------- next / footer ---------- */
.cs-next { width: var(--wide); margin: 0 auto; padding: clamp(60px, 10vh, 120px) 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.cs-next p { margin: 0; color: var(--muted); }
.cs-next a { font: 900 clamp(32px, 4vw, 56px)/1 var(--display); font-stretch: 62%; text-transform: uppercase; text-decoration: none; color: var(--orange); transition: color .2s; }
.cs-next a:hover { color: var(--yellow); }

/* =========================================================
   After Effects timeline (js/case/ae-timeline.js) — black, in the site's colours
   ========================================================= */
.aetl { --row: 17px; --list: 46%; width: 100%; border: 1px solid #222; border-radius: 6px; overflow: hidden; background: #0b0b0b; color: var(--muted);
  font: 500 11px/1 "Montserrat", system-ui, sans-serif; text-align: left; direction: ltr; }
.aetl__head { display: grid; grid-template-columns: var(--list) 1fr; background: #050505; border-bottom: 1px solid #222; }
.aetl__cols, .aetl__row { display: grid; grid-template-columns: 14px 12px 22px 16px minmax(0, 1fr) 16px 86px 64px 64px 64px 46px; align-items: center; column-gap: 6px; padding: 0 8px; }
.aetl__cols { height: 24px; color: #7a7a7a; font-weight: 700; }
.aetl__ruler { position: relative; height: 24px; border-left: 1px solid #222; }
.aetl__ruler span { position: absolute; top: 7px; translate: -50% 0; color: #7a7a7a; font-size: 10px; }
.aetl__ruler span:first-child { translate: 2px 0; }
.aetl__body { display: grid; grid-template-columns: var(--list) 1fr; max-height: calc(var(--row) * 20 + 2px); overflow: hidden; }
.aetl__body .aetl__track { min-height: 100%; }
.aetl__row, .aetl__lane { height: var(--row); border-bottom: 1px solid #141414; }
.aetl__row:nth-child(odd), .aetl__lane:nth-child(odd) { background: #121212; }
.aetl__tw { color: #8a8a8a; font-size: 12px; }
.aetl__sw { width: 10px; height: 10px; border-radius: 50%; }
.aetl__n { color: #7a7a7a; text-align: right; }
.aetl__ic svg { display: block; width: 12px; height: 12px; }
.aetl__name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--cream); }
.aetl__fx { color: var(--cream); font-style: italic; }
.aetl__par { background: #1a1a1a; border-radius: 3px; padding: 2px 5px; color: var(--cream); overflow: hidden; white-space: nowrap; }
.aetl__cols .aetl__par { background: none; padding: 0; color: #7a7a7a; }
.aetl__t { color: var(--orange); text-align: right; white-space: nowrap; }
.aetl__cols .aetl__t { color: #7a7a7a; }
.aetl__track { position: relative; border-left: 1px solid #222; }
.aetl__lane { position: relative; }
.aetl__bar, .aetl__tail { position: absolute; top: 3px; bottom: 3px; border-radius: 3px; }
.aetl__bar--audio { border-radius: 6px 6px 2px 2px; }
.aetl__tail { opacity: .4; }
.aetl__head-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--cream); box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
.aetl__head-line::before { content: ""; position: absolute; top: -1px; left: 50%; translate: -50% 0; width: 10px; height: 8px; background: var(--orange); clip-path: polygon(0 0, 100% 0, 50% 100%); }
@media (max-width: 1100px) { .aetl { --list: 44%; } .aetl__cols, .aetl__row { grid-template-columns: 14px 12px 22px 16px minmax(0, 1fr) 16px 0 64px 64px 0 0; } .aetl__par, .aetl__pc, .aetl__t:nth-last-child(2) { visibility: hidden; } }
@media (max-width: 700px) { .aetl { --list: 40%; font-size: 9px; } .aetl__cols, .aetl__row { grid-template-columns: 12px 0 18px 14px minmax(0, 1fr) 0 0 0 0 0 0; column-gap: 4px; } .aetl__t, .aetl__fx, .aetl__sw { visibility: hidden; } .aetl__ruler span:nth-child(even) { display: none; } }
/* half-width timelines (two shots side by side): keep the name + parent, drop the time columns */
.pair .aetl__cols, .pair .aetl__row { grid-template-columns: 14px 12px 22px 16px minmax(0, 1fr) 16px 72px 0 0 0 0; }
.pair .aetl__cols > :nth-child(n+8), .pair .aetl__row > :nth-child(n+8) { visibility: hidden; }

/* the tilted post fan never widens the page on phones (clip, not hidden: no scroll box, sticky still works) */
.trip { overflow-x: clip; }

/* phones: the intro stacks; jump links land below the fixed bar */
@media (max-width: 760px) { .cs-intro { grid-template-columns: 1fr; } }
[id] { scroll-margin-top: 96px; }
