:root {
  --bg: #f7f5f2;
  --fg: #1a1a1a;
  --muted: #6b6762;
  --faint: #a8a39c;
  --rule: #e4e0da;
  --accent: #c2491d;
  --tag-bg: #ece8e2;
  --sans: "Inter", "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #e9e6e1;
    --muted: #9a958e;
    --faint: #5f5b56;
    --rule: #2a2826;
    --accent: #ec7a4b;
    --tag-bg: #1f1d1b;
  }
}

/* ---------- language switching ---------- */
html[lang="en"] [data-lang="ja"],
html[lang="ja"] [data-lang="en"] { display: none !important; }

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
}
html[lang="en"] body { font-feature-settings: normal; line-height: 1.7; }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color .15s, text-decoration-color .15s;
}
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

::selection { background: var(--accent); color: var(--bg); }

/* ---------- layout ---------- */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 88px;
}

.side-inner {
  position: sticky;
  top: 0;
  padding: 88px 0 48px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main { padding: 88px 0 48px; min-width: 0; }

/* ---------- sidebar ---------- */
.name {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
html[lang="ja"] .name { letter-spacing: 0.02em; }

.name-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.04em;
}

.hop {
  width: 180px;
  height: 30px;
  margin: 28px 0 22px;
  overflow: visible;
}
.hop path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-dasharray: 2.5 3.5;
  stroke-linecap: round;
}
.hop circle { fill: var(--accent); }
.hop line { stroke: var(--rule); stroke-width: 1; }

@media (prefers-reduced-motion: no-preference) {
  .hop path { animation: march 2.4s linear infinite; }
  @keyframes march { to { stroke-dashoffset: -24; } }
}

.role {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.nav {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
}
.nav a::before {
  content: "";
  width: 16px;
  height: 1px;
  background: var(--faint);
  transition: width .2s, background .2s;
}
.nav a:hover, .nav a.active { color: var(--fg); }
.nav a:hover::before, .nav a.active::before { width: 32px; background: var(--accent); }

.links {
  list-style: none;
  margin: auto 0 0;
  padding: 48px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-size: 14px;
}

.lang-toggle {
  margin-top: 20px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--faint);
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  cursor: pointer;
  width: fit-content;
}
.lang-toggle .sep { margin: 0 6px; }
.lang-toggle:hover .opt { color: var(--muted); }
html[lang="en"] .lang-toggle [data-for="en"],
html[lang="ja"] .lang-toggle [data-for="ja"] { color: var(--fg); }

/* ---------- sections ---------- */
.section { padding-bottom: 96px; scroll-margin-top: 48px; }

.label {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin: 0 0 32px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.label .num { color: var(--accent); }
.label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
  transform: translateY(-3px);
}

.sub {
  margin: 36px 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.sub:first-of-type { margin-top: 0; }
.note { font-weight: 400; color: var(--faint); }

p { margin: 0 0 1em; }

.lead {
  font-size: 22px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  font-weight: 500;
  margin-bottom: 28px;
}
html[lang="ja"] .lead { font-size: 20px; line-height: 1.8; letter-spacing: 0.01em; }

#about p:not(.lead):not(.meta-line) { color: var(--muted); }

.meta-line {
  font: 400 12px/1.6 var(--mono);
  color: var(--faint);
  letter-spacing: 0.02em;
  margin-top: 24px;
}

/* ---------- research ---------- */
.project {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 24px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
}
.project:first-of-type { border-top: 0; padding-top: 0; }

.when {
  font: 400 12px/1.6 var(--mono);
  color: var(--faint);
  padding-top: 4px;
  white-space: nowrap;
}

.project h3 {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: -0.005em;
}
.project p { color: var(--muted); font-size: 15px; }

.tags {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tags li {
  font: 400 11px/1 var(--mono);
  padding: 5px 8px;
  border-radius: 3px;
  background: var(--tag-bg);
  color: var(--muted);
}

/* ---------- publications ---------- */
.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}
.pubs li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  font-size: 15px;
}
.pub-title { font-weight: 500; line-height: 1.55; }
.pub-authors { color: var(--muted); font-size: 14px; }
.pub-authors b { color: var(--fg); font-weight: 600; }
.pub-venue { color: var(--faint); font-size: 13px; font-style: italic; }
html[lang="ja"] .pub-venue { font-style: normal; }

/* ---------- timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 24px;
  padding: 7px 0;
  font-size: 15px;
}
.timeline .when { padding-top: 3px; }

.skills {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 8px 24px;
  margin: 0;
  font-size: 15px;
}
.skills dt { font: 400 12px/1.6 var(--mono); color: var(--faint); padding-top: 3px; }
.skills dd { margin: 0; }

/* ---------- footer ---------- */
.footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--rule);
  padding-top: 24px;
  font: 400 12px/1 var(--mono);
  color: var(--faint);
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0 22px;
  }
  .side-inner {
    position: static;
    min-height: 0;
    padding: 64px 0 8px;
  }
  .nav { display: none; }
  .links { margin-top: 0; padding-top: 24px; }
  .main { padding-top: 56px; }
  .section { padding-bottom: 72px; }
  .lead { font-size: 20px; }
  .project { grid-template-columns: 1fr; gap: 6px; }
  .timeline li, .skills { grid-template-columns: 88px 1fr; gap: 4px 16px; }
}
