/* Shared styles for every page under /case-studies/.
   The :root tokens mirror the :root block in /index.html. Change a token in both places. */
:root {
    --paper: #f3f1ea;
    --paper-2: #eae7de;
    --ink: #121212;
    --ink-2: #55554f;
    --ink-3: #8a8a82;
    --line: rgba(18,18,18,0.14);
    --accent: #2b3cff;
    --accent-ink: #ffffff;
    --display: 'Inter Tight', 'Inter', system-ui, sans-serif;
    --serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
    --gutter: clamp(1.25rem, 4vw, 3.5rem);
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --radius: 20px;
    color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: var(--display); background: var(--paper); color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; font-size: 1.0625rem; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; color: var(--accent); }
.wrap { padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); column-gap: 1.5rem; }
.mono { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.icon { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:is(a, button, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.75rem; padding: 1rem 1.5rem; border-radius: 999px; border: 1px solid var(--ink); font: 500 0.95rem/1 var(--display); text-decoration: none; color: var(--ink); background: transparent; position: relative; overflow: hidden; isolation: isolate; transition: color 0.35s var(--ease), border-color 0.35s var(--ease); white-space: nowrap; }
.btn::before { content: ""; position: absolute; inset: 0; background: var(--ink); z-index: -1; transform: translateY(101%); transition: transform 0.45s var(--ease); border-radius: inherit; }
.btn:hover { color: var(--paper); }
.btn:hover::before { transform: translateY(0); }
.btn-fill { background: var(--ink); color: var(--paper); }
.btn-fill::before { background: var(--accent); }
.btn-fill:hover { color: var(--accent-ink); border-color: var(--accent); }
.btn .arr { width: 1.1em; height: 1.1em; transition: transform 0.35s var(--ease); }
.btn:hover .arr { transform: translateX(4px); }

/* ---------- Nav ---------- */
.site-nav { position: sticky; top: 0; z-index: 100; background: rgba(243,241,234,0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; padding: 1.25rem var(--gutter); }
.wordmark { font: 600 1rem/1 var(--display); letter-spacing: -0.02em; text-decoration: none; display: inline-flex; align-items: baseline; gap: 0.35rem; }
.wordmark small { font: 400 0.78rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { text-decoration: none; font: 500 0.85rem/1 var(--display); opacity: 0.85; }
.nav-links a:hover, .nav-links a[aria-current] { opacity: 1; }
.nav-cta { font: 500 0.85rem/1 var(--display); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Page head ---------- */
.crumbs { padding-top: 2rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--ink-3); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.page-head { padding-block: clamp(2.5rem, 7vh, 5rem) clamp(2.5rem, 6vh, 4rem); }
.page-head h1 { grid-column: 1 / span 10; font-size: clamp(2.4rem, 5.4vw, 5.4rem); font-weight: 600; line-height: 0.96; letter-spacing: -0.04em; text-wrap: balance; }
.lede { grid-column: 1 / span 7; margin-top: 1.5rem; font-size: clamp(1.05rem, 1.4vw, 1.25rem); color: var(--ink-2); line-height: 1.45; text-wrap: pretty; }
.tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin-bottom: 1.5rem; }
.tags .mono b { color: var(--ink); font-weight: 500; }

/* ---------- Sections ---------- */
section { padding-block: clamp(3rem, 8vh, 5.5rem); }
.sec-head { padding-bottom: 1rem; border-bottom: 1px solid var(--ink); margin-bottom: clamp(2rem, 5vh, 3rem); }
.sec-head .mono { color: var(--ink); }
h2 { font-size: clamp(1.8rem, 3.6vw, 3.4rem); font-weight: 600; line-height: 1; letter-spacing: -0.035em; text-wrap: balance; }
.prose { grid-column: 1 / span 7; }
.prose p + p { margin-top: 1rem; }
.prose p { color: var(--ink-2); max-width: 62ch; }
.aside { grid-column: 9 / span 4; }

/* ---------- Facts strip ---------- */
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.facts div { display: flex; flex-direction: column; gap: 0.35rem; }
.facts b { font-size: clamp(1.4rem, 2.4vw, 2.2rem); font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.facts small { color: var(--ink-2); font-size: 0.85rem; line-height: 1.35; max-width: 24ch; }

/* ---------- Before / after ---------- */
.ba { grid-column: 1 / -1; width: 100%; border-collapse: collapse; font-size: 1rem; }
.ba th, .ba td { text-align: left; padding: 1rem 1rem 1rem 0; border-top: 1px solid var(--line); vertical-align: top; }
.ba thead th { border-top: 0; padding-top: 0; }
.ba tbody th { font-weight: 500; width: 22%; }
.ba td:nth-child(2) { color: var(--ink-2); }
.ba td:nth-child(3) { font-weight: 500; }
.ba td:nth-child(3)::before { content: "→ "; color: var(--accent); }
.ba.plain td:nth-child(3)::before { content: none; } /* comparisons that are not before/after */

/* ---------- Numbered lists ---------- */
.steps { grid-column: 1 / span 8; list-style: none; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 3rem 1fr; gap: 0.35rem 1rem; padding: 1.4rem 0; border-top: 1px solid var(--line); }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before { counter-increment: s; content: "0" counter(s); grid-row: 1 / span 2; font: 400 0.75rem/2.2 var(--mono); color: var(--ink-3); }
.steps h3 { font-size: clamp(1.15rem, 1.7vw, 1.45rem); font-weight: 500; letter-spacing: -0.02em; line-height: 1.2; }
.steps p { color: var(--ink-2); max-width: 60ch; }

/* ---------- Dark band: results and lessons ---------- */
.dark { background: var(--ink); color: var(--paper); }
.dark .sec-head { border-color: rgba(243,241,234,0.5); }
.dark .sec-head .mono, .dark .mono { color: rgba(243,241,234,0.6); }
.dark .facts { border-color: rgba(243,241,234,0.2); }
.dark .facts small, .dark .steps p { color: rgba(243,241,234,0.65); }
.dark .steps li, .dark .steps li:last-child { border-color: rgba(243,241,234,0.2); }
.dark .steps li::before { color: rgba(243,241,234,0.45); }
.pull { grid-column: 1 / span 9; margin-top: clamp(2.5rem, 6vh, 4rem); }
.pull blockquote { font: 500 clamp(1.8rem, 3.8vw, 3.6rem)/1.02 var(--display); letter-spacing: -0.035em; margin: 0.75rem 0 1rem; }
.pull p { color: rgba(243,241,234,0.7); max-width: 58ch; }

/* ---------- Engagement card ---------- */
.card { border: 1px solid var(--ink); padding: 1.5rem; background: var(--paper); }
.card dl { display: grid; gap: 1rem; }
.card dt { font: 400 0.75rem/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.35rem; }
.card dd { font-size: 0.98rem; }

/* ---------- FAQ ---------- */
.faq { grid-column: 1 / span 8; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 1.3rem 0; display: flex; justify-content: space-between; gap: 2rem; font-size: clamp(1.05rem, 1.5vw, 1.3rem); font-weight: 500; letter-spacing: -0.02em; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-weight: 400; transition: transform 0.4s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 1.4rem; color: var(--ink-2); max-width: 62ch; }

/* ---------- Listing cards ---------- */
.cases { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; list-style: none; }
.case-card { display: flex; flex-direction: column; gap: 1rem; height: 100%; padding: clamp(1.5rem, 3vw, 2.25rem); border: 1px solid var(--ink); text-decoration: none; transition: background 0.35s var(--ease), color 0.35s var(--ease); }
.case-card h2 { font-size: clamp(1.5rem, 2.6vw, 2.3rem); }
.case-card p { color: var(--ink-2); }
.case-card .more { margin-top: auto; display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.case-card:hover { background: var(--ink); color: var(--paper); }
.case-card:hover p, .case-card:hover .mono { color: rgba(243,241,234,0.7); }
.case-card:hover em { color: #8a95ff; }
.case-card.soon { border-style: dashed; border-color: var(--ink-3); justify-content: center; }
.case-card.soon:hover { background: none; color: inherit; }

/* ---------- CTA band ---------- */
.cta-band { background: var(--paper-2); }
.cta-band h2 { grid-column: 1 / span 8; font-size: clamp(2.2rem, 5vw, 4.8rem); }
.cta-band .lede { grid-column: 1 / span 6; }
.cta-band .btn { margin-top: 2rem; }

/* ---------- Footer ---------- */
footer { background: var(--ink); color: rgba(243,241,234,0.6); padding: 2rem var(--gutter); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; font: 400 0.78rem/1.6 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
footer a { color: rgba(243,241,234,0.85); text-decoration: none; }
footer a:hover { color: #fff; }
footer nav { display: flex; flex-wrap: wrap; gap: 1.5rem; }

/* ---------- Video ---------- */
.film { margin: 0; }
.film video { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--ink); }
.film .film-tall { display: none; }
.film figcaption { margin-top: 0.75rem; }
.film-frame { position: relative; }
/* The button covers the whole video except the native control bar, so a click anywhere on the paused video plays it.
   The circle inside is the visual; the play/pause bar at the bottom stays clickable. */
.film-play { position: absolute; inset: 0 0 3.5rem; display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--radius) var(--radius) 0 0; transition: opacity 0.3s var(--ease); animation: film-play-in 0.4s var(--ease); }
.film-play-dot { width: clamp(64px, 9vw, 96px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: var(--paper); color: var(--accent); box-shadow: 0 10px 30px rgba(0,0,0,0.3); opacity: 0.75; transform: translateY(1.75rem); transition: transform 0.3s var(--ease), opacity 0.3s var(--ease); }
.film-play-dot svg { width: 38%; height: 38%; margin-left: 8%; fill: currentColor; }
@keyframes film-play-in { from { opacity: 0; } }
.film-play:hover .film-play-dot, .film-play:focus-visible .film-play-dot { opacity: 1; }
.film-play:hover .film-play-dot { transform: translateY(1.75rem) scale(1.08); }
.film-play:focus-visible { outline: none; }
.film-play:focus-visible .film-play-dot { outline: 3px solid var(--accent-ink); outline-offset: 4px; }
.film-frame.is-playing .film-play { opacity: 0; pointer-events: none; }
.film-play[hidden] { display: none; } /* display: grid above would otherwise override the hidden attribute */

/* ---------- Motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn, .btn::before, .btn .arr, .case-card, .faq summary::after, .film-play, .film-play-dot { transition: none; }
    .film-play { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .page-head h1, .lede, .prose, .aside, .steps, .faq, .pull, .cta-band h2, .cta-band .lede { grid-column: 1 / -1; }
    .aside { margin-top: 2rem; }
    .facts { grid-template-columns: repeat(2, 1fr); }
    .cases { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    body { font-size: 1rem; }
    .nav-links { display: none; }
    .facts { grid-template-columns: 1fr; }
    .ba thead { display: none; }
    .ba tr { display: grid; grid-template-columns: 1fr; padding: 1rem 0; border-top: 1px solid var(--line); }
    .ba th, .ba td { border: 0; padding: 0.15rem 0; width: auto; }
    .ba td:nth-child(2)::before { content: "Before: "; color: var(--ink-3); }
    .ba.plain td:nth-child(2)::before { content: none; }
    .cta-band .btn { width: 100%; justify-content: center; }
}
@media (max-width: 700px) and (orientation: portrait) {
    .film .film-wide { display: none; }
    .film .film-tall { display: block; width: min(100%, calc(85svh * 9 / 16)); margin-inline: auto; }
}
