/* Case study modules — Portfolio DNA (live homepage evidence grammar).
   Image-led process showcase; Brand Appart–style colored hero → white body. */

.case-page {
  --case-stage: 1180px;
  --case-bingo: #0b2c37;
  --case-hero-bg: var(--case-bingo);
  --case-copy: 42rem;
  /* Spacing rhythm — tighter than article, air around media */
  --case-gap-section: clamp(36px, 4.5vw, 56px);
  --case-gap-after-hero: clamp(36px, 5vw, 56px);
  --case-gap-in-section: clamp(16px, 2vw, 24px);
  --case-gap-to-media: clamp(20px, 2.5vw, 28px);
  --case-theme-duration: 0.9s;
  --case-theme-ease: cubic-bezier(0.4, 0, 0.2, 1);
  padding-block: 0 var(--pad-page-bottom);
}

.case-page > .layout-inline,
.case-hero-stage > .layout-inline {
  max-width: var(--case-stage);
}

/* —— Theme flip (Orient): card color while hero is in view —— */
html.is-case-hero-theme {
  --bg-page: var(--case-hero-bg, #0b2c37);
  --bg-nav: color-mix(in srgb, var(--case-hero-bg, #0b2c37) 92%, transparent);
  --text-primary: var(--color-white);
  --text-nav: rgba(255, 255, 255, 0.88);
  --text-nav-logo: var(--color-white);
  --border-hairline: rgba(255, 255, 255, 0.14);
}

html.is-case-hero-theme body {
  background-color: var(--case-hero-bg, #0b2c37);
  color: var(--color-white);
}

/* Longer, even wash — only on case pages */
body:has(.case-page) {
  transition:
    background-color var(--case-theme-duration, 0.9s) var(--case-theme-ease, cubic-bezier(0.4, 0, 0.2, 1)),
    color var(--case-theme-duration, 0.9s) var(--case-theme-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

body:has(.case-page) .nav {
  transition:
    transform var(--duration-entrance) var(--ease-out),
    background-color var(--case-theme-duration, 0.9s) var(--case-theme-ease, cubic-bezier(0.4, 0, 0.2, 1)),
    border-color var(--case-theme-duration, 0.9s) var(--case-theme-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

body:has(.case-page) .nav-logo,
body:has(.case-page) .nav-logo .dot,
body:has(.case-page) .nav-links a {
  transition: color var(--case-theme-duration, 0.9s) var(--case-theme-ease, cubic-bezier(0.4, 0, 0.2, 1));
}

/* —— Full-color hero stage —— */
.case-hero-stage {
  background: var(--case-hero-bg, var(--case-bingo));
  color: var(--color-white);
  padding-block: calc(var(--pad-page-y) + 4px) clamp(36px, 5vw, 56px);
  margin: 0;
}

.case-hero {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.case-hero .page-back {
  margin-bottom: clamp(20px, 3vw, 28px);
  color: rgba(255, 255, 255, 0.55);
}

.case-hero .page-back:hover,
.case-hero .page-back:focus-visible {
  color: var(--color-white);
}

.case-hero .page-eyebrow {
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.45);
}

.case-hero .page-title {
  max-width: 22ch;
  color: var(--color-white);
}

.case-hero .page-lede {
  margin-top: clamp(16px, 2.2vw, 24px);
  color: rgba(255, 255, 255, 0.62);
}

/* Summary inside hero (twins work-card v2 mid) */
.case-summary {
  --case-pad-x: 0;
  --case-pad-y: 0;
  margin-top: clamp(28px, 4vw, 44px);
  background: transparent;
  color: var(--color-white);
}

.case-summary-inner {
  width: 100%;
  margin-inline: 0;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(11rem, 0.85fr);
  gap: clamp(24px, 3.5vw, 48px);
  align-items: start;
}

.case-summary-main {
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 24px);
  min-width: 0;
}

.case-summary-body {
  margin: 0;
  max-width: 54ch;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.45;
  letter-spacing: -0.008em;
  color: #d2d2d2;
}

.case-stats {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(22px, 2.6vw, 40px);
  margin: 0;
}

.case-stat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  min-width: 0;
}

.case-stat dt {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a8a8a8;
  line-height: 1.2;
}

.case-stat dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(16px, 1.55vw, 21px);
  letter-spacing: -0.025em;
  line-height: 1.15;
  color: #e8e8e8;
}

.case-quote {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.case-quote-text {
  margin: 0;
  padding: 0;
  border: 0;
}

.case-quote-text p {
  margin: 0;
  max-width: 30ch;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(13px, 1.15vw, 16px);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: #e1e1e1;
}

.case-quote-author {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.case-quote-author img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.case-quote-author p {
  margin: 0;
  min-width: 0;
}

.case-quote-name,
.case-quote-role {
  display: block;
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.case-quote-name {
  font-weight: 700;
  font-size: clamp(14px, 1.25vw, 17px);
  color: #b1b1b1;
}

.case-quote-role {
  font-weight: 600;
  font-size: clamp(12px, 1.1vw, 14px);
  color: #878787;
}

/* —— Body (transparent — page bg wash owns the color; text locked) —— */
.case-body {
  --text-primary: var(--color-black);
  --text-body: var(--color-body);
  --text-muted: var(--color-muted);
  --border-hairline: rgba(0, 0, 0, 0.08);
  max-width: var(--case-stage);
  display: flex;
  flex-direction: column;
  gap: var(--case-gap-section);
  padding-block: var(--case-gap-after-hero) 0;
  background: transparent;
  color: var(--color-black);
}

.case-section {
  display: flex;
  flex-direction: column;
  gap: var(--case-gap-in-section);
  margin: 0;
  min-width: 0;
}

.case-section:has(.case-figure),
.case-section:has(.case-shots) {
  gap: var(--case-gap-to-media);
}

.case-copy {
  max-width: var(--case-copy);
}

.case-copy h2 {
  margin: 0 0 10px;
  font-weight: 700;
  font-size: var(--text-article-h2);
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}

.case-copy p {
  margin: 0;
  font-size: var(--text-article-body);
  line-height: 1.5;
  color: var(--text-body);
}

.case-copy p + p {
  margin-top: 0.75em;
}

/* —— Two-column split (manager-case grammar) —— */
.case-split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.4fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  margin: 0;
  min-width: 0;
}

.case-split-left {
  min-width: 0;
}

.case-split-label {
  margin: 0 0 12px;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--text-eyebrow-size);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.case-split-heading {
  margin: 0;
  max-width: 16ch;
  font-weight: 700;
  font-size: clamp(26px, 3.2vw, 36px);
  line-height: 1.12;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  text-wrap: balance;
}

.case-split-body {
  margin: 0;
  max-width: 48ch;
  font-size: var(--text-article-body);
  line-height: 1.55;
  color: var(--text-body);
}

/* —— Practice tiles (Concrete-style challenge cards) —— */
.case-tiles-block {
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.5vw, 28px);
  min-width: 0;
}

.case-tiles-eyebrow {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--text-eyebrow-size);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.case-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 1.8vw, 20px);
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  min-width: 0;
}

.case-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(28px, 4vw, 48px);
  min-width: 0;
  min-height: clamp(200px, 26vw, 280px);
  padding: clamp(22px, 2.8vw, 32px);
  border-radius: clamp(20px, 2.4vw, 28px);
  background: #f2f2f2;
}

.case-tile h3 {
  margin: 0;
  max-width: 14ch;
  font-weight: 700;
  font-size: clamp(20px, 2.2vw, 26px);
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: var(--text-primary);
  text-wrap: balance;
}

.case-tile p {
  margin: 0;
  font-size: clamp(14px, 1.2vw, 16px);
  line-height: 1.5;
  color: var(--text-body);
}

/* —— Outcome stats on white —— */
.case-outcome {
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.5vw, 28px);
  min-width: 0;
}

.case-outcome-label {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: var(--text-eyebrow-size);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-muted);
}

.case-outcome .case-stats {
  gap: clamp(28px, 4vw, 56px);
}

.case-outcome .case-stat dt {
  color: var(--text-muted);
}

.case-outcome .case-stat dd {
  font-size: clamp(22px, 2.4vw, 32px);
  color: var(--text-primary);
}

.case-outcome-note {
  margin: 0;
  max-width: 48ch;
  font-size: var(--text-article-body);
  line-height: 1.5;
  color: var(--text-body);
}

/* —— Full-stage process media —— */
.case-figure {
  margin: 0;
  width: 100%;
  background: transparent;
}

.case-figure img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: clamp(16px, 2vw, 24px);
}

.case-figure figcaption {
  margin-top: 10px;
  font-family: var(--font-ui);
  font-size: var(--text-figure-caption);
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 60ch;
}

.case-figure--feature img {
  width: 100%;
  max-height: min(78vh, 820px);
  object-fit: contain;
  object-position: center;
  background: #016df0;
}

.case-figure--light {
  background: transparent;
}

.case-shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
  margin: 0;
  list-style: none;
  padding: 0;
  width: 100%;
  min-width: 0;
}

.case-shots--phones {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(10px, 1.4vw, 16px);
}

.case-shot {
  margin: 0;
  min-width: 0;
  width: 100%;
  border-radius: clamp(16px, 2vw, 22px);
  overflow: hidden;
  background: #555;
  aspect-ratio: 16 / 10;
}

.case-shots--phones .case-shot {
  aspect-ratio: 390 / 844;
  border-radius: clamp(12px, 1.5vw, 18px);
  background: #111;
}

.case-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.case-shots-caption {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-figure-caption);
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 60ch;
}

@media (max-width: 900px) {
  .case-summary-inner {
    grid-template-columns: 1fr;
  }

  .case-split {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .case-split-heading {
    max-width: none;
  }

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

  .case-tile {
    min-height: 0;
    gap: 20px;
  }

  .case-shots {
    grid-template-columns: 1fr;
  }

  .case-shots--phones {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .case-figure--feature img {
    max-height: min(70vh, 560px);
  }
}

@media (prefers-reduced-motion: reduce) {
  body:has(.case-page),
  body:has(.case-page) .nav,
  body:has(.case-page) .nav-logo,
  body:has(.case-page) .nav-logo .dot,
  body:has(.case-page) .nav-links a,
  html.is-case-hero-theme body {
    transition: none;
  }

  .case-shot,
  .case-figure {
    transition: none;
  }
}
