:root{
  --bg:#f7f8fa; --ink:#14181f; --muted:#5a6270; --line:#dde1e8; --accent:#1f497d; --name:#2f6fb5; --card:#ffffff; --ph:#e8ecf2;
  --serif:'Newsreader',Georgia,'Times New Roman',serif;
  --sans:'Public Sans',system-ui,-apple-system,'Segoe UI',Roboto,sans-serif;
}
@media (prefers-color-scheme:dark){
  :root{--bg:#10141a; --ink:#e9edf3; --muted:#9aa4b2; --line:#262d38; --accent:#7fa8dc; --name:#7fa8dc; --card:#161b23; --ph:#1c232d}
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
html.lock{overflow:hidden}
body{margin:0;background:var(--bg);color:var(--ink);font:17px/1.65 var(--sans);-webkit-font-smoothing:antialiased}
a{color:var(--accent);text-underline-offset:3px}
a:focus-visible,button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
main{max-width:1040px;margin:0 auto;padding:64px 24px 48px}
h1,h2,h3{font-family:var(--serif);font-weight:600;line-height:1.15;margin:0}
h1{font-size:clamp(2.6rem,7vw,3.8rem);letter-spacing:-.02em}
h1 .name{color:var(--name)}
h2{font-size:1.7rem;margin:64px 0 20px;padding-bottom:10px;border-bottom:1px solid var(--line)}
.lede{font-family:var(--serif);font-size:clamp(1.25rem,3vw,1.55rem);line-height:1.4;margin:14px 0 14px;max-width:34em}
.bio{color:var(--muted);max-width:62ch;margin:0 0 22px}

/* Hero */
.hero{display:flex;gap:32px;align-items:flex-start;justify-content:space-between}
.hero .text{flex:1;min-width:0}
.actions{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.icon{display:inline-flex;width:30px;height:30px;color:var(--ink)}
.icon:hover{color:var(--accent)}
.icon svg{width:100%;height:100%;fill:currentColor}
.btn{display:inline-block;padding:9px 22px;border:2px solid var(--accent);border-radius:0;background:transparent;color:var(--accent);font:600 1rem var(--sans);text-decoration:none;cursor:pointer;transition:background .15s,color .15s}
.btn:hover{background:var(--accent);color:var(--bg)}
.avatar{flex:none;width:168px;height:168px;border-radius:50%;overflow:hidden;border:1px solid var(--line);background:var(--ph);position:relative;margin:0}
.avatar img{width:100%;height:100%;object-fit:cover;display:block}
.avatar.empty img{display:none}
.avatar.empty::after{content:"ST";position:absolute;inset:0;display:grid;place-items:center;font:600 2.4rem var(--serif);color:var(--muted)}
@media (max-width:620px){.hero{flex-direction:column-reverse;gap:20px}.avatar{width:120px;height:120px}}

/* Project grid */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:20px}
.card{display:flex;flex-direction:column;justify-content:flex-start;align-items:stretch;width:100%;height:100%;padding:0;text-align:left;font:inherit;color:inherit;background:var(--card);border:1px solid var(--line);border-radius:6px;overflow:hidden;cursor:pointer;transition:border-color .15s}
.card:hover{border-color:var(--accent)}
.thumb{flex:none;aspect-ratio:16/10;background:var(--ph);position:relative;overflow:hidden}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb.empty img{display:none}
.thumb.empty::after{content:"Photo";position:absolute;inset:0;display:grid;place-items:center;color:var(--muted);font-size:.85rem}
.card .info{padding:12px 14px 14px}
.card h3{font-size:1.1rem}
.card .res{margin:4px 0 0;font-size:.9rem;color:var(--accent);font-weight:500;line-height:1.4}

/* Skills */
dl.skills{margin:0;display:grid;grid-template-columns:max-content 1fr;gap:8px 24px}
dl.skills dt{font-weight:600}
dl.skills dd{margin:0;color:var(--muted)}
@media (max-width:520px){dl.skills{grid-template-columns:1fr;gap:0}dl.skills dd{margin-bottom:12px}}

/* Modal */
dialog{padding:0;border:1px solid var(--line);border-radius:8px;background:var(--bg);color:var(--ink);width:min(980px,94vw);max-height:92vh;overflow:auto}
dialog::backdrop{background:rgba(10,14,20,.6)}
.m-body{display:grid;grid-template-columns:1.25fr 1fr;gap:28px;padding:24px}
.m-stage{position:relative;aspect-ratio:4/3;background:var(--ph);border-radius:6px;overflow:hidden}
.m-stage img{width:100%;height:100%;object-fit:cover;display:block}
.m-empty{position:absolute;inset:0;display:none;place-items:center;padding:20px;text-align:center;color:var(--muted);font-size:.9rem}
.m-stage.none .m-empty{display:grid}
.m-stage.none img{display:none}
.nav-btn{position:absolute;top:50%;transform:translateY(-50%);width:38px;height:38px;border:0;border-radius:50%;background:rgba(20,24,31,.65);color:#fff;font-size:1.3rem;line-height:1;cursor:pointer}
.nav-btn:hover{background:rgba(20,24,31,.9)}
.nav-btn.prev{left:10px}.nav-btn.next{right:10px}
.m-stage.single .nav-btn,.m-stage.none .nav-btn{display:none}
.dots{display:flex;justify-content:center;gap:8px;margin-top:12px;min-height:10px}
.dots button{width:9px;height:9px;padding:0;border-radius:50%;border:0;background:var(--line);cursor:pointer}
.dots button[aria-current="true"]{background:var(--accent)}
.m-text h2{font-size:1.6rem;margin:0 0 8px;padding:0 40px 0 0;border:0}
.m-text .res{margin:0 0 14px;padding-right:40px;color:var(--accent);font-weight:600}
.m-text p{margin:0 0 14px}
.m-text .tags{color:var(--muted);font-size:.92rem}
.close{position:absolute;top:10px;right:12px;z-index:2;width:36px;height:36px;border:0;border-radius:50%;background:var(--card);color:var(--ink);font-size:1.4rem;line-height:1;cursor:pointer;border:1px solid var(--line)}
.close:hover{border-color:var(--accent)}
@media (max-width:760px){.m-body{grid-template-columns:1fr;gap:18px;padding:16px}.m-text{padding-top:4px}}

/* Resume page */
.back{display:inline-block;margin-bottom:40px;font-weight:500;color:var(--muted);text-decoration:none}
.back:hover{color:var(--ink);text-decoration:underline;text-underline-offset:6px}
.resume-wrap{max-width:760px}
.resume-top{display:flex;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;margin-bottom:8px}
.resume-top p{margin:6px 0 0;color:var(--muted)}
.r-item{margin:0 0 22px}
.r-head{display:flex;justify-content:space-between;gap:24px;align-items:baseline}
.r-head h3{font-family:var(--sans);font-size:1.05rem;font-weight:600}
.r-head .when{color:var(--muted);font-size:.92rem;white-space:nowrap}
.r-sub{color:var(--muted);margin:0 0 4px;font-size:.95rem}
.r-item ul{margin:6px 0 0;padding-left:20px;max-width:68ch}
.r-item li{margin:0 0 4px}
footer{margin-top:64px;padding-top:24px;border-top:1px solid var(--line);color:var(--muted);font-size:.95rem}
@media (max-width:520px){.r-head{flex-direction:column;gap:0}.r-head .when{white-space:normal}}
@media print{
  body{background:#fff;color:#000;font-size:11pt}
  .back,.btn{display:none}
  main{padding:0;max-width:none}
  h2{margin-top:24px}
  a{color:#000}
}

