/* Site stylesheet: one column, restrained colour, system fonts (Latin + Japanese). */

:root {
  --bg: #ffffff;
  --text: #1f2328;
  --muted: #5d6673;
  --rule: #e2e5ea;
  --soft: #f5f6f8;
  --accent: #1d3a5f;
  --award: #8a5a00;
  --fs-sm: 0.92rem;   /* secondary text: authors, venues, notes, card text, navigation */
  --fs-xs: 0.84rem;   /* small text: buttons, labels, captions, footer */
  --fs-xxs: 0.78rem;  /* tags */
  --col: 180px;       /* width of the left column (dates, thumbnails, photo) */
  --col-gap: 20px;
  --lift: 0 1px 2px rgba(20, 30, 50, 0.10), 0 8px 22px rgba(20, 30, 50, 0.13);   /* shadow of a raised block */
  --sans: "Helvetica Neue", Helvetica, Arial, "Hiragino Kaku Gothic ProN", "Hiragino Sans",
          "Noto Sans JP", "Noto Sans CJK JP", "Yu Gothic", Meiryo, sans-serif;
  --serif: Georgia, "Times New Roman", "Hiragino Mincho ProN", "Noto Serif JP",
           "Noto Serif CJK JP", "Yu Mincho", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b;
    --text: #e4e7eb;
    --muted: #9aa3af;
    --rule: #2b3138;
    --soft: #1c2026;
    --accent: #9dbde6;
    --award: #e0b45c;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.5), 0 8px 22px rgba(0, 0, 0, 0.55);
  }
}

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

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

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

html[lang="ja"] body { line-height: 1.8; }

.wrap { max-width: 860px; margin: 0 auto; padding: 0 24px; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: 0 0 0.8em; }
#about p, #interests > p { text-align: justify; hyphens: manual; }
.nowrap { white-space: nowrap; }
img { max-width: 100%; height: auto; }

/* Shared pages render both languages; show only the active one. */
html[data-lang="en"] [data-lang="ja"],
html[data-lang="ja"] [data-lang="en"] { display: none; }

/* ---------- Top bar ---------- */

.masthead { border-bottom: 1px solid var(--rule); }

.masthead__inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 28px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.masthead__name {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-right: auto;
}
.masthead__name:hover { text-decoration: none; }

.masthead__nav { display: flex; gap: 22px; }
/* the homepage has no site name in the bar: keep the navigation on the right */
.masthead__inner > .masthead__nav:first-child { margin-left: auto; }
.masthead__nav a { color: var(--muted); font-size: var(--fs-sm); padding: 4px 0; border-bottom: 2px solid transparent; }
.masthead__nav a:hover { color: var(--text); text-decoration: none; }
.masthead__nav a[aria-current] { color: var(--text); border-bottom-color: var(--accent); }

.masthead__lang {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: hidden;
  font-size: var(--fs-xs);
}
.masthead__lang a { padding: 3px 10px; color: var(--muted); }
.masthead__lang a:hover { text-decoration: none; color: var(--text); }
.masthead__lang a[aria-current] { background: var(--accent); color: var(--bg); }

/* ---------- Headings and sections ---------- */

main.wrap { padding-top: 40px; padding-bottom: 56px; }

h1, h2, h3 { line-height: 1.3; margin: 0; }

.page-title { font-family: var(--serif); font-size: 1.6rem; margin-bottom: 8px; }

.lede { color: var(--muted); margin-bottom: 0; }

.section { margin-top: 40px; scroll-margin-top: 72px; }

/* Section heading: a filled label sitting on a rule */
.sec {
  margin: 0 0 18px;
  border-bottom: 2px solid var(--accent);
  font-size: var(--fs-xs);
  line-height: 1;
}
.sec span {
  display: inline-block;
  padding: 7px 14px 6px;
  border-radius: 4px 4px 0 0;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
html[lang="ja"] .sec { font-size: var(--fs-sm); }
html[lang="ja"] .sec span { letter-spacing: 0.06em; }

.section h3 { font-size: 1rem; margin: 22px 0 10px; }

.more { margin-top: 14px; font-size: var(--fs-sm); }

/* ---------- Profile header ---------- */

.profile {
  display: flex; gap: 40px; align-items: center;
  padding: 28px 32px;
  background: var(--soft);
  border: 1px solid var(--rule);
  border-radius: 8px;
}

.profile__photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--rule);
  flex: none;
}

.profile__name { font-family: var(--serif); font-size: 2rem; margin-bottom: 6px; }
.profile__name-alt { font-size: 1.15rem; font-weight: 400; color: var(--muted); margin-left: 8px; white-space: nowrap; }
.profile__role { font-weight: 600; margin-bottom: 0; }
.profile__affiliation, .profile__location { margin-bottom: 0; color: var(--muted); }

.profile__links {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: var(--fs-sm);
}
.profile__links li + li::before { content: "·"; color: var(--muted); margin: 0 10px; }

/* ---------- Research themes ---------- */

/* The concept row and the cards share one three-column grid so their edges line up. */
.flow { --gap: 24px; margin: 18px 0 26px; }
.flow__row, .themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.flow__box {
  position: relative;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 10px 12px; text-align: center;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--soft);
}
.flow__box strong { font-size: var(--fs-sm); }
.flow__box span { font-size: var(--fs-xs); color: var(--muted); }
.flow__box--main { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.flow__box:not(:last-child)::after {
  content: "→"; position: absolute; left: 100%; top: 50%; width: var(--gap);
  transform: translateY(-50%); text-align: center; line-height: 1;
  color: var(--accent); font-size: 1.05rem;
}
/* return path from the centre of the result box back to the centre of the intent box */
.flow__loop {
  position: relative; height: 26px; margin: 0 calc((100% - 2 * var(--gap)) / 6);
  border: 1.5px dashed var(--accent); border-top: 0; border-radius: 0 0 8px 8px;
}
.flow__loop::before {
  content: ""; position: absolute; left: -5.5px; top: -1px;
  border: 5px solid transparent; border-top: 0; border-bottom: 7px solid var(--accent);
}
.flow__loop span {
  position: absolute; left: 50%; bottom: -0.75em; transform: translateX(-50%);
  padding: 0 10px; background: var(--bg); color: var(--accent);
  font-size: var(--fs-xs); white-space: nowrap;
}

.themes { list-style: none; margin: 0; padding: 0; }
.theme { display: flex; flex-direction: column; text-align: center; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.theme__fig { background: var(--soft); border-bottom: 1px solid var(--rule); padding: 10px 8px; }
.art { display: block; width: 100%; height: 118px; color: var(--accent); }
.art-line { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.art-panel { fill: var(--bg); }
.art-soft { fill: color-mix(in srgb, currentColor 10%, var(--bg)); }
.art-mid { fill: color-mix(in srgb, currentColor 32%, var(--bg)); }
.art-strong { fill: color-mix(in srgb, currentColor 62%, var(--bg)); }
.art-accent, .art-knob { fill: currentColor; }
.art-dot { fill: color-mix(in srgb, currentColor 40%, var(--bg)); }
.art-track { stroke: color-mix(in srgb, currentColor 25%, var(--bg)); stroke-width: 4; stroke-linecap: round; }
.art-fill { stroke: color-mix(in srgb, currentColor 60%, var(--bg)); stroke-width: 4; stroke-linecap: round; }
.art-knob { stroke: var(--bg); stroke-width: 2; }
.art-cursor { fill: var(--text); stroke: var(--bg); stroke-width: 1.2; stroke-linejoin: round; }
.art-sketch { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-dasharray: 7 3 12 4; }
.art-road { stroke: color-mix(in srgb, currentColor 18%, var(--bg)); stroke-width: 5; }
.theme h3 { font-size: 1rem; margin: 14px 16px 4px; }
.theme p { font-size: var(--fs-sm); margin: 0 16px 16px; text-wrap: balance; }

/* ---------- Dated entries (education, work, awards) ---------- */

.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 140px 1fr; gap: 0 18px; }
.entry__period { color: var(--accent); font-size: var(--fs-sm); font-weight: 700; font-variant-numeric: tabular-nums; text-align: left; white-space: nowrap; padding-top: 1px; }
.entry__body { position: relative; border-left: 2px solid var(--rule); padding: 0 0 18px 24px; }
.entry:last-child .entry__body { padding-bottom: 4px; }
.entry__body::before {
  content: ""; position: absolute; left: -7px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.entry__note { display: block; color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

/* ---------- News ---------- */

.news { list-style: none; margin: 0; padding: 0; }
/* News as a timeline: a vertical line with a marker for each item */
.news { position: relative; margin-left: 5px; padding-left: 22px; border-left: 2px solid var(--rule); }
.news li { position: relative; padding: 0 0 14px; }
.news:last-child li:last-child, .expand .news li:last-child { padding-bottom: 2px; }
.news:has(+ .expand[open]) li:last-child { padding-bottom: 14px; }
.news li::before {
  content: ""; position: absolute; left: -29px; top: 6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
/* avoid a lone word on the last line */
.news li, .entry__body, .pub__title, .pub__venue { text-wrap: pretty; }
.news__date { display: block; color: var(--accent); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* ---------- Expandable list ---------- */

.expand { display: flex; flex-direction: column; }
.expand > summary {
  order: 2;
  align-self: flex-start;
  cursor: pointer;
  list-style: none;
  margin-top: 14px;
  padding: 4px 14px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: var(--fs-sm);
  color: var(--accent);
}
.expand > summary::-webkit-details-marker { display: none; }
.expand > summary:hover { background: var(--soft); }
.expand > summary::before { content: "+"; margin-right: 8px; }
.expand[open] > summary::before { content: "\2212"; }
.expand .expand__less, .expand[open] .expand__more { display: none; }
.expand[open] .expand__less { display: inline; }
.expand .pubs .pub:first-child { padding-top: 14px; }
.expand--plain { border-top: 0; }
.expand--plain > summary { margin-top: 10px; }

/* ---------- Publications ---------- */

.toc {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 14px 0 0;
  padding: 10px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  font-size: var(--fs-sm);
}
.toc__inner { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.toc__inner::-webkit-scrollbar { display: none; }
.toc a { flex: none; border: 1px solid var(--rule); border-radius: 4px; padding: 4px 12px; color: var(--text); white-space: nowrap; }
.toc a:hover { background: var(--soft); text-decoration: none; }
.toc a[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.toc a[aria-current] .count { color: inherit; opacity: 0.8; }
.count { color: var(--muted); margin-left: 4px; }
.legend { color: var(--muted); font-size: var(--fs-xs); margin: 12px 0 0; }

.pubs { list-style: none; margin: 0; padding: 0; }

.pub { padding: 14px; margin: 0 -14px; border-radius: 8px; transition: background-color 0.15s, box-shadow 0.15s, transform 0.15s; }
.pub + .pub { margin-top: 2px; }
/* the padding that makes room for the hover background should not push the list away from its heading or the next section */
.sec + .pubs { margin-top: -12px; }
.sec + .pubs--compact { margin-top: -8px; }
.section > .pubs:last-child { margin-bottom: -12px; }
@media (hover: hover) {
  /* the entry under the pointer lifts slightly off the page */
  .pub:hover { background: var(--soft); box-shadow: var(--lift); transform: translateY(-2px); }
  .pub:hover .pub__fig { border-color: var(--accent); }
  .pub:hover .pub__title a { color: var(--accent); }
}

.pub--thumb { display: grid; grid-template-columns: var(--col) 1fr; gap: var(--col-gap); align-items: start; }

.pub__fig {
  height: 112px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.pub__fig img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pub__fig-empty { color: var(--muted); font-size: var(--fs-xs); letter-spacing: 0.04em; }
.pub__fig:has(.pub__fig-empty) { background: var(--soft); }

.pub p { margin: 0; }
.pub__title { font-weight: 600; line-height: 1.4; }
.pub__title a { color: var(--text); }
.pub__title a:hover { color: var(--accent); }
.pub__label { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; margin-right: 4px; }
/* numbered entries: the number hangs in its own column, the text lines up to its right */
.pub--num .pub__body { position: relative; padding-left: 3.4em; }
.pub--num .pub__label { position: absolute; left: 0; margin: 0; }
.pub__authors { font-size: var(--fs-sm); margin-top: 3px !important; }
.pub__authors { color: var(--text); }
.pub__authors strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.pub__venue { font-size: var(--fs-sm); color: var(--muted); }
.pub__links { font-size: var(--fs-xs); margin-top: 6px !important; display: flex; gap: 8px; }
.pub__links a { border: 1px solid var(--rule); border-radius: 3px; padding: 0 8px; }
.pub__links a:hover { background: var(--soft); text-decoration: none; }

.pubs--compact .pub { padding: 9px 14px; }
.pubs--compact .pub__links { display: none; }

.tag {
  display: inline-block;
  font-size: var(--fs-xxs);
  line-height: 1.5;
  padding: 0 7px;
  margin-left: 4px;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--muted);
  white-space: nowrap;
}
.tag--award { color: var(--award); border-color: currentColor; }

/* ---------- Publication detail page ---------- */

.back { font-size: var(--fs-sm); margin-bottom: 20px; }
.back--end { margin: 36px 0 0; padding-top: 16px; border-top: 1px solid var(--rule); }

.paper__head { padding: 16px 20px; margin-bottom: 26px; background: var(--soft); border: 1px solid var(--rule); border-radius: 8px; }
.paper__title { font-family: var(--serif); font-size: 1.5rem; margin-bottom: 8px; }
.paper__authors { margin-bottom: 2px; }
.paper__authors strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.paper__venue { color: var(--muted); margin-bottom: 0; }
.paper__content section p + .sec { margin-top: 28px; }
.paper__content figure { margin: 28px 0 0; padding: 12px; background: #fff; border: 1px solid var(--rule); border-radius: 4px; }
.paper__content img { display: block; margin: 0 auto; }
.paper__content p { text-align: justify; hyphens: manual; }

/* ---------- Footer ---------- */

.footer { border-top: 1px solid var(--rule); color: var(--muted); font-size: var(--fs-xs); }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px; padding-top: 18px; padding-bottom: 28px; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  main.wrap { padding-top: 28px; }
  .masthead__name { width: 100%; }
  .masthead__nav { margin-right: auto; }
  .masthead__inner > .masthead__nav:first-child { margin-left: 0; }
  .profile { flex-direction: column; align-items: flex-start; gap: 18px; padding: 20px; }
  .profile__photo { width: 128px; height: 128px; }
  .profile__name { font-size: 1.6rem; }
  .profile__name-alt { display: block; margin: 2px 0 0; }
  .profile__links { gap: 8px; }
  .profile__links li + li::before { content: none; }
  .profile__links a { display: inline-block; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 4px; }
  .pub__links a { padding: 4px 11px; }
  .entry, .themes { grid-template-columns: 1fr; }
  .entry { position: relative; border-left: 2px solid var(--rule); margin-left: 5px; padding: 0 0 16px 20px; }
  .entry:last-child { padding-bottom: 2px; }
  .entry::before { content: ""; position: absolute; left: -7px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent); }
  .entry__period { text-align: left; padding: 0 0 2px; }
  .entry__body { border-left: 0; padding: 0; }
  .entry__body::before { content: none; }
  .paper__head { padding: 14px 16px; }
  .flow__row { grid-template-columns: 1fr; gap: 26px; }
  .themes { gap: 14px; }
  .flow__box:not(:last-child)::after { content: "↓"; left: 0; top: 100%; width: 100%; height: 26px; line-height: 26px; transform: none; }
  .flow__loop { margin: 0; height: auto; border: 0; }
  .flow__loop::before { content: none; }
  .flow__loop span { position: static; transform: none; display: block; text-align: center; white-space: normal; padding: 8px 0 0; }
  .flow__loop span::before { content: "↺ "; }
  .pub--thumb { grid-template-columns: 1fr; gap: 10px; }
  .paper__content p, #about p, #interests > p { text-align: left; }
  .pub__fig { height: 150px; }
  .pub--thumb .pub__fig:has(.pub__fig-empty) { display: none; }
  .paper__title { font-size: 1.3rem; }
}

@media print {
  .masthead__nav, .masthead__lang, .toc, .pub__links, .back, .more, .expand > summary, .no-print { display: none; }
  .toc { position: static; }
  body { font-size: 10.5pt; color: #000; }
  .masthead, .footer { border-color: #999; }
  a { color: inherit; }
  main.wrap { padding-top: 16px; padding-bottom: 0; }
  /* Browsers drop background colours when printing, so headings become plain bold text on a rule. */
  .sec { border-bottom: 1px solid #000; margin-bottom: 10px; break-after: avoid; }
  .sec span { background: none; color: #000; padding: 0 0 4px; }
  .section { margin-top: 22px; }
  .lede, .entry__period, .entry__note, .pub__venue, .news__date { color: #333; }
  .pub, .entry, .news li { break-inside: avoid; }
  .theme__fig, .flow__box, .profile { background: none; }
}
