/* ===========================================================
   Yupeng Su — homepage. Left sidebar + right content.
   UCSB Navy (#003660) + white, quiet gold accent, light motion.
   =========================================================== */

:root {
  --navy: #003660; --navy-700: #012a4d; --blue: #0a5bb5; --blue-600: #0d68cf;
  --gold: #e0a021; --ink: #14263a; --text: #3c4c5d; --muted: #6f7d8c;
  --line: #e6ebf1; --bg: #ffffff; --bg-soft: #f4f7fb; --bg-card: #ffffff;
  --ring: rgba(10,91,181,.13);
  --shadow-sm: 0 1px 2px rgba(1,42,77,.06);
  --shadow: 0 4px 14px rgba(1,42,77,.08);
  --shadow-lg: 0 16px 42px rgba(1,42,77,.16);
  --radius: 16px; --maxw: 1080px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --navy: #86b8ea; --navy-700: #6aa4de; --blue: #63a6f0; --blue-600: #7fb6f3; --gold: #ecb642;
    --ink: #eaf1f8; --text: #bdc8d3; --muted: #8896a4; --line: #223244;
    --bg: #0c1620; --bg-soft: #101e2a; --bg-card: #15222f; --ring: rgba(99,166,240,.18);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 4px 14px rgba(0,0,0,.34); --shadow-lg: 0 16px 44px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --navy: #86b8ea; --navy-700: #6aa4de; --blue: #63a6f0; --blue-600: #7fb6f3; --gold: #ecb642;
  --ink: #eaf1f8; --text: #bdc8d3; --muted: #8896a4; --line: #223244;
  --bg: #0c1620; --bg-soft: #101e2a; --bg-card: #15222f; --ring: rgba(99,166,240,.18);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow: 0 4px 14px rgba(0,0,0,.34); --shadow-lg: 0 16px 44px rgba(0,0,0,.5);
}
:root[data-theme="light"] {
  --navy: #003660; --navy-700: #012a4d; --blue: #0a5bb5; --blue-600: #0d68cf; --gold: #e0a021;
  --ink: #14263a; --text: #3c4c5d; --muted: #6f7d8c; --line: #e6ebf1;
  --bg: #ffffff; --bg-soft: #f4f7fb; --bg-card: #ffffff; --ring: rgba(10,91,181,.13);
  --shadow-sm: 0 1px 2px rgba(1,42,77,.06); --shadow: 0 4px 14px rgba(1,42,77,.08); --shadow-lg: 0 16px 42px rgba(1,42,77,.16);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 74px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.64; -webkit-font-smoothing: antialiased; transition: background .25s, color .25s; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-600); }
strong { color: var(--ink); font-weight: 600; }
img { max-width: 100%; display: block; }

/* ---- NAV ---- */
.nav { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s; }
.nav.is-stuck { border-color: var(--line); box-shadow: 0 4px 18px rgba(1,42,77,.05); }
.nav__wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; height: 58px; display: flex; align-items: center; gap: 16px; }
.nav__brand { font-family: var(--serif); font-weight: 600; color: var(--ink); font-size: 1.1rem; margin-right: auto; }
.nav__brand:hover { color: var(--blue); }
.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a { color: var(--muted); font-weight: 500; font-size: .92rem; padding: 7px 11px; border-radius: 8px; position: relative; transition: color .18s, background .18s; }
.nav__links a:hover { color: var(--ink); background: var(--bg-soft); }
.nav__links a.is-active { color: var(--navy); }
.nav__links a.is-active::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px; background: var(--gold); border-radius: 2px; }
.nav__pdf { border: 1px solid var(--line); color: var(--muted) !important; font-weight: 600 !important; }
.nav__pdf:hover { background: var(--navy) !important; color: #fff !important; border-color: var(--navy); }
:root[data-theme="dark"] .nav__pdf:hover { color: #05121e !important; background: var(--blue) !important; border-color: var(--blue); }
.nav__pdf.is-active::after { display: none; }
.theme-toggle { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s; }
.theme-toggle:hover { color: var(--navy); border-color: var(--blue); }
.theme-toggle .ic-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .ic-moon { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .theme-toggle .ic-sun { display: none; } :root:not([data-theme]) .theme-toggle .ic-moon { display: block; } }
.nav__toggle { display: none; background: none; border: 0; cursor: pointer; flex-direction: column; gap: 5px; padding: 6px; }
.nav__toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }

/* ---- SHELL (left sidebar + right content) ---- */
.shell { max-width: var(--maxw); margin: 0 auto; padding: 44px 28px 20px; display: grid; grid-template-columns: 264px 1fr; gap: 52px; align-items: start; }
.side { position: sticky; top: 82px; }
.side__photo { width: 176px; height: 176px; object-fit: cover; border-radius: 22px; box-shadow: var(--shadow-lg); border: 4px solid var(--bg-card); outline: 1px solid var(--line); margin-bottom: 18px; }
.side__name { font-family: var(--serif); font-weight: 600; font-size: 1.7rem; line-height: 1.12; color: var(--ink); margin: 0 0 4px; letter-spacing: -.01em; }
.side__role { font-size: .96rem; color: var(--text); margin: 0 0 2px; }
.side__role .at { color: var(--navy); font-weight: 600; }
.side__loc { font-size: .86rem; color: var(--muted); margin: 6px 0 16px; display: flex; align-items: center; gap: 6px; }
.side__links { display: grid; gap: 1px; margin-bottom: 16px; }
.side__links a { display: flex; align-items: center; gap: 11px; padding: 6px 9px; border-radius: 9px; color: var(--text); font-size: .92rem; font-weight: 500; transition: background .15s, color .15s; }
.side__links a:hover { background: var(--bg-soft); color: var(--ink); text-decoration: none; }
.side__links .ico { display: inline-flex; color: var(--blue); flex: none; }
.side__links .ico svg { width: 17px; height: 17px; display: block; }

/* ---- CONTENT ---- */
.content { min-width: 0; padding-top: 4px; }
.section { padding: 30px 0; border-top: 1px solid var(--line); }
.content > .section:first-child { border-top: 0; padding-top: 0; }
.section__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.section__title { font-family: var(--serif); font-size: 1.55rem; font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -.01em; }
.section__note { color: var(--muted); font-size: .86rem; margin: -6px 0 16px; }
.star { color: var(--gold); }

.prose p { margin: 0 0 13px; font-size: 1.01rem; }
.prose p:last-child { margin-bottom: 0; }
.prose .hire { border-left: 3px solid var(--gold); background: var(--bg-soft); padding: 12px 16px; border-radius: 0 12px 12px 0; }

/* ---- CITATION SHIELD ---- */
.shield { display: inline-flex; align-items: stretch; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); font-size: .78rem; font-weight: 600; box-shadow: var(--shadow-sm); transition: transform .18s var(--ease), box-shadow .18s; }
.shield:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.shield__k { background: var(--bg-soft); color: var(--muted); padding: 5px 10px; }
.shield__v { background: var(--navy); color: #fff; padding: 5px 11px; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .shield__v { background: var(--blue); color: #05121e; }

/* ---- NEWS TIMELINE ---- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline__item { position: relative; padding: 0 0 15px 34px; display: grid; grid-template-columns: 62px 1fr; gap: 3px 14px; align-items: baseline; }
.timeline__dot { position: absolute; left: 0; top: 7px; width: 16px; height: 16px; border-radius: 50%; background: var(--bg); border: 3px solid var(--blue); }
.timeline__item:first-child .timeline__dot { border-color: var(--gold); box-shadow: 0 0 0 4px var(--ring); }
.timeline__date { font-weight: 700; color: var(--navy); font-size: .85rem; font-variant-numeric: tabular-nums; }
.timeline__text { color: var(--text); font-size: .96rem; }

/* ---- PUBLICATIONS (compact bulleted list) ---- */
.pub-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.pub { position: relative; padding: 8px 10px 8px 26px; border-radius: 10px; transition: background .15s; }
.pub:hover { background: var(--bg-soft); }
.pub::before { content: ""; position: absolute; left: 9px; top: 15px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); }
.pub--first::before { background: var(--gold); }
.pub__title { margin: 0 0 1px; font-size: 1rem; line-height: 1.4; font-weight: 600; }
.pub__title a { color: var(--ink); }
.pub__title a:hover { color: var(--blue); }
.pub__authors { margin: 0 0 1px; font-size: .88rem; color: var(--muted); }
.pub__authors strong { color: var(--navy); }
.pub__meta { margin: 0; font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: baseline; }
.pub__venue { font-style: italic; }
.pub__meta a { font-weight: 600; }
.pub__meta .dot { color: var(--muted); opacity: .5; margin: 0 8px; }

/* ---- PROJECTS ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.card { position: relative; display: flex; flex-direction: column; gap: 5px; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 18px; box-shadow: var(--shadow-sm); transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--blue); }
.card__meta { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--blue); }
.card__title { font-weight: 700; color: var(--ink); font-size: .98rem; }
.card__authors { font-size: .84rem; color: var(--muted); }
.card__arrow { position: absolute; top: 14px; right: 15px; color: var(--muted); transition: transform .2s var(--ease), color .2s; }
.card:hover .card__arrow { color: var(--blue); transform: translate(3px,-3px); }

/* ---- CV TWO-COL ---- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.col__head { font-size: 1rem; color: var(--ink); margin: 0 0 14px; font-weight: 700; }
.entry { position: relative; display: grid; gap: 2px; padding: 0 0 16px 18px; border-left: 2px solid var(--line); }
.entry::before { content: ""; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--navy); }
:root[data-theme="dark"] .entry::before { background: var(--blue); }
.entry:last-child { padding-bottom: 0; }
.entry__period { font-size: .77rem; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .03em; }
.entry__title { font-weight: 700; color: var(--ink); }
.entry__org { font-size: .91rem; color: var(--text); }
.entry__note { font-size: .84rem; color: var(--muted); font-style: italic; }

/* ---- HONORS ---- */
.honors { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.honors li { display: grid; grid-template-columns: 86px 1fr; gap: 14px; align-items: baseline; padding: 11px 14px; background: var(--bg-card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); transition: border-color .18s, transform .18s var(--ease); }
.honors li:hover { border-color: var(--blue); transform: translateX(4px); }
.honors__date { font-weight: 700; color: var(--navy); font-size: .83rem; font-variant-numeric: tabular-nums; }
.honors__text { color: var(--text); font-size: .94rem; }

/* ---- FOOTER / TOTOP ---- */
.footer { border-top: 1px solid var(--line); margin-top: 24px; }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 26px 28px 40px; color: var(--muted); font-size: .85rem; text-align: center; }
.footer__inner a { color: var(--blue); }
.totop { position: fixed; right: 22px; bottom: 22px; width: 42px; height: 42px; border-radius: 12px; background: var(--navy); color: #fff; border: 0; cursor: pointer; font-size: 1.05rem; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s, transform .25s var(--ease), background .2s; z-index: 40; }
.totop.is-show { opacity: 1; transform: none; pointer-events: auto; }
.totop:hover { background: var(--blue); }

/* ---- SCROLL REVEAL ---- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s var(--ease), transform .55s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .card, .honors li, .shield { transition: none; }
}

/* ---- RESPONSIVE ---- */
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; gap: 22px; padding-top: 30px; }
  .side { position: static; }
  .side__photo { width: 140px; height: 140px; }
  .side__links { grid-template-columns: 1fr 1fr; gap: 0 10px; margin-bottom: 4px; }
  .two-col { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 560px) {
  .side__links { grid-template-columns: 1fr; }
  .honors li { grid-template-columns: 1fr; gap: 2px; }
  .nav__toggle { display: flex; order: 3; }
  .nav__links { position: absolute; top: 58px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 12px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: .22s; }
  .nav__links.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .nav__links a { padding: 11px 12px; }
  .theme-toggle { position: absolute; top: 12px; right: 58px; }
}
