:root {
  --device-grey: #d8d8d8;
  --grid-gap: clamp(42px, 4.63vw, 70px);
  --grid-track: clamp(56px, 6.26vw, 94.66px);
}

.case-introduction {
  width: calc(100% - 110px);
  margin-inline: auto;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(18, var(--grid-track)) minmax(var(--grid-track), auto) repeat(31, var(--grid-track));
  gap: var(--grid-gap);
  width: calc(100% - 110px);
  margin: 0 auto 50px;
}

.project-grid figure { margin: 0; }
.grid-full { grid-column: 1 / -1; }
.grid-two { grid-column: span 2; }

.device {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.device__frame {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.device__screen {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  background: var(--device-grey);
}

.device__screen::before {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  height: 4.5%;
  min-height: 7px;
  content: "";
  border-bottom: 1px solid #c2c2c2;
  background: #efefef;
}

.device__screen img,
.iteration-tile img,
.reference-placeholder img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-grid .device--desktop {
  /* Positive values move the page upward while the Safari bar and frame stay fixed. */
  --trendradar-scroll-y: 0px;
  grid-row: 1 / span 6;
  aspect-ratio: var(--desktop-frame-ratio);
  width: calc(100% - 40px);
  margin-inline: 20px;
}
.device--desktop .device__screen { inset: var(--desktop-screen-inset); }

.device__screen--trendradar::before { content: none; }

.device__page-viewport {
  position: absolute;
  inset: 4.59% 0 0;
  overflow: hidden;
  background: #fff;
}

.device--laptop .device__page-viewport { inset-block-start: 3.94%; }
.device--tablet .device__page-viewport { inset-block-start: 4.09%; }
.device--phone .device__page-viewport { inset: 5.8% 0 5.69%; }

.device__screen .device__page-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: initial;
  transform: translate3d(0, calc(0px - var(--trendradar-scroll-y)), 0);
  transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}

/* The placeholder export has 15 transparent pixels on each side. */
.device--tablet.grid-tablet-right .device__page-image {
  width: 102.23%;
  margin-inline-start: -1.11%;
}

.device.is-scroll-linked .device__page-image { transition: none; }

.device.has-scroll-timeline .device__page-image {
  animation: trendradar-device-scroll linear both;
  animation-timeline: scroll(root block);
  animation-range: var(--trendradar-animation-start) var(--trendradar-animation-end);
}

@keyframes trendradar-device-scroll {
  from {
    transform: translate3d(0, calc(0px - var(--trendradar-scroll-from)), 0);
    animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
  }
  to { transform: translate3d(0, calc(0px - var(--trendradar-scroll-to)), 0); }
}

.device__screen .device__browser-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  display: block;
  width: 100%;
  height: auto;
  object-fit: initial;
  pointer-events: none;
}

.device__screen .device__browser-bar--phone-top {
  top: 0;
  bottom: auto;
}

.device__screen .device__browser-bar--phone-bottom {
  top: auto;
  bottom: 0;
}

.device--laptop { aspect-ratio: 828 / 511; }
.device--laptop .device__screen { inset: 3.13% 8.21% 7.44% 8.09%; }

.device--tablet { aspect-ratio: var(--tablet-frame-ratio); }
.device--tablet .device__screen { inset: var(--tablet-screen-inset); }

.device--phone { aspect-ratio: 474 / 970; }
.device--phone .device__screen { inset: 1.96% 4.64%; border-radius: 11% / 5%; }
.device--phone .device__screen::before { height: 7.5%; }
.device--phone .device__frame,
.device--tablet .device__frame { z-index: 3; }

.design-system {
  grid-column: 1 / -1;
  grid-row: 26 / 32;
  height: calc(2 * var(--grid-track) + 2 * var(--grid-gap));
  align-self: center;
  transform: translateY(40px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 1.4fr) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 26px;
  align-items: center;
}
.design-system__palette, .design-system__type { padding: 0; margin: 0; list-style: none; }
.design-system__palette { display: flex; flex-wrap: wrap; justify-content: space-around; gap: 12px 20px; color: #000; font-size: 11px; font-weight: 400; }
.design-system__palette[hidden] { display: none; }
.design-system__palette li { display: flex; align-items: center; gap: 8px; }
.design-system__label { line-height: 1; transform: translateY(2px); }
.design-system__palette--orange, .design-system__palette--blue { grid-column: 1 / -1; }
.design-system__palette--orange { grid-row: 1; }
.design-system__palette--blue { grid-row: 3; }
.design-system__palette--neutral { flex-direction: column; align-items: center; }
.design-system__dot { flex: none; width: 25px; aspect-ratio: 1; border: 1px solid rgb(0 0 0 / 10%); border-radius: 50%; background: var(--swatch); }
.design-system__copy { grid-column: 2; grid-row: 2; text-align: left; }
.design-system__type { grid-row: 2; opacity: .5; justify-self: center; color: #000; font-size: 10px; line-height: 1.4; }
.design-system__type--left { grid-column: 1; }
.design-system__type--right { grid-column: 3; }
.design-system__type li + li { margin-top: 4px; }
.design-system__type strong { margin-left: 8px; font-weight: 600; }
.design-system__type-h0 { font-size: 20px; font-weight: 700; }
.design-system__type-h1 { font-size: 16px; font-weight: 700; }
.design-system__type-h2 { font-size: 13px; font-weight: 700; }
.design-system__type-small { font-size: 9px; }
.design-system__type-label { font-weight: 600; }
.design-system__type-mini { font-size: 8px; }

.copy-block { padding-inline: 20px; }
.grid-intro-placeholder { grid-column: 1 / span 2; grid-row: 7 / span 2; align-self: center; }

@media (prefers-reduced-motion: reduce) {
  .device__screen .device__page-image { transition: none; }
}

.reference-placeholder {
  aspect-ratio: 338 / 140;
  overflow: hidden;
}

.device--laptop.grid-two { grid-column: 1 / span 2; grid-row: 9; }
.grid-phone-top {
  grid-column: 3;
  grid-row: 7 / span 4;
  width: auto;
  height: 100%;
  justify-self: center;
}
.grid-phone-small { grid-column: 3; grid-row: 11 / span 3; width: 78%; justify-self: center; }
.grid-tablet-left { grid-column: 1; grid-row: 13 / span 3; }
.grid-requirements {
  grid-column: 2;
  grid-row: 13 / span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.grid-laptop-right { grid-column: 2 / -1; grid-row: 15 / span 4; }
.grid-placeholder-left { grid-column: 1; grid-row: 19 / span 7; display: flex; flex-direction: column; gap: var(--grid-gap); align-items: center; align-self: start; }
.grid-phone-left { width: 78%; }
.grid-placeholder-copy { width: 100%; }
.grid-tablet-right { grid-column: 2 / -1; grid-row: 19 / span 7; width: 100%; justify-self: center; }
.grid-iterations-copy {
  grid-column: 1 / -1;
  grid-row: 32 / span 2;
  width: min(614px, 100%);
  justify-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.iteration-grid {
  display: contents;
}

.iteration-tile {
  width: 100%;
  align-self: start;
  aspect-ratio: var(--tile-ratio);
  overflow: hidden;
  border: 1px solid #6c6c6c;
  background: #fff;
}

.iteration-tile img { height: auto; object-fit: initial; }

.iteration-tile--01 { grid-area: 35 / 1 / span 4 / span 1; --tile-ratio: 377 / 589; }
.iteration-tile--02 { grid-area: 35 / 2 / span 2 / span 1; --tile-ratio: 377 / 244; }
.iteration-tile--03 { grid-area: 35 / 3 / span 4 / span 1; --tile-ratio: 377 / 589; }
.iteration-tile--04 { grid-area: 37 / 2 / span 2 / span 1; --tile-ratio: 377 / 259; }
.iteration-tile--05 { grid-area: 39 / 1 / span 2 / span 1; --tile-ratio: 377 / 245; }
.iteration-tile--06 { grid-area: 39 / 2 / span 4 / span 1; --tile-ratio: 377 / 589; }
.iteration-tile--07 { grid-area: 39 / 3 / span 2 / span 1; --tile-ratio: 377 / 244; }
.iteration-tile--08 { grid-area: 41 / 1 / span 2 / span 1; --tile-ratio: 377 / 259; }
.iteration-tile--09 { grid-area: 41 / 3 / span 2 / span 1; --tile-ratio: 377 / 259; }
.iteration-tile--10 { grid-area: 43 / 2 / span 2 / span 1; --tile-ratio: 377 / 244; }
.iteration-tile--11 { grid-area: 43 / 1 / span 3 / span 1; --tile-ratio: 377 / 424; }
.iteration-tile--12 { grid-area: 43 / 3 / span 3 / span 1; --tile-ratio: 377 / 616; }
.iteration-tile--13 { grid-area: 45 / 2 / span 3 / span 1; --tile-ratio: 377 / 424; }
.iteration-tile--14 { grid-area: 46 / 1 / span 3 / span 1; --tile-ratio: 377 / 424; }
.iteration-tile--15 { grid-area: 47 / 3 / span 4 / span 1; --tile-ratio: 377 / 589; }
.iteration-tile--16 { grid-area: 48 / 2 / span 2 / span 1; --tile-ratio: 377 / 259; }

@media (max-width: 900px) {
  :root { --grid-gap: 42px; }
  .case-introduction {
    width: 100%;
  }

  .project-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: auto;
    width: 100%;
    padding: 0 var(--case-copy-inset) 44px;
  }

  .project-grid .device--desktop {
    width: 100%;
    margin-inline: 0;
  }

  .grid-full,
  .grid-two,
  .device--laptop.grid-two,
  .grid-phone-top,
  .grid-phone-small,
  .grid-tablet-left,
  .grid-requirements,
  .grid-laptop-right,
  .grid-placeholder-left,
  .grid-placeholder-copy,
  .grid-intro-placeholder,
  .grid-tablet-right,
  .grid-iterations-copy,
  .iteration-grid {
    grid-column: 1;
    width: 100%;
  }

  .iteration-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .project-grid .device--desktop,
  .design-system,
  .device--laptop.grid-two,
  .grid-phone-top,
  .grid-phone-small,
  .grid-tablet-left,
  .grid-requirements,
  .grid-laptop-right,
  .grid-placeholder-left,
  .grid-placeholder-copy,
  .grid-intro-placeholder,
  .grid-tablet-right,
  .grid-iterations-copy { grid-row: auto; }

  .design-system { height: auto; transform: none; grid-template-columns: 1fr; gap: 32px; padding-block: 24px; }
  .design-system__palette--orange, .design-system__palette--blue { grid-column: 1; grid-row: auto; }
  .design-system__palette--neutral { flex-direction: row; justify-content: center; }
  .design-system__copy { grid-column: 1; grid-row: 1; max-width: 420px; justify-self: center; }
  .design-system__type { grid-column: 1; grid-row: auto; }

  .copy-block { padding-inline: 0; }
  .device--phone { width: 52%; justify-self: center; }
  .grid-phone-top { height: auto; }
  .device--tablet { width: 72%; justify-self: center; }
  .iteration-tile { grid-area: auto; }

}

@media (max-width: 560px) {
  .iteration-grid { grid-template-columns: 1fr; }
}
