/* Projects listing (projects/index.html) and case-study pages (projects/*.html).
   Tiles mirror the homepage grid; case pages keep the layout of the old project modal. */

.work,
.case {
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.14);
  --muted: rgba(255,255,255,.5);
}

/* ── Buttons (v9 design: outlined pill on dark, fills white on hover) ── */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: fit-content;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: background .28s ease, border-color .28s ease, color .28s ease, transform .36s cubic-bezier(.16,1,.3,1);
}

.pill-btn:hover,
.pill-btn:focus-visible {
  background: #fff;
  border-color: #fff;
  color: #000;
  transform: translateY(-1px);
}

.pill-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pill-btn--small {
  min-height: 38px;
  gap: 10px;
  padding: 0 14px;
}

/* Project switcher pills (v9 modal footer) */
.project-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}

.project-pill {
  padding: 11px 16px;
  border-radius: 999px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.56);
  text-decoration: none;
  font: 600 12px/1 'Inter', sans-serif;
  letter-spacing: -.01em;
  white-space: nowrap;
  transition: background .28s ease, color .28s ease;
}

.project-pill:hover { background: rgba(255,255,255,.1); color: #fff; }
.project-pill[aria-current="page"] { background: #fff; color: #000; }

.pill-btn:focus-visible,
.project-pill:focus-visible,
.case-yt:focus-visible,
.project-tile:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* ══════════════ LISTING ══════════════ */
.work-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: end;
  padding: 72px 16px 40px;
}

.work-heading {
  font-size: clamp(56px, 9vw, 148px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.035em;
}

.work-lede {
  max-width: 520px;
  font-size: clamp(18px, 1.68vw, 27px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -.028em;
  color: var(--muted);
}

/* 2×2 grid, same as the homepage */
.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.project-tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0b0b0b;
  color: inherit;
  text-decoration: none;
  isolation: isolate;
}

.project-tile video,
.project-tile > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #0b0b0b;
  transition: transform .82s cubic-bezier(.16,1,.3,1);
}

/* Transparent until the clip plays, so the cover image underneath shows */
.project-tile video { background: transparent; }

.project-tile:hover video,
.project-tile:hover > img { transform: scale(1.04); }

.project-tile-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 16px;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 100%);
}

.project-tile-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.project-tile-name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
}

.project-tile-type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.5);
}

/* Tiles without footage yet: upcoming projects and pages still waiting for visuals */
.project-tile--soon,
.project-tile--placeholder {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.07), transparent 55%), #0b0b0b;
}

.project-tile-soon {
  font-size: clamp(22px, 2.6vw, 40px);
  font-weight: 500;
  letter-spacing: -.03em;
  color: rgba(255,255,255,.34);
}

.project-tile--placeholder .project-tile-soon { color: rgba(255,255,255,.72); }

/* Covered name (unregistered trademark): a solid bar in the text colour */
.redacted {
  display: inline-block;
  width: 4.2em;
  height: .74em;
  border-radius: .06em;
  background: currentColor;
  vertical-align: -.02em;
}

/* ══════════════ CASE STUDY ══════════════ */
.case-head {
  --title-size: clamp(40px, 6vw, 104px);
  display: grid;
  grid-template-columns: 1fr 3fr;
  gap: 24px;
  padding: 72px 16px 40px;
}

.case-head-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  /* Centre the 38px "All projects" pill on the title's first line (cap centre sits at .49em) */
  padding-top: max(0px, calc(var(--title-size) * .49 - 19px));
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--muted);
}

.case-head-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.case-title {
  font-size: var(--title-size);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.035em;
}

.case-subtitle {
  max-width: 760px;
  font-size: clamp(18px, 1.68vw, 27px);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -.028em;
  color: rgba(255,255,255,.72);
}

/* Media column + info column, sized like the old modal (max 1320px) */
.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, .95fr);
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #050505;
}

.case-media {
  min-width: 0;
  padding: 20px;
  border-right: 1px solid var(--line);
}

.case-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0b0b0b;
}

.case-frame + .case-frame { margin-top: 14px; }

.case-frame img,
.case-frame video,
.case-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
  background: #000;
}

.case-frame .is-contain { object-fit: contain; }

.case-yt {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: #000;
  appearance: none;
  cursor: pointer;
}

.case-yt img { transition: transform .6s cubic-bezier(.16,1,.3,1), opacity .3s ease; }
.case-yt:hover img { transform: scale(1.02); opacity: .85; }

.case-yt-play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  transform: translate(-50%, -50%);
  transition: transform .36s cubic-bezier(.16,1,.3,1);
}

.case-yt-play svg {
  width: 22px;
  height: 22px;
  margin-left: 3px;
}

.case-yt:hover .case-yt-play { transform: translate(-50%, -50%) scale(1.08); }

.case-info {
  min-width: 0;
  padding: 28px 24px 24px;
}

.case-info-inner {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.case-label {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.4);
}

.case-desc {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 13px;
  line-height: 1.7;
  letter-spacing: -.01em;
  color: #fff;
}

.case-inline-link {
  color: #fff;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  transition: opacity .28s ease;
}

.case-inline-link:hover { opacity: .7; }

.case-meta { border-top: 1px solid var(--line); }

.case-meta > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.case-meta dt {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.4);
}

.case-meta dd {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -.01em;
  color: #fff;
}

.case-frame--soon {
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 70% 20%, rgba(255,255,255,.06), transparent 55%), #0b0b0b;
}

.case-frame--soon span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.44);
}

/* Data panels in the media column (stats, bar charts, step diagrams) */
.case-panel {
  padding: 22px 22px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #0b0b0b;
}

.case-media > * + * { margin-top: 14px; }

.case-gallery-heading {
  padding: 26px 2px 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.4);
}

.case-panel-title {
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.4);
}

.case-panel-note {
  margin-top: 16px;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.4);
}

.case-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px 16px;
}

.case-stats strong {
  display: block;
  font-size: clamp(28px, 2.6vw, 40px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -.03em;
  color: #fff;
}

.case-stats span {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.5);
}

.case-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 28px;
}

.case-bar-group h3 {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
}

.case-bar {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.5);
}

.case-bar-model {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-bar-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}

.case-bar-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: rgba(255,255,255,.3);
}

.case-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.case-bar.is-highlight { color: #fff; }
.case-bar.is-highlight .case-bar-fill { background: #fff; }

.case-flow {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 10px;
  list-style: none;
  counter-reset: step;
}

.case-flow li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  counter-increment: step;
}

.case-flow li::before {
  content: counter(step, decimal-leading-zero);
  font-size: 11px;
  font-weight: 600;
  color: rgba(255,255,255,.35);
}

.case-flow li + li::after {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: rgba(255,255,255,.3);
}

.case-flow strong {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #fff;
}

.case-flow span {
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: -.01em;
  color: rgba(255,255,255,.55);
}

.case-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.case-link-note {
  font-size: 12px;
  color: rgba(255,255,255,.4);
}

/* Previous · project pills · Next */
/* With more than six projects the pills become one counter button */
.pill-count {
  color: rgba(255,255,255,.5);
  font-variant-numeric: tabular-nums;
  transition: color .28s ease;
}

.pill-btn--counter:hover .pill-count,
.pill-btn--counter:focus-visible .pill-count { color: rgba(0,0,0,.5); }

.case-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.case-pager .pill-btn:last-child { justify-self: end; }

@media (max-width: 900px) {
  .work-head,
  .case-head {
    grid-template-columns: 1fr;
    padding: 64px 16px 28px;
    gap: 16px;
  }

  .tiles { grid-template-columns: 1fr; }

  .case-head-meta {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding-top: 0;
  }

  .case-layout {
    grid-template-columns: 1fr;
    border-radius: 18px;
  }

  .case-media {
    padding: 12px;
    border-right: none;
  }

  .case-frame { border-radius: 12px; }
  .case-frame + .case-frame { margin-top: 12px; }

  .case-info { padding: 8px 16px 20px; }
  .case-info-inner { position: static; }

  .case-meta > div {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 10px 0;
  }

  .case-yt-play {
    width: 56px;
    height: 56px;
  }

  .case-panel { padding: 18px 16px 16px; border-radius: 12px; }
  .case-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case-bars { grid-template-columns: 1fr; }
  .case-flow { grid-auto-flow: row; }
  .case-flow li + li::after { display: none; }

  .case-pager {
    grid-template-columns: 1fr 1fr;
    padding: 28px 0;
  }

  .case-pager .pill-btn--counter {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: center;
  }

  .case-pager .project-pills {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .case-pager .project-pills::-webkit-scrollbar { display: none; }
}
