/* ---------- Theme tokens ---------- */
:root {
  --bg: #f7f9fb; --surface: #ffffff; --surface-2: #eef2f6;
  --text: #17202b; --muted: #556270; --border: #d9e0e7;
  --accent: #0f766e; --accent-contrast: #ffffff; --accent-soft: #e0f2ef;
  --todo-bg: #fff7e0; --todo-border: #d99a00; --todo-text: #5c4300;
  --radius: 10px; --shadow: 0 1px 2px rgb(16 24 40 / .05), 0 1px 3px rgb(16 24 40 / .06);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --surface: #141a22; --surface-2: #1b232d;
    --text: #e6edf3; --muted: #9aa7b4; --border: #2a3441;
    --accent: #2dd4bf; --accent-contrast: #062925; --accent-soft: #10302d;
    --todo-bg: #2b2208; --todo-border: #b88400; --todo-text: #f5d98a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --surface: #141a22; --surface-2: #1b232d;
  --text: #e6edf3; --muted: #9aa7b4; --border: #2a3441;
  --accent: #2dd4bf; --accent-contrast: #062925; --accent-soft: #10302d;
  --todo-bg: #2b2208; --todo-border: #b88400; --todo-text: #f5d98a;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.6 var(--sans); background: var(--bg); color: var(--text); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; margin: 2.2rem 0 1rem; }
h2::before { content: "# "; font-family: var(--mono); color: var(--accent); font-weight: 600; }
.card h2::before, .hero h2::before { content: none; }
h3 { font-size: 1.05rem; margin: 0; }
img { max-width: 100%; height: auto; }
.container { width: min(1040px, 100% - 2.5rem); margin-inline: auto; }
main { padding: 2.5rem 0 4rem; }
.muted { color: var(--muted); }
.label { font-weight: 600; color: var(--muted); font-size: .9rem; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--accent); color: var(--accent-contrast); padding: .5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; }

/* ---------- Header / nav ---------- */
.site-header { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; }
.brand-mark { width: 34px; height: 34px; display: block; object-fit: contain; }
.brand-name { font-size: 1.2rem; line-height: 1; position: relative; top: -2px; }
@media (max-width: 480px) { .brand-name { font-size: 1.05rem; } .brand-mark { width: 30px; height: 30px; } }
.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0; flex-wrap: wrap; }
.site-nav a { display: block; padding: .4rem .65rem; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.theme-toggle, .nav-toggle { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: .35rem .6rem; cursor: pointer; font: inherit; }
.nav-toggle { display: none; margin-left: auto; }
@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem 1.25rem 1rem; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; }
  html:not(:has(script)) .site-nav { display: block; position: static; }
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: 1.25rem 0; }
.footer-inner p { margin: 0; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stats { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stat { display: flex; flex-direction: column; gap: .25rem; border-top: 3px solid var(--accent); }
.stat-result { font-weight: 700; font-size: 1.05rem; }
.stat-name { color: var(--muted); font-size: .9rem; }
.tags { list-style: none; padding: 0; margin: .4rem 0 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { font-family: var(--mono); font-size: .8rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .15rem .65rem; }
.tag.in-progress { border-style: dashed; }
.badge { display: inline-block; font-family: var(--mono); font-size: .72rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: .1rem .45rem; vertical-align: middle; }
.badge.subtle { background: var(--surface-2); color: var(--muted); }
.button { display: inline-block; background: var(--accent); color: var(--accent-contrast); padding: .55rem 1rem; border-radius: 8px; text-decoration: none; font-weight: 600; }
.button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.cta { display: flex; gap: .75rem; flex-wrap: wrap; }
.todo { background: var(--todo-bg); border: 1px dashed var(--todo-border); color: var(--todo-text); border-radius: 8px; padding: .6rem .85rem; font-size: .92rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem; }

.verify-link { margin: .6rem 0 0; font-size: .9rem; }
.verify-link a { font-weight: 600; text-decoration: none; border-bottom: 1px solid currentColor; }
.verify-link a:hover { border-bottom-width: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Entries ---------- */
.entry { margin-bottom: 1rem; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; flex-wrap: wrap; }
.dates { font-family: var(--mono); font-size: .85rem; color: var(--muted); white-space: nowrap; }
.org { color: var(--muted); margin: .15rem 0 .5rem; }
.project { margin: .3rem 0; }
.entry ul:not(.tags) { margin: .4rem 0 0; padding-left: 1.2rem; }
.entry li { margin: .2rem 0; }
.timeline { list-style: none; padding: 0; margin: 0; }
.entry p { margin: .3rem 0; }
.result { font-weight: 700; color: var(--accent); margin: .3rem 0; }
.skill-label { margin-top: 1rem; font-size: .95rem; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 280px 1fr; gap: 2.5rem; align-items: start; }
.eyebrow { font-family: var(--mono); color: var(--accent); font-size: .85rem; margin: 0 0 .3rem; text-transform: uppercase; letter-spacing: .08em; }
.pfp { margin: 0; text-align: center; }
/* Profile picture: two stacked rounded-square cards; front = shown pfp, back peeks out upper-left */
.pfp { --pfp-size: 240px; --pfp-off: 28px; --pfp-radius: 18px; }
.pfp-stack { position: relative; display: block; margin: 0 auto; padding: 0; border: 0; background: none; cursor: pointer;
  width: calc(var(--pfp-size) + var(--pfp-off)); height: calc(var(--pfp-size) + var(--pfp-off)); border-radius: var(--pfp-radius); }
.pfp-stack:focus-visible { outline-offset: 4px; }
.pfp-card { position: absolute; top: var(--pfp-off); left: var(--pfp-off); width: var(--pfp-size); height: var(--pfp-size);
  border-radius: var(--pfp-radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); will-change: transform; }
.pfp-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pfp-card.is-front { z-index: 2; transform: translate(0, 0);
  box-shadow: 0 10px 24px rgb(16 24 40 / .18), 0 2px 6px rgb(16 24 40 / .12); }
.pfp-card.is-back { z-index: 1; transform: translate(calc(-1 * var(--pfp-off)), calc(-1 * var(--pfp-off))); filter: saturate(.85) brightness(.95); }
.pfp-stack:hover .pfp-card.is-front { border-color: var(--accent); }
:root[data-theme="dark"] .pfp-card.is-front { box-shadow: 0 10px 28px rgb(0 0 0 / .55), 0 2px 6px rgb(0 0 0 / .4); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pfp-card.is-front { box-shadow: 0 10px 28px rgb(0 0 0 / .55), 0 2px 6px rgb(0 0 0 / .4); } }
.pfp figcaption { font-size: .85rem; color: var(--muted); margin-top: .75rem; font-style: italic; }
.objective { margin: 1.25rem 0; border-left: 4px solid var(--accent); }
.objective h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .3rem; }
.objective p { margin: 0; }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; text-align: left; }
  .pfp { --pfp-size: 190px; --pfp-off: 22px; --pfp-radius: 16px; }
}

/* ---------- Posts ---------- */
.post-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.post-list h2 { margin: .2rem 0; }
.post-list h2::before { content: none; }
.crumbs { margin: 0 0 1rem; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0 2rem; }
.facts dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.facts dd { margin: 0; font-weight: 600; }
.prose { max-width: 72ch; }
.prose pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 1rem; overflow-x: auto; }
.prose code { font-family: var(--mono); font-size: .9em; }

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