/* Cercle Brugge 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 the
   site laid out on it: images cut from 2x exports of the Figma file, plus the rings,
   which are the identity's own vectors. */

:root {
  --green: #60b22c; /* Cercle green, from the brand page */
  --black: #000;
  --dark: #323232;
  --light: #f0f0f0;
  --lift: 0 30px 80px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.2);
  --pad: clamp(20px, 5vw, 64px);
}

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

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

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

.stage-green { background: var(--green); }
.stage-black { background: var(--black); }
.stage-dark { background: var(--dark); }
.stage-light { background: var(--light); }

/* ── 1. Homepage ────────────────────────────────────────── */

.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 90px rgba(20, 50, 8, 0.45), 0 6px 18px rgba(20, 50, 8, 0.25);
  transform-origin: 50% 0;
}

.hero-screen > img:first-child {
  width: 100%;
}

/* The photo header, live, over its own picture in the screenshot: 1760 × 510
   design px from y 119 of the 1500 cut. One design px is --u. */
.carousel {
  position: absolute;
  top: calc(119 / 1500 * 100%);
  left: 0;
  width: 100%;
  aspect-ratio: 1760 / 510;
  overflow: hidden;
  background: #000;
  container-type: inline-size;
  --u: calc(100cqw / 1760);
}

.panel {
  position: absolute;
  top: 0;
  left: calc(var(--x) * var(--u));
  width: calc(var(--w) * var(--u));
  height: 100%;
  overflow: hidden;
  --cut: calc(90 * var(--u)); /* the slant: 90 design px over the full height */
}

.panel-left { clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); }
.panel-middle { clip-path: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); }
.panel-right { clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%); }

/* each photo covers its panel at full height, centred, so it slides half as fast as the panel's edge */
.panel img {
  position: absolute;
  top: 0;
  left: 50%;
  width: auto;
  max-width: none;
  height: 100%;
  transform: translateX(-50%);
}

/* the panel's own fills: a fixed shade along the bottom, and a dimming that is
   strong on the closed panels and a quarter of that on the open one */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.panel::before {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 50%);
}

.panel::after {
  background: linear-gradient(rgba(0, 0, 0, 0.48), rgba(0, 0, 0, 0)), rgba(0, 0, 0, 0.4);
  opacity: var(--dim, 1);
}

.caption {
  position: absolute;
  z-index: 2;
  top: calc(var(--y) * var(--u));
  left: calc(var(--x) * var(--u));
  width: calc(var(--w) * var(--u));
  max-width: none;
}

/* the design's own hand cursor; its fingertip sits on the point it is moved to */
.pointer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 3;
  width: clamp(20px, 2.2vw, 30px);
  height: auto;
  margin: -2px 0 0 -9px;
  opacity: 0;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  pointer-events: none;
}

/* ── 4. Player cards ────────────────────────────────────── */

/* three cards at the size four would have, centred */
.squad-row {
  --gap: clamp(10px, 1.8vw, 24px);
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, calc((100% - 3 * var(--gap)) / 4));
  justify-content: center;
  gap: var(--gap);
}

.player-card {
  position: relative;
  display: grid;
}

/* the hover's flag, position and age, on their own layer so they can slide in after the card turns */
.player-card .meta {
  position: absolute;
  left: calc(240 / 698 * 100%);
  width: calc(220 / 698 * 100%);
  opacity: 0;
}

.player-card > img {
  grid-area: 1 / 1;
  width: 100%;
}

.player-card .on {
  opacity: 0;
}

/* ── 5. Player statistics (a video) ─────────────────────── */

.shot-stats {
  width: 100%;
  aspect-ratio: 1680 / 740;
  background: #000;
}

/* ── 2. Pages on a phone ───────────────────────────────── */

/* one 375 × 812 screen: the top bar (73 px) on top, the page types stacked below it */
.mpages-screen {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 375 / 812;
  overflow: hidden;
  border-radius: 10px;
  background: #000;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45), 0 6px 14px rgba(0, 0, 0, 0.25);
}

.mpages-screen img {
  position: absolute;
  left: 0;
  top: calc(73 / 812 * 100%);
  width: 100%;
}

.mpages-screen .pages-bar {
  top: 0;
  z-index: 3;
}

.mpages-screen img:not(.pages-bar) + img {
  opacity: 0;
}

/* ── 2. Mobile menu ─────────────────────────────────────── */

.stage-screen { background: #151515; } /* the screens' own background */

/* one 375 × 812 screen; the menu sheet lies over it, off to the right until it opens */
.menu-demo {
  position: relative;
  width: min(100%, 340px);
  margin: 0 auto;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 30px 70px rgba(0, 0, 0, 0.55);
}

.menu-demo > img {
  width: 100%;
}

.menu-sheet {
  position: absolute;
  inset: 0;
  visibility: hidden; /* shown by the script, which slides it in and out */
}

.menu-sheet > img:first-child {
  width: 100%;
}

/* the first level's items, slid aside as a group when Teams drills down */
.menu-level {
  position: absolute;
  inset: 0;
}

/* the Teams level: its list (x 62, y 89, 313 × 344 design px), built from pieces so A-Kern can open */
.menu-teams {
  position: absolute;
  left: calc(62 / 375 * 100%);
  top: calc(89 / 812 * 100%);
  width: calc(313 / 375 * 100%);
  aspect-ratio: 626 / 688;
  opacity: 0;
}

.menu-teams > img {
  position: absolute;
  left: 0;
  width: 100%;
}

.ak-open,
.ak-closed { top: 0; }

/* A-Kern's links, shown down to --o (0 closed, 1 open); the teams below ride down with them */
.ak-links {
  top: calc(104 / 688 * 100%);
  --o: 0;
  clip-path: inset(0 0 calc((1 - var(--o)) * 100%) 0);
}

.ak-rest { top: calc(104 / 688 * 100%); }

.menu-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
}

/* the seven items, cut from the menu, at x 62 and y 89 + 52 per row of 375 × 812 */
.menu-row {
  position: absolute;
  left: calc(62 / 375 * 100%);
  top: calc((89 + 52 * var(--i)) / 812 * 100%);
  width: calc(313 / 375 * 100%);
}

/* a fingertip: a soft ring where the screen is tapped */
.tap {
  position: absolute;
  z-index: 2;
  width: calc(44 / 375 * 100%);
  aspect-ratio: 1;
  margin: calc(-22 / 375 * 100%) 0 0 calc(-22 / 375 * 100%);
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  opacity: 0;
  pointer-events: none;
}

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

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

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

.shots .shot > .stage {
  align-items: center;
}

.tile-green { background: var(--green); }
.tile-grey { background: #b4b4b4; }

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

/* ── Phones and narrow screens ──────────────────────────── */

@media (max-width: 699px) {
  .hero-screen {
    width: 94%;
  }

  .squad-row {
    grid-template-columns: repeat(2, 1fr);
  }

  /* two of the three: the name type and the outline number */
  .squad-row .player-card:nth-child(3) {
    display: none;
  }

}

/* the desktop window: 1760 × 1100 design px */
.window {
  width: 100%;
  max-width: 1100px;
  aspect-ratio: 1760 / 1100;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.12);
}

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

/* ── 3. Pages ───────────────────────────────────────────── */

#pages {
  align-items: center;
}

/* the page types below one shared top bar (115 of 1100 design px); the script shows one page at a time */
.pages-window {
  position: relative;
  box-shadow: 0 30px 90px rgba(20, 50, 8, 0.45), 0 6px 18px rgba(20, 50, 8, 0.25);
}

.pages-window img {
  position: absolute;
  left: 0;
  top: calc(115 / 1100 * 100%);
  width: 100%;
}

.pages-window .pages-bar {
  top: 0;
  z-index: 3;
}

.pages-window img:not(.pages-bar) + img {
  opacity: 0;
}

/* the two phones side by side: the page types and the menu */
.phone-pair {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(16px, 5vw, 72px);
}

.phone-pair > * {
  flex: 0 1 340px;
  margin: 0;
}

/* the desktop window alone, at the slide's full width */
.pages-solo {
  width: 100%;
}
