/* ---------- Colors and type: change these to restyle the whole site ---------- */
:root {
  --ink: #1d2733;
  --muted: #5d6b7a;
  --line: #e3e7ec;
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --accent: #1f4e79;       /* links, headings */
  --accent-2: #a3342b;     /* awards, highlights */
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 920px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.site-header .wrap { max-width: 1140px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.25; color: var(--ink); }
h2 { font-size: 1.6rem; margin: 0 0 1rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line); }
h3 { font-size: 1.12rem; margin: 1.6rem 0 .6rem; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.site-nav { display: flex; gap: 1.3rem; }
.site-nav a { color: var(--ink); font-size: .95rem; font-weight: 500; }
.site-nav a:hover { color: var(--accent); text-decoration: none; }
.nav-toggle, .nav-toggle-label { display: none; }
.header-inner { gap: 1.5rem; }
.site-nav { margin-left: auto; }
.header-icons { display: flex; gap: .7rem; padding-left: 1.2rem; border-left: 1px solid var(--line); }
.header-icons a { color: var(--muted); display: flex; }
.header-icons a:hover { color: var(--accent); }
.header-icons .ico { width: 17px; height: 17px; }

/* Icons (SVG files in assets/icons, colored by the surrounding text color) */
.ico { display: inline-block; width: 1em; height: 1em; background-color: currentColor; vertical-align: -0.125em;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); background: var(--bg); transition: all .15s; }
.icon-btn .ico { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); text-decoration: none; }

/* ---------- Hero ---------- */
.hero { display: flex; gap: 2.2rem; align-items: center; padding: 3rem 0 1.5rem; }
.hero-photo { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.hero h1 { font-size: 2.3rem; margin: 0 0 .3rem; }
.pronouns { font-family: var(--sans); font-size: .95rem; font-weight: 400; color: var(--muted); }
.hero-title { margin: 0 0 .6rem; font-size: 1.05rem; }
.hero-interests { margin: 0 0 1rem; color: var(--muted); font-size: .95rem; }
.hero-links { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.hero-links .btn-primary { padding: .5rem 1rem; display: inline-flex; align-items: center; gap: .4rem; }
.btn { display: inline-block; padding: .32rem .8rem; border: 1px solid var(--line); border-radius: 999px; font-size: .86rem; color: var(--ink); background: var(--bg); }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #173c5e; color: #fff; }

/* ---------- Sections ---------- */
.section { padding: 1.6rem 0; }
.bio p { margin: 0 0 1rem; }
.callout { background: var(--bg-soft); border-left: 3px solid var(--accent); padding: .9rem 1.2rem; border-radius: 6px; margin-top: 1.2rem; }
.callout h3 { margin: 0 0 .4rem; font-size: 1rem; }
.callout ul { margin: 0 0 .4rem; padding-left: 1.1rem; }
.callout p { margin: 0; font-size: .92rem; }

.entries { list-style: none; padding: 0; margin: 0; }
.entry { margin-bottom: 1rem; }
.entry-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.entry-head h3 { margin: 0; }
.year { color: var(--muted); font-size: .92rem; white-space: nowrap; }
.committee { font-size: .95rem; }

/* ---------- Papers ---------- */
.papers { padding-left: 1.3rem; margin: 0; }
.paper { margin-bottom: 1.15rem; padding-left: .2rem; }
.paper-title { font-weight: 600; }
.paper-authors, .paper-venue, .paper-status { font-size: .95rem; }
.paper-status { color: var(--muted); font-style: italic; }
.badges { margin-top: .3rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.badge { font-size: .78rem; color: var(--accent-2); border: 1px solid #e9c9c5; background: #fbf3f2; padding: .08rem .55rem; border-radius: 999px; }
.paper-links { margin-top: .35rem; font-size: .9rem; display: flex; flex-wrap: wrap; gap: .9rem; align-items: baseline; }
.paper-links details { flex-basis: 100%; }
.paper-links summary { cursor: pointer; color: var(--accent); width: max-content; }
.paper-links details p { margin: .4rem 0 0; color: var(--ink); background: var(--bg-soft); padding: .7rem .9rem; border-radius: 6px; font-size: .92rem; }
.paper-links details[open] { margin-top: -.2rem; }

/* ---------- Tools ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0; }
.card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.card:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 4px 14px rgba(31,78,121,.08); }
.card h3 { margin: 0 0 .4rem; font-size: 1.02rem; }
.card p { margin: 0 0 .6rem; font-size: .9rem; color: var(--muted); flex-grow: 1; }
.card-more { font-size: .88rem; color: var(--accent); }

/* ---------- Talks ---------- */
.talks { columns: 2; column-gap: 2.5rem; }
.talk-year { break-inside: avoid; margin-bottom: .8rem; }
.talk-year h3 { margin: 0 0 .3rem; }
.talk-year ul { margin: 0; padding-left: 1.1rem; font-size: .93rem; }

/* ---------- Teaching ---------- */
.inst { margin-bottom: 1.3rem; }
.inst h3 { font-size: 1.05rem; }
.role { margin: .5rem 0 .2rem; font-weight: 600; font-size: .92rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.courses { list-style: none; padding: 0; margin: 0; }
.courses li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px dashed var(--line); font-size: .95rem; }
.terms { color: var(--muted); white-space: nowrap; font-size: .9rem; }

/* ---------- Honors / service ---------- */
.honors { list-style: none; padding: 0; margin: 0; }
.honors li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; padding: .25rem 0; align-items: baseline; }
.service { display: grid; grid-template-columns: 10.5rem 1fr; gap: .5rem 1rem; margin: 0; }
.service dt { font-weight: 600; }
.service dd { margin: 0; }

/* ---------- Inner pages ---------- */
.page-head { padding-top: 2.5rem; }
.page-head h1 { font-size: 2rem; margin: 0 0 .8rem; }
.prose { max-width: 720px; }
.embed { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; }
.embed iframe { width: 100%; border: 0; display: block; }
.embed-app iframe { height: 85vh; min-height: 640px; }
.embed-pdf iframe { height: 90vh; }
.embed-tableau { display: flex; justify-content: center; margin-bottom: 2rem; overflow-x: auto; }
.resources { padding-left: 1.1rem; margin: 0; }
.resources li { margin: .2rem 0; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 3rem; border-top: 1px solid var(--line); background: var(--bg-soft); }
.footer-inner { padding: 1.4rem 20px; text-align: center; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.1rem; font-size: .9rem; }
.footer-icon { color: var(--muted); }
.footer-icon:hover { color: var(--accent); }
.footer-icon .ico { width: 19px; height: 19px; }
.footer-links + .footer-links { margin-top: .6rem; }
.footer-meta { color: var(--muted); font-size: .85rem; margin: .7rem 0 0; }

/* ---------- Phones and small tablets ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .header-icons { display: none; }
  .nav-toggle-label { display: block; width: 28px; height: 22px; position: relative; cursor: pointer; }
  .nav-toggle-label span, .nav-toggle-label span::before, .nav-toggle-label span::after { position: absolute; left: 0; width: 100%; height: 2px; background: var(--ink); content: ""; }
  .nav-toggle-label span { top: 10px; }
  .nav-toggle-label span::before { top: -8px; }
  .nav-toggle-label span::after { top: 8px; }
  .site-nav { display: none; position: absolute; top: 60px; left: 0; right: 0; flex-direction: column; gap: 0; background: #fff; border-bottom: 1px solid var(--line); }
  .site-nav a { padding: .75rem 20px; border-top: 1px solid var(--line); }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .hero { flex-direction: column; text-align: center; padding-top: 2rem; }
  .hero-photo { width: 150px; height: 150px; }
  .hero h1 { font-size: 1.9rem; }
  .hero-links { justify-content: center; gap: .35rem; }
  .icon-btn { width: 33px; height: 33px; }
  .icon-btn .ico { width: 16px; height: 16px; }
  .hero-links .btn-primary { padding: .4rem .8rem; }
  .cards { grid-template-columns: 1fr; }
  .talks { columns: 1; }
  .courses li, .entry-head { flex-direction: column; gap: 0; }
  .honors li { grid-template-columns: 1fr; gap: 0; }
  .honors .year { font-size: .85rem; }
  .service { grid-template-columns: 1fr; }
  .service dd { margin-bottom: .6rem; }
}

/* ---------- Full-page tools (Upstreamness, Value Chain, SC Explorer) ---------- */
.tool-main { display: flex; flex-direction: column; height: calc(100vh - 61px); height: calc(100dvh - 61px); }
.tool-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0 20px; height: 46px; border-bottom: 1px solid var(--line); background: var(--bg-soft); flex-shrink: 0; position: relative; }
.tool-tabs { display: flex; gap: .3rem; overflow-x: auto; }
.tool-tabs a { padding: .3rem .8rem; border-radius: 999px; font-size: .88rem; color: var(--ink); white-space: nowrap; }
.tool-tabs a:hover { background: #e8edf2; text-decoration: none; }
.tool-tabs a.active { background: var(--accent); color: #fff; }
.tool-actions { display: flex; align-items: center; gap: 1rem; font-size: .88rem; flex-shrink: 0; }
.tool-about summary { cursor: pointer; color: var(--accent); list-style: none; }
.tool-about summary::-webkit-details-marker { display: none; }
.tool-about summary::before { content: "ⓘ "; }
.tool-about-panel { position: absolute; right: 20px; top: 50px; z-index: 5; width: min(520px, calc(100vw - 40px)); background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1.1rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); font-size: .92rem; }
.tool-about-panel p { margin: 0 0 .6rem; }
.tool-about-panel p:last-child { margin-bottom: 0; }
.tool-frame { flex: 1; min-height: 0; }
.tool-frame iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 760px) {
  .tool-bar { padding: 0 10px; gap: .5rem; }
  .tool-tabs { gap: .1rem; }
  .tool-tabs a { padding: .3rem .55rem; font-size: .8rem; }
  .tool-actions { font-size: .8rem; }
  .tool-open { display: none; }
  .tool-about-panel { right: 12px; width: calc(100vw - 24px); }
}
