/* Case gallery — image-led case studies.
   The work leads: a stage of real screenshots on the project's own ground
   colour, then short chapters, each carried by a composed band of screens.
   Per case, set --ground (the site's own surface) and --ground-ink on .cg. */

.cg { --ground: oklch(93% 0.01 60); --ground-ink: oklch(22% 0.02 45); --ground-soft: color-mix(in oklch, var(--ground-ink) 72%, var(--ground)); }

/* screenshots */
.cg-shot { margin: 0; }
.cg-shot img { display: block; width: 100%; height: auto; background: var(--ground); box-shadow: 0 1.6rem 3.2rem -1.4rem oklch(10% 0.02 45 / 0.45), 0 0.35rem 0.9rem oklch(10% 0.02 45 / 0.16); }
.cg-shot--phone img { border-radius: clamp(1rem, 2.4vw, 1.7rem); }
.cg-shot--desk img { border-radius: 0.6rem; }
.cg-cap { margin-top: 1rem; color: var(--ground-soft); font-size: 0.8rem; line-height: 1.5; }
.cg-cap strong { display: block; margin-bottom: 0.15rem; color: var(--ground-ink); font-weight: 600; }

/* stage: the first thing after the title */
.cg-stage { padding: clamp(2.5rem, 6vw, 5.5rem) var(--page-pad) clamp(3rem, 7vw, 6rem); background: var(--ground); }
.cg-stage-inner { position: relative; max-width: 76rem; margin: 0 auto; padding-inline-end: clamp(0rem, 9vw, 9rem); }
.cg-stage .cg-shot--desk { width: 100%; }
.cg-stage .cg-shot--phone { position: absolute; inset-inline-end: 0; bottom: clamp(-4rem, -5vw, -1.5rem); width: clamp(9rem, 21%, 15.5rem); }
.cg-stage-note { max-width: 76rem; margin: clamp(2rem, 4vw, 3rem) auto 0; color: var(--ground-soft); font-size: 0.8rem; line-height: 1.6; }

/* facts */
.cg-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; margin: 0; padding: 1.6rem 0; border-block: 1px solid var(--line); }
.cg-facts dt { margin-bottom: 0.45rem; color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.cg-facts dd { margin: 0; font-size: 0.95rem; line-height: 1.5; }
.cg-facts a { border-bottom: 1px solid var(--line); transition: color 200ms ease, border-color 200ms ease; }
.cg-facts a:hover { color: var(--orange-hot); border-color: var(--orange); }

/* intro */
.cg-intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); margin-top: clamp(3.5rem, 7vw, 6rem); }
.cg-statement { margin: 0; font-family: var(--display); font-size: clamp(2.6rem, 5.4vw, 4.8rem); font-weight: 400; line-height: 0.9; text-transform: uppercase; text-wrap: balance; }
.cg-copy p { max-width: 62ch; margin: 0 0 1.1rem; color: oklch(84% 0.012 55); font-size: 0.95rem; line-height: 1.8; }
.cg-copy p:last-child { margin-bottom: 0; }

/* chapters */
.cg-chapter { padding: clamp(4.5rem, 9vw, 8rem) var(--page-pad) 0; }
.cg-chapter-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(1.5rem, 6vw, 6rem); align-items: end; max-width: 76rem; margin: 0 auto clamp(2rem, 4vw, 3rem); }
.cg-chapter-head h2 { margin: 0; font-family: var(--display); font-size: clamp(2.4rem, 4.8vw, 4.2rem); font-weight: 400; line-height: 0.9; text-transform: uppercase; text-wrap: balance; }
.cg-chapter-head p { max-width: 58ch; margin: 0; color: oklch(84% 0.012 55); font-size: 0.95rem; line-height: 1.8; }
.cg-label { display: block; margin-bottom: 1rem; color: var(--orange); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* bands of screens */
.cg-band { max-width: 76rem; margin: 0 auto; padding: clamp(2rem, 5.5vw, 4.5rem); border-radius: 1rem; background: var(--ground); }
.cg-row { display: grid; gap: clamp(1.2rem, 3.5vw, 3rem); align-items: start; }
.cg-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 60rem; margin: 0 auto; padding-top: clamp(1rem, 2.5vw, 2.5rem); }
.cg-row--3 > :nth-child(2) { translate: 0 calc(clamp(1rem, 2.5vw, 2.5rem) * -1); }
.cg-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 40rem; margin: 0 auto; }
.cg-row--duo { grid-template-columns: minmax(0, 1fr) minmax(0, 0.3fr); align-items: end; }
.cg-row--wide { grid-template-columns: minmax(0, 1fr); }

/* honest scope and proof */
.cg-notes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 6rem); padding-top: 2rem; border-top: 1px solid var(--line); }
.cg-notes h2 { margin: 0 0 1.2rem; font-family: var(--display); font-size: clamp(2rem, 3.6vw, 3rem); font-weight: 400; line-height: 0.95; text-transform: uppercase; }
.cg-notes p { max-width: 60ch; margin: 0 0 1rem; color: oklch(84% 0.012 55); font-size: 0.9rem; line-height: 1.8; }
.cg-notes .c-built li { font-size: 0.88rem; }

/* walkthrough film, last */
.cg-film { margin: 0; }
.cg-film video { display: block; width: 100%; max-height: 82vh; border-radius: 1rem; background: oklch(6% 0.01 45); }
.cg-film figcaption { margin-top: 1rem; color: var(--muted); font-size: 0.8rem; line-height: 1.6; }

/* Arabic */
.cg[dir="rtl"] { font-family: var(--arabic); }
.cg[dir="rtl"] .cg-statement, .cg[dir="rtl"] .cg-chapter-head h2, .cg[dir="rtl"] .cg-notes h2 { font-family: var(--arabic); font-weight: 700; line-height: 1.35; text-transform: none; }
.cg[dir="rtl"] .cg-statement { font-size: clamp(2rem, 3.8vw, 3.3rem); }
.cg[dir="rtl"] .cg-chapter-head h2 { font-size: clamp(1.8rem, 3.2vw, 2.8rem); }
.cg[dir="rtl"] .cg-notes h2 { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
.cg[dir="rtl"] .cg-facts dt, .cg[dir="rtl"] .cg-label { letter-spacing: 0; }
.cg[dir="rtl"] .cg-copy p, .cg[dir="rtl"] .cg-chapter-head p, .cg[dir="rtl"] .cg-notes p { line-height: 2; }

@media (max-width: 900px) {
  .cg-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cg-intro, .cg-chapter-head, .cg-notes { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .cg-stage-inner { padding-inline-end: 0; padding-bottom: 0; }
  .cg-stage .cg-shot--phone { position: relative; inset: auto; width: 46%; margin: -22% 0 0 auto; margin-inline-start: auto; margin-inline-end: 0.5rem; }
  .cg-band { padding: 1.5rem 1.1rem; border-radius: 0.8rem; }
  .cg-row--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
  .cg-row--3 > :nth-child(2) { translate: none; }
  .cg-row--3 > :nth-child(3) { grid-column: 1 / -1; width: calc(50% - 0.55rem); justify-self: center; }
  .cg-row--duo { grid-template-columns: minmax(0, 1fr); }
  .cg-row--duo > .cg-shot--phone { width: 56%; justify-self: center; }
  .cg-cap { font-size: 0.78rem; }
}
.cg-row--solo { grid-template-columns: minmax(0, 1fr); max-width: 26rem; margin: 0 auto; }
