/**
 * The Traffic Plans Company - Case Studies (/case-studies/)
 * Rollout 3 - THEA-693
 *
 * ARCHITECTURE: this file is PAGE-SPECIFIC ONLY, ported from
 * 03-Rollout-3/hifi/case-studies.css. It assumes a shared foundation
 * stylesheet providing the band system (.band / .band-asphalt / .band-orange
 * / .band-panel_grey and the --primitive-* / --band-* custom properties),
 * .tpc-proof, .tpc-close, .tpc-notepad / .tpc-testimonial-feature (the
 * review-card component this page exists for), .tpc-eyebrow,
 * .tpc-section-head and the scroll reveal hooks. AS OF THIS PORT, THAT
 * FOUNDATION DOES NOT YET EXIST ANYWHERE IN tpc-bridge (verified by grep
 * across every theme CSS file - no .band system, no .tpc-notepad, no
 * .tpc-proof, no .tpc-close, no design-token custom properties, no GSAP /
 * Lenis / Splide). This page will render unstyled until that foundation is
 * ported in. See the hand-back report.
 *
 * This page's interactive carousel (the notepad stack) needs case-studies.js
 * (ported alongside this file, enqueued conditionally in functions.php) for
 * next/prev/dots/swipe - that JS has no external library dependency so it
 * was ported in full rather than stubbed.
 */

/* ─────────────────────────────────────────────────────────────────────
   SHERO - split variant, internal-page tier.
   ───────────────────────────────────────────────────────────────────── */
.tpc-shero--split .band__inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--primitive-space-8);
  align-items: center;
}
.tpc-shero--split .shero__inner { max-width: none; }

.tpc-shero--orange {
  --tpc-cone-orange: #E8611C;
  --band-bg: linear-gradient(180deg, var(--primitive-orange) 0%, var(--tpc-cone-orange) 100%);
  --band-heading-text: var(--primitive-white);
  --band-h2-text: var(--primitive-white);
  --band-body-text: var(--primitive-white);
}
.tpc-shero--orange.band {
  min-height: 42vh;
  min-height: 42svh;
  padding-block: var(--primitive-space-7);
  display: flex;
  align-items: center;
}
/* "word for it" forced onto its own line with explicit block spans rather
   than a column-width nudge, which only holds at one viewport. Both rows
   carry three words, so the no-single-word-row rule is satisfied. */
.tpc-shero--orange .shero__title span { display: block; }

.tpc-shero--orange .shero__title {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
}
.tpc-shero--orange .shero__intro {
  font-size: 16px;
}

/* .tpc-shero__media states an aspect-ratio purely to hold the slot open for
   an absolutely-positioned figure; .tpc-shero--orange.band's overflow: clip
   is what crops the legs at the band edge. 1531/1027 kept verbatim so this
   hero measures the same height as every other internal page's. */
.tpc-shero--orange.band { overflow: clip; }

.tpc-shero__media {
  position: relative;
  aspect-ratio: 1531 / 1027;
}
.tpc-shero__worker {
  /* THE TOP PIN IS MEASURED, NOT GUESSED: the subject's topmost opaque row
     is y=26 of 1402, i.e. 1.8545%. top: calc((1 - scale) * headPct) pins
     that row in place as the image grows, because the scale cancels. This
     source is PORTRAIT (1122x1402) where the shared hero figure asset is
     landscape, so the figure stands taller in the slot and the scale is
     lower than the landscape variant's. */
  --worker-scale: 1.72;
  display: block;
  position: absolute;
  left: 50%;
  top: calc((1 - var(--worker-scale)) * 1.8545%);   /* 1.8545% = the head, from the alpha scan */
  height: calc(var(--worker-scale) * 100%);
  width: auto;
  transform: translateX(-50%);
}
/* Below 1024px the columns stack and the figure sits above the copy, where
   an overflowing one would run into it - back to in-flow and uncropped. */
@media (max-width: 1024px) {
  .tpc-shero__media { aspect-ratio: auto; }
  .tpc-shero__worker {
    position: static;
    height: auto;
    max-height: 46vh;
    width: auto;
    max-width: 100%;
    margin-inline: auto;
    transform: none;
  }
}

@media (max-width: 1024px) {
  .tpc-shero--split .band__inner { grid-template-columns: 1fr; gap: var(--primitive-space-6); }
  .tpc-shero__media { order: -1; }
}

/* ─────────────────────────────────────────────────────────────────────
   SECTION HEADING STACK TRAPS.
   .tpc-eyebrow--solo inherits uppercase from the small-caps eyebrow it is
   based on; both headings on this page are full sentences, not labels, so
   it is lifted per-section rather than on the class. .tpc-hub__sub
   hardcodes asphalt text for its default (hub) context; the quotes section
   sits on an asphalt band, so it needs the band-aware override.
   ───────────────────────────────────────────────────────────────────── */
.tpc-headstack .tpc-eyebrow--solo { text-transform: none; }
.band-asphalt .tpc-hub__sub { color: var(--band-heading-text); }

/* ─────────────────────────────────────────────────────────────────────
   TRUST STRIP - byte-identical from the shared internal-page benchmark.
   76% is the midpoint of the signal-red/asphalt mix, deliberately NOT a
   gradient ramp - a near-flat ramp dithers unevenly on an 8-bit display
   and a lossy encoder, producing a phantom "darker rectangle" band edge.
   ───────────────────────────────────────────────────────────────────── */
.tpc-proof--strip {
  background: color-mix(in srgb, var(--primitive-signal-red) 76%, var(--primitive-asphalt));
  padding-block: clamp(14px, 1.8vh, 22px);
}
.tpc-proof--strip .tpc-proof__stat,
.tpc-proof--strip .tpc-proof__star,
.tpc-proof--strip .tpc-proof__label {
  color: color-mix(in srgb, var(--primitive-orange) 55%, var(--primitive-white));
}
.tpc-proof--strip .tpc-proof__item { gap: 2px; }
.tpc-proof--strip .tpc-proof__stat { font-size: clamp(20px, 1.9vw, 26px); }
.tpc-proof--strip .tpc-proof__stat--word { font-size: clamp(16px, 1.5vw, 20px); }
.tpc-proof--strip .tpc-proof__label { max-width: none; font-size: 12.5px; }

/* ─────────────────────────────────────────────────────────────────────
   NOTE - centred, 62ch measure, normal body copy.
   ───────────────────────────────────────────────────────────────────── */
.tpc-note {
  margin: var(--primitive-space-7) auto 0;
  max-width: 62ch;
  text-align: center;
  font-size: 18px;
  color: var(--band-body-text);
}

/* ─────────────────────────────────────────────────────────────────────
   CLOSE BAND - --split layout, the copy-beside-heading head shared with
   every other internal page's close band.
   ───────────────────────────────────────────────────────────────────── */
.tpc-close--split .tpc-close__head--split {
  --close-fig-w: calc(0.6538 * clamp(230px, 33vh, 358px));  /* 510/780 aspect */
  max-width: none;
  margin-inline: 0;
  margin-bottom: var(--primitive-space-7);
  text-align: left;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(24px, 3vw, 56px);
  align-items: center;
  padding-left: calc(var(--close-fig-w) + clamp(16px, 2vw, 40px));
}
.tpc-close--split .tpc-close__title { margin-bottom: 0; }

@media (max-width: 900px) {
  .tpc-close--split .tpc-close__head--split {
    grid-template-columns: 1fr;
    padding-left: 0;
  }
}

.tpc-close--split .tpc-close__lead { color: var(--primitive-white); }

/* ─────────────────────────────────────────────────────────────────────
   THE CLOSE-BAND PLANNER, BACK ON MOBILE. The shared .tpc-close hides this
   figure below 900px by default (its desktop anchor assumes a desktop
   container width); restored here below 699px so "Fancy joining the review
   pile?" still has a planner on every phone visit.
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 699px) {
  .tpc-close--split .tpc-close__figure {
    display: block;
    position: static;
    bottom: auto;
    left: auto;
    margin-left: 0;
    margin-top: clamp(10px, 4vw, 20px);
    width: max-content;
    margin-inline: auto;
    height: clamp(150px, 32vh, 220px);
    z-index: 1;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   NOTEPAD DOTS ON A DARK BAND. The shared component's inactive dot is
   asphalt at low opacity, which reads as a soft grey on a LIGHT ground;
   this section is band-asphalt, so that would be asphalt-on-asphalt and
   the inactive dots would disappear entirely. Flipped to white at 36% -
   not a guess: white at 36% over #222222 composites to rgb(114,114,114),
   which measures 3.31:1 against the band, clearing the 3:1 WCAG floor for
   a non-text UI indicator. The active dot stays --primitive-orange.
   Scoped to the dark band, NOT to .tpc-notepad, so other pages' own dots
   are untouched.
   ───────────────────────────────────────────────────────────────────── */
.band-asphalt .tpc-notepad__dot {
  background: rgba(255, 255, 255, 0.36);
}
.band-asphalt .tpc-notepad__dot[aria-current="true"] {
  background: var(--primitive-orange);
}

/* ─────────────────────────────────────────────────────────────────────
   SECTION BLEND, asphalt (quotes) into panel grey (case studies note).
   Paint the PREVIOUS band's colour over the top of the NEXT section and
   mask it away downward - a 41-stop smoothstep rather than a linear fade,
   which gives the browser enough stops to dither against and kills the
   banding a straight alpha ramp would show.
   ───────────────────────────────────────────────────────────────────── */
.tpc-cs-seam-asphalt { position: relative; }
.tpc-cs-seam-asphalt {
  padding-top: calc(clamp(140px, 22vh, 240px) + clamp(48px, 7vh, 96px));
}
.tpc-cs-seam-asphalt::before {
  content: '';
  position: absolute;
  left: 0; right: 0;
  /* top: -1px, not 0 - when the two section edges land on a fractional
     device pixel the browser antialiases both and the page's white body
     background leaks through the sliver as a pale hairline across the
     join; overlapping by a pixel and taking the pixel back in height
     closes it. */
  top: -1px;
  z-index: 0;
  pointer-events: none;
  height: calc(clamp(140px, 22vh, 240px) + 1px);
  background: var(--primitive-asphalt);
  --seam-ramp:
    rgba(0, 0, 0, 0.0000) 0.0%,
    rgba(0, 0, 0, 0.0018) 2.5%,
    rgba(0, 0, 0, 0.0073) 5.0%,
    rgba(0, 0, 0, 0.0160) 7.5%,
    rgba(0, 0, 0, 0.0280) 10.0%,
    rgba(0, 0, 0, 0.0430) 12.5%,
    rgba(0, 0, 0, 0.0607) 15.0%,
    rgba(0, 0, 0, 0.0812) 17.5%,
    rgba(0, 0, 0, 0.1040) 20.0%,
    rgba(0, 0, 0, 0.1291) 22.5%,
    rgba(0, 0, 0, 0.1562) 25.0%,
    rgba(0, 0, 0, 0.1853) 27.5%,
    rgba(0, 0, 0, 0.2160) 30.0%,
    rgba(0, 0, 0, 0.2482) 32.5%,
    rgba(0, 0, 0, 0.2817) 35.0%,
    rgba(0, 0, 0, 0.3164) 37.5%,
    rgba(0, 0, 0, 0.3520) 40.0%,
    rgba(0, 0, 0, 0.3883) 42.5%,
    rgba(0, 0, 0, 0.4253) 45.0%,
    rgba(0, 0, 0, 0.4625) 47.5%,
    rgba(0, 0, 0, 0.5000) 50.0%,
    rgba(0, 0, 0, 0.5375) 52.5%,
    rgba(0, 0, 0, 0.5748) 55.0%,
    rgba(0, 0, 0, 0.6117) 57.5%,
    rgba(0, 0, 0, 0.6480) 60.0%,
    rgba(0, 0, 0, 0.6836) 62.5%,
    rgba(0, 0, 0, 0.7183) 65.0%,
    rgba(0, 0, 0, 0.7518) 67.5%,
    rgba(0, 0, 0, 0.7840) 70.0%,
    rgba(0, 0, 0, 0.8147) 72.5%,
    rgba(0, 0, 0, 0.8438) 75.0%,
    rgba(0, 0, 0, 0.8709) 77.5%,
    rgba(0, 0, 0, 0.8960) 80.0%,
    rgba(0, 0, 0, 0.9188) 82.5%,
    rgba(0, 0, 0, 0.9392) 85.0%,
    rgba(0, 0, 0, 0.9570) 87.5%,
    rgba(0, 0, 0, 0.9720) 90.0%,
    rgba(0, 0, 0, 0.9840) 92.5%,
    rgba(0, 0, 0, 0.9928) 95.0%,
    rgba(0, 0, 0, 0.9982) 97.5%,
    rgba(0, 0, 0, 1.0000) 100.0%;
  -webkit-mask-image: linear-gradient(to top, var(--seam-ramp));
          mask-image: linear-gradient(to top, var(--seam-ramp));
}
.tpc-cs-seam-asphalt > .band__inner { position: relative; z-index: 1; }

/* ─────────────────────────────────────────────────────────────────────
   WIDOWS & ORPHANS - responsive pass. balance on headings/short labels,
   pretty on body copy: both hold at every column width where a hardcoded
   break would not. Note: "coming" / "soon" splitting alone at >=1366px
   desktop widths is a pre-existing defect in the approved frozen design,
   not introduced here - kept as-is per "do not change anything visible at
   1280px or wider".
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .tpc-case-studies-main h1,
  .tpc-case-studies-main h2,
  .tpc-case-studies-main h3,
  .tpc-case-studies-main .tpc-hub__sub { text-wrap: balance; }

  .tpc-case-studies-main p,
  .tpc-case-studies-main .tpc-section-intro,
  .tpc-case-studies-main .tpc-close__lead,
  .tpc-case-studies-main .tpc-note { text-wrap: pretty; }
}

/* ─────────────────────────────────────────────────────────────────────
   FOUNDER RULING: "across the entire website all text needs to be centred
   for mobile." Marketing/content sections centre; long-form legal, blog
   post bodies and form fields stay left (none of those appear on this
   page, carve-outs kept for parity with the other page stylesheets).
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 699px) {
  .band__inner, .band__inner h1, .band__inner h2, .band__inner h3,
  .band__inner p, .band__inner li,
  .tpc-sec, .tpc-section-head, .tpc-showcase__tile, .tpc-showcase__copy {
    text-align: center;
  }
}

/* ─────────────────────────────────────────────────────────────────────
   TESTIMONIAL CARD DOTS ON PHONE, WHITE. The shared mobile dot shape puts
   the circle on a ::before with the button itself as a transparent hit
   area; anything theming these dots has to colour the pseudo-element, not
   the button, or the button's own background paints a visible block
   around the circle. White per the founder: active dot solid white, rest
   at 40%, so the control still reads without adding a second accent on a
   band that already carries orange in the quote. Phones only - desktop
   keeps the 8px circles with the orange active dot.
   ───────────────────────────────────────────────────────────────────── */
@media (max-width: 699px) {
  .band-asphalt .tpc-notepad__dot,
  .band-asphalt .tpc-notepad__dot[aria-current="true"] {
    background: none;
  }
  .band-asphalt .tpc-notepad__dot::before {
    background: rgba(255, 255, 255, 0.4);
  }
  .band-asphalt .tpc-notepad__dot[aria-current="true"]::before {
    background: var(--primitive-white);
  }
}
