/* Case studies page (/case-studies/). Loaded after shared/pages.css, which carries the
   site tokens, header, footer, buttons and eyebrow; this file is only the page's own parts. */

.pc-h2 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.04; letter-spacing: -.03em; font-weight: 700; text-wrap: balance; }

.pc-hero { padding: clamp(40px, 6vw, 72px) 0 clamp(48px, 6vw, 80px); text-align: center; }
.pc-hero h1 { margin: 0 auto; max-width: 24ch; font-size: clamp(2.2rem, 4.4vw, 3.8rem); line-height: 1.02; letter-spacing: -.035em; font-weight: 700; text-wrap: balance; }

/* ---- about ---------------------------------------------------------------- */
.pc-me { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 96px); align-items: center; padding: clamp(48px, 6vw, 96px) 0; border-top: 1px solid var(--border); }
.pc-me__photo { margin: 0; aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.pc-me__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.pc-stat { display: flex; align-items: baseline; gap: 18px; margin: 20px 0 24px; padding: 24px 0; border-block: 1px solid var(--border); }
.pc-stat strong { font-size: clamp(3.5rem, 8vw, 6.5rem); line-height: .9; letter-spacing: -.05em; color: var(--brand-blue); }
.pc-stat span { max-width: 20ch; font-size: clamp(1.1rem, 1rem + .5vw, 1.45rem); line-height: 1.3; font-weight: 600; letter-spacing: -.015em; }
.pc-me__more { margin: 0 0 28px; max-width: 46ch; color: var(--muted-foreground); font-size: 1.1rem; line-height: 1.55; }
.pc-link { color: var(--foreground); text-decoration: none; font-weight: 600; border-bottom: 1px solid var(--brand-blue); padding-bottom: 3px; }
.pc-link:hover { color: var(--brand-blue); }

/* ---- client builds: one pinned screen --------------------------------------
   the scrollcraft engine gives the act its sticky stage; case-studies.js turns
   the act's progress into the active build (index i) and how far through it the
   reader is (--f on the active name, 0..1), which fills the blue line under it. */
.pc-builds-head { padding: clamp(72px, 9vw, 128px) 0 0; border-top: 1px solid var(--border); }
.pc-builds__stage { display: grid; align-items: center; }
.pc-builds__grid { display: grid; grid-template-columns: minmax(240px, 4fr) minmax(0, 8fr); gap: clamp(32px, 5vw, 80px); align-items: center; }

.pc-index ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pc-index button {
  --f: 0;
  display: block; width: 100%; text-align: left; padding: 9px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: clamp(1.2rem, 1rem + .9vw, 1.9rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.15;
  color: #4c565d; transition: color var(--sc-d-base) var(--sc-ease-out);
}
.pc-index button span {
  background: linear-gradient(var(--brand-blue), var(--brand-blue)) no-repeat 0 100% / calc(var(--f) * 100%) 2px;
  padding-bottom: 4px;
}
.pc-index button:hover { color: #8c969c; }
.pc-index li.is-active button { color: var(--foreground); }
.pc-index li.is-done button { color: #6f7a81; }
@media (min-width: 861px) {
  .pc-index li:not(.is-active) button span { background-size: 0 2px; }   /* only the active build shows its line */
}

.pc-screen { display: grid; gap: 22px; }
.pc-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(242, 248, 252, .1); background: var(--card); box-shadow: var(--sc-e3);
}
.pc-slide {
  position: absolute; inset: 0; opacity: 0; transform: scale(1.025);
  transition: opacity 520ms var(--sc-ease-out), transform 720ms var(--sc-ease-out);
}
.pc-slide.is-active { opacity: 1; transform: none; z-index: 1; }
.pc-slide video { width: 100%; height: 100%; object-fit: cover; }
.pc-clip iframe { display: block; width: 100%; height: 100%; border: 0; }
.pc-ph {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; text-align: center;
  background:
    radial-gradient(70% 90% at 50% 120%, rgba(12, 163, 239, .22), transparent 70%),
    linear-gradient(160deg, #141b20, #0d1317);
}
.pc-ph strong { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 3rem); letter-spacing: -.03em; }
.pc-ph small { font-family: var(--sc-font-mono); font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-foreground); }
.pc-clip .cs-sound { opacity: 1; pointer-events: auto; }
.pc-clip.is-listening .cs-sound { display: none; }

.pc-caps { position: relative; min-height: 6.2em; }
.pc-cap {
  position: absolute; inset: 0 auto auto 0; margin: 0; max-width: 52ch; opacity: 0; transform: translateY(8px);
  font-size: clamp(1.05rem, 1rem + .3vw, 1.25rem); line-height: 1.45; color: var(--muted-foreground);
  transition: opacity 420ms var(--sc-ease-out), transform 420ms var(--sc-ease-out);
}
.pc-cap.is-active { opacity: 1; transform: none; }
.pc-cap strong { display: none; }
/* marker-pen highlight in brand sky blue: uneven ink, heavier at the ends, text stays white */
.pc-hl {
  color: var(--foreground); margin: 0 -.12em; padding: .06em .3em .1em; border-radius: .8em .3em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background-color: transparent;
  background-image:
    linear-gradient(100deg, rgba(12,163,239,0) .9%, rgba(12,163,239,.62) 2.4%, rgba(12,163,239,.42) 5.8%, rgba(12,163,239,.34) 93%, rgba(12,163,239,.66) 96%, rgba(12,163,239,0) 98.5%),
    linear-gradient(182deg, rgba(12,163,239,0) 0%, rgba(12,163,239,.22) 8%, rgba(12,163,239,0) 16%);
}
.pc-for { font-size: .55em; font-weight: 400; letter-spacing: 0; white-space: nowrap; }

/* ---- internal systems: a stacked deck ---------------------------------------
   One pinned act. case-studies.js sets two numbers on each card:
     --e  how far it has slid up into place (0 = below the screen, 1 = landed)
     --d  how many cards have landed on top of it since (fractional)
   A landed card shrinks back and darkens by --d, so the earlier ones peek out
   above the current card like a stack. */
.pc-own-head { padding: clamp(96px, 12vw, 160px) 0 0; border-top: 1px solid var(--border); margin-top: clamp(48px, 6vw, 96px); }
.pc-deck__stage { display: grid; align-items: center; }
.pc-deck__cards { position: relative; height: min(66svh, 620px); }
.pc-card {
  --e: 0; --d: 0;
  position: absolute; inset: 0;
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: clamp(24px, 4vw, 56px); align-items: center;
  padding: clamp(18px, 2.2vw, 28px); border-radius: 22px;
  border: 1px solid rgba(242, 248, 252, .1); background: #121a1f; box-shadow: var(--sc-e3), var(--sc-edge);
  transform-origin: 50% 0;
  transform: translateY(calc((1 - var(--e)) * 105svh - var(--d) * 26px)) scale(calc(1 - var(--d) * .05));
  filter: brightness(calc(1 - var(--d) * .3));
  will-change: transform;
}
.pc-card__media { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--card); }
.pc-card__media video { width: 100%; height: 100%; object-fit: cover; }
.pc-card .pc-ph strong { display: none; }   /* the card's own title sits right beside it */
.pc-card__text h3 { margin: 0 0 14px; font-size: clamp(1.8rem, 1.2rem + 2vw, 3rem); line-height: 1.02; letter-spacing: -.035em; }
.pc-card__text p { margin: 0; max-width: 32ch; color: var(--muted-foreground); font-size: clamp(1.05rem, 1rem + .3vw, 1.25rem); line-height: 1.5; }

/* ---- phones ---------------------------------------------------------------
   The index doesn't fit beside the frame: the frame sits on top, the active
   build's name and line under it, and the index becomes a thin progress row. */
@media (max-width: 860px) {
  .pc-deck__cards { height: min(58svh, 460px); }
  .pc-card { grid-template-columns: 1fr; align-content: start; gap: 18px; }
  .pc-card__text h3 { margin-bottom: 8px; }
  .pc-me { grid-template-columns: 1fr; }
  .pc-me__photo { max-width: 420px; }
  .pc-builds__grid { grid-template-columns: 1fr; gap: 20px; }
  .pc-screen { order: -1; }
  .pc-index ol { display: flex; gap: 6px; }
  .pc-index li { flex: 1; }
  .pc-index button { height: 4px; padding: 0; border-radius: 2px; background: #2a3236; font-size: 0; overflow: hidden; }
  .pc-index button span { display: block; height: 100%; padding: 0; background-size: calc(var(--f) * 100%) 100%; }
  .pc-index li.is-done button { background: var(--brand-blue); }
  .pc-caps { min-height: 6.5em; }
  .pc-cap strong { display: block; margin-bottom: 4px; color: var(--foreground); font-size: 1.35rem; letter-spacing: -.02em; }
}
