/* Shared by /projects/ and the case-study pages. Tokens match the homepage. */
:root {
  --bg: #fbfaf7; --surface: #ffffff; --fg: #1d1d1b; --muted: #62615c; --rule: #e4e2db;
  --accent: #1f5f8b; --accent-soft: #e6eff6; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.06);
  --header: rgba(251,250,247,.85);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131312; --surface: #1c1c1a; --fg: #e8e6e1; --muted: #a3a19a; --rule: #2e2d2a;
    --accent: #7fb6dc; --accent-soft: #1d2c37; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
    --header: rgba(19,19,18,.85);
  }
}
:root[data-theme="dark"] {
  --bg: #131312; --surface: #1c1c1a; --fg: #e8e6e1; --muted: #a3a19a; --rule: #2e2d2a;
  --accent: #7fb6dc; --accent-soft: #1d2c37; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.3);
  --header: rgba(19,19,18,.85);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 1.03125rem/1.6 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
html { font-size: clamp(100%, calc(0.385vw + 65.4%), 137.5%); }  /* 16px up to ~1440px wide, growing to 22px by ~3000px: the whole layout scales on large screens */
:root { --gutter: clamp(1rem, 4vw, 2.5rem); }  /* side gutter: 16px on phones, 40px from about 1000px */
.wrap { max-width: calc(58rem + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }  /* text stays 58rem wide on large screens */
.article .wrap { max-width: calc(48rem + 2 * var(--gutter)); }  /* case studies: header, content and footer share one column */

/* header */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--header); backdrop-filter: saturate(1.5) blur(10px);
  -webkit-backdrop-filter: saturate(1.5) blur(10px); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; height: 3.5rem; }
.brand { font-weight: 650; color: var(--fg); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); text-decoration: none; padding: .35rem .65rem; border-radius: 6px; font-size: .95rem; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); background: var(--accent-soft); }
.icon-btn { background: none; border: 1px solid var(--rule); color: var(--fg); border-radius: 6px; width: 2rem; height: 2rem;
  display: grid; place-items: center; cursor: pointer; margin-left: .25rem; }
.theme-btn .sun { display: none; }
:root[data-theme="dark"] .theme-btn .sun { display: block; } :root[data-theme="dark"] .theme-btn .moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-btn .sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .moon { display: none; } }

/* breadcrumb + intro */
.crumbs { font-size: .85rem; color: var(--muted); padding: 1.2rem 0 0; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--fg); }
.intro { padding: 1.5rem 0 .5rem; }
.intro h1 { font-size: clamp(1.9rem, 4vw, 2.5rem); line-height: 1.15; margin: .2rem 0 .8rem; letter-spacing: -.015em; }
.intro p { margin: 0 0 .8rem; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 650; color: var(--accent); }
.statrow { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; list-style: none; padding: .8rem 0; margin: 1rem 0 .4rem;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); color: var(--muted); font-size: .92rem; }
.statrow b { color: var(--fg); font-size: 1.05rem; }

/* sections */
.group { padding: 2.4rem 0 0; }
.group > h2 { font-size: 1.6rem; margin: 0 0 .6rem; letter-spacing: -.01em; }
.group > .sub { color: var(--muted); margin: 0 0 1rem; }

/* project cards: media left, body right */
.pj { background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; box-shadow: var(--shadow); margin-top: 1rem; overflow: hidden; }
.pj-row { display: grid; grid-template-columns: 18rem 1fr; gap: 1.4rem; padding: 1.2rem; align-items: center; }
.pj-row + .pj-row { border-top: 1px solid var(--rule); }
.pj-media { display: block; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--rule); }
.pj-media img { width: 100%; height: 100%; object-fit: contain; display: block; } .pj-media img.cover { object-fit: cover; }
.pj-row h3 { font-size: 1.2rem; margin: .15rem 0 .35rem; line-height: 1.3; }
.pj-row p { margin: .35rem 0; }
.stats { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .88rem; color: var(--muted); margin: .2rem 0 .3rem; }
.stats b { color: var(--fg); }
.actions { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center; margin-top: .7rem; }
.link { font-size: .9rem; text-decoration: none; font-weight: 550; } .link:hover { text-decoration: underline; }

/* small cards */
.mini { display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1rem; margin-top: 1rem; }
.mini a { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 1rem; color: var(--fg); text-decoration: none; }
.mini a:hover { border-color: var(--accent); }
.tag { display: inline-block; border: 1px solid var(--rule); border-radius: 999px; padding: 0 .55rem; font-size: .72rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; }
.mini h3 { font-size: 1.02rem; margin: .5rem 0 .2rem; } .mini p { margin: 0; color: var(--muted); font-size: .9rem; }

/* screenshot carousel */
.carousel { margin-top: 1.2rem; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
  border: 1px solid var(--rule); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.track::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: reduce) { .track { scroll-behavior: auto; } }
.slide { flex: 0 0 100%; scroll-snap-align: start; margin: 0; padding: .8rem .8rem .6rem; }
.slide img { width: 100%; aspect-ratio: 16 / 10; height: auto; object-fit: contain; display: block; border-radius: 8px; }
.slide figcaption { color: var(--muted); font-size: .88rem; margin-top: .5rem; text-align: center; }
.controls { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: .7rem; }
.nav-btn { background: var(--surface); border: 1px solid var(--rule); color: var(--fg); border-radius: 999px; width: 2.2rem; height: 2.2rem; cursor: pointer; font-size: 1rem; }
.nav-btn:hover { border-color: var(--accent); }
.dots { display: flex; gap: .45rem; }
.dots button { width: .55rem; height: .55rem; border-radius: 50%; border: 0; padding: 0; background: var(--rule); cursor: pointer; }
.dots button[aria-current="true"] { background: var(--accent); }

/* section write-ups */
.lead { margin: 0; }
.takeaway { margin: 1.2rem 0 0; padding: .6rem .9rem; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 8px 8px 0; font-size: .95rem; }

/* case-study prose */
.prose h3 { font-size: 1.05rem; margin: 1.8rem 0 .4rem; }
.prose p { margin: .5rem 0; }
.prose ul { padding-left: 1.2rem; } .prose li { margin: .3rem 0; }
.diagram { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: .8rem; overflow-x: auto; margin-top: 1.2rem; }
.diagram svg { width: 100%; min-width: 34rem; height: auto; display: block; }
.diagram text { fill: var(--fg); font: 12.5px system-ui, sans-serif; } .diagram .sub { fill: var(--muted); font-size: 11px; }
.diagram rect { fill: var(--bg); stroke: var(--rule); } .diagram rect.key { stroke: var(--accent); fill: var(--accent-soft); }
.diagram line { stroke: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: .93rem; margin: 1.2rem 0 .6rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--rule); }
caption { text-align: left; font-size: .82rem; font-weight: 600; color: var(--accent); padding: .2rem 0 .3rem; }
table + table { margin-top: 1.6rem; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; } td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; list-style: none; margin: 1.2rem 0 0; }
.chips li { border: 1px solid var(--rule); border-radius: 999px; padding: .15rem .65rem; font-size: .85rem; color: var(--muted); }
.note { color: var(--muted); font-size: .88rem; }
footer { border-top: 1px solid var(--rule); padding: 1.5rem 0 3rem; color: var(--muted); font-size: .9rem; margin-top: 2rem; }

@media (max-width: 720px) {
  .pj-row { grid-template-columns: 1fr; gap: .9rem; }
  .nav a.hide-sm { display: none; }
}

/* screenshot lightbox */
.slide a { cursor: zoom-in; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; cursor: zoom-out; }
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; }
.lightbox::backdrop { background: rgba(0, 0, 0, .88); }
.lightbox img { max-width: 94vw; max-height: 84vh; width: auto; height: auto; border-radius: 8px; box-shadow: 0 8px 40px rgba(0, 0, 0, .5); }
.lightbox p { color: #d6d4cf; font-size: .9rem; margin: 0; padding: 0 1rem; text-align: center; max-width: 60rem; }
.lb-close { position: fixed; top: .75rem; right: 1rem; width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lb-close:hover { background: rgba(255, 255, 255, .22); }

.toc { font-size: .88rem; color: var(--muted); margin: .4rem 0 .6rem; line-height: 1.9; }
.toc span { display: block; text-transform: uppercase; letter-spacing: .08em; font-size: .7rem; font-weight: 650; color: var(--muted); }
.toc a { text-decoration: none; } .toc a:hover { text-decoration: underline; }
[id] { scroll-margin-top: 4.5rem; }
