/* One column: header, a tab bar, then one section at a time. */
:root {
  --bg: #fbfaf7;
  --fg: #1d1d1b;
  --muted: #6b6a65;
  --rule: #e4e1d9;
  --accent: #1f5f8b;
  --accent-soft: #e6eef4;
  --glint: rgba(255, 255, 255, 0.5);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif SC", "Songti SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --spring: cubic-bezier(.2, .7, .3, 1.4);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161615;
    --fg: #e9e7e1;
    --muted: #9c9a93;
    --rule: #2e2d2a;
    --accent: #8cbfe3;
    --accent-soft: #1f2a33;
    --glint: rgba(255, 255, 255, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161615;
  --fg: #e9e7e1;
  --muted: #9c9a93;
  --rule: #2e2d2a;
  --accent: #8cbfe3;
  --accent-soft: #1f2a33;
  --glint: rgba(255, 255, 255, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0 auto;
  max-width: 50rem;
  padding: 4.5rem 1.5rem 3rem;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.65 var(--sans);
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); }
a:hover { text-decoration-color: currentColor; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.4rem 0.7rem; z-index: 1; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Header */
.hero { display: flex; gap: 2rem; align-items: center; }
.hero-text { min-width: 0; }
/* Avatar: a glass glint crosses the photo every few seconds. */
@keyframes glint { 0%, 72% { background-position: 160% 0; } 100% { background-position: -60% 0; } }
.avatar {
  --size: 8.5rem;
  position: relative;
  flex: none;
  width: var(--size);
  height: var(--size);
  animation: rise 0.6s var(--ease) both;
}
.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(115deg, transparent 38%, var(--glint) 50%, transparent 62%) 160% 0 / 260% 100% no-repeat;
  pointer-events: none;
  animation: glint 6s 1.2s ease-in-out infinite;
}
.portrait {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: var(--rule);
  transition: transform 0.4s var(--spring);
}
.avatar:hover .portrait { transform: scale(1.03); }
h1 {
  margin: 0;
  font: 500 2.4rem/1.15 var(--serif);
  letter-spacing: -0.01em;
  text-wrap: balance;
  animation: rise 0.6s 0.08s var(--ease) both;
}
.cjk { font-size: 0.62em; color: var(--muted); margin-left: 0.25em; font-weight: 400; letter-spacing: 0.05em; }
.role { margin: 0.5rem 0 1rem; color: var(--muted); line-height: 1.5; animation: rise 0.6s 0.16s var(--ease) both; }

.links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem 0.3rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--fg);
  font-size: 0.875rem;
  text-decoration: none;
  animation: rise 0.5s var(--ease) both;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--spring), box-shadow 0.2s;
}
.links a:nth-child(1) { animation-delay: 0.24s; }
.links a:nth-child(2) { animation-delay: 0.29s; }
.links a:nth-child(3) { animation-delay: 0.34s; }
.links a:nth-child(4) { animation-delay: 0.39s; }
.links a:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-2px); box-shadow: 0 4px 12px -6px var(--accent); }
.links svg { width: 1rem; height: 1rem; flex: none; transition: transform 0.25s var(--spring); }
.links a:hover svg { transform: rotate(-8deg) scale(1.12); }

/* Tabs */
.tabs { margin-top: 2.5rem; border-bottom: 1px solid var(--rule); animation: rise 0.5s 0.42s var(--ease) both; }
.tablist { position: relative; display: flex; gap: 1.75rem; }
.tablist a {
  position: relative;
  padding: 0.6rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s;
}
.tablist a:hover, .tablist a[aria-selected="true"] { color: var(--fg); }
.tablist a:focus-visible { outline-offset: -2px; }
.indicator {
  display: none;
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  border-radius: 2px;
  background: var(--accent);
}
.has-tabs .indicator { display: block; }
.indicator.ready { transition: transform 0.35s var(--ease), width 0.35s var(--ease); }

/* Panels */
.panel { padding-top: 2rem; }
.panel + .panel { margin-top: 1rem; }
.has-tabs .panel + .panel { margin-top: 0; }
.panel.enter { animation: rise 0.35s var(--ease) both; }
.panel-title { margin: 0 0 1.25rem; font: 500 1.5rem/1.3 var(--serif); }
.has-tabs .panel-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.prose { max-width: 38rem; }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); margin: 1.75rem 0 0; font-size: 0.9375rem; }

.prose a, .muted a, .contact a {
  text-decoration: none;
  background:
    linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat,
    linear-gradient(color-mix(in srgb, var(--accent) 35%, transparent), color-mix(in srgb, var(--accent) 35%, transparent)) 0 100% / 100% 1px no-repeat;
  transition: background-size 0.3s ease;
}
.prose a:hover, .muted a:hover, .contact a:hover { background-size: 100% 1px, 100% 1px; }

.label {
  margin: 2.25rem 0 1rem;
  font: 600 0.75rem/1.6 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.panel-title + .label { margin-top: 0; }

.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.entries.compact { gap: 0.6rem; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
h4 { margin: 0; font: 600 1rem/1.45 var(--sans); }
.compact h4 { font-weight: 400; }
.date { flex: none; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.org { margin: 0.1rem 0 0; color: var(--muted); }
.note { margin: 0.35rem 0 0; font-size: 0.9375rem; }

.contact address { font-style: normal; margin: 0 0 0.6rem; }
.contact p { margin: 0; }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.75rem; }
.pub { display: grid; grid-template-columns: 6.5rem 1fr; gap: 0 1.25rem; align-items: start; }
.pub-body { min-width: 0; }
.venue-badge {
  justify-self: start;
  margin-top: 0.2rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 0.75rem/1.5 var(--mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pub-title { margin: 0; font: 500 1.125rem/1.4 var(--serif); text-wrap: balance; }
.pub-title a { color: var(--fg); text-decoration: none; transition: color 0.2s; }
.pub-title a:hover { color: var(--accent); }
.pub-authors, .pub-venue { margin: 0.3rem 0 0; font-size: 0.9375rem; }
.pub-authors strong { font-weight: 600; }
.pub-venue { color: var(--muted); font-style: italic; }
.pub-links { margin: 0.6rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pub-links a {
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--fg);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s, transform 0.2s var(--spring);
}
.pub-links a:hover { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

/* Footer */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.8125rem;
}
footer p { margin: 0; }
.globe { width: 90px; height: 90px; overflow: hidden; }
.globe canvas { width: 90px !important; height: 90px !important; max-width: 90px !important; max-height: 90px !important; }

/* Phones */
@media (max-width: 640px) {
  body { padding: 2.5rem 1rem 2rem; }
  .hero { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .avatar { --size: 6.5rem; }
  h1 { font-size: 2rem; }
  .tabs { margin-top: 2rem; }
  .tablist { gap: 1.25rem; }
  .entry-head { flex-direction: column; gap: 0; }
  .pub { grid-template-columns: 1fr; gap: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  body { background: #fff; color: #000; padding: 0; }
  .links a, .pub-links a { border: 0; padding: 0; }
  .tabs, .globe { display: none; }
  .panel[hidden] { display: block !important; }
}
