/* Revers case study. The layout (sidebar, slides, grid) is shared: case.css and
   case.js. This file holds each slide's backdrop (.stage), in the brand's own
   palette, and the pieces laid out on it: screens and images cut from 2x exports
   of the Revers Figma file. */

:root {
  --blush: #f7bde3;
  --pink: #e57cbe;
  --orchid: #7f429d;
  --violet: #4b3354;
  --oatmilk: #f4ebe2;
  --cantaloupe: #f8cc95;
  --peach: #f39253;
  --coral: #ef6e47;
  /* the app's own background, sampled from its screens: crops of glass cards blend into it */
  --app-bg: linear-gradient(170deg, #f8dbdb 0%, #f5eadd 55%, #f6e6e6 100%);
  --screen-radius: 11.45% / 5.28%; /* 45 px corners on a 393 × 852 screen */
  --pad: clamp(20px, 5vw, 64px);
}

img {
  -webkit-user-drag: none;
}

/* ── Stages ─────────────────────────────────────────────── */

/* contain: what's inside a slide never widens the page (the guideline rows are
   wider than the slide on purpose) */
.stage {
  position: relative;
  overflow: hidden;
  contain: inline-size;
  padding: var(--pad);
}

.stage-gradient { background: #f2a9d8 url("assets/gradient.webp") right bottom / cover no-repeat; }
.stage-app { background: var(--app-bg); }
.stage-violet { background: var(--violet); }
.stage-orchid { background: var(--orchid); }
.stage-blush { background: var(--blush); }
.stage-pink { background: var(--pink); }
.stage-cantaloupe { background: var(--cantaloupe); }
.stage-peach { background: var(--peach); }
.stage-coral { background: var(--coral); }
.stage-white { background: #fff; }

/* Shapes go on the slide, not on its backdrop: the backdrop is a flex item that
   stretches to fill the slide, and Firefox drops an aspect ratio there. The width
   keeps a rounded-up height from turning the ratio into a width. */
.shot-hero,
.shot-site { width: 100%; aspect-ratio: 4 / 3; }
.shot-screens { width: 100%; aspect-ratio: 16 / 9; }
.shot-tall { width: 100%; aspect-ratio: 4 / 5; }

.screen {
  border-radius: var(--screen-radius);
}

/* ── Hero: three screens centred in the slide, the middle one raised ── */

.shot > .stage.hero {
  justify-content: center;
  perspective: 1600px;
}

.hero-screens {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4%;
  /* the raised middle screen sits 4 % of its height above the others, the outer
     ones as far below, so the group as a whole is centred */
  transform-origin: 50% 50%;
}

.hero-screens .screen {
  width: 21%;
  translate: 0 4%;
  box-shadow: 0 40px 90px rgba(127, 66, 157, 0.35), 0 8px 20px rgba(75, 51, 84, 0.18);
}

.hero-screens .screen:nth-child(2) {
  translate: 0 -4%;
}

/* ── The website, scrolling in its window ───────────────── */

/* the window runs off the slide's bottom edge, so it has no padding there */
.shot > .stage#site {
  align-items: center;
  padding-bottom: 0;
}

/* a browser view of the page (captured 1280 px wide at 2x), as tall as the slide allows */
.site-window {
  position: relative;
  flex: 1;
  width: 80%;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
  background: #f0e5db;
  box-shadow: 0 40px 90px rgba(15, 5, 20, 0.45), 0 8px 20px rgba(15, 5, 20, 0.25);
}

.site-page {
  display: block;
  width: 100%;
  will-change: transform;
}

/* the site's nav stays put; the page fades out under it, standing in for the
   site's own blur band */
.site-nav,
.site-fade {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.site-fade {
  height: 17%;
  background: linear-gradient(rgba(240, 229, 221, 0.92) 45%, rgba(240, 229, 221, 0));
}

/* ── Screens scrolling in their tiles ───────────────────── */

.scroller {
  align-items: center;
  justify-content: center;
}

.phone {
  width: 68%;
  aspect-ratio: 393 / 852;
  overflow: hidden;
  border-radius: var(--screen-radius);
  box-shadow: 0 40px 80px rgba(160, 90, 30, 0.3), 0 8px 18px rgba(160, 90, 30, 0.14);
}

.phone img {
  width: 100%;
  will-change: transform;
}

/* ── Picking a date ─────────────────────────────────────── */

#date {
  align-items: center;
}

/* the conversation, laid out as in the chat screen: a 353 × 628 column */
.chat {
  position: relative;
  width: 70%;
  aspect-ratio: 353 / 628;
}

.msg {
  position: absolute;
  filter: none;
}

.msg-card { left: 0; top: 0; width: calc(280 / 353 * 100%); }
.msg-sorry { left: calc(113 / 353 * 100%); top: calc(261 / 628 * 100%); width: calc(240 / 353 * 100%); }
.msg-pick { left: calc(73 / 353 * 100%); top: calc(321 / 628 * 100%); width: calc(280 / 353 * 100%); display: grid; }
.msg-reply { left: 0; top: calc(550 / 628 * 100%); width: calc(240 / 353 * 100%); }

.msg-pick > img {
  grid-area: 1 / 1;
  width: 100%;
}

/* a picked row: the same card with its dates ticked, cut down to the row */
.pick-on {
  clip-path: inset(var(--t) 0 var(--b) 0);
}

/* a screen rising out of the bottom edge */
.shot > .stage.hang {
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 0;
}

.hang .screen {
  width: 64%;
  margin-bottom: -22%;
  box-shadow: 0 40px 80px rgba(140, 50, 10, 0.3), 0 8px 18px rgba(140, 50, 10, 0.16);
}

/* the welcome screen: its members and 3D icons on the rings around the R
   (centred at 197, 278 of 393 × 852), each placed by its top-left corner */
.welcome {
  position: relative;
  overflow: hidden;
}

.welcome > img:first-child {
  display: block;
  width: 100%;
}

.welcome .orbit {
  position: absolute;
  left: calc(var(--x) / 393 * 100%);
  top: calc(var(--y) / 852 * 100%);
  width: calc(var(--w) / 393 * 100%);
  will-change: left, top;
}

/* ── Four screens ───────────────────────────────────────── */

.screens {
  flex-direction: row !important;
  align-items: center;
  justify-content: center;
  gap: 3%;
}

.screens .screen {
  width: 19%;
  box-shadow: 0 40px 80px rgba(30, 10, 40, 0.35), 0 8px 18px rgba(30, 10, 40, 0.2);
  will-change: transform;
}

/* ── Brand guidelines: two rows of pages ────────────────── */

.guides {
  gap: clamp(14px, 2vw, 28px);
  padding-inline: 0;
  padding-block: clamp(48px, 7vw, 96px);
}

.guide-row {
  display: flex;
  gap: clamp(14px, 2vw, 28px);
  width: max-content;
  will-change: transform;
}

.guide-row img {
  width: clamp(240px, 30vw, 460px);
  border-radius: 8px;
  box-shadow: 0 24px 50px rgba(75, 51, 84, 0.2), 0 5px 12px rgba(75, 51, 84, 0.1);
}

/* ── 3D icons ───────────────────────────────────────────── */

.icons {
  align-items: center;
  padding-block: clamp(40px, 7vw, 96px);
}

/* on a half tile: three across, four down */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 3.4vw, 44px) clamp(12px, 2.4vw, 32px);
  width: 84%;
  place-items: center;
}

.icon-grid img {
  width: 76%;
  will-change: transform;
}

/* ── Illustrations ──────────────────────────────────────── */

/* on a half tile: two by two, each card tilted its own way */
.illus {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  align-content: center;
  align-items: center;
  justify-items: center;
  gap: clamp(14px, 3vw, 36px) clamp(12px, 2.4vw, 28px);
  padding-inline: 12%;
}

.illu {
  width: 100%;
  will-change: transform;
}

.illu img {
  width: 100%;
  border-radius: 12px;
  box-shadow: 0 30px 60px rgba(120, 30, 10, 0.28), 0 6px 14px rgba(120, 30, 10, 0.14);
}

.illu:nth-child(1) { rotate: -5deg; }
.illu:nth-child(2) { rotate: 3deg; margin-top: 10%; }
.illu:nth-child(3) { rotate: -2deg; margin-top: -6%; }
.illu:nth-child(4) { rotate: 5deg; margin-top: 4%; }

/* ── Small screens ──────────────────────────────────────── */

@media (max-width: 699px) {
  .shot-hero { aspect-ratio: 4 / 5; }
  .hero-screens .screen { width: 42%; }
  .hero-screens .screen:nth-child(1) { display: none; }
  .hero-screens .screen:nth-child(n) { translate: 0 5%; }
  .hero-screens .screen:nth-child(2) { translate: 0 -5%; }
  .shot-screens { aspect-ratio: 4 / 5; }
  .site-window { width: 94%; }
  .screens .screen { width: 42%; }
  .screens .screen:nth-child(n + 3) { display: none; }
  .icon-grid { width: 92%; }
}
