/* Pivot Labs case study pages: shared design (matches homepage, About, Contact) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --ink: #0B0C0E; --ink-2: #2A2C30; --mute: #5E646B; --mist: #F2F4F4; --card: #FFFFFF;
  --brand: #127BBC; --aqua: #5DD3E3; --ice: #B8F2EE; --pill: #C9F1EC; --pill-2: #B3E9E3; --glow: #E3F7F4;
  --line: #E3E8E9; --font: 'Geist', system-ui, sans-serif; --max: 1240px; --r: 14px;
}
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--mist); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 32px; }

/* Pill buttons */
.pill { display: inline-flex; align-items: stretch; font-size: 13.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink); }
.pill > span { background: var(--pill); display: flex; align-items: center; transition: background .2s, transform .2s; }
.pill .t { padding: 15px 26px; border-radius: 12px 0 0 12px; }
.pill .i { padding: 0 18px; border-radius: 0 12px 12px 0; margin-left: 2px; font-size: 15px; }
.pill:hover > span { background: var(--pill-2); }
.pill:hover .i { transform: translateX(3px); }
.pill.ghost > span { background: #FFFFFFCC; }
.pill.ghost:hover > span { background: #fff; }

/* NAV */
.nav { position: fixed; top: 16px; left: 0; right: 0; z-index: 50; }
.nav .wrap { display: flex; justify-content: space-between; align-items: center; }
.nav-group { display: flex; gap: 2px; }
.nav-group > * { background: #FFFFFFE6; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: flex; align-items: center; }
.nav-logo { padding: 10px 18px; border-radius: 12px 0 0 12px; font-weight: 600; font-size: 19px; letter-spacing: -.02em; gap: 10px; }
.nav-logo svg { width: 24px; height: 24px; }
.nav-links { border-radius: 0 12px 12px 0; padding: 0 8px; gap: 2px; }
.nav-links a { font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; padding: 9px 12px; border-radius: 8px; color: var(--ink-2); transition: background .15s; }
.nav-links a:hover, .nav-links a[aria-current] { background: #0B0C0E0D; }
.nav-cta .t { padding: 13px 20px; }
.nav-cta .i { padding: 0 15px; }

/* HEADER */
.cs-header { padding: 150px 0 40px; position: relative; overflow: hidden; }
.cs-header::before { content: ''; position: absolute; right: -10%; top: -30%; width: 70%; height: 150%; background: radial-gradient(closest-side, #5DD3E333, transparent); pointer-events: none; }
.cs-header-inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; position: relative; }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-bottom: 28px; }
.back:hover { text-decoration: underline; text-underline-offset: 4px; }
.cs-header h1 { font-size: clamp(52px, 9vw, 128px); font-weight: 500; letter-spacing: -.055em; line-height: .92; margin-bottom: 18px; }
.cs-kicker { font-size: clamp(20px, 2.2vw, 28px); line-height: 1.3; letter-spacing: -.015em; color: var(--ink-2); max-width: 760px; margin-bottom: 40px; }
.meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.meta > div { background: var(--card); padding: 18px 22px; }
.meta dt { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); margin-bottom: 4px; }
.meta dd { font-size: 16.5px; font-weight: 500; letter-spacing: -.01em; }

/* HERO SHOT */
.hero-shot { padding: 0 0 72px; }
.hero-shot-inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; }
.hero-shot img { width: 100%; border-radius: 18px; box-shadow: 0 40px 80px -50px #127BBC88, 0 0 0 1px #0B0C0E0F; background: #fff; }

/* ARTICLE LAYOUT with sticky contents */
article { padding: 0 0 96px; }
.article-inner { max-width: var(--max); margin: 0 auto; padding: 0 32px; display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 56px; }
.toc { grid-column: 1; grid-row: 1 / span 999; align-self: start; position: sticky; top: 96px; background: var(--card); border-radius: var(--r); padding: 20px; max-height: calc(100vh - 120px); overflow: auto; }
.toc b { display: block; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .1em; color: var(--mute); margin-bottom: 10px; }
.toc a { display: block; font-size: 14px; line-height: 1.35; color: var(--ink-2); padding: 6px 10px; margin: 0 -10px; border-radius: 8px; transition: background .15s, color .15s; }
.toc a:hover { background: var(--mist); }
.toc a.on { background: var(--pill); color: var(--ink); }
.cs-section { grid-column: 2; background: var(--card); border-radius: var(--r); padding: 44px 48px; margin-bottom: 16px; scroll-margin-top: 96px; min-width: 0; }
.cs-section h2 { font-size: clamp(28px, 3vw, 40px); font-weight: 500; letter-spacing: -.035em; line-height: 1.08; margin-bottom: 18px; }
.cs-section h3 { font-size: 21px; font-weight: 500; letter-spacing: -.02em; margin: 32px 0 10px; }
.cs-section h4 { font-size: 17px; font-weight: 600; margin: 24px 0 8px; }
.cs-section p, .cs-section li { font-size: 17px; color: var(--ink-2); max-width: 760px; }
.cs-section p + p { margin-top: 14px; }
.cs-section strong { color: var(--ink); font-weight: 600; }
.cs-section em { font-style: normal; color: var(--brand); font-weight: 500; }
.cs-section ul:not(.facts), .cs-section ol { padding-left: 22px; margin: 14px 0; display: grid; gap: 6px; }
.cs-section a:not(.proto) { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

/* Facts: problem / role / decision cards */
.facts { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 28px 0 8px; padding: 0; }
.facts li { background: var(--mist); border-radius: 12px; padding: 18px 20px; font-size: 15.5px; line-height: 1.5; max-width: none; }
.facts li strong { display: block; font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-bottom: 6px; }

/* Figures */
figure { margin: 28px 0; }
figure img { width: 100%; border-radius: 12px; box-shadow: 0 0 0 1px #0B0C0E14; background: #fff; cursor: zoom-in; transition: transform .25s, box-shadow .25s; }
figure img:hover { box-shadow: 0 0 0 1px #0B0C0E14, 0 24px 50px -30px #127BBC66; }
figcaption { font-size: 13.5px; color: var(--mute); margin-top: 10px; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 28px 0; }
.gallery figure { margin: 0; }
.gallery.phones { grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gallery.phones img { border-radius: 18px; aspect-ratio: 644 / 1400; height: auto; object-fit: contain; }
.cs-section .proto + .proto { margin-left: 8px; }

/* Metrics */
.metric { display: inline-flex; flex-direction: column; vertical-align: top; min-width: 200px; max-width: 280px; margin: 20px 28px 4px 0; padding-top: 14px; border-top: 1.5px solid var(--ink); }
.metric .value { font-size: clamp(40px, 4.4vw, 60px); font-weight: 500; letter-spacing: -.05em; line-height: 1; margin-bottom: 8px; color: var(--ink); }
.metric .label { font-size: 14px; color: var(--mute); line-height: 1.45; }

/* Callout and quote */
.callout { background: var(--glow); border-radius: 12px; padding: 22px 26px; margin: 24px 0; font-size: 19px; line-height: 1.45; letter-spacing: -.01em; color: var(--ink); border-left: 3px solid var(--brand); }
blockquote { margin: 24px 0; padding: 22px 26px; background: var(--mist); border-radius: 12px; font-size: 19px; line-height: 1.45; }

/* External link button */
.proto { display: inline-flex; align-items: center; gap: 10px; margin-top: 22px; background: var(--ink); color: #fff; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; padding: 14px 20px; border-radius: 12px; transition: background .2s; }
.proto:hover { background: var(--brand); }

/* NEXT / FINAL */
.cs-next { padding: 0 0 16px; }
.cs-next .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cs-next a { background: var(--card); border-radius: var(--r); padding: 28px 32px; display: flex; flex-direction: column; gap: 6px; transition: transform .25s, box-shadow .25s; }
.cs-next a:hover { transform: translateY(-3px); box-shadow: 0 24px 50px -30px #127BBC66; }
.cs-next small { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); }
.cs-next b { font-size: clamp(26px, 3vw, 38px); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; }
.cs-next span { font-size: 15px; color: var(--ink-2); }
.cs-next a.nx { text-align: right; align-items: flex-end; }
.final { margin: 80px 16px 16px; border-radius: 20px; color: #fff; text-align: center; padding: 112px 24px; background: radial-gradient(50% 60% at 50% 100%, #5DD3E355, transparent 70%), linear-gradient(180deg, #8FA5AB, #6F878E); }
.final h2 { font-size: clamp(36px, 5vw, 64px); font-weight: 500; letter-spacing: -.04em; line-height: 1; margin-bottom: 20px; }
.final p { font-size: 19px; max-width: 520px; margin: 0 auto 36px; opacity: .92; }
.final .ctas { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* Lightbox */
.lb { position: fixed; inset: 0; z-index: 200; background: #0B0C0EE6; display: none; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; }
.lb.open { display: flex; }
.lb img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 40px 80px #0008; }
.lb button { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 12px; border: 0; background: #fff; font-size: 20px; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (max-width: 1000px) {
  .article-inner { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
  .cs-section { grid-column: 1; }
}
@media (max-width: 900px) {
  .nav-links { display: none !important; }
  .nav-logo { border-radius: 12px; }
  .cs-header { padding: 120px 0 32px; }
  .meta { grid-template-columns: 1fr 1fr; }
  .cs-section { padding: 32px 26px; }
  .cs-next .wrap { grid-template-columns: 1fr; }
  .cs-next a.nx { text-align: left; align-items: flex-start; }
}
@media (max-width: 560px) {
  .wrap, .cs-header-inner, .hero-shot-inner, .article-inner { padding-left: 16px; padding-right: 16px; }
  .nav { top: 10px; }
  .nav-cta .t { padding: 12px 14px; }
  .cs-section { padding: 26px 20px; }
  .gallery { grid-template-columns: 1fr; }
  .gallery.phones { grid-template-columns: 1fr 1fr; gap: 10px; }
  .metric { min-width: 140px; margin-right: 18px; }
  .final { margin: 64px 8px 8px; padding: 88px 20px; }
}
