/* ---- DataShiftiX case study ----
   Page-specific styles, loaded after css/style.css so the shared tokens, the
   site header/nav and .project-back are already in place. Everything here is
   prefixed .dsx- so it cannot collide with the other case studies.

   The Figma frame is 1440 wide and its blocks sit flush, with no gaps between
   them. The case study is inset to the nav's content box like the others, so
   every size below is a share of that column, carrying the frame's
   proportions rather than its pixels. */
.dsx-page {
  width: calc(100% - 2 * var(--case-pad-x));
  margin-inline: auto;
  padding-top: var(--case-gap);
}

.dsx-page > * {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Every plate is an image or clip that fills its block edge to edge. */
.dsx-page img,
.dsx-page video {
  display: block;
  width: 100%;
  height: auto;
}

/* ---- Logo animation ----
   The render is the frame's own 1440x842, so it fills the block uncropped.
   The ratio sits on the wrapper so nothing below jumps while it loads. */
.dsx-hero {
  aspect-ratio: 1440 / 842;
  background: #424650;
}

/* ---- Intro ----
   The frame's 40px above and below the text, and the text starting on the
   halfway line (x 719 of 1440) and stopping 65px short of the edge - 65/720 of
   the right half. */
.dsx-caption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding-block: var(--case-gap);
}

.dsx-caption-text {
  grid-column: 2;
  padding-right: 9.03%;
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  font-size: var(--case-text); /* shared with every case study's caption */
  font-weight: 400;
  line-height: 1.5;
  color: #000000;
}

.dsx-caption h2 {
  margin: 0 0 14px; /* the frame's gap between the two text boxes */
  font-size: inherit;
  font-weight: 500;
}

.dsx-caption p {
  margin: 0;
}

.dsx-caption p + p {
  margin-top: 1.5em;
}

/* ---- Side-by-side rows ----
   Column widths are the frame's own, as fr units so the pair always fills
   the column; each half carries its frame ratio, so the pair stays level. */
.dsx-split {
  display: grid;
}

.dsx-split-logo {
  grid-template-columns: 1fr 1fr; /* 720 / 720 */
}

.dsx-split-logo > img {
  aspect-ratio: 720 / 531;
}

.dsx-split-cards {
  grid-template-columns: 717fr 723fr;
}

.dsx-split-bag {
  grid-template-columns: 748fr 692fr;
}

/* ---- Cropped plates ----
   Photos placed in the frame larger than their box and shifted for the
   composition. The box carries the frame's size; the photo is positioned in
   it by the frame's offsets, as shares of the box so the crop holds at any
   width. */
.dsx-crop {
  position: relative;
  overflow: hidden;
}

.dsx-crop > img {
  position: absolute;
  max-width: none;
}

/* Business cards: 785x589 at (-45, -40) in a 717x482 window. */
.dsx-crop-cards {
  aspect-ratio: 717 / 482;
}

.dsx-crop-cards > img {
  left: -6.282%;
  top: -8.383%;
  width: 109.496%;
}

/* Tablet: 1473x1105 at (-17, 0) in the full-width 1440x1103 window. */
.dsx-crop-tablet {
  aspect-ratio: 1440 / 1103;
}

.dsx-crop-tablet > img {
  left: -1.150%;
  top: 0;
  width: 102.300%;
}

/* Bag: 748x561 at (0, -20.5) in a 748x532 window. */
.dsx-crop-bag {
  aspect-ratio: 748 / 532;
}

.dsx-crop-bag > img {
  left: 0;
  top: -3.853%;
  width: 100%;
}

/* ---- Stack ----
   1100px is the site's breakpoint; keep it in step with NAV_BREAKPOINT in
   js/main.js. The caption text drops to the full column there, as the shared
   .case-caption does. */
@media (max-width: 1100px) {
  .dsx-caption {
    grid-template-columns: 1fr;
  }

  .dsx-caption-text {
    grid-column: 1;
    padding-inline: clamp(8px, 2vw, 24px);
  }
}

/* On phones the halves are too small to read side by side. */
@media (max-width: 600px) {
  .dsx-split {
    grid-template-columns: 1fr;
  }

  .dsx-caption-text {
    padding-inline: 16px;
  }
}
