/* =========================================================
   CASE STUDY — project detail pages
   Speaks the same language as projects.html: warm off-white canvas,
   Antonio caps for display, logo teal for labels and state, work in
   soft-cornered frames. Every class here is new (cs-*), so none of the
   older .pd-* rules in style.css reach this page.
   ========================================================= */

.cs {
  --bg: #f3f3f1;
  --bg-2: #e8e8e3;

  --ink: #131315;
  --ink-2: #55555a;
  --ink-3: #6b6b71;
  --line: #dcdcd6;
  --line-strong: #bdbdb6;

  --brand: #115a63;
  --on-brand: #ffffff;
  --brand-text: #115a63;

  --r-card: 22px;
  --r-img: 16px;

  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --display: 'Antonio', 'Inter', sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --section: 128px;

  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 30px 150px;
  color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "cv11", "ss01";
}

body.dark-mode .cs {
  --bg: #1d1d1e;
  --bg-2: #232326;

  --ink: #ffffff;
  --ink-2: #a9a9ae;
  --ink-3: #86868e;
  --line: #313134;
  --line-strong: #55555a;

  /* #115a63 on near-black is 2.1:1 — labels take a lighter tint of it. */
  --brand-text: #5fc2ce;
}

.cs ::selection {
  background: var(--brand);
  color: var(--on-brand);
}

/* Zero-specificity reset, so .cs-cover / .cs-shot spacing still applies */
:where(.cs) figure {
  margin: 0;
}

.cs .ico {
  flex: 0 0 auto;
  stroke-width: 1.9;
  transition: transform 0.3s var(--ease);
}

/* ---------- Canvas ---------- */
body.case-page {
  background: #f3f3f1;
}

body.case-page footer {
  border-top: 1px solid #dcdcd6;
  background: #f3f3f1;
  color: #6b6b71;
}

body.case-page.dark-mode {
  background: #1d1d1e;
  color: #fff;
}

body.case-page.dark-mode::before {
  opacity: 0.035;
}

body.case-page.dark-mode footer {
  border-top-color: #313134;
  background: #1d1d1e;
  color: #86868e;
}

/* =========================================================
   1. TITLE BLOCK
   ========================================================= */
.cs-hero {
  padding: 30px 0 72px;
}

.cs-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.cs-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: -0.006em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.cs-back:hover {
  color: var(--brand-text);
}

.cs-back:hover .ico {
  transform: translateX(-3px);
}

.cs-kicker {
  color: var(--ink-3);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Class-qualified so it out-ranks `body.dark-mode h1..h4` in style.css */
.cs .cs-title {
  margin: 26px 0 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(3.2rem, 11.5vw, 8.5rem);
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 0.84;
  text-transform: uppercase;
}

/* Lead + tags on the left, spec sheet on the right, on one ruled row —
   so the right half of the header carries weight instead of sitting
   empty, and all four facts stay in one column (no orphaned "Live"). */
.cs-hero-foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 380px);
  align-items: start;
  gap: 40px 72px;
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.cs-lead {
  max-width: 48ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 1.1rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.cs-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
}

.cs-tags li {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 0.73rem;
  font-weight: 450;
  letter-spacing: -0.003em;
}

.cs-facts {
  margin: 0;
}

.cs-facts > div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

/* First fact lines up with the first line of the lead */
.cs-facts > div:first-child {
  padding-top: 0;
}

.cs-facts dt {
  color: var(--ink-3);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cs-facts dd {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: -0.008em;
}

.cs-facts a,
.cs-block a {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.cs-facts a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.cs-facts a:hover,
.cs-block a:hover {
  color: var(--brand-text);
  text-decoration-color: var(--brand-text);
}

.cs-facts a:hover .ico {
  transform: translate(2px, -2px);
}

/* =========================================================
   2. FRAMES — cover and gallery share one treatment
   ========================================================= */
.cs-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-img);
  background: var(--bg-2);
  font-size: 0;
}

.cs-frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* A hairline drawn over the image, not under it — the near-white pieces
   (brand board, logo sheet) otherwise have no edge on the light canvas. */
.cs-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07);
  pointer-events: none;
}

body.dark-mode .cs-frame::after {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.cs figcaption {
  max-width: 64ch;
  margin-top: 16px;
  color: var(--ink-3);
  font-size: 0.82rem;
  line-height: 1.6;
  letter-spacing: -0.004em;
  text-wrap: pretty;
}

/* Gallery captions carry a plate number and a label, so a caption reads
   as a credit for the piece rather than a loose grey sentence. The number
   comes from the counter on .cs-work, so the order can change freely. */
.cs-work figcaption {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  row-gap: 5px;
  max-width: 56ch;
}

.cs-work figcaption::before {
  content: counter(cs-shot, decimal-leading-zero);
  grid-column: 1;
  grid-row: 1 / span 2;
  padding-top: 1px;
  color: var(--brand-text);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* The cover caption carries no plate number, so it stacks on its own */
.cs-cover figcaption {
  display: grid;
  row-gap: 5px;
  max-width: 56ch;
}

/* Column 2 is the text column; column 1 belongs to the plate number */
.cs-work figcaption .cs-cap-title {
  grid-column: 2;
  grid-row: 1;
}

.cs-work figcaption .cs-cap-text {
  grid-column: 2;
  grid-row: 2;
}

.cs-cap-title {
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

/* TEDx sets its own casing */
.cs-cap-title--asis {
  letter-spacing: 0.04em;
  text-transform: none;
}

.cs-cover {
  margin-bottom: var(--section);
}

.cs-cover .cs-frame {
  border-radius: var(--r-card);
}

/* =========================================================
   3. STORY — label left, argument right, ruled rows
   ========================================================= */
.cs-story {
  margin-bottom: var(--section);
  border-top: 1px solid var(--line);
  counter-reset: cs-story;
}

.cs-block {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: 20px 64px;
  padding: 40px 0 44px;
  border-bottom: 1px solid var(--line);
  counter-increment: cs-story;
}

.cs .cs-block h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.6rem, 3.2vw, 2.4rem);
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 0.95;
  text-transform: uppercase;
}

.cs .cs-block h2::before {
  content: counter(cs-story, decimal-leading-zero);
  display: block;
  margin-bottom: 14px;
  color: var(--brand-text);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.cs-block p {
  max-width: 60ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1.72;
  letter-spacing: -0.008em;
  text-wrap: pretty;
}

/* =========================================================
   4. SECTION TITLES — THE WORK ─────────────── 12
   ========================================================= */
.cs .cs-section-title {
  display: flex;
  align-items: center;
  gap: 26px;
  margin: 0 0 40px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(1.7rem, 4vw, 2.9rem);
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 0.95;
  text-transform: uppercase;
}

.cs-section-title .name {
  flex: 0 0 auto;
}

.cs-section-title .rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.cs-section-title .count {
  flex: 0 0 auto;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

/* =========================================================
   5. THE WORK
   ========================================================= */
.cs-work {
  margin-bottom: var(--section);
  counter-reset: cs-shot;
}

.cs-shot {
  margin-bottom: 64px;
  counter-increment: cs-shot;
}

.cs-work > :last-child {
  margin-bottom: 0;
}

.cs-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 30px;
  margin-bottom: 64px;
}

/* Four mockups of one deliverable, tight enough to read as a single
   plate — one number, one caption, one slot in the sequence. */
.cs-quad {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cs-quad .cs-frame {
  border-radius: 10px;
}

/* Social posts: the artwork is square or 4:5 depending on the piece, so
   each cell takes one portrait frame and the design sits centred in it —
   three posts, equal heights, nothing cropped. */
.cs-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.cs-frame--post {
  box-sizing: border-box;
  aspect-ratio: 4 / 5;
  padding: 12px;
  border-radius: 12px;
}

.cs-frame--post img {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  object-fit: contain;
}

.cs-pair .cs-shot {
  margin-bottom: 0;
}

/* =========================================================
   6. DELIVERABLES — grouped, not a run-on list
   ========================================================= */
.cs-deliverables {
  margin-bottom: var(--section);
}

.cs-deliv-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px 30px;
}

.cs .cs-deliv-group h3 {
  margin: 0 0 14px;
  color: var(--brand-text);
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.cs-deliv-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-deliv-group li {
  padding: 11px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 450;
  line-height: 1.4;
  letter-spacing: -0.008em;
}

/* =========================================================
   7. NEXT PROJECT
   ========================================================= */
.cs-next {
  margin-bottom: 64px;
}

.cs-next a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  align-items: center;
  gap: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}

.cs-next-text {
  display: grid;
  justify-items: start;
  gap: 18px;
}

.cs-next-label {
  color: var(--ink-3);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cs-next-title {
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(2.4rem, 6.4vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 0.88;
  text-transform: uppercase;
  transition: color 0.25s ease;
}

.cs-next-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 500;
  transition: border-color 0.25s ease, color 0.25s ease;
}

.cs-next-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--r-img);
  background: var(--bg-2);
  font-size: 0;
}

.cs-next-media img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.8s var(--ease);
}

.cs-next a:hover .cs-next-title {
  color: var(--brand-text);
}

.cs-next a:hover .cs-next-cta {
  border-bottom-color: var(--brand-text);
  color: var(--brand-text);
}

.cs-next a:hover .cs-next-cta .ico {
  transform: translateX(3px);
}

.cs-next a:hover .cs-next-media img {
  transform: scale(1.04);
}

.cs-next a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 6px;
  border-radius: 4px;
}

/* =========================================================
   8. CLOSING
   ========================================================= */
.cs-cta {
  display: grid;
  justify-items: center;
  gap: 22px;
  padding: 88px 40px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg-2);
  text-align: center;
}

.cs .cs-cta h2 {
  max-width: 16ch;
  margin: 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 0.9;
  text-transform: uppercase;
  text-wrap: balance;
}

.cs-cta p {
  max-width: 54ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.62;
}

.cs-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.82rem;
  font-weight: 550;
  letter-spacing: -0.007em;
  text-decoration: none;
  transition: background 0.25s ease, color 0.25s ease;
}

.cs-btn .ico {
  stroke-width: 2.2;
}

.cs-btn:hover {
  background: var(--brand);
  color: var(--on-brand);
}

.cs-btn:hover .ico {
  transform: translateX(3px);
}

.cs-btn:focus-visible,
.cs-back:focus-visible,
.cs-facts a:focus-visible,
.cs-block a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 4px;
}

/* =========================================================
   9. RESPONSIVE
   ========================================================= */
@media screen and (max-width: 1000px) {
  .cs-hero-foot {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-lead {
    max-width: 60ch;
  }

  .cs-deliv-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media screen and (max-width: 800px) {
  .cs {
    --section: 84px;

    padding: 26px 18px 110px;
  }

  .cs-hero {
    padding: 18px 0 52px;
  }

  .cs-block {
    grid-template-columns: minmax(0, 1fr);
    padding: 30px 0 34px;
  }

  .cs-block p {
    font-size: 0.98rem;
  }

  .cs .cs-section-title {
    gap: 16px;
    margin-bottom: 28px;
  }

  .cs-shot,
  .cs-pair {
    margin-bottom: 44px;
  }

  .cs-pair {
    grid-template-columns: minmax(0, 1fr);
    gap: 44px;
  }

  /* Below this the quadrants are too small to read as mockups */
  .cs-quad {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  /* Posts stay side by side — three in a row still read at phone width */
  .cs-trio {
    gap: 8px;
  }

  .cs-frame--post {
    padding: 6px;
  }

  .cs-cover .cs-frame {
    border-radius: var(--r-img);
  }

  .cs-next {
    margin-bottom: 44px;
  }

  .cs-next a {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding-top: 28px;
  }

  .cs-next-media {
    order: -1;
  }

  .cs-cta {
    padding: 60px 22px;
  }
}

@media screen and (max-width: 480px) {
  .cs-deliv-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .cs-facts > div {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cs *,
  .cs *::before,
  .cs *::after {
    transition-duration: 0.01ms !important;
  }

  .cs-next a:hover .cs-next-media img {
    transform: none;
  }
}
