:root {
  --bg: #f7f5f0;
  --surface: #ffffff;
  --fg: #16181d;
  --muted: #5d6270;
  --line: #e2ded4;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --live: #1f9d55;
  --radius: 14px;
  --font-display: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111317;
    --surface: #1a1d23;
    --fg: #f1efe9;
    --muted: #a3a8b4;
    --line: #2c3038;
    --accent: #7c9bff;
    --accent-ink: #0d1020;
    --live: #4ade80;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; z-index: 10; background: var(--surface); padding: 8px 12px; border-radius: 8px; }

/* Sticky top bar keeps résumé + LinkedIn one tap away */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--font-display); font-weight: 600; font-size: 18px; text-decoration: none; }
.quick { display: flex; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 999px;
  font: 600 14px/1 var(--font-body); text-decoration: none;
  border: 1.5px solid transparent;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line); background: var(--surface); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* Hero */
.hero {
  display: grid; grid-template-columns: 1fr 280px; gap: 56px; align-items: center;
  padding: 72px 0 64px;
}
.status { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px; font-size: 14px; font-weight: 600; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 22%, transparent); }
.hero h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 600; max-width: 16ch; }
.lede { font-size: 19px; color: var(--muted); max-width: 56ch; margin: 20px 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; }
.text-link { font-weight: 600; font-size: 15px; margin-left: 4px; text-underline-offset: 4px; }
.portrait { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 24px; transform: rotate(2deg); box-shadow: 0 20px 40px -20px rgba(0,0,0,.35); }

/* Case studies */
.work { padding: 24px 0 40px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 40px; margin-bottom: 32px; }
.section-head h2 { font-size: 28px; font-weight: 600; }
.section-head p { margin: 0; color: var(--muted); font-size: 15px; }

.case {
  display: grid; grid-template-columns: 1.25fr 1fr; gap: 40px; align-items: center;
  padding: 24px; margin-bottom: 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
}
.case:nth-of-type(even) { grid-template-columns: 1fr 1.25fr; }
.case:nth-of-type(even) .case-media { order: 2; }
.case-media { display: block; overflow: hidden; border-radius: var(--radius); background: var(--line); aspect-ratio: 16 / 10; }
.case-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.case:hover .case-media img { transform: scale(1.03); }
.case-body { padding: 8px 8px 8px 0; }
.case:nth-of-type(even) .case-body { padding: 8px 0 8px 8px; }
.meta { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.meta span { color: var(--accent); margin-right: 6px; }
.case h3 { font-size: 26px; font-weight: 600; }
.case h3 a { text-decoration: none; }
.case h3 a:hover { text-decoration: underline; text-underline-offset: 5px; }
.case-body > p:not(.meta) { color: var(--muted); margin: 12px 0 20px; }
.stat { display: flex; align-items: center; gap: 14px; margin: 0 0 20px; padding: 14px 16px; border-radius: 12px; background: var(--bg); }
.stat dt { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--accent); white-space: nowrap; line-height: 1; }
.stat dd { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.4; }
.more { font-weight: 600; text-decoration: none; }
.more span { display: inline-block; transition: transform .15s ease; }
.more:hover span { transform: translateX(4px); }

/* Contact */
.contact { text-align: center; padding: 64px 0; }
.contact h2 { font-size: clamp(26px, 3.5vw, 36px); font-weight: 600; max-width: 22ch; margin-inline: auto; }
.contact > p { color: var(--muted); margin: 12px auto 28px; max-width: 52ch; }
.contact .hero-actions { justify-content: center; }

.footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.footer p { margin: 0; }
.footer a { text-underline-offset: 3px; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding: 40px 0 48px; }
  .portrait { width: 160px; order: -1; transform: rotate(-3deg); border-radius: 20px; }
  .case, .case:nth-of-type(even) { grid-template-columns: 1fr; gap: 20px; padding: 16px; }
  .case:nth-of-type(even) .case-media { order: 0; }
  .case-body, .case:nth-of-type(even) .case-body { padding: 0 4px 4px; }
  .case h3 { font-size: 22px; }
}

@media (max-width: 480px) {
  body { font-size: 16px; }
  .quick .btn-ghost span { display: none; }
  .quick .btn-ghost { width: 40px; padding: 0; justify-content: center; }
  .lede { font-size: 17px; }
  .hero-actions .btn-lg { flex: 1 1 auto; justify-content: center; }
  .text-link { width: 100%; margin: 4px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ───────────── Case study pages ───────────── */
.cs-hero { padding: 48px 0 32px; }
.back { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; margin-bottom: 28px; }
.back:hover { color: var(--fg); }
.cs-hero .meta { margin-bottom: 14px; }
.cs-hero h1 { font-size: clamp(34px, 5.4vw, 60px); font-weight: 600; max-width: 20ch; }
.cs-hero .lede { margin: 20px 0 0; max-width: 62ch; }

.snapshot { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; margin: 40px 0 0; padding: 0; background: var(--line); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.snapshot div { background: var(--surface); padding: 18px 20px; }
.snapshot dt { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.snapshot dd { margin: 0; font-size: 15px; line-height: 1.5; }

.cs-cover { margin: 40px 0 0; border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.cs-cover img { width: 100%; }

.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 32px 0 0; padding: 0; list-style: none; }
.toc a { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600; text-decoration: none; }
.toc a:hover { border-color: var(--fg); }

/* Reading column: text stays narrow, figures break out wider */
.cs-body { padding: 24px 0 48px; }
.cs-body > * { max-width: 700px; margin-inline: auto; }
.cs-body > .wide { max-width: 1040px; }
.cs-body section { max-width: none; scroll-margin-top: 88px; }
.cs-body section > * { max-width: 700px; margin-inline: auto; }
.cs-body section > .wide { max-width: 1040px; }

.cs-body h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 600; margin-top: 72px; margin-bottom: 16px; }
.cs-body h2 .num { display: block; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; font-family: var(--font-body); }
.cs-body h3 { font-size: 20px; font-weight: 600; margin-top: 40px; margin-bottom: 8px; }
.cs-body p, .cs-body li { color: color-mix(in srgb, var(--fg) 82%, var(--bg)); }
.cs-body p { margin-top: 0; margin-bottom: 18px; }
.cs-body strong { color: var(--fg); font-weight: 600; }
.cs-body a:not(.btn) { text-underline-offset: 3px; }

.quote { margin: 40px auto; padding: 4px 0 4px 24px; border-left: 4px solid var(--accent); font-family: var(--font-display); font-size: clamp(22px, 2.8vw, 28px); font-weight: 500; line-height: 1.3; color: var(--fg); }
.quote p { color: inherit !important; margin: 0 !important; }

.points { list-style: none; padding: 0; display: grid; gap: 12px; margin-bottom: 28px; }
.points li { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.points li strong { display: block; margin-bottom: 4px; }

.steps { list-style: none; padding: 0; margin-bottom: 28px; display: grid; gap: 8px; }
.steps li { position: relative; padding-left: 28px; }
.steps li::before { content: ""; position: absolute; left: 4px; top: .62em; width: 10px; height: 10px; border-radius: 3px; background: var(--accent); opacity: .85; }

.levels { list-style: none; padding: 0; counter-reset: lvl; display: grid; gap: 10px; margin-bottom: 28px; }
.levels li { counter-increment: lvl; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.levels li::before { content: counter(lvl); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 600 15px var(--font-display); }

/* Figures */
.fig { margin: 36px auto; }
.fig img { margin-inline: auto; border-radius: 14px; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
.fig figcaption { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--muted); text-align: center; max-width: 64ch; margin-inline: auto; }
.fig figcaption strong { display: block; color: var(--fg); font-size: 15px; margin-bottom: 2px; }
.fig-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 36px auto; }
.fig-grid .fig { margin: 0; }
.fig-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Outcomes */
.outcomes { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 8px auto 28px; }
.outcomes > div { padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.outcomes b { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1.1; margin-bottom: 8px; }
.outcomes span { font-size: 15px; line-height: 1.5; }

.lesson { margin: 40px auto; padding: 24px; border-radius: 18px; background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
.lesson h3 { margin-top: 0; }
.lesson p:last-child, .lesson ul:last-child { margin-bottom: 0; }

/* Next case study */
.next { border-top: 1px solid var(--line); padding: 48px 0 16px; }
.next-label { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 16px; }
.next-card { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; align-items: center; padding: 20px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); text-decoration: none; }
.next-card img { border-radius: 14px; aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.next-card h2 { font-size: clamp(22px, 3vw, 30px); font-weight: 600; margin: 6px 0 10px; }
.next-card p { margin: 0; color: var(--muted); }
.next-card .more { display: inline-block; margin-top: 16px; }
.next-card:hover .more span { transform: translateX(4px); }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 96vw; max-height: 94vh; }
.lightbox::backdrop { background: rgba(10, 12, 16, .86); }
.lightbox img { max-width: 96vw; max-height: 94vh; width: auto; border-radius: 10px; background: #fff; }
.lightbox button { position: fixed; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: #111; font-size: 22px; cursor: pointer; }

@media (max-width: 860px) {
  .cs-hero { padding: 28px 0 16px; }
  .fig-grid, .fig-grid.three { grid-template-columns: 1fr; }
  .next-card { grid-template-columns: 1fr; gap: 16px; padding: 14px; }
  .cs-body h2 { margin-top: 56px; }
}

/* Data tables (case studies) */
.table-wrap { margin: 32px auto; }
.table-box { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.table-wrap figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); text-align: center; }
.data { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.data th, .data td { padding: 14px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.data tbody tr:last-child > * { border-bottom: 0; }
.data thead th { background: var(--accent); color: var(--accent-ink); font: 600 13px/1.3 var(--font-body); letter-spacing: .04em; text-transform: uppercase; border-bottom: 0; }
.data tbody th { font-weight: 600; color: var(--fg); width: 22%; }
.data tbody td { color: color-mix(in srgb, var(--fg) 82%, var(--bg)); }
.data tbody tr:nth-child(even) > * { background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.data tbody tr:hover > * { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }

/* Phones: each row becomes a labelled card */
@media (max-width: 640px) {
  .data, .data tbody, .data tr, .data th, .data td { display: block; width: 100%; }
  .table-box { border: 0; background: transparent; border-radius: 0; overflow: visible; }
  .table-wrap { display: flex; flex-direction: column; }
  .data thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-wrap figcaption { order: -1; margin: 0 0 10px; text-align: left; }
  .data tbody tr { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
  .data tbody tr > *, .data tbody tr:nth-child(even) > *, .data tbody tr:hover > * { background: transparent; }
  .data tbody th { width: auto; padding: 12px 16px; background: var(--accent) !important; color: var(--accent-ink); }
  .data tbody td { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .data tbody tr > td:last-child { border-bottom: 0; }
  .data td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  .data td[data-label=""]::before { display: none; }
}
