/* ==========================================================
   jiashuhan.github.io — shared stylesheet
   Plain CSS, no build step. Colors are tokens below; dark mode
   follows the visitor's system setting.
   ========================================================== */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #1d2433;
  --ink-2: #4a5263;
  --ink-3: #6b7280;
  --line: #e3e0d8;
  --accent: #0f6e8c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f1f5;
  --quote: #b45f06;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 24, 40, .05), 0 4px 16px rgba(20, 24, 40, .05);
  --serif: "Source Serif 4", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --max: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --surface: #181d26;
    --surface-2: #1f2530;
    --ink: #e8eaef;
    --ink-2: #b7bdc9;
    --ink-3: #8b93a3;
    --line: #2b3240;
    --accent: #5cc3e0;
    --accent-ink: #0b1a20;
    --accent-soft: #16303a;
    --quote: #f0a95a;
    --shadow: none;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 {
  font-family: var(--serif);
  line-height: 1.25;
  color: var(--ink);
  margin: 0 0 .5em;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 4.5vw, 2.8rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 1.9rem); margin-top: 0; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10;
}
.skip:focus { left: 8px; top: 8px; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 60px; flex-wrap: wrap;
}
.brand {
  font-family: var(--serif); font-weight: 600; font-size: 1.2rem;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--ink-2); text-decoration: none; font-size: .95rem; font-weight: 500;
  padding: 6px 12px; border-radius: 999px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 600px) {
  .site-header .wrap { padding-top: 8px; padding-bottom: 8px; gap: 4px; }
  .nav { width: 100%; justify-content: space-between; gap: 0; }
  .nav a { padding: 6px 8px; font-size: .9rem; }
}

/* ---------- Banner + hero ---------- */
.banner {
  height: 180px;
  background: #0b1020 url("../img/banner.webp") center 40% / cover no-repeat;
}
@media (max-width: 600px) { .banner { height: 110px; } }

.hero { position: relative; margin-top: -72px; }
.hero-grid {
  display: grid; grid-template-columns: 200px 1fr; gap: 32px; align-items: end;
}
.portrait {
  width: 200px; height: 200px; border-radius: 50%;
  border: 6px solid var(--bg); object-fit: cover; background: var(--surface-2);
  box-shadow: var(--shadow);
}
.hero h1 { margin-bottom: .15em; }
.tagline { color: var(--ink-2); font-size: 1.1rem; margin: 0; }
@media (max-width: 720px) {
  .hero { margin-top: -56px; }
  .hero-grid { grid-template-columns: 1fr; gap: 16px; }
  .portrait { width: 132px; height: 132px; border-width: 4px; }
}

.page-head { padding: 48px 0 8px; }
.page-head .lede { color: var(--ink-2); font-size: 1.1rem; max-width: 70ch; }
@media (max-width: 600px) { .page-head { padding-top: 32px; } }

/* ---------- Sections ---------- */
main section { padding: 40px 0; border-bottom: 1px solid var(--line); }
main section:last-of-type { border-bottom: 0; }
.prose { max-width: 72ch; }
.prose p, .prose li { color: var(--ink); }
.muted { color: var(--ink-3); }
.small { font-size: .9rem; }
.eyebrow {
  font-family: var(--sans); font-size: .8rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .4em;
}

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: .95rem;
  text-decoration: none; border: 1px solid var(--line); color: var(--ink);
  background: var(--surface);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 8px;
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.stat b { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; color: var(--accent); }
.stat span { display: block; color: var(--ink-2); font-size: .92rem; margin-top: 6px; line-height: 1.45; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card .eyebrow { margin-bottom: .6em; }

/* ---------- Principles (numbered) ---------- */
.principles { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; counter-reset: p; }
.principles li {
  counter-increment: p; position: relative; padding: 18px 20px 18px 64px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.principles li::before {
  content: counter(p); position: absolute; left: 20px; top: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-weight: 700; display: grid; place-items: center;
}
.principles h3 { font-size: 1.08rem; margin-bottom: .25em; }
.principles p { margin: 0; color: var(--ink-2); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td .course { font-weight: 600; white-space: nowrap; }
.role-group td { background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: .88rem; }
@media (max-width: 600px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
  td { border: 0; padding: 2px 0; }
  .role-group { padding: 0; }
  .role-group td { padding: 8px 14px; }
}

/* ---------- Quotes ---------- */
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
blockquote {
  margin: 0; padding: 20px 22px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--quote); border-radius: var(--radius);
}
blockquote p { font-family: var(--serif); font-size: 1.12rem; line-height: 1.5; margin: 0 0 .6em; }
blockquote cite { font-style: normal; color: var(--ink-3); font-size: .88rem; }

/* ---------- Lists ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--ink-3); font-size: .92rem; }
.timeline .what b { display: block; }
.timeline .what span { color: var(--ink-2); font-size: .95rem; }
@media (max-width: 600px) { .timeline li { grid-template-columns: 1fr; gap: 2px; } }

.pubs { padding-left: 1.2em; }
.pubs li { margin-bottom: 1em; }
.pubs .title { font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; margin: 0; }
.chips a, .chips span {
  display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: .9rem;
  border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink);
}
.chips a:hover { border-color: var(--accent); color: var(--accent); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.figure { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #000; }
.caption { color: var(--ink-3); font-size: .88rem; margin-top: 8px; }

.note {
  background: var(--accent-soft); border-radius: var(--radius); padding: 16px 20px; color: var(--ink);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 24px; padding: 28px 0 40px; color: var(--ink-3); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: center; }
.site-footer a { color: var(--ink-2); }
.icons { display: flex; gap: 14px; }
.icons a { color: var(--ink-2); display: inline-flex; }
.icons a:hover { color: var(--accent); }
.icons svg { width: 20px; height: 20px; }

@media print {
  .site-header, .banner, .site-footer, .actions { display: none; }
  body { background: #fff; color: #000; }
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.two-col .timeline li { grid-template-columns: 110px 1fr; }
@media (max-width: 600px) { .two-col .timeline li { grid-template-columns: 1fr; } }
