/* Case pages (/work/<id>/) and the list (/work/). Uses the tokens and parts of style.css:
   nav, buttons, frames, footer, and the per-site colours set on [data-work]. */

.page-case {
  background: var(--clay);
  color: var(--dusk);
}
.page-case [data-theme='light'] :focus-visible,
.page-case [data-theme='light']:focus-visible { outline-color: var(--dusk); }

.case-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.case-title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: var(--serif-weight);
  font-variation-settings: var(--serif-vary);
  font-size: clamp(52px, 9.4vw, 156px);
  line-height: 0.92;
  letter-spacing: -0.02em;
}
.case-title em { font-style: italic; color: #963A1A; }
.case-lede {
  max-width: 36ch;
  margin: 22px 0 0;
  font-size: clamp(19px, 0.9vw + 14px, 25px);
  line-height: 1.4;
}

/* ---------- First screen: the site's own colour ---------- */

.case-hero {
  padding: clamp(104px, 14vh, 150px) var(--pad) clamp(56px, 8vw, 104px);
  background: var(--card);
  color: var(--card-ink);
}
.case-hero .case-kicker { color: var(--card-soft); }
.case-hero .case-kicker span:first-child { color: var(--card-accent); }
.case-hero__grid {
  display: grid;
  gap: 32px;
  margin-top: clamp(36px, 5vw, 72px);
}
.case-hero__shot { width: 100%; }
.case-facts {
  margin: 0 0 28px;
}
.case-facts div {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid color-mix(in srgb, var(--card-ink) 18%, transparent);
}
.case-facts div:last-child { border-bottom: 1px solid color-mix(in srgb, var(--card-ink) 18%, transparent); }
.case-facts dt {
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--card-soft);
}
.case-facts dd {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
}
.case-hero .btn--ink,
.case-next .btn--ink { background: var(--card-ink); color: var(--card); }
.case-hero .btn--ink:hover { background: var(--card-accent); color: var(--card); }
.case-hero :focus-visible { outline-color: var(--card-ink); }

@media (min-width: 1000px) {
  .case-hero__grid {
    grid-template-columns: minmax(0, 2.3fr) minmax(260px, 1fr);
    gap: clamp(32px, 4vw, 72px);
    align-items: end;
  }
}

/* ---------- Story: label left, text right ---------- */

.case-story {
  padding: clamp(72px, 10vw, 150px) var(--pad) clamp(40px, 6vw, 80px);
}
.case-row {
  display: grid;
  gap: 10px;
  padding: 26px 0 30px;
  border-top: 1px solid rgb(42 18 12 / 0.16);
}
.case-row__label,
.case-label {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.case-row p {
  max-width: 62ch;
  margin: 0;
  font-size: clamp(18px, 0.35vw + 16px, 21px);
  line-height: 1.6;
}
@media (min-width: 800px) {
  .case-row {
    grid-template-columns: minmax(180px, 1fr) minmax(0, 2.4fr);
    gap: 24px;
  }
  .case-row__label { padding-top: 6px; }
}

/* ---------- Gallery: screens of different widths, phones on the site's colour ---------- */

.case-gallery {
  padding: clamp(40px, 6vw, 80px) var(--pad) clamp(72px, 10vw, 140px);
}
.case-gallery > .case-label { margin-bottom: 24px; }
.case-desk {
  display: grid;
  gap: clamp(40px, 5vw, 72px);
}
.case-shot { margin: 0; min-width: 0; }
.case-shot figcaption {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}
@media (min-width: 800px) {
  .case-desk {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: clamp(20px, 3vw, 48px);
  }
  .case-shot--1 { grid-column: 1 / -1; }
  .case-shot--2 { grid-column: 1 / 8; }
  .case-shot--3 { grid-column: 8 / -1; margin-top: 14vw; }
  .case-shot--4 { grid-column: 2 / 7; }
  .case-shot--5 { grid-column: 7 / -1; margin-top: -6vw; }
}

.case-phones {
  margin-top: clamp(64px, 8vw, 120px);
  padding: clamp(28px, 5vw, 72px) clamp(16px, 4vw, 72px);
  border-radius: 20px;
  background: var(--card);
  color: var(--card-ink);
}
.case-phones .case-label { color: var(--card-soft); margin-bottom: 24px; }
.case-phones__row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(10px, 4vw, 56px);
  max-width: 880px;
  margin: 0 auto;
}
.case-phones .frame--phone {
  position: relative;
  right: auto;
  bottom: auto;
  width: auto;
}
.case-phones .case-phones__row > :nth-child(2) { translate: 0 8%; }
@media (max-width: 799px) {
  .case-phones .frame--phone { padding: 3px; border-radius: 14px; }
  .case-phones .frame--phone img { border-radius: 11px; }
}

.case-gallery__live {
  margin: clamp(48px, 6vw, 80px) 0 0;
  text-align: center;
}

/* Screens open larger on click */
.case-zoom {
  display: block;
  width: 100%;
  border: 0;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
  text-align: left;
}
.case-zoom img { transition: scale 0.3s var(--ease-out); }
.case-zoom:focus-visible { outline: 2px solid var(--dusk); outline-offset: 4px; }

.lightbox {
  width: min(96vw, 1600px);
  max-width: none;
  max-height: 96vh;
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--glow);
  overflow: visible;
}
.lightbox::backdrop { background: rgb(22 7 5 / 0.88); }
.lightbox__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(96vh - 72px);
  object-fit: contain;
  border-radius: 10px;
}
.lightbox__cap {
  margin: 12px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--glow-soft);
}
.lightbox__bar {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 6px;
}
.lightbox__btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgb(251 237 226 / 0.3);
  border-radius: 999px;
  background: rgb(42 18 12 / 0.7);
  color: var(--glow);
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.lightbox__btn:hover { background: rgb(42 18 12 / 0.95); }
.lightbox[open] { animation: fade 0.25s var(--ease-out); }

/* The hero recording, with a pause button (WCAG: moving content can be stopped) */
.case-hero__shot { position: relative; }
.case-video { display: block; width: 100%; height: auto; }
.case-video__toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid rgb(251 237 226 / 0.35);
  border-radius: 999px;
  background: rgb(22 7 5 / 0.6);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--glow);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.case-video__toggle:focus-visible { outline-color: var(--glow); }

/* ---------- If this were your business ---------- */

.case-real { padding: 0 var(--pad) clamp(72px, 10vw, 140px); }
.case-real__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 64px);
  border: 1px solid rgb(42 18 12 / 0.18);
  border-radius: 20px;
}
.case-real__title {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: var(--serif-weight);
  font-variation-settings: var(--serif-vary);
  font-size: clamp(34px, 4.6vw, 64px);
  line-height: 1;
  letter-spacing: -0.01em;
}
.case-real__title em { color: #963A1A; }
.case-real__lede { margin: 16px 0 0; color: var(--ink-soft); }
.case-real__list {
  margin: 24px 0 32px;
  padding: 0;
  list-style: none;
  counter-reset: real;
}
.case-real__list li {
  counter-increment: real;
  display: grid;
  grid-template-columns: 3em 1fr;
  padding: 14px 0;
  border-top: 1px solid rgb(42 18 12 / 0.14);
  font-size: clamp(17px, 0.3vw + 16px, 20px);
}
.case-real__list li::before {
  content: counter(real, decimal-leading-zero);
  padding-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: #963A1A;
}

/* ---------- Next work: the next site's colour ---------- */

.case-next {
  display: grid;
  gap: 28px;
  padding: clamp(64px, 9vw, 128px) var(--pad);
  background: var(--card);
  color: var(--card-ink);
}
.case-next__link {
  display: block;
  text-decoration: none;
}
.case-next .case-kicker { color: var(--card-soft); }
.case-next .case-kicker span:first-child { color: var(--card-accent); }
.case-next__name {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: var(--serif-weight);
  font-variation-settings: var(--serif-vary);
  font-size: clamp(44px, 8.4vw, 136px);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.case-next__name .arrow {
  display: inline-block;
  margin-left: 0.25em;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.5em;
  vertical-align: 0.25em;
  transition: translate 0.4s var(--ease-out);
}
.case-next__link:hover .case-next__name { color: var(--card-accent); }
.case-next__name { transition: color 0.3s var(--ease-out); }
.case-next__niche {
  display: block;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--card-soft);
}
.case-next__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 28px;
  margin: 0;
}
.case-next__prev {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-size: 16px;
  text-underline-offset: 5px;
}
.case-next__keys {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--card-soft);
}
@media (hover: none) { .case-next__keys { display: none; } }
.case-next__all {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-underline-offset: 6px;
}
.case-next :focus-visible { outline-color: var(--card-ink); }

/* ---------- /work/ list ---------- */

.worklist {
  padding: clamp(116px, 16vh, 170px) var(--pad) clamp(72px, 10vw, 140px);
}
.worklist__head .case-kicker { color: var(--ink-soft); }
.worklist__grid {
  display: grid;
  gap: clamp(20px, 3vw, 40px);
  margin: clamp(48px, 7vw, 96px) 0 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 800px) {
  .worklist__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.wtile { min-width: 0; }
.wtile__link {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: clamp(14px, 2vw, 24px) clamp(14px, 2vw, 24px) clamp(22px, 2.6vw, 32px);
  border-radius: 20px;
  background: var(--card);
  color: var(--card-ink);
  text-decoration: none;
}
.wtile .frame { display: block; margin-bottom: 18px; }
.wtile .frame img { transition: scale 0.3s var(--ease-out); }
.wtile__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--card-soft);
}
.wtile__meta span:first-child { color: var(--card-accent); }
.wtile__name {
  font-family: var(--serif);
  font-style: italic;
  font-weight: var(--serif-weight);
  font-variation-settings: var(--serif-vary);
  font-size: clamp(32px, 3.2vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.wtile__line { color: var(--card-soft); font-size: 16px; }
.wtile__link:focus-visible { outline: 2px solid var(--dusk); outline-offset: 4px; }

/* ---------- 404 ---------- */

.lost {
  min-height: 80svh;
  display: grid;
  align-content: center;
  padding: 140px var(--pad) 96px;
}
.lost__code {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.lost__actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 32px 0 0; }
.page-404 .btn--card-line { border-color: rgb(42 18 12 / 0.4); color: var(--dusk); }

/* ---------- Motion ---------- */

.case-hero__head > *,
.case-hero__shot,
.case-hero__side,
.worklist__head > * {
  animation: fade 0.9s var(--ease-out) both;
}
.case-hero__head > :nth-child(2),
.worklist__head > :nth-child(2) { animation-delay: 0.08s; }
.case-hero__head > :nth-child(3),
.worklist__head > :nth-child(3) { animation-delay: 0.16s; }
.case-hero__shot { animation-delay: 0.24s; }
.case-hero__side { animation-delay: 0.32s; }

.js .reveal {
  opacity: 0;
  translate: 0 16px;
  transition: opacity 0.6s var(--ease-out), translate 0.6s var(--ease-out);
}
.js .reveal.is-in { opacity: 1; translate: 0 0; }

@media (prefers-reduced-motion: reduce) {
  .case-hero__head > *,
  .case-hero__shot,
  .case-hero__side,
  .worklist__head > * { animation: none; }
  .js .reveal { translate: none; transition: opacity 0.4s linear; }
  .lightbox[open] { animation: fadeOnly 0.2s linear; }
  .wtile .frame img, .case-next__name .arrow { transition: none; }
}

/* Hover motion only where there is a real mouse */
@media (hover: hover) and (pointer: fine) {
  .case-zoom:hover img { scale: 1.015; }
  .case-next__link:hover .case-next__name .arrow { translate: 0.2em 0; }
  .wtile__link:hover .frame img { scale: 1.03; }
}

@keyframes fadeOnly { from { opacity: 0; } to { opacity: 1; } }
