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

:root {
  /* flat backdrops, never gradients: neutrals, and light tints of Unifly's
     orange (#ffb359, the website's call to action) and its green */
  --charcoal: #232327;
  --grey: #e4e4e2;
  --paper: #f2f0eb;
  --apricot: #f6dfc3;
  --sage: #d9e5d3;
  --sky: #d6e2f3; /* a light blue for the dashboard, from its navy */
  --night: #14092c; /* the website's hero */
  --screen-shadow: 0 30px 80px rgba(0, 0, 0, 0.28), 0 6px 18px rgba(0, 0, 0, 0.14);
  --pad: clamp(20px, 5vw, 64px);
}

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

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

.stage {
  position: relative;
  overflow: hidden;
  padding: var(--pad);
}

.stage-charcoal { background: var(--charcoal); }
.stage-grey { background: var(--grey); }
.stage-paper { background: var(--paper); }
.stage-apricot { background: var(--apricot); }
.stage-sage { background: var(--sage); }
.stage-sky { background: var(--sky); }
.stage-night { background: var(--night); }
.stage-white { background: #fff; }

/* a whole web screen on a backdrop */
.screen {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--screen-shadow);
}

.screen img {
  display: block;
  width: 100%;
}

/* ── Flight map ─────────────────────────────────────────── */

.shot > .stage.hero {
  justify-content: flex-end;
  padding-bottom: 0;
  perspective: 1400px;
}

.hero-screen {
  position: relative;
  z-index: 1;
  width: 88%;
  margin: 0 auto;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(26, 36, 80, 0.25), 0 6px 18px rgba(26, 36, 80, 0.12);
  transform-origin: 50% 0;
}

.hero-screen img {
  display: block;
  width: 100%;
}

/* ── Brand themes: stacked ──────────────────────────────── */

.themes {
  display: grid;
}

.themes > img {
  grid-area: 1 / 1;
}

/* Each theme sweeps in from the left over the one before; without motion the
   first one shows. */
.themes > img + img {
  clip-path: inset(0 100% 0 0);
}

.theme-edge {
  grid-area: 1 / 1;
  justify-self: start;
  z-index: 9;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
  opacity: 0;
}

/* ── iOS app ────────────────────────────────────────────── */

.shelf {
  padding-inline: 0;
}

.shelf-row {
  --h: clamp(220px, 24vw, 360px); /* phone height */
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.4vw, 36px);
  width: max-content;
  will-change: transform;
}

.shelf-row + .shelf-row {
  margin-top: clamp(16px, 2.4vw, 36px);
}

/* one row of larger phones */
.shelf-wide .shelf-row {
  --h: clamp(320px, 40vw, 600px);
  gap: clamp(20px, 3vw, 48px);
}

/* Shadows are baked into the images, with room around the phone: 0.1 of its
   height above, 0.2 at the sides and 0.32 below, taken back here. */
.shelf-row img {
  height: calc(var(--h) * 1.42);
  width: auto;
  margin: calc(var(--h) * -0.1) calc(var(--h) * -0.2) calc(var(--h) * -0.32);
}

/* ── Validation ─────────────────────────────────────────── */

/* The card hangs from near the top of a square tile: closed it fits, and as
   it opens it grows past the tile's bottom edge. The box keeps the open card's
   height (cut off by the tile); the script shrinks the clip to the state shown. */
.shots .shot > #validation {
  display: block;
  padding: 0;
}

.accordion {
  position: absolute;
  top: 9%;
  left: 18%;
  width: 64%;
  aspect-ratio: 1040 / 1920;
}

.accordion-clip {
  position: absolute;
  inset: 0 0 auto;
  height: 100%;
  overflow: hidden;
}

.acc {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
}

.acc-closed,
.acc-mid,
.acc-rest {
  opacity: 0;
}

/* the rows below a section, sliding over the card beneath */
.acc-rest {
  z-index: 1;
}

/* plain cuts: no tile shadow or rounding (the shared two-up rule adds both) */
.shots .accordion .acc,
.shots #themes .screen img {
  border-radius: 0;
  box-shadow: none;
}

.cursor {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  width: clamp(20px, 2.2vw, 28px);
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}

/* ── Website ────────────────────────────────────────────── */

/* the window runs into the slide's bottom edge */
.shot > #site {
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 0;
}

.site-window {
  width: 92%;
  aspect-ratio: 4 / 3;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.5), 0 8px 20px rgba(0, 0, 0, 0.3);
}

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

/* ── Screens, each on a tile ────────────────────────────── */

.shot-tile {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.shots .shot > .stage {
  display: grid;
  place-items: center;
  align-items: center;
  padding: 9%;
}

.shots .stage img {
  width: 100%;
  border-radius: 5px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.16), 0 5px 12px rgba(0, 0, 0, 0.07);
}

/* ── Design system: a drone, then components in use ─────── */

/* The slide's screen: a 1648 x 900 scene in which every piece is a full-scene
   layer, so its moves can be given in % of the scene (labels size with it, cqw). */
.ds-stack {
  display: grid;
}

.ds-screen {
  grid-area: 1 / 1;
  position: relative;
  width: 100%;
  aspect-ratio: 1648 / 900;
  container-type: inline-size;
}

.ds-base {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  box-shadow: var(--screen-shadow);
}

/* the component's frame, as Figma draws a component set: a dashed violet
   outline (drawn on, see .ds-outline below) with its icon and name above it */
.ds-set {
  position: absolute;
  z-index: 3;
  opacity: 0;
  pointer-events: none;
}

.ds-name {
  position: absolute;
  bottom: 100%;
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 0.55em;
  font-family: var(--font-sans);
  font-size: max(10px, 1.1cqw);
  font-weight: 500;
  line-height: 1;
  color: #9747ff;
  white-space: nowrap;
}

.ds-name svg {
  width: 1em;
  height: 1em;
  fill: currentColor;
}

/* The map (its base and pins) is one layer the script can push in and fade;
   the selected drone is a layer of its own, a vector so it stays sharp as it
   grows; every other piece is a full-scene layer, its image placed at its
   resting size. Without motion only the flight map shows. */
.ds3-map,
.ds3-board,
.ds3-drone,
.ds3-item {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* the task board the last component lands on */
.ds3-board {
  opacity: 0;
}

.ds3-pin,
.ds3-drone img,
.ds3-item img,
.ds3-item > svg,
.ds3-cursor > svg {
  position: absolute;
  display: block;
  height: auto;
  overflow: visible;
}

/* the cursor that uses the components: an arrow, a pointing hand over what can
   be clicked and a text beam over the input, each with its hotspot on the
   layer's anchor */
.ds3-cursor {
  position: absolute;
  inset: 0;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
}

.ds3-cursor > svg + svg {
  opacity: 0;
}

/* the line that sweeps the task view back into the map: the theme switcher's edge */
.ds3-edge {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.6);
  opacity: 0;
  pointer-events: none;
}

.ds3-item {
  opacity: 0;
}

.ds3-drone {
  z-index: 2;
}

/* the frame drawn on: an outline in the frame's box, revealed along its length
   by a mask the script moves */
.ds-outline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ds-outline rect {
  x: 0.75px;
  y: 0.75px;
  width: calc(100% - 1.5px);
  height: calc(100% - 1.5px);
  rx: 12px;
  fill: none;
}

/* 1.5px on a wide slide, thinner as the scene gets smaller */
.ds-dash {
  stroke: #9747ff;
  stroke-width: clamp(1px, 0.15cqw, 1.5px);
  stroke-dasharray: 5 4;
}

.ds-pen {
  stroke: #fff;
  stroke-width: 8px;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

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

@media (max-width: 699px) {
  .hero-screen { width: 100%; }
  .site-window { width: 100%; aspect-ratio: 3 / 4; }
  .shelf-row { --h: 220px; }
  .shelf-wide .shelf-row { --h: 340px; }
}

/* ── The app in context ─────────────────────────────────── */

.shot-office {
  width: 100%;
  aspect-ratio: 2400 / 1610;
}

.office {
  padding: 0;
}

.office img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 40% 50%;
}

/* ── In the field ───────────────────────────────────────── */

/* ── Brand themes and feature icons: two squares ───────── */

.shot-square {
  width: 100%;
  aspect-ratio: 1 / 1;
}

/* the screen's top-left corner, running off the tile's right and bottom edges */
.shots .shot > #themes {
  display: block;
  padding: 0;
  background: #2f3068; /* the first theme's colour; the script fades it with each theme */
}

#themes .screen {
  position: absolute;
  top: 12%;
  left: 12%;
  width: 100%;
  border-radius: 8px 0 0 0;
}

.shots .stage-icons {
  background: #fff;
}

.icons {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 18cqw 16cqw;
}

.shots .shot > .stage-icons {
  container-type: inline-size;
}

.icon {
  display: block;
  width: 14cqw;
  height: auto;
}
