:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #59636e;
  --line: #e3e6ea;
  --accent: #1a5fb4;
  --header-bg: #f5f7fa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --fg: #e6e8eb;
    --muted: #9aa4af;
    --line: #2c3238;
    --accent: #7fb2f0;
    --header-bg: #1c2026;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 3.5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 15.5px;
  line-height: 1.75;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header { background: var(--header-bg); border-bottom: 1px solid var(--line); padding: 2.5rem 0 1.75rem; }
.site-header h1 { margin: 0 0 .5rem; font-size: 1.9rem; line-height: 1.3; }
.site-header h1 .en { display: inline-block; font-size: 1.15rem; font-weight: 500; color: var(--muted); margin-left: .4em; }
.site-header p { margin: .25rem 0; }
.role { font-weight: 500; }
.contact { color: var(--muted); font-size: .92rem; }

.toc { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.toc .wrap { display: flex; gap: 1.25rem; overflow-x: auto; white-space: nowrap; padding-top: .6rem; padding-bottom: .6rem; font-size: .92rem; }

main section { padding: 1.5rem 0 .5rem; }
h2 { font-size: 1.35rem; margin: 1rem 0 .75rem; padding-bottom: .3rem; border-bottom: 2px solid var(--line); }
h3 { font-size: 1.08rem; margin: 1.5rem 0 .5rem; }
h4 { font-size: .98rem; margin: 1.2rem 0 .4rem; color: var(--muted); }

ul.timeline { list-style: none; padding: 0; margin: 0; }
ul.timeline li { padding: .3rem 0; border-bottom: 1px dashed var(--line); }
ul.timeline .sub { color: var(--muted); font-size: .93rem; padding-left: 1em; }

ul.pubs { padding-left: 1.3em; margin: 0; }
ul.pubs li { margin: .45rem 0; overflow-wrap: anywhere; }

footer { color: var(--muted); font-size: .85rem; padding: 2rem 16px 3rem; }

.links { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: .6rem !important; font-size: .92rem; }
.links a { border: 1px solid var(--line); border-radius: 999px; padding: .1rem .7rem; background: var(--bg); }

/* CV-style rows: date column + content */
ul.cv { list-style: none; padding: 0; margin: 0; }
ul.cv > li { display: grid; grid-template-columns: 11.5em 1fr; gap: .2rem 1rem; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
ul.cv .date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .93rem; }
ul.cv .sub { color: var(--muted); font-size: .93rem; }
ul.roles { list-style: none; padding: 0; margin: .3rem 0 0; }
ul.roles li { display: grid; grid-template-columns: 11.5em 1fr; gap: 1rem; font-size: .95rem; }
@media (max-width: 600px) {
  ul.cv > li, ul.roles li { grid-template-columns: 1fr; gap: 0; }
  ul.roles li { margin-bottom: .2rem; }
}

.note { color: var(--muted); font-size: .88rem; margin: 0 0 .5rem; }
a.tag { display: inline-block; font-size: .82rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 .4rem; margin-left: .2rem; line-height: 1.6; }

/* Research Interests */
.lead { margin: .25rem 0 1rem; }
.lead .sub { color: var(--muted); font-size: .93rem; }
.themes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem; }
.theme { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; }
.theme h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.theme h3 .en { display: block; font-size: .82rem; font-weight: 500; color: var(--muted); }
.theme p { margin: 0 0 .5rem; font-size: .93rem; }
.theme .works { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.theme .works a.tag { margin-left: 0; }

/* multi-page layout */
.site-header.compact { padding: 1.1rem 0 .9rem; }
.site-header .site-name { margin: 0 0 .2rem; font-size: 1.25rem; font-weight: 700; }
.site-header .site-name a { color: var(--fg); }
.site-header .site-name .en { font-size: .95rem; font-weight: 500; color: var(--muted); margin-left: .3em; }
.site-header.compact .role { font-size: .88rem; font-weight: 400; color: var(--muted); }
.toc a.active { color: var(--fg); font-weight: 700; border-bottom: 2px solid var(--accent); padding-bottom: .15rem; }
.page-title { font-size: 1.6rem; margin: 1.6rem 0 .3rem; }
.page-toc { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: .88rem; margin: 0 0 .5rem; }
ul.news > li { grid-template-columns: 7.5em 1fr; }
.more { margin-top: 1rem; font-size: .92rem; }
@media (max-width: 600px) { ul.news > li { grid-template-columns: 1fr; } }

/* 言語切り替え（日本語 / English） */
.site-header .wrap { position: relative; }
.lang-switch { position: absolute; top: 0; right: 16px; margin: 0 !important; font-size: .85rem; }
.lang-switch a { border: 1px solid var(--line); border-radius: 999px; padding: .05rem .7rem; background: var(--bg); }
@media (max-width: 600px) { .lang-switch { position: static; text-align: right; margin: 0 0 .3rem !important; } }
