/* Portfolio — hand-written CSS. No framework, no build step, no external requests.
   Must stay CSP-compatible: no inline <style>, no remote fonts, no @import. */

:root {
  --ink:        #10151f;
  --ink-2:      #35415a;
  --muted:      #6a7793;
  --faint:      #97a2ba;
  --line:       #e2e7f0;
  --line-soft:  #eef1f7;
  --bg:         #fbfcfe;
  --card:       #ffffff;
  --accent:     #1b4dd8;
  --accent-ink: #12369b;
  --accent-bg:  #eaf0ff;
  --warm:       #b4560a;
  --warm-bg:    #fdf4ea;
  --good:       #0f7a52;
  --good-bg:    #e8f6f0;
  --radius:     12px;
  --stack: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --shadow: 0 1px 2px rgba(16,21,31,.04), 0 8px 24px -12px rgba(16,21,31,.10);
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e9eef8; --ink-2: #c2ccdf; --muted: #8f9bb5; --faint: #6d7893;
    --line: #24304a; --line-soft: #1b2438; --bg: #0b1018; --card: #121a28;
    --accent: #7fa6ff; --accent-ink: #a8c4ff; --accent-bg: #16233d;
    --warm: #e0a15f; --warm-bg: #2a1f12; --good: #5fc79c; --good-bg: #10241d;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--stack);
  font-size: 16.5px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.wrap, .narrow {
  /* Fallback first for engines without min(): padding + max-width still centers. */
  width: 100%;
  padding-left: 1.375rem;
  padding-right: 1.375rem;
  margin-left: auto;
  margin-right: auto;
}
.wrap   { max-width: 1080px; }
.narrow { max-width: 760px; }
/* Modern engines: drop the padding and use the exact gutter. */
@supports (width: min(10px, 10px)) {
  .wrap, .narrow { padding-left: 0; padding-right: 0; }
  .wrap   { width: min(1080px, calc(100% - 2.75rem)); }
  .narrow { width: min(760px,  calc(100% - 2.75rem)); }
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-ink); }

.skip { position: absolute; left: -9999px; z-index: 100; background: var(--accent); color: #fff; padding: .6rem 1rem; }
.skip:focus { left: .5rem; top: .5rem; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* ---------------- nav ---------------- */
.nav { border-bottom: 1px solid var(--line); background: var(--card); position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(160%) blur(10px); }
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .nav { background: color-mix(in srgb, var(--card) 88%, transparent); }
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; }
.brand { font-weight: 700; letter-spacing: -.015em; color: var(--ink); text-decoration: none; font-size: 1.02rem; }
.brand span { color: var(--muted); font-weight: 500; }
.nav ul { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: .92rem; }
.nav li + li { margin-left: 1.35rem; }
@supports (gap: 1rem) { .nav ul { gap: 1.35rem; } .nav li + li { margin-left: 0; } }
.nav a:not(.brand) { color: var(--ink-2); text-decoration: none; }
.nav a:not(.brand):hover { color: var(--accent); }
@media (max-width: 640px) { .nav ul { gap: .9rem; font-size: .85rem; } .nav .wrap { flex-wrap: wrap; } }

/* ---------------- hero ---------------- */
.hero { padding: 4.5rem 0 3rem; border-bottom: 1px solid var(--line); background: var(--card); }
.eyebrow { font-size: .76rem; letter-spacing: .13em; text-transform: uppercase; color: var(--accent); font-weight: 700; margin: 0 0 .9rem; }
.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.15rem); line-height: 1.1; letter-spacing: -.028em; margin: 0 0 1.1rem; max-width: 20ch; text-wrap: balance; }
.hero .lede { font-size: clamp(1.02rem, 2.1vw, 1.18rem); color: var(--ink-2); max-width: 62ch; margin: 0 0 1.6rem; }
.hero .lede strong { color: var(--ink); font-weight: 620; }
.cta { display: flex; flex-wrap: wrap; gap: .65rem; }
.btn { display: inline-block; padding: .6rem 1.15rem; border-radius: 8px; font-size: .93rem; font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.btn-p { background: var(--accent); color: #fff; }
.btn-p:hover { background: var(--accent-ink); color: #fff; }
.btn-s { border-color: var(--line); color: var(--ink); background: var(--card); }
.btn-s:hover { border-color: var(--accent); color: var(--accent); }

/* ---------------- stat strip ---------------- */
.stats { border-bottom: 1px solid var(--line); background: var(--bg); }
.stats .wrap { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.1rem 1.5rem; padding: 1.75rem 0; }
@media (min-width: 720px) { .stats .wrap { grid-template-columns: repeat(4, 1fr); } }
.stat b { display: block; font-size: 1.65rem; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { display: block; font-size: .81rem; color: var(--muted); margin-top: .15rem; }

/* ---------------- sections ---------------- */
section { padding: 3.6rem 0; }
section + section { border-top: 1px solid var(--line-soft); }
.sec-head { margin-bottom: 1.9rem; }
.sec-head h2 { font-size: clamp(1.45rem, 3vw, 1.85rem); letter-spacing: -.022em; margin: 0 0 .45rem; }
.sec-head p { color: var(--muted); margin: 0; max-width: 68ch; font-size: .97rem; }

/* ---------------- work cards ---------------- */
.cards { display: grid; gap: 1.1rem; }
@media (min-width: 860px) { .cards { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem; display: flex; flex-direction: column;
  box-shadow: var(--shadow); text-decoration: none; color: inherit;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
a.card { transition: border-color .15s ease, transform .15s ease; }
@media (prefers-reduced-motion: reduce) { a.card { transition: none; } a.card:hover { transform: none; } }
.tag { display: inline-block; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; font-weight: 700; padding: .22rem .55rem; border-radius: 5px; background: var(--accent-bg); color: var(--accent-ink); margin-bottom: .8rem; align-self: flex-start; }
.tag.warm { background: var(--warm-bg); color: var(--warm); }
.tag.good { background: var(--good-bg); color: var(--good); }
.card h3 { margin: 0 0 .5rem; font-size: 1.1rem; line-height: 1.32; letter-spacing: -.012em; }
.card p { margin: 0 0 1rem; font-size: .93rem; color: var(--ink-2); flex: 1; }
.card .meta { font-size: .8rem; color: var(--faint); font-family: var(--mono); }
.card .go { font-size: .87rem; font-weight: 650; color: var(--accent); margin-top: .85rem; }

/* ---------------- capability grid ---------------- */
.caps { display: grid; gap: 1.6rem 2.4rem; }
@media (min-width: 760px) { .caps { grid-template-columns: 1fr 1fr; } }
.cap h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 0 0 .5rem; }
.cap p { margin: 0; font-size: .93rem; color: var(--ink-2); }
.cap p code { font-family: var(--mono); font-size: .84em; background: var(--line-soft); padding: .08em .35em; border-radius: 4px; color: var(--ink); }

/* ---------------- method list ---------------- */
.method { display: grid; gap: 1.4rem; counter-reset: m; }
@media (min-width: 760px) { .method { grid-template-columns: 1fr 1fr; gap: 1.6rem 2.4rem; } }
.method > div { padding-left: 2.6rem; position: relative; }
.method > div::before {
  counter-increment: m; content: counter(m);
  position: absolute; left: 0; top: .05rem;
  width: 1.85rem; height: 1.85rem; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-ink);
  display: grid; place-items: center; font-size: .82rem; font-weight: 700;
}
.method h3 { margin: 0 0 .35rem; font-size: 1rem; letter-spacing: -.01em; }
.method p { margin: 0; font-size: .92rem; color: var(--ink-2); }

/* ---------------- note / callout ---------------- */
.note { border-left: 3px solid var(--warm); background: var(--warm-bg); padding: 1rem 1.2rem; border-radius: 0 8px 8px 0; }
.note p { margin: 0; font-size: .92rem; color: var(--ink-2); }
.note strong { color: var(--ink); }

/* ---------------- case study pages ---------------- */
.cs-hero { padding: 3.2rem 0 2.4rem; border-bottom: 1px solid var(--line); background: var(--card); }
.crumb { font-size: .85rem; color: var(--muted); margin: 0 0 1rem; }
.crumb a { text-decoration: none; }
.cs-hero h1 { font-size: clamp(1.75rem, 4.2vw, 2.5rem); letter-spacing: -.026em; line-height: 1.14; margin: 0 0 .9rem; max-width: 24ch; }
.cs-hero .lede { font-size: 1.06rem; color: var(--ink-2); max-width: 64ch; margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.4rem; padding: 0; list-style: none; }
.chips li { font-family: var(--mono); font-size: .75rem; padding: .22rem .55rem; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); }

article.cs { padding: 2.8rem 0 3.5rem; }
article.cs h2 { font-size: 1.28rem; letter-spacing: -.018em; margin: 2.4rem 0 .8rem; }
article.cs h2:first-child { margin-top: 0; }
article.cs h3 { font-size: 1rem; margin: 1.6rem 0 .5rem; }
article.cs p { margin: 0 0 1rem; color: var(--ink-2); }
article.cs ul { margin: 0 0 1.2rem; padding-left: 1.25rem; color: var(--ink-2); }
article.cs li { margin-bottom: .45rem; }
article.cs strong { color: var(--ink); font-weight: 620; }
article.cs code { font-family: var(--mono); font-size: .85em; background: var(--line-soft); padding: .1em .38em; border-radius: 4px; color: var(--ink); }

.kv { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 0 0 1.6rem; }
.kv div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .7rem 1rem; font-size: .9rem; border-bottom: 1px solid var(--line-soft); }
.kv div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-weight: 600; margin: 0; }
.kv dd { margin: 0; color: var(--ink-2); }
@media (max-width: 560px) { .kv div { grid-template-columns: 1fr; gap: .15rem; } }

.pull { border-left: 3px solid var(--accent); padding: .3rem 0 .3rem 1.2rem; margin: 1.6rem 0; font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; color: var(--ink); }

.withheld { border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin: 2rem 0 0; background: var(--bg); }
.withheld h3 { margin: 0 0 .5rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.withheld p { font-size: .9rem; margin: 0 0 .8rem; }
.withheld ul { margin: 0; font-size: .9rem; }

/* ---------------- footer ---------------- */
footer { border-top: 1px solid var(--line); background: var(--card); padding: 2.8rem 0; }
footer h2 { font-size: 1.2rem; margin: 0 0 .5rem; letter-spacing: -.018em; }
footer p { color: var(--muted); font-size: .93rem; margin: 0 0 1.1rem; max-width: 60ch; }
.links { display: flex; flex-wrap: wrap; gap: 1.2rem; list-style: none; margin: 0 0 1.8rem; padding: 0; font-size: .95rem; }
.fine { font-size: .8rem; color: var(--faint); max-width: 78ch; margin: 0; line-height: 1.55; }

.nf { padding: 6rem 0; text-align: center; }
.nf h1 { font-size: 3.4rem; margin: 0 0 .4rem; letter-spacing: -.03em; }
.nf p { color: var(--muted); }
