/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --ink: #1f2328;
    --muted: #5b636b;
    --faint: #8a929a;
    --line: #e4e1da;
    --bg: #fbfaf7;
    --card: #ffffff;
    --accent: #1d6670;
    --accent-soft: #e3f0f0;
    --warm: #c7772d;
    --serif: 'Source Serif 4', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --max: 860px;
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--sans);
    font-size: 16.5px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: #fff; padding: 6px 10px; z-index: 50; }

.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-family: var(--sans); font-size: .78rem; font-weight: 400; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; gap: 22px; list-style: none; font-size: .95rem; }
.nav a { color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

/* ===== Typography ===== */
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; color: var(--ink); }
h1 { font-size: 2.3rem; margin-bottom: .4rem; }
h2 { font-size: 1.6rem; margin-bottom: 1.1rem; }
h3 { font-size: 1.15rem; margin-bottom: .3rem; }
p { margin-bottom: 1rem; }
section { padding: 52px 0 8px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; }
.section-head h2 { margin-bottom: .5rem; }
.lede { font-size: 1.08rem; color: var(--muted); }
.tags { color: var(--muted); font-size: .95rem; margin-bottom: 1.2rem; }
.tags span + span::before { content: " · "; color: var(--faint); }

/* ===== Hero ===== */
.hero { display: grid; grid-template-columns: 1fr 230px; gap: 40px; align-items: start; padding-top: 48px; }
.hero img { border-radius: 6px; aspect-ratio: 4/5; object-fit: cover; width: 100%; }
.hero p strong { font-weight: 600; }
.btns { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1.2rem; }
.btn { display: inline-block; padding: 8px 18px; border-radius: 4px; font-size: .93rem; font-weight: 500; border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer; font-family: var(--sans); }
.btn:hover { text-decoration: none; background: #155058; }
.btn.outline { background: transparent; color: var(--accent); }
.btn.outline:hover { background: var(--accent-soft); }

/* ===== Project cards ===== */
.project { display: grid; grid-template-columns: 240px 1fr; gap: 28px; padding: 26px 0; border-bottom: 1px solid var(--line); }
.project:last-child { border-bottom: none; }
.project .thumb { border: 1px solid var(--line); border-radius: 6px; background: var(--card); overflow: hidden; aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center; }
.project .thumb img, .project .thumb svg { width: 100%; height: 100%; object-fit: cover; }
.project .meta { font-size: .85rem; color: var(--faint); margin-bottom: .5rem; }
.project p { margin-bottom: .6rem; }
.method { font-size: .93rem; color: var(--muted); }
.method b { color: var(--ink); font-weight: 600; }
.more { font-size: .93rem; font-weight: 500; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--warm); margin-bottom: .25rem; }

/* full-width project with figure (research page) */
.project.wide { grid-template-columns: 1fr; }
.figure { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 18px; margin: 10px 0 8px; }
.figure svg { width: 100%; height: auto; display: block; }
.figure figcaption { font-size: .82rem; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.fig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== Interests ===== */
.interests { display: grid; gap: 20px; }
.interest { padding-left: 18px; border-left: 3px solid var(--accent-soft); }
.interest h3 { margin-bottom: .35rem; }
.interest p { margin-bottom: 0; color: #343a40; }

/* ===== Lists (experience, pubs) ===== */
.entry { padding: 16px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: none; }
.entry-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.entry .when { font-size: .88rem; color: var(--faint); white-space: nowrap; }
.entry .where { font-size: .93rem; color: var(--muted); margin-bottom: .4rem; }
.entry ul { padding-left: 1.1rem; font-size: .96rem; }
.entry li { margin-bottom: .3rem; }
.pub-venue { font-style: italic; color: var(--muted); font-size: .93rem; }
.pub-authors { font-size: .93rem; }
.status { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--warm); }

.plain-list { list-style: none; }
.plain-list li { padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .96rem; }
.plain-list li:last-child { border-bottom: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

.skills dt { font-weight: 600; font-size: .93rem; }
.skills dd { color: var(--muted); font-size: .95rem; margin-bottom: .7rem; }

/* ===== Contact & footer ===== */
.contact-mail { font-family: var(--serif); font-size: 1.5rem; }
.site-footer { margin-top: 60px; border-top: 1px solid var(--line); padding: 26px 0 40px; font-size: .88rem; color: var(--faint); }
.site-footer .links { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 8px; }

/* ===== Viewer (view-only documents) ===== */
.viewer { position: fixed; inset: 0; background: rgba(20, 24, 28, .98); z-index: 100; display: none; flex-direction: column; }
.viewer.open { display: flex; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; color: #e8eaec; font-size: .92rem; border-bottom: 1px solid rgba(255,255,255,.12); }
.viewer-bar .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar .controls { display: flex; gap: 8px; flex-shrink: 0; }
.viewer-bar button { background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; padding: 4px 12px; font-size: .9rem; cursor: pointer; font-family: var(--sans); }
.viewer-bar button:hover { background: rgba(255,255,255,.2); }
.viewer-body { flex: 1; overflow: auto; padding: 24px 16px 60px; }
.viewer-pages { margin: 0 auto; display: flex; flex-direction: column; gap: 18px; width: min(100%, var(--vw, 860px)); }
.viewer-page { position: relative; background: #fff; box-shadow: 0 4px 24px rgba(0,0,0,.4); user-select: none; -webkit-user-select: none; }
.viewer-page img { width: 100%; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.viewer-page::after { content: ""; position: absolute; inset: 0; }  /* shield: blocks right-click/drag on the image */
.viewer-note { text-align: center; color: #9aa3ab; font-size: .8rem; margin-top: 8px; }

@media print { .viewer { display: none !important; } }

/* ===== Responsive ===== */
@media (max-width: 720px) {
    h1 { font-size: 1.9rem; }
    .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 32px; }
    .hero img { max-width: 220px; order: -1; }
    .project { grid-template-columns: 1fr; gap: 14px; }
    .two-col, .fig-grid { grid-template-columns: 1fr; }
    .nav { gap: 16px; }
    .site-header { position: static; }
    .figure { padding: 10px; }
}

/* keep grid children from forcing horizontal overflow on small screens */
.project > *, .hero > *, .two-col > *, .fig-grid > * { min-width: 0; }
