/* Project case study pages.
   Structure mirrors the live Adobe Portfolio pages: a centred stack of text blocks,
   single images and image rows, each with its own width (--mw, % of a 1000px canvas).
   Images never exceed 800px; text keeps a readable measure. */

.project {
  --canvas: 1000px;
  --img-max: 800px;
  --text-max: 600px;
  padding: calc(var(--nav-h) + 96px) var(--gutter) 0;
}

/* ---------- Intro ---------- */
.p-head {
  max-width: var(--text-max);
  margin: 0 auto 72px;
}
.p-title {
  font-size: clamp(32px, 4.2vw, 52px);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: var(--tracking);
  margin-bottom: 20px;
}
.p-lede {
  font-size: 19px;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

/* ---------- Module stack ---------- */
.p-modules { display: grid; gap: 64px; }

.m {
  width: min(100%, calc(var(--canvas) * var(--mw, 100) / 100), var(--img-max));
  margin: 0 auto;
}
.m-text { width: min(100%, var(--text-max)); }

/* Images */
.p-fig {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--chip);
}
.m-img .p-fig {
  /* never wider than the image itself, so small exports aren't upscaled into blur */
  max-width: var(--w, 100%);
  margin: 0 auto;
}
.p-fig img { width: 100%; height: auto; }

/* Image rows: flex-grow is set per image from its aspect ratio → equal heights */
.m-grid { display: grid; gap: var(--gap); }
.m-row { display: flex; gap: var(--gap); align-items: flex-start; }
.m-row .p-fig { flex-basis: 0; min-width: 0; }

/* Text */
.m-text > * {
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}
.m-text p + p,
.m-text ul + p,
.m-text p + ul { margin-top: 1em; }
.m-text h2 {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: var(--tracking-small);
  color: var(--muted);
  margin: 2em 0 .6em;
}
.m-text > h2:first-child { margin-top: 0; }
.m-text ul { list-style: none; }
.m-text li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.m-text li:last-child { border-bottom: 1px solid var(--line); }
.m-text .link { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.m-text .link:hover { text-decoration-color: currentColor; }
.m-text .p-credit {
  font-size: 13px;
  letter-spacing: var(--tracking-small);
  color: var(--muted);
}

/* ---------- Next project ---------- */
.p-next {
  max-width: var(--img-max);
  margin: 120px auto 0;
  padding: 40px 0 96px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
}
.p-next-label {
  font-size: 13px;
  letter-spacing: var(--tracking-small);
  color: var(--muted);
}
.p-next-link {
  font-size: clamp(28px, 3.4vw, 44px);
  font-weight: 500;
  line-height: 1.05;
  width: fit-content;
  transition: color .2s ease;
}
.p-next-link span { display: inline-block; transition: transform .3s ease; }
.p-next-link:hover { color: var(--gold); }
.p-next-link:hover span { transform: translateX(6px); }

@media (max-width: 760px) {
  .project { padding-top: calc(var(--nav-h) + 56px); }
  .p-head { margin-bottom: 48px; }
  .p-modules { gap: 40px; }
  .m { width: 100%; }
  .m-img[style*="--mw:3"] { width: 70%; } /* the small 30% images stay small */
  .p-lede { font-size: 17px; }
  .m-row { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .p-next-link span { transition: none; }
}
