/* Case study pages: shared with the generated home (IBM Plex Sans / JetBrains Mono). */
:root {
  --bg: #f4f1ec; --surface: #fbf9f5; --ink: #1d1c1a; --ink-body: #3a3835; --ink-muted: #6b675f;
  --line: #d9d3c8; --dark: #33312e; --dark-ink: #f4f1ec; --accent: #9a3b2b;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --shell: clamp(16px, 4vw, 44px); --maxw: 1280px; --gap: clamp(12px, 2vw, 22px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412; --surface: #1d1c1a; --ink: #f1ede6; --ink-body: #d6d1c8; --ink-muted: #9b958b;
    --line: #34322e; --dark: #0e0d0c; --accent: #e08a74;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink-body); font: 400 17px/1.6 var(--font-sans); -webkit-font-smoothing: antialiased; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
.shell { width: min(var(--maxw), 100% - 2 * var(--shell)); margin-inline: auto; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar .shell { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 16px; }
.bar a { text-decoration: none; font: 500 14px/1 var(--font-mono); letter-spacing: .02em; }
.bar .back::before { content: "← "; }
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }

/* hero */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(32px, 5vw, 64px); }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(24px, 4vw, 64px); align-items: end; }
.kicker { font: 500 13px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .12em; color: var(--ink-muted); }
h1 { font-size: clamp(56px, 11vw, 168px); line-height: .9; letter-spacing: -.045em; color: var(--ink); margin: 18px 0 20px; font-weight: 600; }
h1 .line { display: block; overflow: hidden; padding-bottom: .06em; }
h1 .line > span { display: inline-block; }
.lede { font-size: clamp(19px, 2vw, 24px); line-height: 1.45; color: var(--ink); max-width: 34ch; margin: 0; }
.meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); margin-top: 28px; }
.meta div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.meta dt { font: 500 12px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .1em; color: var(--ink-muted); margin-bottom: 6px; }
.meta dd { margin: 0; color: var(--ink); font-size: 15px; }
.hero-media { border-radius: 18px; overflow: hidden; background: var(--dark); }
.hero-media video, .hero-media img { width: 100%; height: auto; }

/* sections */
section.block { padding: clamp(48px, 8vw, 120px) 0; border-top: 1px solid var(--line); }
.block-head { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(20px, 4vw, 64px); margin-bottom: clamp(28px, 4vw, 52px); }
h2 { font-size: clamp(32px, 4.6vw, 64px); line-height: 1; letter-spacing: -.035em; color: var(--ink); margin: 10px 0 0; font-weight: 600; }
.block-head p { margin: 0; font-size: clamp(17px, 1.5vw, 20px); color: var(--ink-body); max-width: 56ch; align-self: end; }
.credit { font: 400 13px/1.5 var(--font-mono); color: var(--ink-muted); margin-top: 14px; }
.dark { background: var(--dark); color: var(--dark-ink); border-top: 0; }
.dark h2, .dark .kicker, .dark p, .dark .credit { color: var(--dark-ink); }
.dark .credit, .dark .kicker { opacity: .7; }

/* media grids */
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
figure { margin: 0; }
figure .frame { border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
figure img, figure video { width: 100%; height: auto; }
figcaption { font: 400 13px/1.45 var(--font-mono); color: var(--ink-muted); margin-top: 10px; }
.dark figcaption { color: var(--dark-ink); opacity: .7; }
.tag { display: inline-block; font: 500 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; padding: 5px 8px; border: 1px solid currentColor; border-radius: 99px; margin-left: 8px; vertical-align: 1px; }

/* swipeable carousel (scroll-snap) */
.swipe { display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 460px); gap: var(--gap); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 14px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.swipe > * { scroll-snap-align: start; }
.swipe.wide { grid-auto-columns: min(88%, 760px); }
.swipe-nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
.swipe-nav button { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 18px; cursor: pointer; }
.dark .swipe-nav button { background: transparent; color: var(--dark-ink); border-color: #4a4742; }

/* phone that scrolls a long feed/stories board with the page */
.scrolly { position: relative; }
.scrolly-sticky { position: sticky; top: 74px; height: calc(100vh - 96px); display: grid; grid-template-columns: 1fr auto; gap: clamp(20px, 5vw, 80px); align-items: center; }
.phone { width: min(360px, 74vw); aspect-ratio: 9 / 19; border-radius: 46px; background: #0b0b0b; padding: 12px; box-shadow: 0 30px 80px rgba(0,0,0,.28); }
.phone-screen { width: 100%; height: 100%; border-radius: 35px; overflow: hidden; background: #fff; position: relative; }
.phone-screen img { width: 100%; height: auto; transform: translateY(var(--y, 0px)); will-change: transform; }
.scrolly-copy p { max-width: 38ch; }
.counter { font: 500 clamp(40px, 6vw, 88px)/1 var(--font-mono); color: var(--ink); letter-spacing: -.04em; }
.dark .counter { color: var(--dark-ink); }

/* next case */
.next { display: block; text-decoration: none; padding: clamp(48px, 8vw, 110px) 0; border-top: 1px solid var(--line); }
.next .kicker { display: block; margin-bottom: 10px; }
.next strong { font-size: clamp(48px, 9vw, 140px); letter-spacing: -.045em; line-height: .9; color: var(--ink); font-weight: 600; transition: letter-spacing .6s var(--ease); }
.next:hover strong, .next:focus-visible strong { letter-spacing: -.02em; }
footer { padding: 28px 0 40px; font: 400 13px/1.5 var(--font-mono); color: var(--ink-muted); border-top: 1px solid var(--line); }

/* scroll reveal (only when JS runs and motion is allowed) */
.js [data-reveal] { opacity: 0; transform: translateY(36px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); transition-delay: var(--d, 0s); }
.js [data-reveal].in { opacity: 1; transform: none; }
.js h1 .line > span { transform: translateY(105%) rotate(2deg); transition: transform 1.1s var(--ease); transition-delay: var(--d, 0s); }
.js h1.in .line > span { transform: none; }
.js [data-parallax] { transform: translateY(var(--py, 0px)); }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js h1 .line > span { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

@media (max-width: 860px) {
  .hero-grid, .block-head { grid-template-columns: 1fr; }
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scrolly-sticky { grid-template-columns: 1fr; position: relative; top: 0; height: auto; justify-items: center; }
  .scrolly { height: auto !important; }
  .phone { width: min(300px, 80vw); }
  .phone-screen { overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .phone-screen img { transform: none; }
}
@media (max-width: 520px) {
  .g2, .g3 { grid-template-columns: 1fr; }
  .meta { grid-template-columns: 1fr; }
}

/* board variant of the scrolly frame (stories sheets, newsletters) */
.board { width: min(520px, 84vw); aspect-ratio: 4 / 5; border-radius: 18px; background: #fff; padding: 0; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.18); }
.board .phone-screen { border-radius: 0; }

/* hero video that fills its card (Luca Faloni) */
.hero-grid:has(.hero-media.fill) { align-items: stretch; }
.hero-media.fill { position: relative; min-height: min(76vh, 760px); }
.hero-media.fill video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* justified rows: figures share one height, widths follow each image's ratio */
.just { display: flex; gap: var(--gap); align-items: flex-start; }
.just + .just, .sub-head + .just { margin-top: var(--gap); }
.just > figure { min-width: 0; }
.just-stack { display: grid; gap: var(--gap); min-width: 0; }
.sub-head { display: grid; grid-template-columns: 1fr 1.4fr; gap: clamp(20px, 4vw, 64px); margin: clamp(44px, 6vw, 80px) 0 clamp(18px, 2.4vw, 28px); padding-top: clamp(20px, 3vw, 32px); border-top: 1px solid var(--line); }
.sub-head p { margin: 0; max-width: 56ch; }

/* long pages in a fixed frame, panning top to bottom while in view */
.tall .frame { aspect-ratio: 3 / 4; }
.tall img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0; }
.js .tall.in img { animation: pan 14s ease-in-out .6s infinite alternate; }
.tall:hover img { animation-play-state: paused; }
@keyframes pan { 0%, 6% { object-position: 50% 0; } 94%, 100% { object-position: 50% 100%; } }

/* marquee: two copies of the set slide by -50% for a seamless loop; speed follows scroll in case.js */
.marquee { overflow: hidden; }
.marquee-track { display: flex; width: max-content; animation: slide var(--dur, 40s) linear infinite; }
.marquee-set { display: flex; flex: none; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes slide { to { transform: translateX(-50%); } }
.marquee.band { background: var(--dark); color: var(--dark-ink); padding: clamp(18px, 2.6vw, 30px) 0; --dur: 36s; }
.band-item { display: flex; align-items: center; gap: clamp(36px, 5vw, 72px); padding-right: clamp(36px, 5vw, 72px); }
.band-item img { height: clamp(28px, 3.6vw, 46px); width: auto; }
.band-item img + img { height: clamp(38px, 4.6vw, 60px); }
.marquee.products { --dur: 48s; margin-inline: calc(50% - 50vw); }
.marquee.products .marquee-set { gap: var(--gap); padding-right: var(--gap); }
.mq-card { margin: 0; width: clamp(180px, 20vw, 260px); }
.mq-card img { border-radius: 12px; aspect-ratio: 3 / 4; object-fit: cover; width: 100%; height: auto; background: #e7e5e1; }
.mq-card figcaption { margin-top: 8px; }

/* Devré × Aquiles */
.aq-hero { display: grid; grid-template-columns: auto 1fr; gap: clamp(24px, 4vw, 64px); align-items: center; }
.aq-phone { margin: 0; justify-self: center; }
.aq-phone .phone { width: min(320px, 72vw); }
.aq-phone .phone-screen video { width: 100%; height: 100%; object-fit: cover; }
.sound { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); border: 0; border-radius: 99px; padding: 8px 14px; background: rgba(0,0,0,.6); color: #fff; font: 500 12px/1 var(--font-mono); letter-spacing: .04em; cursor: pointer; backdrop-filter: blur(6px); }
.sound[aria-pressed="true"] { background: rgba(255,255,255,.88); color: #111; }
.aq-mosaic { display: grid; grid-template-columns: 1.1fr 1fr; grid-template-rows: auto auto; gap: var(--gap); }
.aq-mosaic figure:nth-child(3) { grid-column: 1 / -1; }
.aq-mosaic img { width: 100%; height: 100%; object-fit: cover; }
.aq-mosaic figure:nth-child(-n+2) .frame { aspect-ratio: 4 / 5; }
.aq-graphic { border-radius: 18px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.js .aq-graphic { clip-path: inset(0 100% 0 0); transition: clip-path 1.4s var(--ease); opacity: 1; transform: none; }
.js .aq-graphic.in { clip-path: inset(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  .marquee-track, .js .tall.in img { animation: none; }
  .marquee { overflow-x: auto; }
  .js .aq-graphic { clip-path: none; }
}
@media (max-width: 860px) {
  .just { flex-direction: column; }
  .just > figure, .just-stack { flex: none !important; width: 100%; }
  .sub-head { grid-template-columns: 1fr; }
  .aq-hero { grid-template-columns: 1fr; }
  .hero-media.fill { min-height: 0; aspect-ratio: 4 / 5; }
  .g3.talls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .g3.talls { grid-template-columns: 1fr 1fr; }
  .aq-mosaic { grid-template-columns: 1fr 1fr; }
}
.aq-intro { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(24px, 4vw, 64px); align-items: center; margin-bottom: clamp(32px, 5vw, 64px); }
.aq-intro p { max-width: 40ch; }
@media (max-width: 860px) { .aq-intro { grid-template-columns: 1fr; } }
/* Macowens hero: the whole feed, panning top to bottom inside the card */
.hero-media img.hero-pan { aspect-ratio: 4 / 5; height: auto; object-fit: cover; object-position: 50% 0; animation: pan 18s ease-in-out 1s infinite alternate; }
@media (prefers-reduced-motion: reduce) { .hero-media img.hero-pan { animation: none; } }

/* crossfading hero (Cacharel): each image holds, then dissolves into the next */
.fade-stack { position: absolute; inset: 0; }
.fade-stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; }
.js .fade-stack img { opacity: 0; animation: xfade calc(var(--n) * 4s) linear infinite; animation-delay: calc(var(--i) * 4s - 1s); }
@keyframes xfade { 0% { opacity: 0; transform: scale(1.04); } 6%, 25% { opacity: 1; } 31%, 100% { opacity: 0; transform: scale(1); } }
.hero-media.fill:has(.fade-stack) { aspect-ratio: 2 / 3; min-height: 0; max-height: 82vh; justify-self: end; width: 100%; max-width: calc(82vh * 2 / 3); }
@media (prefers-reduced-motion: reduce) { .js .fade-stack img { animation: none; opacity: 0; } .js .fade-stack img:first-child { opacity: 1; } }
