:root{
  --paper:#FBF5EA; --ink:#161412; --muted:#5E5850;
  --red:#D2263B; --gold:#D9A43A; --green:#2E7A4B; --pink:#E88FA3; --blue:#2C5DA8;
  --card:#FFFFFF; --line:#E7DCC8;
  --display:"Fraunces", Georgia, serif; --body:"DM Sans", system-ui, sans-serif; --hand:"Caveat", cursive;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth; scroll-padding-top:70px}
body{margin:0; background:var(--paper); color:var(--ink); font:17px/1.6 var(--body)}
a{color:var(--red); text-underline-offset:3px}
a:hover{color:var(--ink)}
img{max-width:100%; height:auto; display:block}

/* ---------- nav ---------- */
.nav{position:sticky; top:0; z-index:10; display:flex; justify-content:flex-end; align-items:center; gap:16px;
  padding:12px clamp(16px,4vw,48px); background:color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter:blur(6px);
  border-bottom:1px solid var(--line)}
.nav-name{font:800 20px var(--display); color:var(--ink); text-decoration:none}
.nav nav{display:flex; flex-wrap:wrap; gap:4px 18px}
.nav nav a{color:var(--ink); text-decoration:none; font-weight:500; font-size:15px}
.nav nav a:hover{color:var(--red)}

main section, .contact{padding:72px clamp(16px,5vw,72px); max-width:1240px; margin:0 auto}

/* ---------- home ---------- */
.home{display:grid; grid-template-columns:1fr 1.15fr; gap:clamp(24px,4vw,64px); align-items:center; padding-top:48px !important}
.name{font:800 clamp(52px,8vw,108px)/0.92 var(--display); margin:0 0 20px; letter-spacing:-0.02em}
.name-line{display:block}
.name .l{display:inline-block; transition:transform .25s}
.name .l:hover{transform:translateY(-6px) rotate(-6deg)}
.role{font:500 clamp(20px,2.3vw,30px)/1.2 var(--display); margin:0 0 10px}
@media (min-width:861px){ .role{white-space:nowrap} }
.amp{font-family:var(--hand); font-size:1.4em; line-height:0; color:var(--red); margin:0 .32em 0 .1em}
.affil{color:var(--muted); margin:0 0 22px; font-size:16px}
.affil b{color:var(--ink)}
.intro{max-width:34em}
.home-links{display:flex; flex-wrap:wrap; gap:12px; margin-top:26px}
.btn{display:inline-block; padding:10px 20px; border-radius:999px; background:var(--ink); color:var(--paper); text-decoration:none; font-weight:700; font-size:15px}
.btn:hover{background:var(--red); color:#fff}
.btn-ghost{background:transparent; color:var(--ink); box-shadow:inset 0 0 0 2px var(--ink)}

.anatomy{margin:0}
.fig-cap{font:400 15px var(--body); color:var(--ink); margin:14px 4px 0; text-align:center}
.anatomy-img{position:relative; border-radius:18px; overflow:hidden; box-shadow:0 18px 40px -18px rgba(0,0,0,.45);
  outline:10px solid #fff; outline-offset:-1px}
.anatomy-img svg{position:absolute; inset:0; width:100%; height:100%}
.lbl path{fill:none; stroke-width:6; stroke-linecap:round}
.lbl text{font:700 62px var(--hand); paint-order:stroke; stroke:#fff; stroke-width:14px; stroke-linejoin:round}
.lbl text.note{font-size:42px; font-weight:500}
.lbl{opacity:0; transition:opacity .8s}
.anatomy.on .lbl{opacity:1}
/* editor (index.html?edit) */
.editing .lbl{opacity:1; cursor:move}
.editing .lbl.sel text{stroke:#FFF27A}
.h{fill:#fff; stroke:var(--ink); stroke-width:4; cursor:grab}
.h.c{fill:#FFF27A}
.hl{stroke:var(--ink); stroke-width:3; stroke-dasharray:10 8; fill:none}
.ed-panel{position:fixed; right:16px; bottom:16px; z-index:50; width:300px; max-width:calc(100vw - 32px); background:#fff; border:2px solid var(--ink);
  border-radius:14px; padding:14px; font-size:14px; box-shadow:0 12px 30px -12px rgba(0,0,0,.4)}
.ed-panel h4{margin:0 0 8px; font:700 16px var(--body)}
.ed-panel label{display:block; font-weight:700; margin:10px 0 4px}
.ed-panel textarea,.ed-panel input[type=text]{width:100%; font:14px var(--body); padding:6px; border:1px solid #bbb; border-radius:6px}
.sw{display:flex; flex-wrap:wrap; gap:6px; align-items:center}
.sw button{width:24px; height:24px; border-radius:50%; border:2px solid #fff; box-shadow:0 0 0 1px #999; cursor:pointer}
.sw input[type=color]{width:30px; height:26px; padding:0; border:none; background:none}
.ed-row{display:flex; flex-wrap:wrap; gap:6px; margin-top:12px}
.ed-row button{font:600 13px var(--body); padding:6px 10px; border-radius:8px; border:1px solid var(--ink); background:#fff; cursor:pointer}
.ed-row button.primary{background:var(--ink); color:#fff}
.ed-msg{margin:8px 0 0; color:var(--muted); min-height:1.2em}

/* cross-stitch band, after the embroidery */
.stitch{height:28px; max-width:1240px; margin:0 auto; opacity:.9;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='28'%3E%3Cg stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M4 4l8 8M12 4l-8 8M16 16l8 8M24 16l-8 8' stroke='%23D2263B'/%3E%3Cpath d='M32 4l8 8M40 4l-8 8M44 16l8 8M52 16l-8 8' stroke='%23161412'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat:repeat-x; background-position:center}

/* ---------- sections ---------- */
.sec-title{font:800 clamp(40px,5vw,64px)/1 var(--display); margin:0 0 14px; letter-spacing:-0.02em}
.sec-title::after{content:""; display:block; width:72px; height:8px; margin-top:12px; border-radius:4px;
  width:132px; background:linear-gradient(90deg,var(--red) 0 16.66%,var(--ink) 0 33.33%,var(--gold) 0 50%,var(--green) 0 66.66%,var(--pink) 0 83.33%,var(--blue) 0)}
.sec-lead{max-width:44em; color:var(--muted); margin:0 0 40px}

.card{margin:0 0 64px}
.card-head{margin:0 0 18px}
.card-body{display:grid; grid-template-columns:1fr 1.1fr; gap:clamp(20px,3vw,48px); align-items:start}
.card.flip .sim{order:2}
.card-text p:first-child{margin-top:0}
.sim{order:2}
.sim{background:var(--card); border-radius:18px; padding:12px; box-shadow:0 10px 30px -18px rgba(0,0,0,.35); border:1px solid var(--line)}
.sim canvas{width:100%; aspect-ratio:4/3; display:block; border-radius:10px; cursor:pointer}
.sim-cap{font:400 15px/1.45 var(--body); color:var(--ink); margin:10px 4px 0}
.kicker{text-transform:uppercase; letter-spacing:.12em; font-size:12px; font-weight:700; color:var(--red); margin:0 0 6px}
.card h3{font:800 clamp(24px,2.6vw,32px)/1.15 var(--display); margin:0 0 12px}
.with{font-size:15px; color:var(--muted)}

.pub-list{list-style:none; padding:0; margin:0; max-width:880px}
.pub-list li{display:grid; grid-template-columns:84px 1fr; gap:16px; padding:18px 0; border-top:2px dashed var(--line)}
.pub-year{font:700 24px var(--hand); color:var(--red)}
.pub-list p{margin:0}
.pub-title{font:500 20px/1.3 var(--display)}
.pub-auth{color:var(--muted); font-size:15px; margin-top:4px !important}
.pub-venue{font-size:15px}

.music-grid{display:grid; grid-template-columns:1.3fr 1fr; gap:36px; align-items:start}
.video-slot{aspect-ratio:16/9; border-radius:18px; background:var(--card); border:2px dashed var(--line); display:flex; align-items:center; justify-content:center; padding:24px}
.construction{font:800 clamp(22px,2.6vw,32px)/1.2 var(--display); margin:0; text-align:center}
.music-list{margin:0; padding-left:20px}
.music-list li{margin-bottom:14px}

.two{display:grid; grid-template-columns:repeat(2,1fr); gap:36px; max-width:1000px}
.two h3{font:700 28px var(--hand); color:var(--green); margin:0 0 4px}

.contact{text-align:center; padding-bottom:96px}
.contact .sec-title::after{margin-left:auto; margin-right:auto}
.contact-links{display:flex; flex-wrap:wrap; justify-content:center; gap:12px 28px; font-size:18px; font-weight:500}
.small{color:var(--muted); font-size:14px}

/* draft placeholders: visible on purpose */
.todo{background:#FFF27A; padding:2px 6px; border-radius:4px; outline:2px dashed var(--gold)}

@media (max-width:860px){
  .home,.card-body,.music-grid{grid-template-columns:1fr}
  .card.flip .sim{order:0}
  .two{grid-template-columns:1fr}
  .nav{flex-direction:column; align-items:flex-start}
}
@media (prefers-reduced-motion:reduce){ html{scroll-behavior:auto} .lbl{transition:none} }

.out-list{margin:0; padding-left:20px}
.out-list li{margin-bottom:8px}

/* text editor (index.html?edit) */
.txt-edit{outline:1px dashed rgba(210,38,59,.35); outline-offset:3px; border-radius:2px}
.txt-edit:hover{outline-color:var(--red)}
.txt-edit:focus{outline:2px solid var(--red); background:rgba(255,242,122,.25)}
.txt-dirty{background:rgba(255,242,122,.45)}
.txt-bar{position:fixed; left:16px; bottom:16px; z-index:50; display:flex; flex-wrap:wrap; align-items:center; gap:6px; max-width:calc(100vw - 350px);
  background:#fff; border:2px solid var(--ink); border-radius:14px; padding:10px 12px; font-size:14px; box-shadow:0 12px 30px -12px rgba(0,0,0,.4)}
.txt-bar button{font:600 13px var(--body); padding:5px 10px; border-radius:8px; border:1px solid var(--ink); background:#fff; cursor:pointer}
.txt-bar button.primary{background:var(--ink); color:#fff}
#txt-count{color:var(--muted); margin:0 4px}
@media (max-width:860px){ .txt-bar{max-width:calc(100vw - 32px); bottom:auto; top:70px} }

/* vertical YouTube Short in a research card */
.short{width:min(100%,300px); aspect-ratio:9/16; margin:0 auto; border-radius:10px; overflow:hidden; background:#000}
.short iframe{width:100%; height:100%; border:0; display:block}
.wide{aspect-ratio:16/9; border-radius:10px; overflow:hidden; background:#000}
.wide iframe{width:100%; height:100%; border:0; display:block}

/* teaching: lecture-notes tour video */
.notes-video{margin:12px 0 14px; border-radius:14px; overflow:hidden; background:var(--card); border:1px solid var(--line);
  box-shadow:0 10px 30px -18px rgba(0,0,0,.35); aspect-ratio:1280/850; display:flex; align-items:center; justify-content:center; padding:0}
.notes-video video{width:100%; height:100%; object-fit:cover; display:block}
.notes-video .todo{margin:16px}

@media (max-width:560px){ .pub-list li{grid-template-columns:1fr; gap:4px} }

/* controls under an interactive simulation */
.sim-controls{display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; margin:10px 4px 0; font-size:14px}
.sim-controls .seg{display:inline-flex; border:1.5px solid var(--ink); border-radius:999px; overflow:hidden}
.sim-controls .seg button{font:600 13px var(--body); border:0; background:#fff; padding:5px 12px; cursor:pointer}
.sim-controls .seg button + button{border-left:1.5px solid var(--ink)}
.sim-controls .seg button.on{background:var(--ink); color:#fff}
.sim-controls label{display:inline-flex; gap:5px; align-items:center; cursor:pointer}
.sim-controls > button{font:600 13px var(--body); border:1.5px solid var(--ink); border-radius:999px; background:#fff; padding:5px 12px; cursor:pointer}
