.design-system-page { --case-surface: rgb(249 249 249 / 90%); }

.design-system-page .case-study {
  overflow-x: hidden;
  overflow-y: clip;
}

.case-introduction {
  width: min(1272px, calc(100% - 120px));
  margin-inline: auto;
}

.case-section {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.case-section--catalogue {
  width: min(1272px, calc(100% - 120px));
  margin: 79px auto 131px;
  overflow: visible;
}

.case-section--inspiration {
  display: grid;
  grid-template-columns: 135fr 517fr 620fr;
  align-items: start;
  aspect-ratio: 1272 / 787;
  padding-top: 10.85%;
}

.case-section--inspiration[hidden] {
  display: none;
}

.case-section--inspiration .case-copy {
  position: relative;
  z-index: 3;
  grid-column: 2;
  width: 100%;
  isolation: isolate;
}

.case-section--technology {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  aspect-ratio: 1392 / 1450;
  padding: 8.5% 0 12% 15.45%;
}

.case-section--components {
  aspect-ratio: 1392 / 2073;
}

.case-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  pointer-events: none;
}

.case-art svg {
  display: block;
  width: 100%;
  height: 100%;
}

.case-copy {
  position: absolute;
  z-index: 1;
  width: 38%;
}

.case-section--technology .case-copy {
  position: relative;
  width: 41.4%;
}

.technology-code-art {
  position: relative;
  z-index: 1;
  width: 41.4%;
  flex: 1 1 0;
  min-height: 0;
  margin: 24px 0 0;
}

.technology-figma-art {
  --technology-screen-center: 50%;
  position: absolute;
  z-index: 0;
  top: 12.8%;
  left: 65%;
  width: min(40.4%, 523px);
  aspect-ratio: 523 / 1008;
  margin: 0;
  container-type: size;
}

/* The full laptop extends beyond the right edge of the section. */
.technology-figma-art::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -4%;
  left: -28.3%;
  width: 350%;
  aspect-ratio: 828 / 511;
  background: url("../trendradar/assets/trendradar-laptop-frame.svg") no-repeat center / 100% 100%;
  pointer-events: none;
}

.technology-figma-art__image {
  position: absolute;
  top: var(--technology-screen-center);
  left: 0;
  display: block;
  width: 342%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 3cqw;
  transform: translateY(calc(-50% - 6px));
}

.technology-code-window {
  display: flex;
  flex-direction: column;
  height: 70%;
  overflow: hidden;
  border: 1px solid rgb(65 85 129 / 18%);
  background: #fff;
  box-shadow: 0 12px 28px rgb(34 42 58 / 8%);
}

.technology-code-window__bar {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 23px;
  padding: 0 9px;
  border-bottom: 1px solid #eceef2;
  background: #f7f8fa;
  flex: 0 0 23px;
}

.technology-code-window__bar > span:not(.technology-code-window__filename) {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c5cad3;
}

.technology-code-window__filename {
  margin-left: 4px;
  color: #798092;
  font: 500 8px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.technology-code-window__viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.technology-code {
  display: block;
  width: max-content;
  min-height: 100%;
  margin: 0;
  padding: 11px 12px 24px;
  color: #24292f;
  font: 500 clamp(6px, 0.61vw, 9px) / 1.64 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  letter-spacing: -0.035em;
  white-space: pre;
  transform: translateY(0);
  will-change: transform;
}

.technology-code__line {
  display: block;
  min-height: 1.64em;
}

.case-section--catalogue .case-art {
  --catalogue-columns: 8;
  --catalogue-copy-columns: 4;
  position: relative;
  inset: auto;
  width: 120%;
  height: auto;
  margin-left: -10%;
  display: grid;
  grid-template-columns: repeat(var(--catalogue-columns), minmax(0, 1fr));
  grid-auto-flow: dense;
  align-items: center;
  gap: clamp(12px, 1.25vw, 20px);
}

.catalogue-card {
  position: relative;
  left: auto;
  top: auto;
  display: block;
  justify-self: center;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
  overflow: hidden;
  border: 1px solid #eeedeb;
  border-radius: 6px;
  box-shadow: 2px 2px 21.6px rgb(0 0 0 / 15%);
  object-fit: cover;
  pointer-events: auto;
  transition:
    opacity 300ms ease,
    box-shadow 300ms ease;
}

.catalogue-card[hidden],
.catalogue-card.is-grid-overflow {
  display: none;
}

.catalogue-card[data-card^="buttons"] {
  aspect-ratio: 166 / 150;
  object-position: bottom;
}

.catalogue-card.is-category-active {
  z-index: 2;
  box-shadow: 3px 5px 28px rgb(0 0 0 / 22%);
}

.has-active-category .catalogue-card:not(.is-category-active) {
  opacity: 0.1;
}

.figma-comment {
  --comment-background: #fff;
  --comment-ink: #000;
  --comment-meta: #7b7b7b;
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 240px;
  padding: 13px;
  border-radius: 16px 16px 16px 0;
  color: var(--comment-ink);
  background: var(--comment-background);
  box-shadow: 0 1px 2px rgb(0 0 0 / 25%);
  font-family: Inter, Arial, sans-serif;
  font-size: 11px;
  line-height: normal;
  opacity: 0;
  pointer-events: none;
  transform: translate(0, -100%) scale(0.96);
  transform-origin: bottom left;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.figma-comment.is-visible {
  opacity: 1;
  transform: translate(0, -100%) scale(1);
}

.figma-comment--unread {
  --comment-background: #009cff;
  --comment-ink: #fff;
  --comment-meta: #d1ecff;
}

.figma-comment__avatar {
  display: flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #fff;
  background: #ff3000;
  font-size: 13.6px;
  font-weight: 300;
  text-align: center;
}

.figma-comment__content {
  display: flex;
  flex: 0 0 181px;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.figma-comment__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.figma-comment__meta strong {
  font-weight: 500;
}

.figma-comment__meta > span {
  color: var(--comment-meta);
  font-weight: 400;
}

.figma-comment__message {
  width: 100%;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.notion-comment {
  position: absolute;
  z-index: 3;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: min(308px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid #e8e7e4;
  border-radius: 12px;
  color: #37352f;
  background: #fff;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  translate: 0 -100%;
  transform: scale(0.98);
  transform-origin: bottom left;
  transition: opacity 120ms ease, transform 120ms ease;
}

.notion-comment.is-visible {
  opacity: 1;
  transform: scale(1);
}

.notion-comment.is-flipped {
  translate: -100% -100%;
  transform-origin: bottom right;
}

.notion-comment__avatar {
  display: flex;
  flex: 0 0 24px;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 1px solid #e8e7e4;
  border-radius: 50%;
  color: #777;
  font-size: 11px;
}

.notion-comment__content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.notion-comment__meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}

.notion-comment__meta strong {
  font-size: 14px;
  font-weight: 600;
}

.notion-comment__meta > span {
  color: #99958e;
  font-size: 12px;
}

.notion-comment__message {
  width: 100%;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.case-section--catalogue .case-copy {
  position: relative;
  grid-column: calc(1 + (var(--catalogue-columns) - var(--catalogue-copy-columns)) / 2)
    / span var(--catalogue-copy-columns);
  grid-row: 3 / span 2;
  pointer-events: auto;
  width: auto;
  padding: 16px clamp(16px, 2vw, 32px);
}

.case-section--inspiration .case-copy::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  filter: blur(clamp(16px, 1.9vw, 25px));
  pointer-events: none;
  background: #f9f9f9;
  box-shadow: 0 0 0 clamp(44px, 7vw, 91px) #f9f9f9;
  border-radius: 37% 63% 48% 52% / 58% 39% 61% 42%;
}

.case-section--catalogue h2,
.case-section--inspiration h2,
.case-section--components .case-copy h2 {
  margin-bottom: 25px;
}

.case-section--catalogue p,
.case-section--inspiration p,
.case-section--components .case-copy p {
  margin-bottom: 15px;
}

.case-section--components .case-copy {
  top: 11.29%;
  left: 8.76%;
  width: 35.85%;
}

.components-art {
  overflow: hidden;
  background: transparent;
}

.components-asset {
  position: absolute;
  display: block;
  width: var(--asset-width);
  height: auto;
  max-width: none;
}

.components-asset--button-variants { top: 0; left: 74.21%; --asset-width: 25.79%; }
.components-asset--segmented-variants { top: 28.32%; left: 0; --asset-width: 19.90%; }
.components-asset--search-variants { top: 81.04%; left: 26.58%; --asset-width: 33.98%; }
.components-asset--text-input-variants { top: 62.42%; left: 26.72%; --asset-width: 16.95%; }
.components-asset--button-states { top: 41.20%; left: 49.07%; --asset-width: 38.51%; }
.components-asset--multiline-variants { top: 78.24%; left: 72.63%; --asset-width: 27.37%; }
.components-asset--filter-variants { top: 55.09%; left: 72.05%; --asset-width: 8.19%; }
.components-asset--tooltip-variants { top: 72.79%; left: 21.05%; --asset-width: 9.41%; }
.components-asset--slider-variants { top: 69.37%; left: 72.05%; --asset-width: 9.63%; }
.components-asset--badge-variants { top: 72.79%; left: 35.70%; --asset-width: 5.89%; }
.components-asset--button-dialogue { top: 8.83%; left: 49.07%; --asset-width: 16.16%; }
.components-asset--segmented-dialogue { top: 28.56%; left: 26.72%; --asset-width: 16.16%; }
.components-asset--search-dialogue { top: 55.81%; left: 49.07%; --asset-width: 16.16%; }
.components-asset--multiline-dialogue { top: 73.66%; left: 0; --asset-width: 15.23%; }
.components-asset--filter-dialogue { top: 54.22%; left: 88.58%; --asset-width: 11.49%; }

h2 {
  margin-bottom: 1.45em;
}

p {
  margin-bottom: 1.7em;
}

@media (max-width: 1240px) {
  .case-section--components {
    display: grid;
    row-gap: clamp(36px, 5vw, 64px);
    aspect-ratio: auto;
  }

  .case-section--components .case-copy {
    position: relative;
    inset: auto;
    grid-row: 1;
    width: min(580px, 82.48%);
    margin-inline: 8.76%;
  }

  .case-section--components .case-art {
    position: relative;
    grid-row: 2;
    aspect-ratio: 1392 / 2073;
  }
}

@media (max-width: 1100px) {
  .case-section--catalogue .case-art {
    --catalogue-columns: 6;
  }
}

@media (max-width: 1040px) {
  .design-system-page .case-introduction {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "metadata" "intro";
  }

  .case-introduction__copy {
    margin-block-start: var(--case-introduction-space);
  }

  .case-introduction__copy > p:first-child {
    margin-top: 0;
  }
}

@media (max-width: 780px) {
  .case-introduction {
    width: 100%;
  }

  .case-section {
    display: flex;
    flex-direction: column;
    gap: 32px;
    aspect-ratio: auto;
    padding: 0 0 76px;
    overflow: hidden;
  }

  .case-copy {
    position: static;
    order: 1;
    width: auto !important;
    margin-inline: var(--case-copy-inset);
  }

  .case-art {
    position: static;
    order: 2;
    width: 165%;
    margin-left: -31%;
  }

  .case-section--catalogue .case-art {
    position: relative;
    inset: auto;
    order: 2;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    margin: 0;
    gap: 5px;
  }

  .case-section--catalogue {
    width: 100%;
    margin: 0;
    padding-bottom: 76px;
    overflow: visible;
    aspect-ratio: auto;
  }

  .case-section--catalogue .case-copy {
    grid-column: 1 / -1;
    grid-row: 1;
    padding: 0;
    margin: 0 var(--case-copy-inset) 20px;
  }

  .case-section--catalogue .catalogue-card {
    width: 100%;
    margin-top: 0;
  }

  .notion-comment {
    width: min(188px, calc((100vw - 24px) / 2));
  }

  .case-section--inspiration .case-copy {
    position: relative;
  }

  .case-section--technology {
    --technology-code-split: 68%;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    row-gap: clamp(40px, 7vw, 64px);
    padding: 0 0 clamp(88px, 14vw, 120px);
    overflow: clip;
  }

  .case-section--technology .case-copy {
    grid-area: 1 / 1;
  }

  .case-section--technology .technology-code-art,
  .case-section--technology .technology-figma-art {
    grid-area: 2 / 1;
    position: relative;
    top: auto;
  }

  .case-section--technology .technology-code-art {
    display: grid;
    align-items: center;
    align-self: center;
    width: calc(var(--technology-code-split) - 22px);
    height: clamp(330px, 130vw, 640px);
    margin: 0 0 0 16px;
  }

  .case-section--technology .technology-code-window {
    box-shadow: 0 8px 24px rgb(34 42 58 / 24%), 0 2px 6px rgb(34 42 58 / 14%);
  }

  .case-section--technology .technology-code {
    font-size: clamp(7px, 2vw, 9px);
    padding-inline: 8px;
  }

  .case-section--technology .technology-figma-art {
    /* The figure reserves the full frame height at 350% of its width. */
    --technology-screen-center: 48.2%;
    left: var(--technology-code-split);
    width: clamp(250px, 86vw, 465px);
    aspect-ratio: 828 / 1788.5;
    /* The variables table starts 11.5% into the image, which is 342% of this figure. */
    transform: translateX(-39.33%);
  }

  .case-section--technology .technology-figma-art::before {
    top: 0;
  }

  .case-section--components .case-copy {
    margin-inline: var(--case-copy-inset);
  }

  .case-section--components .case-art {
    width: 142%;
    margin-left: -16%;
  }

  h2 {
    margin-bottom: 1.15em;
  }
}


/* References fly into one shared button target. */
.case-section--inspiration .inspiration-board {
  position: relative;
  z-index: 2;
  grid-column: 3;
  grid-row: 1;
  align-self: start;
  min-width: 0;
  margin: 50px 5% 0 9%;
}
.inspiration-deck { display: grid; isolation: isolate; perspective: 1200px; position: relative; }
.inspiration-reference {
  grid-area: 1 / 1;
  min-width: 0;
  opacity: 0;
  transform: translate(0, 0) scale(.08);
  transition: transform 1260ms cubic-bezier(.18, .72, .22, 1), opacity 1080ms ease;
  pointer-events: none;
  border: 1px solid #dce0e6;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  box-shadow: 0 18px 45px -20px #25334a55;
}
.inspiration-reference img { display: block; width: 100%; height: auto; aspect-ratio: 1455 / 1000; object-fit: contain; }
.inspiration-reference.is-source { z-index: 2; transition: none; animation: inspiration-journey 1400ms both; }
@keyframes inspiration-journey {
  0% { opacity: 0; transform: translate(var(--entry-x), var(--entry-y)) scale(.42); animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  17.75% { opacity: .96; transform: translate(var(--entry-x), var(--entry-y)) scale(.65); }
  25.7%, 71.43% { opacity: .96; transform: translate(var(--entry-x), var(--entry-y)) scale(.62); }
  71.43% { animation-timing-function: cubic-bezier(.55, 0, 1, 1); }
  90.36% { opacity: .96; }
  100% { opacity: 0; transform: translate(0, 0) scale(.06); }
}
@font-face {
  font-family: "Portfolio Roboto Condensed";
  src: url("../../assets/fonts/roboto-condensed-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
.inspiration-target {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 9px;
  background: #1a4096;
  color: #fff;
  font: 700 14px/20px "Portfolio Roboto Condensed", sans-serif;
  white-space: nowrap;
  cursor: default;
}
.inspiration-target-icon { display: block; flex: none; }
.inspiration-target-badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 3px; border-radius: 5px; background: #dce2f0; color: #1a4096; font-size: 12px; font-weight: 400; line-height: 13px; }
.inspiration-target-badge[hidden] { display: none; }
.inspiration-target-count { display: block; transform: translateY(.5px); }
.inspiration-target.is-puckering { animation: inspiration-pucker 620ms cubic-bezier(.2, .75, .25, 1); }
.inspiration-reference.is-static { opacity: 1; transform: none; }
@keyframes inspiration-pucker {
  0% { border-radius: 9px; transform: translate(-50%, -50%) scale(1); }
  28% { border-radius: 15px 15px 8px 8px; transform: translate(-50%, -50%) scale(1.15, .76); }
  58% { border-radius: 10px; transform: translate(-50%, -50%) scale(.93, 1.08); }
  100% { border-radius: 9px; transform: translate(-50%, -50%) scale(1); }
}
@media (max-width: 780px) {
  .case-section--inspiration .inspiration-board { order: 2; width: 88%; margin: 50px auto 65px; }
}
@media (prefers-reduced-motion: reduce) {
  .inspiration-reference { transition: none; }
  .inspiration-reference.is-source { transform: none; opacity: 0; animation: none; }
  .inspiration-target.is-puckering { animation: none; }
}

.technology-figma-hotspots {
  position: absolute;
  top: var(--technology-screen-center); left: 0; width: 342%; aspect-ratio: 16 / 9;
  transform: translateY(calc(-50% - 6px));
}
.technology-figma-hotspot {
  position: absolute; left: 11.5%; width: 17%; padding: 0;
  border: 0; background: transparent; cursor: pointer;
}
.technology-figma-hotspot.is-highlighted, .technology-figma-hotspot:focus-visible {
  background: rgb(70 130 230 / 20%); outline: 1px solid #4682e6;
}
.technology-code__line.is-highlighted { background: #d8e7ff; color: #172f64; }

.case-section--modernise {
  display: grid;
  align-content: start;
  row-gap: clamp(44px, 5vw, 72px);
  aspect-ratio: 1331 / 1490;
  padding-top: 6.38%;
}

.case-section--modernise .case-copy {
  position: relative;
  grid-row: 1;
  width: 50%;
  margin-left: 31.4%;
}

.modernise-art {
  --selection-color: #9747ff;
  position: relative;
  display: grid;
  grid-row: 2;
  grid-template-columns: 50% 46%;
  justify-content: center;
  align-items: center;
  gap: 4%;
  margin-inline: 7.2%;
}

@media (max-width: 780px) {
  .case-section--modernise {
    aspect-ratio: auto;
    padding-top: 0;
  }

  .case-section--modernise .case-copy {
    margin-inline: var(--case-copy-inset);
  }
}

.modernise-before,
.modernise-frame img {
  display: block;
  width: 100%;
}

.modernise-frame {
  position: relative;
  padding: 1.75%;
  border-radius: 5px;
  background:
    linear-gradient(to right, var(--selection-color) 65%, transparent 0) top / 15px 2px repeat-x,
    linear-gradient(to right, var(--selection-color) 65%, transparent 0) bottom / 15px 2px repeat-x,
    linear-gradient(to bottom, var(--selection-color) 65%, transparent 0) left / 2px 15px repeat-y,
    linear-gradient(to bottom, var(--selection-color) 65%, transparent 0) right / 2px 15px repeat-y;
}

.modernise-label { position: absolute; bottom: 100%; left: 0; color: var(--selection-color); font: 500 clamp(9px, .9vw, 12px) Inter, sans-serif; white-space: nowrap; display: flex; align-items: center; gap: 5px; padding-bottom: 5px; }
.modernise-label::before { content: ""; width: 10px; height: 10px; flex: none; transform: rotate(45deg); background: linear-gradient(to right, transparent 45%, white 45%, white 55%, transparent 55%), linear-gradient(to bottom, var(--selection-color) 45%, white 45%, white 55%, var(--selection-color) 55%); }

.modernise-comment {
  opacity: 1;
  transform: translate(-50%, -50%);
}

.modernise-comment--before { left: 25%; top: 25%; }
.modernise-comment--before .figma-comment__avatar { background: #09f; }
.modernise-comment--after { left: 77%; top: 0; }

@media (max-width: 700px) {
  .modernise-art { gap: 3%; }
  .modernise-comment {
    transform: translate(-50%, -50%) scale(.6);
    transform-origin: center;
  }
}
