:root {
  --bg: #f6f5f1; --surface: #ffffff; --ink: #17191c; --muted: #5d6168; --line: #e2dfd8;
  --accent: #b2182b; --accent-soft: #fbe9e6; --cool: #2b5c9e; --code: #f1efe9;
  --radius: 12px; --max: 1080px;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121315; --surface: #1b1d20; --ink: #ecebe7; --muted: #a3a6ab; --line: #2e3135;
          --accent: #ff6f61; --accent-soft: #3a1f1d; --cool: #7fa7e0; --code: #24272b; }
  .figure img { background: #fff; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
       backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; gap: 16px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 500; }
.nav-links { display: flex; gap: 20px; font-size: 14px; }
.nav-links a { color: var(--muted); text-decoration: none; }
.nav-links a:hover { color: var(--ink); }

/* hero */
.hero { padding: 72px 0 48px; }
.eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); font-weight: 600; margin: 0 0 12px; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 18px; }
.lede { font-size: clamp(17px, 2vw, 20px); color: var(--muted); max-width: 720px; margin: 0 0 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
.chips li { font-size: 13px; border: 1px solid var(--line); background: var(--surface); padding: 5px 11px; border-radius: 999px; color: var(--muted); }

/* sections */
section { padding: 40px 0; }
h2 { font-family: var(--serif); font-size: 30px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
h3 { font-size: 18px; margin: 28px 0 8px; }
.section-intro { color: var(--muted); margin: 0 0 28px; max-width: 700px; }

/* project cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
        display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s; }
a.card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }
.card .thumb { aspect-ratio: 16/8; background: #e9e6df; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; font-size: 19px; line-height: 1.3; }
.card p { margin: 0; color: var(--muted); font-size: 15px; }
.card .meta { margin-top: auto; padding-top: 10px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.tag { border: 1px solid var(--line); border-radius: 6px; padding: 1px 8px; }
.status { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.status.done { color: #2f7d4a; } .status.wip { color: #9a6a00; }
.card.wip { opacity: .85; } .card.wip .thumb { background: repeating-linear-gradient(135deg, #ece9e2 0 10px, #e4e0d7 10px 20px); color: #8b8679; font-size: 13px; }
.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.4fr 1fr; }
.featured .thumb { aspect-ratio: auto; min-height: 260px; }
@media (max-width: 760px) { .featured { grid-template-columns: 1fr; } .featured .thumb { min-height: 180px; } }

/* about / skills */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .two { grid-template-columns: 1fr; } }
.list { padding-left: 18px; margin: 0; } .list li { margin: 4px 0; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.skill { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.skill b { display: block; font-size: 14px; margin-bottom: 4px; } .skill span { color: var(--muted); font-size: 14px; }

/* case study pages */
.crumbs { font-size: 14px; color: var(--muted); padding-top: 28px; } .crumbs a { color: var(--muted); }
.cs-hero { padding: 24px 0 28px; }
.cs-hero h1 { font-size: clamp(30px, 4.4vw, 46px); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { filter: brightness(.96); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 28px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .v { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .v.hot { color: var(--accent); } .stat .l { font-size: 13px; color: var(--muted); line-height: 1.4; }
.layout { display: grid; grid-template-columns: 210px 1fr; gap: 44px; align-items: start; }
.toc { position: sticky; top: 80px; font-size: 14px; }
.toc a { display: block; color: var(--muted); text-decoration: none; padding: 4px 0 4px 10px; border-left: 2px solid var(--line); }
.toc a:hover { color: var(--ink); border-color: var(--accent); }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .toc { display: none; } }
.prose { max-width: 760px; min-width: 0; }
.prose section { padding: 0 0 36px; }
.prose h2 { font-size: 26px; padding-top: 8px; scroll-margin-top: 76px; }
.prose p, .prose li { color: var(--ink); }
.prose ol, .prose ul { padding-left: 22px; } .prose li { margin: 6px 0; }
code { font: 13.5px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--code); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code); padding: 14px 16px; border-radius: 8px; overflow-x: auto; font-size: 13px; }
pre code { background: none; padding: 0; }
.table-wrap { overflow-x: auto; margin: 14px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: color-mix(in srgb, var(--surface) 92%, var(--line)); }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
.figure { margin: 22px 0; } .figure img { border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.figure figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.wide { margin-left: 0; margin-right: 0; }
.fig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 700px) { .fig-grid { grid-template-columns: 1fr; } }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 0 10px 10px 0; margin: 20px 0; }
.callout.info { border-color: var(--cool); background: color-mix(in srgb, var(--cool) 10%, var(--surface)); }
.callout p { margin: 0; }
.flow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; font-size: 14px; }
.flow span { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.flow i { color: var(--muted); font-style: normal; }
.map-embed { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; height: 560px; margin: 18px 0; background: var(--surface); }
.map-embed iframe { width: 100%; height: 100%; border: 0; }
@media (max-width: 700px) { .map-embed { height: 480px; } }

footer { border-top: 1px solid var(--line); padding: 28px 0 40px; margin-top: 30px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
