/* ==========================================================================
   Case study pages. Shared layout for the pages under /work/
   Built for the Tourb case first, meant to be reused for every case.
   Depends on bootstrap.min.css being loaded before it.
   ========================================================================== */

:root {
  --case-measure: 68ch;
  --case-rule: #e3ecef;
  --case-muted: #5a6a70;
  --case-accent: #1e7f86;
  --case-shadow: 0px 9px 17px rgba(30, 127, 134, .25);
}

.case {
  font-size: clamp(1rem, .97rem + .18vw, 1.09rem);
  line-height: 1.7;
}

/* --- readable column ----------------------------------------------------- */

.case-body {
  max-width: var(--case-measure);
  margin-inline: auto;
}

.case-body > p,
.case-body > ul,
.case-body > ol {
  margin-bottom: 1.35em;
}

.case-body h2 {
  font-weight: 700;
  margin-top: 2.6em;
  margin-bottom: .7em;
  text-wrap: balance;
}

.case-body h3 {
  font-size: 1.28em;
  font-weight: 700;
  margin-top: 2.2em;
  margin-bottom: .6em;
  text-wrap: balance;
}

.case-body h2:first-child,
.case-body h3:first-child { margin-top: 0; }

.case-body strong { font-weight: 650; }

/* --- hero ---------------------------------------------------------------- */

.case-hero {
  text-align: center;
  padding-block: clamp(2rem, 1rem + 4vw, 4rem) clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.case-hero h1 {
  font-weight: 800;
  text-wrap: balance;
  margin-bottom: .5em;
  min-height: 0; /* index.php sets a global h1 min-height we don't want here */
}

.case-hero .case-standfirst {
  font-size: clamp(1.05rem, 1rem + .4vw, 1.3rem);
  color: var(--case-muted);
  max-width: 58ch;
  margin-inline: auto;
  text-wrap: pretty;
}

.case-eyebrow {
  display: inline-block;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--case-accent);
  margin-bottom: 1em;
}

/* --- section rhythm ------------------------------------------------------ */

.case-section { padding-block: clamp(2rem, 1rem + 3vw, 3.25rem); }

.case-section + .case-section { border-top: 1px solid var(--case-rule); }

.case-phase {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--case-accent);
  margin-bottom: .6em;
}

/* --- pull quote ---------------------------------------------------------- */

.case-pull {
  max-width: 46ch;
  margin: 2.5rem auto;
  padding-left: 1.25rem;
  border-left: 5px solid var(--case-accent);
  font-size: clamp(1.15rem, 1.05rem + .5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.42;
  text-wrap: balance;
}

.case-pull p { margin-bottom: 0; }

/* --- figures ------------------------------------------------------------- */

.case-figure {
  margin: 2.5rem auto;
  max-width: 860px;
}

.case-figure-inner {
  padding: clamp(1.25rem, 1rem + 2vw, 2.25rem);
  border: 4px solid #fff;
  border-radius: 1em;
  background: linear-gradient(2deg, #e9f3f7, #ffffff);
  box-shadow: var(--case-shadow);
}

.case-figure figcaption {
  margin-top: .9rem;
  font-size: .87rem;
  line-height: 1.55;
  color: var(--case-muted);
  text-align: center;
}

.case-figure-title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--case-muted);
  margin-bottom: 1.1rem;
  text-align: center;
}

/* --- 2x2 decision matrix (the key image of the case) --------------------- */

.case-matrix-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  gap: .65rem;
  align-items: stretch;
}

.case-matrix-ylabel,
.case-matrix-xlabel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--case-muted);
  white-space: nowrap;
}

.case-matrix-ylabel {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.case-matrix-xlabel { grid-column: 2; }

.case-matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}

.case-quad {
  padding: 1.1rem;
  border-radius: .75rem;
  border: 2px solid var(--case-rule);
  background: #fff;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.case-quad-name {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .02em;
  margin-bottom: .15em;
}

.case-quad-def {
  font-size: .8rem;
  color: var(--case-muted);
  line-height: 1.4;
}

.case-quad-figs {
  margin-top: .9rem;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
}

.case-quad-pages {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
}

.case-quad-clicks {
  font-size: .82rem;
  font-weight: 600;
  color: var(--case-muted);
}

/* the two quadrants that carry the traffic */
.case-quad--live { border-color: var(--case-accent); background: #f2fafb; }
.case-quad--live .case-quad-pages { color: var(--case-accent); }

/* --- horizontal bar chart (city concentration) --------------------------- */

.case-bars { display: grid; gap: .55rem; }

.case-bar-row {
  display: grid;
  grid-template-columns: minmax(88px, auto) 1fr minmax(96px, auto);
  align-items: center;
  gap: .75rem;
  font-size: .87rem;
}

.case-bar-name { font-weight: 600; }

.case-bar-track {
  background: #e8f1f3;
  border-radius: 999px;
  height: 15px;
  overflow: hidden;
}

.case-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--case-accent);
  min-width: 3px;
}

.case-bar-row--weak .case-bar-fill { background: #c3d2d6; }

.case-bar-val {
  text-align: right;
  color: var(--case-muted);
  font-variant-numeric: tabular-nums;
}

/* --- stat row ------------------------------------------------------------ */

.case-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.25rem;
  text-align: center;
}

.case-stat-num {
  display: block;
  font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.05;
  color: var(--case-accent);
}

.case-stat-label {
  display: block;
  margin-top: .35em;
  font-size: .85rem;
  line-height: 1.4;
  color: var(--case-muted);
}

/* --- tables -------------------------------------------------------------- */

.case-table-scroll { overflow-x: auto; }

.case-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

.case-table th,
.case-table td {
  padding: .7rem .85rem;
  border-bottom: 1px solid var(--case-rule);
  text-align: left;
  vertical-align: top;
}

.case-table thead th {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--case-muted);
  white-space: nowrap;
}

.case-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.case-table tbody tr:last-child th,
.case-table tbody tr:last-child td { border-bottom: 0; }

/* --- numbered process steps ---------------------------------------------- */

.case-steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: .75rem;
}

.case-steps li {
  counter-increment: step;
  background: #fff;
  border: 2px solid var(--case-rule);
  border-radius: .75rem;
  padding: 1rem;
  font-size: .88rem;
  line-height: 1.5;
}

.case-steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9em;
  height: 1.9em;
  margin-bottom: .6rem;
  border-radius: 50%;
  background: var(--case-accent);
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
}

/* --- chip list ----------------------------------------------------------- */

.case-chips {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
}

.case-chips li {
  background: #fff;
  border: 2px solid var(--case-rule);
  border-radius: 999px;
  padding: .45em .95em;
  font-size: .87rem;
  font-weight: 600;
}

/* --- design-system specimen (renders in Tourb's own tokens) -------------- */

.case-specimen {
  --paper: #F4ECDB;
  --ink: #17120D;
  --brand: #FF5A1F;
  --sun: #FFC93C;
  --cobalt: #2540FF;
  --mint: #15B886;

  background: var(--paper);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  padding: clamp(1.1rem, .9rem + 1.5vw, 1.9rem);
  font-family: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
}

.case-swatches {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: .6rem;
  margin-bottom: 1.4rem;
}

.case-swatch {
  border: 2.5px solid var(--ink);
  border-radius: 5px;
  overflow: hidden;
  background: #fff;
}

.case-swatch-chip { height: 46px; }

.case-swatch-meta {
  padding: .4rem .5rem;
  border-top: 2.5px solid var(--ink);
  font-size: .68rem;
  line-height: 1.35;
}

.case-swatch-name { font-weight: 700; display: block; }
.case-swatch-hex { font-variant-numeric: tabular-nums; opacity: .7; }

.case-specimen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.25rem;
  align-items: flex-end;
}

.case-specimen-label {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  opacity: .65;
  margin-bottom: .5rem;
}

/* the button, with the real -2px / +2px pressure metaphor */
.case-btn-demo {
  display: inline-block;
  background: var(--brand);
  color: #fff;
  border: 2.5px solid var(--ink);
  border-radius: 8px;
  padding: .6em 1.3em;
  font: inherit;
  font-weight: 700;
  box-shadow: 5px 5px 0 var(--ink);
  transition: transform .12s cubic-bezier(.2, .8, .2, 1),
              box-shadow .12s cubic-bezier(.2, .8, .2, 1);
}

.case-btn-demo:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 var(--ink);
}

.case-btn-demo:active {
  transform: translate(2px, 2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.case-btn-demo:focus-visible {
  outline: 3px solid var(--cobalt);
  outline-offset: 3px;
}

.case-typescale { line-height: 1.15; }
.case-typescale span { display: block; font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .case-btn-demo { transition: none; }
}

/* --- deliverables list --------------------------------------------------- */

.case-delivers { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }

.case-delivers li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .85rem;
  align-items: start;
  background: #fff;
  border: 2px solid var(--case-rule);
  border-radius: .75rem;
  padding: 1rem 1.15rem;
}

.case-delivers .bi {
  color: var(--case-accent);
  font-size: 1.15rem;
  line-height: 1.5;
}

/* --- before / after pair ------------------------------------------------- */

.case-ba {
  display: grid;
  gap: 1.1rem;
}

.case-ba-row {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  align-items: center;
  gap: 1rem;
}

.case-ba-label {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--case-muted);
}

.case-ba-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: .7rem;
  min-width: 0;
}

.case-ba-track { min-width: 0; }

.case-ba-fill {
  display: block;
  height: 34px;
  border-radius: .4rem;
  background: #c3d2d6;
}

.case-ba-row--after .case-ba-fill { background: var(--case-accent); }

.case-ba-val {
  font-weight: 800;
  font-size: 1.05rem;
  white-space: nowrap;
}

.case-ba-row--after .case-ba-val { color: var(--case-accent); }

/* --- funnel (stage to stage drop) ---------------------------------------- */

.case-funnel { display: grid; gap: .6rem; }

/* Label and value live outside the bar, so the bar stays purely proportional
   and can shrink to any width without pushing text out of itself. */
.case-funnel-row {
  display: grid;
  grid-template-columns: minmax(76px, auto) 1fr minmax(28px, auto);
  align-items: center;
  gap: .85rem;
}

.case-funnel-label { font-weight: 700; font-size: .88rem; }

.case-funnel-track { min-width: 0; }

.case-funnel-fill {
  display: block;
  height: 38px;
  border-radius: .5rem;
  background: var(--case-accent);
}

.case-funnel-val {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.case-funnel-row--drop .case-funnel-fill { background: #b4451f; }
.case-funnel-row--drop .case-funnel-val { color: #b4451f; }

.case-funnel-note {
  text-align: center;
  font-size: .85rem;
  font-weight: 700;
  color: #b4451f;
}

/* --- three-column concept map -------------------------------------------- */

.case-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
}

.case-map-card {
  background: #fff;
  border: 2px solid var(--case-rule);
  border-radius: .75rem;
  padding: 1.1rem;
}

.case-map-stage {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--case-muted);
  margin-bottom: .55rem;
}

.case-map-emotion {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--case-accent);
  line-height: 1.2;
  margin-bottom: .25rem;
}

.case-map-bias { font-size: .85rem; line-height: 1.45; }

/* --- table extras: chosen row + leash tags -------------------------------- */

.case-table tr.is-pick { background: #f2fafb; }
.case-table tr.is-pick td,
.case-table tr.is-pick th { font-weight: 700; }

.case-tag {
  display: inline-block;
  border-radius: 999px;
  padding: .2em .7em;
  font-size: .74rem;
  font-weight: 700;
  white-space: nowrap;
}

.case-tag--free { background: #dff3ec; color: #12664c; }
.case-tag--gated { background: #fdeede; color: #8a4a12; }
.case-tag--human { background: #fadfd7; color: #8c3418; }

/* --- numbered takeaways -------------------------------------------------- */

.case-takeaways { counter-reset: take; list-style: none; padding: 0; margin: 0; }

.case-takeaways li {
  counter-increment: take;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.6rem;
}

.case-takeaways li::before {
  content: counter(take);
  position: absolute;
  left: 0;
  top: -.12em;
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1;
  color: var(--case-accent);
  opacity: .35;
}

/* --- next / footer nav --------------------------------------------------- */

.case-next {
  text-align: center;
  padding-block: clamp(2rem, 1.5rem + 2vw, 3.5rem);
  border-top: 1px solid var(--case-rule);
}

/* --- summary card (top of case): story over a facts footer --------------- */

.case-summary {
  max-width: 860px;
  margin: 0 auto clamp(1.5rem, 1rem + 2vw, 2.5rem);
  border: 4px solid #fff;
  border-radius: 1em;
  background: linear-gradient(2deg, #e9f3f7, #ffffff);
  box-shadow: var(--case-shadow);
  overflow: hidden;
}

.case-summary-story {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: .55rem 1.4rem;
  margin: 0;
  padding: clamp(1.25rem, 1rem + 1.5vw, 1.9rem) clamp(1.25rem, 1rem + 2vw, 2.25rem);
}

.case-summary-story dt {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--case-accent);
  padding-top: .22em;
}

.case-summary-story dd {
  margin: 0;
  line-height: 1.5;
  text-wrap: pretty;
}

.case-summary-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.1rem 1.5rem;
  margin: 0;
  padding: clamp(1.1rem, .9rem + 1vw, 1.5rem) clamp(1.25rem, 1rem + 2vw, 2.25rem);
  border-top: 1px solid var(--case-rule);
  background: rgba(255, 255, 255, .45);
}

.case-summary-facts dt {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--case-muted);
  margin-bottom: .3em;
}

.case-summary-facts dd {
  margin: 0;
  font-weight: 600;
  line-height: 1.45;
}

@media (max-width: 575.98px) {
  .case-summary-story { grid-template-columns: 1fr; gap: .15rem; }
  .case-summary-story dd { margin-bottom: .75rem; }
  .case-summary-story dd:last-child { margin-bottom: 0; }
}

/* --- screenshots --------------------------------------------------------- */

.case-shot img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: .5em;
  background: #fff;
}

/* wider than the reading column, for full-bleed interface shots */
.case-shot--wide { max-width: 1100px; }

/* phone-sized captures: keep them phone-sized, never blown up */
.case-shot--device .case-figure-inner { display: flex; justify-content: center; }
.case-shot--device img { max-width: 300px; border-radius: 1.1em; }

/* tall captures get a scroll window so they can't swallow the page */
.case-shot--tall .case-figure-inner { max-height: 78vh; overflow-y: auto; }

/* before / after, side by side */
.case-compare { max-width: 1100px; }

.case-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(.75rem, .5rem + 1vw, 1.25rem);
}

.case-compare-grid figcaption { margin-top: .55rem; }

.case-compare-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--case-muted);
  margin-bottom: .5rem;
}

.case-compare-grid img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: .5em;
}

@media (max-width: 575.98px) {
  .case-compare-grid { grid-template-columns: 1fr; }
}

/* --- small screens ------------------------------------------------------- */

@media (max-width: 575.98px) {
  .case-matrix-wrap { grid-template-columns: 1fr; }
  .case-matrix-ylabel { writing-mode: horizontal-tb; transform: none; justify-content: flex-start; }
  .case-matrix-xlabel { grid-column: 1; }
  .case-bar-row { grid-template-columns: minmax(76px, auto) 1fr; }
  .case-bar-val { grid-column: 1 / -1; text-align: left; }
}
