:root { --bg:#0e1116; --fg:#e6edf3; --muted:#8b98a5; --accent:#4cc2ff; --card:#161b22; }
@media (prefers-color-scheme: light) {
  :root { --bg:#f7f9fb; --fg:#14181d; --muted:#5b6672; --accent:#0a6cb8; --card:#fff; }
}
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--fg); font:16px/1.6 system-ui,sans-serif; }
header { display:flex; justify-content:space-between; align-items:center; padding:1rem 1.5rem; max-width:900px; margin:auto; }
.brand { font-weight:700; color:var(--fg); text-decoration:none; }
nav a { margin-left:1.2rem; color:var(--muted); text-decoration:none; }
nav a:hover, a { color:var(--accent); }
main { max-width:900px; margin:auto; padding:0 1.5rem; }
section { padding:2rem 0; }
.hero { padding:4rem 0 3rem; }
.hero h1 { font-size:clamp(2rem,6vw,3.2rem); margin:0 0 .5rem; }
.hero p { color:var(--muted); font-size:1.15rem; }
.button { display:inline-block; margin-top:1rem; padding:.6rem 1.2rem; background:var(--accent); color:var(--bg); border-radius:8px; text-decoration:none; font-weight:600; }
.cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:1rem; }
article { background:var(--card); padding:1rem 1.2rem; border-radius:10px; border:1px solid #8884; }
article h3 { margin:.2rem 0; }
footer { text-align:center; color:var(--muted); padding:2rem; }

/* CV page */
.cv-head { padding:2.5rem 0 1rem; }
.cv-head h1 { font-size:clamp(2rem,6vw,2.8rem); margin:0; }
.cv-head p { margin:.2rem 0; color:var(--muted); }
.cv h2 { font-size:1.1rem; text-transform:uppercase; letter-spacing:.08em; border-bottom:1px solid #8884; padding-bottom:.3rem; }
.entry { margin-bottom:1.2rem; }
.row { display:flex; justify-content:space-between; gap:1rem; flex-wrap:wrap; align-items:baseline; }
.row h3 { margin:0; font-size:1.05rem; }
.date { color:var(--muted); font-size:.95rem; white-space:nowrap; }
.org { margin:0; color:var(--muted); font-style:italic; }
.entry ul { margin:.3rem 0 0; padding-left:1.2rem; }
.tags { list-style:none; padding:0; display:flex; flex-wrap:wrap; gap:.5rem; }
.tags li { background:var(--card); border:1px solid #8884; border-radius:999px; padding:.15rem .8rem; font-size:.9rem; }
@media print { header, .button, footer { display:none; } body { background:#fff; color:#000; } }

/* projects + extras */
.button.ghost { background:transparent; color:var(--accent); border:1px solid var(--accent); margin-left:.5rem; }
.project { padding-bottom:1rem; }
.project .meta { color:var(--muted); font-style:italic; margin-top:-.4rem; }
.tags-line { color:var(--muted); font-size:.9rem; }
.cards article a { font-size:.95rem; }

/* figures */
figure { margin:1.2rem 0; }
figure img { width:100%; height:auto; border-radius:10px; border:1px solid #8884; display:block; }
figcaption { color:var(--muted); font-size:.9rem; margin-top:.4rem; }
.gallery { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:1rem 1.2rem; align-items:start; }
.gallery figure { margin:.5rem 0; }
.gallery figure img { background:#fff; }
.gallery figure.wide { grid-column:1/-1; }

/* home portrait */
.hero-flex { display:flex; align-items:center; justify-content:space-between; gap:2rem; }
.portrait { width:220px; height:220px; flex:none; border-radius:50%; object-fit:cover; border:3px solid var(--accent); }
@media (max-width:640px) { .hero-flex { flex-direction:column-reverse; text-align:center; } .portrait { width:180px; height:180px; } .button.ghost { margin-left:0; margin-top:.5rem; } }
.cv-head .portrait { width:170px; height:170px; }
@media (max-width:640px) { .cv-head .portrait { width:150px; height:150px; } }

/* GitHub contribution chart: keep it readable on narrow screens */
.contrib { border:0; background:transparent; }
figure.wide:has(.contrib) { overflow-x:auto; }
figure.wide:has(.contrib) .contrib { min-width:640px; }

/* full coursework list */
.coursegroup { margin:.7rem 0 0; }
.coursegroup h4 { margin:0 0 .15rem; font-size:.8rem; font-weight:600; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.coursegroup p { margin:.1rem 0; }
#coursework .row .date { white-space:normal; text-align:right; }
