/* ---------- Theme ---------- */
/* Charcoal + off-white + one restrained accent */
:root {
  --bg: #151515; --surface: #1c1c1c; --surface-2: #222120; --border: #33312e;
  --text: #f1ede6; --muted: #aaa49a; --accent: #d9a55c; --on-accent: #1a1308; --accent-2: #d9a55c; --warn: #9fb7c9;
  --code-bg: #111111; --t-k: #e5a06b; --t-s: #b5c99a; --t-c: #7d776e; --t-n: #d7b46a; --t-t: #9fc3d6;
  --radius: 14px; --max: 1160px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f2ec; --surface: #fbfaf7; --surface-2: #ece7de; --border: #d9d2c6;
    --text: #1d1c1a; --muted: #5b564e; --accent: #8a5a12; --on-accent: #ffffff; --accent-2: #8a5a12; --warn: #3d5f78;
    --code-bg: #f8f6f1; --t-k: #9a3d12; --t-s: #3f6212; --t-c: #78716c; --t-n: #8a5a12; --t-t: #1e5a7a;
    color-scheme: light;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 100; }
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.nav { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent);
       backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.logo { font-weight: 800; color: var(--text); text-decoration: none; letter-spacing: .5px; }
.nav ul { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; }
.nav ul a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav ul a:hover { color: var(--text); }

/* ---------- Hero ---------- */
.hero { padding: 96px 0 72px; display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.facts { color: var(--muted); font-size: 14px; margin: -8px 0 24px; }
.avatar { width: 160px; height: 160px; border-radius: 50%; border: 3px solid var(--border); background: var(--surface); object-fit: cover; }
.eyebrow { color: var(--accent-2); font-weight: 700; font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; margin: 0 0 8px; }
h1 { font-size: clamp(32px, 5.5vw, 54px); line-height: 1.08; margin: 0 0 14px; }
.lead { color: var(--muted); font-size: 18px; max-width: 640px; margin: 0 0 24px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; font-weight: 600; font-size: 15px;
       border: 1px solid var(--border); color: var(--text); background: var(--surface); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:hover { filter: brightness(1.08); }
.row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Sections ---------- */
section { padding: 56px 0; border-top: 1px solid var(--border); }
h2 { font-size: 28px; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 24px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.filters button { font: inherit; font-size: 14px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
                  border: 1px solid var(--border); background: var(--surface); color: var(--muted); }
.filters button span { opacity: .7; margin-left: 2px; }
.filters button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Project card ---------- */
.projects { display: grid; gap: 28px; }
.project { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 0;
           background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.project[hidden] { display: none; }
.media { width: 100%; aspect-ratio: 16 / 9; background: #000; display: block; border: 0; }
.project > .media, .project > .media.placeholder { align-self: start; }
.media video, video.media { width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.media.placeholder { display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--muted);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, color-mix(in srgb, var(--surface-2) 70%, var(--border)) 14px 28px); }
.media.placeholder span { font-size: 34px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--border); padding-left: 4px; }
.media.yt { position: relative; padding: 0; cursor: pointer; overflow: hidden; }
.media.yt img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media.yt .play { position: absolute; inset: 0; margin: auto; width: 68px; height: 48px; border-radius: 12px; background: #e00; }
.media.yt .play::after { content: ""; position: absolute; left: 27px; top: 14px; border: 10px solid transparent; border-left: 16px solid #fff; border-right: 0; }

.media-col { min-width: 0; display: flex; flex-direction: column; }
.caption { margin: 0; padding: 10px 16px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--border); }
.project.featured { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.project.featured h3 { font-size: 28px; }
.role { margin: -2px 0 0; font-weight: 600; color: var(--accent); font-size: 15px; }
.summary { margin: 0; color: var(--text); font-size: 15.5px; }
details { border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; font-size: 14.5px; }
details summary { cursor: pointer; font-weight: 600; color: var(--text); }
details ul { margin: 8px 0 4px; padding-left: 18px; display: grid; gap: 6px; color: var(--muted); }
.jobs { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.job { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.job-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; align-items: baseline; }
.job h3 { margin: 0; font-size: 20px; }
.job .dates { color: var(--muted); font-size: 14px; }
.job .role { margin: 2px 0 10px; }
.job ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.about { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 40px; }
.about p { margin: 0 0 14px; color: var(--muted); font-size: 16.5px; max-width: 68ch; }
.edu { margin: 0; display: grid; gap: 4px; }
.edu dt { font-weight: 700; margin-top: 10px; }
.edu dd { margin: 0; color: var(--muted); font-size: 15px; }
.body { padding: 22px 24px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0; font-size: 13px; color: var(--muted); }
.badge { font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid currentColor; }
.badge.lead, .badge.solo { color: var(--accent-2); }
.badge.contributor { color: var(--warn); }
.project h3 { margin: 0; font-size: 22px; line-height: 1.2; }
.subtitle { margin: -4px 0 0; color: var(--muted); font-size: 14px; }
.bullets { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 8px; font-size: 15px; }
.bullets strong { color: var(--text); }
.bullets li::marker { color: var(--accent); }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; }
.tags li { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: auto 0 0; padding-top: 6px; }

/* ---------- Code ---------- */
.code { grid-column: 1 / -1; margin: 0; border-top: 1px solid var(--border); background: var(--code-bg); min-width: 0; }
.code figcaption { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 10px 18px; font-size: 13px;
                   border-bottom: 1px solid var(--border); color: var(--muted); }
.code .file { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; color: var(--text); }
.code .lang { padding: 1px 8px; border-radius: 6px; border: 1px solid var(--border); font-size: 12px; }
.code figcaption a { margin-left: auto; }
.code pre { margin: 0; padding: 16px 18px; overflow: auto; max-height: 340px; font: 13.5px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; tab-size: 4; }
.code-note { margin: 0; padding: 10px 18px; font-size: 14px; color: var(--muted); border-bottom: 1px solid var(--border); background: var(--surface); }
.code-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--border); background: var(--surface); }
.code-tabs [role=tab] { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; cursor: pointer; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; margin-bottom: -1px; }
.code-tabs [role=tab]:hover { color: var(--text); }
.code-tabs [role=tab][aria-selected="true"] { color: var(--text); background: var(--code-bg); border-color: var(--border); box-shadow: inset 0 2px 0 var(--accent); }
.t-k { color: var(--t-k); } .t-s { color: var(--t-s); } .t-c { color: var(--t-c); font-style: italic; } .t-n { color: var(--t-n); } .t-t { color: var(--t-t); }

/* ---------- Other / skills / about ---------- */
.other { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.other li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; display: grid; gap: 2px; }
.other a { font-weight: 600; }
.other span { color: var(--muted); font-size: 14px; }
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.skills > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.skills h3 { margin: 0 0 8px; font-size: 16px; }
.skills p { margin: 0; color: var(--muted); font-size: 15px; }
.timeline { list-style: none; margin: 20px 0 0; padding: 0 0 0 18px; border-left: 2px solid var(--border); max-width: 760px; }
.timeline li { position: relative; padding: 0 0 18px 16px; }
.timeline li::before { content: ""; position: absolute; left: -25px; top: 8px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); }
.timeline b { display: block; }
.timeline span { color: var(--muted); }
.contact { text-align: center; }
.contact .row { justify-content: center; }
footer { padding: 26px 0; text-align: center; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .project, .project.featured { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; gap: 12px; }
}
@media (max-width: 640px) {
  .nav ul { gap: 14px; } .nav .hide-sm { display: none; }
  .logo { font-size: 15px; }
  .hero { grid-template-columns: 1fr; text-align: center; padding: 40px 0 40px; gap: 20px; }
  .hero .avatar { order: -1; }
  .project.featured h3 { font-size: 24px; }
  .avatar { margin: 0 auto; width: 104px; height: 104px; }
  .lead { margin-inline: auto; }
  .hero .row { justify-content: center; }
  .body { padding: 18px; }
  .code pre { font-size: 12.5px; padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
