:root {
  --text: #404040;
  --text-strong: #000000;
  --text-muted: #737373;
  --line: #d4d4d4;
  --line-soft: #e5e5e5;
  --bg-soft: #fafafa;
  --bg-hover: #f5f5f5;
  --bg-dark: #111827;
  --text-dark: #e5e5e5;
  --content-width: 48rem;
  --wide-width: 72rem;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 1.1rem 0 2rem;
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 1.125rem;
  line-height: 1.75;
  background: #ffffff;
}

body.home-page {
  overflow: hidden;
}

/* Homepage refresh: a compact research-profile layout inspired by the supplied reference. */
body.benshi-home {
  min-height: 100vh;
  padding: 2.5rem 1.25rem 5rem;
  overflow: visible;
  color: #303030;
  font-size: 1rem;
  line-height: 1.6;
}

.profile-page { width: min(100%, 50rem); margin: 0 auto; }
.profile-nav { display: flex; gap: 1.85rem; height: 2.35rem; margin-bottom: 2.1rem; border-bottom: 1px solid #e7e7e7; color: #777; font-size: .95rem; }
.profile-nav a { display: flex; align-items: flex-start; padding: .05rem .1rem .7rem; border-bottom: 2px solid transparent; }
.profile-nav a:hover, .profile-nav a.active { color: #222; }
.profile-nav a.active { border-color: #386ab2; }
.profile-header { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.profile-identity { display: flex; align-items: center; gap: 1.1rem; }
.profile-avatar-wrap { position: relative; width: 5.4rem; height: 5.4rem; flex: none; }
.profile-avatar { position: absolute; inset: 0; width: 100%; height: 100%; border: 1px solid #e1e1e1; border-radius: 50%; object-fit: cover; transition: opacity 180ms ease; }
.profile-avatar-hover { opacity: 0; }
.profile-avatar-wrap:hover .avatar-primary { opacity: 0; }
.profile-avatar-wrap:hover .avatar-hover { opacity: 1; }
.profile-header h1, .works h2, .recent-card h2 { margin: 0; color: #303030; font-weight: 650; }
.profile-header h1 { font-size: 1.55rem; line-height: 1.25; }
.profile-subtitle { margin: .15rem 0 0; color: #777; font-size: .91rem; }
.profile-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.profile-links a { display: grid; width: 2.25rem; height: 2.25rem; place-items: center; border-radius: 50%; background: #f4f4f4; color: #555; font-size: .83rem; transition: color 160ms ease, background-color 160ms ease; }
.profile-links a:hover { background: #e7eef9; color: #2f65aa; }
.social-icon svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }
.social-icon.scholar-icon svg { width: 1.2rem; height: 1.2rem; }
.profile-intro { margin-top: 1.7rem; }
.profile-intro p + p { margin-top: 1rem; }
.profile-intro a, .recent-card a, .contact-line a { color: #3568ab; }
.profile-intro a:hover, .recent-card a:hover, .contact-line a:hover { text-decoration: underline; }
.recent-card { margin-top: 2rem; padding: 1.45rem 1.5rem; border-radius: .35rem; background: #f8f8f8; }
.recent-card h2 { margin-bottom: 1.05rem; color: #666; font-size: 1.13rem; }
.recent-item { display: grid; grid-template-columns: 5.8rem 1fr; gap: .85rem; }
.recent-item + .recent-item { margin-top: .9rem; }
.recent-item time { color: #777; font-size: .9rem; }
.recent-item p { margin: 0; }
.contact-line { margin: 2rem 0 2.7rem; }
.contact-line a { padding: .1rem .28rem; background: #f3f3f3; color: #444; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; }
.works h2 { font-size: 1.25rem; }
.works-note { margin: -.1rem 0 1.25rem; color: #8a8a8a; font-size: .85rem; font-style: italic; }
.work-entry { padding: 1.35rem 0; border-top: 1px solid #e7e7e7; }
.work-entry h3 { margin: 0 0 .18rem; color: #333; font-size: 1.02rem; line-height: 1.42; font-weight: 650; }
.work-authors, .work-venue { margin: 0; font-size: .91rem; }
.work-authors { color: #6e6e6e; font-style: italic; }
.cofirst-note { margin-left: .35rem; color: #888; font-size: .84em; font-style: normal; }
.work-venue { color: #555; }
.work-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: .72rem; }
.work-actions a { padding: .22rem .55rem; border-radius: .2rem; background: #f1f1f1; color: #3568ab; font-size: .88rem; line-height: 1.3; }
.work-actions a:hover { background: #e7eef9; }
.site-credit { margin-top: 4rem; color: #888; font-size: .84rem; }
.site-credit a { color: #666; text-decoration: underline; text-decoration-color: #c8c8c8; text-underline-offset: 2px; }
.site-credit a:hover { color: #3568ab; text-decoration-color: #3568ab; }

/* Shared interior-page treatment. */
.subpage-heading { display: flex; align-items: center; gap: 1rem; margin-bottom: 2rem; }
.subpage-avatar { position: relative; display: block; width: 3.8rem; height: 3.8rem; flex: none; }
.subpage-avatar-image { position: absolute; inset: 0; width: 100%; height: 100%; border: 1px solid #e1e1e1; border-radius: 50%; object-fit: cover; transition: opacity 180ms ease; }
.subpage-avatar-hover { opacity: 0; }
.subpage-avatar:hover .subpage-avatar-primary { opacity: 0; }
.subpage-avatar:hover .subpage-avatar-hover { opacity: 1; }
.subpage-heading h1 { margin: 0; color: #303030; font-size: 1.55rem; line-height: 1.2; font-weight: 650; }
.subpage-heading p { margin: .2rem 0 0; color: #777; font-size: .92rem; }
.research-works { margin-top: 0; }
.research-works .work-entry:first-child { border-top: 0; padding-top: 0; }
.research-works .work-entry h2 { margin: 0 0 .18rem; color: #333; font-size: 1.1rem; line-height: 1.4; font-weight: 650; }
.work-description { margin: .7rem 0 0; color: #4f4f4f; }
.more-section { margin-top: 2.7rem; }
.more-section h2 { margin: 0 0 1rem; color: #333; font-size: 1.2rem; font-weight: 650; }
.timeline-list { border-top: 1px solid #e7e7e7; }
.timeline-row { display: grid; grid-template-columns: 5.8rem 1fr; gap: .85rem; padding: .8rem 0; border-bottom: 1px solid #e7e7e7; }
.timeline-row time { color: #777; font-size: .9rem; }
.timeline-row strong { display: inline; color: #373737; font-weight: 600; }
.timeline-row span { margin-left: .5rem; color: #777; font-size: .91rem; }
.timeline-row p { margin: .2rem 0 0; color: #777; font-size: .91rem; line-height: 1.45; }
.timeline-row a, .fun-fact a { color: #3568ab; }
.timeline-row a:hover, .fun-fact a:hover { text-decoration: underline; }
.section-kicker { margin: -.6rem 0 .8rem; color: #777; font-size: .88rem; font-style: italic; }
.fun-fact p { margin: 0; }
.service-summary { padding: .85rem 0; border-top: 1px solid #e7e7e7; border-bottom: 1px solid #e7e7e7; }
.service-summary p { margin: 0; }
.service-summary p + p { margin-top: .35rem; }
.service-summary strong { color: #373737; font-weight: 600; }
.blog-page { margin-top: .2rem; }
.blog-page h1 { margin: 0; color: #303030; font-size: 1.55rem; line-height: 1.25; font-weight: 650; }
.blog-intro { margin: .45rem 0 1.8rem; color: #777; }
.blog-list { border-top: 1px solid #e7e7e7; }
.blog-empty { margin: 0; padding: 1.15rem 0; color: #777; font-style: italic; }

@media (max-width: 540px) {
  body.benshi-home { padding: 1.2rem 1rem 3rem; }
  .profile-nav { margin-bottom: 1.5rem; }
  .profile-header { align-items: flex-start; }
  .profile-links { gap: .35rem; }
  .profile-links a { width: 2rem; height: 2rem; }
  .profile-avatar-wrap { width: 4.45rem; height: 4.45rem; }
  .profile-header h1 { font-size: 1.32rem; }
  .recent-card { padding: 1.2rem 1rem; }
  .recent-item { grid-template-columns: 3.6rem 1fr; gap: .65rem; }
  .subpage-heading { margin-bottom: 1.6rem; }
  .subpage-avatar { width: 3.3rem; height: 3.3rem; }
  .subpage-heading h1 { font-size: 1.35rem; }
  .timeline-row { grid-template-columns: 3.6rem 1fr; gap: .65rem; }
}

@media (min-width: 640px) {
  body {
    padding: 2.4rem 0 4rem;
  }
}

@media (min-width: 768px) {
  body {
    padding: 3.2rem 0 6rem;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
ul {
  margin: 0;
}

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

.layout {
  width: min(100%, calc(var(--content-width) + 2rem));
  margin: 0 auto;
  padding: 0 1rem;
}

.layout-wide {
  width: min(100%, calc(var(--wide-width) + 2rem));
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .layout,
  .layout-wide {
    padding: 0 1.5rem;
  }
}

.header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.8rem;
  margin-bottom: 1.35rem;
}

.brand {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 700;
  color: var(--text-strong);
}

.identity-copy {
  display: flex;
  flex-direction: column;
}

.avatar-top {
  display: flex;
  justify-content: center;
  margin-bottom: 1.35rem;
}

.avatar-wrap {
  position: relative;
  width: 5.4rem;
  height: 5.4rem;
  flex: none;
}

.name-g {
  color: inherit;
  text-decoration: none;
}

.name-g:hover {
  color: inherit;
  text-decoration: none;
}

.avatar {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 1.25rem;
  border: 1px solid var(--line-soft);
  background: #f3efe8;
  object-fit: cover;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.avatar-primary {
  opacity: 1;
}

.avatar-hover {
  opacity: 0;
}

.avatar-caption {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.6rem);
  transform: translateX(-50%) translateY(0.2rem);
  padding: 0.35rem 0.55rem;
  border-radius: 0.5rem;
  background: rgba(17, 24, 39, 0.94);
  color: #ffffff;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.avatar-wrap:hover .avatar-primary {
  opacity: 0;
}

.avatar-wrap:hover .avatar-hover {
  opacity: 1;
}

.avatar-wrap:hover .avatar-caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.page-title {
  margin-left: 0.3rem;
  font-weight: 300;
}

.page-title-dash {
  color: #a3a3a3;
}

.nav {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding-top: 0;
  color: var(--text-muted);
}

.nav a {
  transition: color 0.15s ease;
}

.nav a:hover,
.nav a.active {
  color: #5e17eb;
}

main {
  display: block;
}

.stack-lg > * + * {
  margin-top: 3.5rem;
}

.stack-md > * + * {
  margin-top: 1.25rem;
}

.stack-sm > * + * {
  margin-top: 1rem;
}

.lead {
  line-height: 1.375;
}

.link {
  text-decoration: underline;
  text-decoration-color: #a3a3a3;
  text-underline-offset: 2px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.link:hover {
  color: #5e17eb;
  text-decoration-color: #5e17eb;
}

.project-pair {
  display: grid;
  gap: 0.25rem;
  margin: 0 -0.75rem;
  padding: 0.5rem 0.75rem;
  transition: background-color 0.15s ease;
}

.project-pair:hover {
  background: var(--bg-hover);
}

.section-title {
  margin-bottom: 0.75rem;
  color: var(--text-strong);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.section-title-spaced {
  margin-top: 2.5rem;
}

.awards-page {
  max-width: 46rem;
}

.section-rule {
  margin: 0 0 1.75rem;
  border: 0;
  border-top: 1px solid var(--line-soft);
}

.awards-groups {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.award-group-year {
  margin-bottom: 0.35rem;
  color: var(--text-strong);
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
}

.awards-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.award-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
  line-height: 1.25;
}

.award-title {
  color: var(--text-strong);
  font-weight: 600;
  line-height: 1.4;
}

.award-amount {
  color: var(--text-muted);
  font-size: 0.98rem;
}

.award-note {
  width: 100%;
  margin-top: 0.15rem;
  margin-bottom: 0;
  padding-left: 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.service-list {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.service-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  line-height: 1.25;
}

.service-label {
  color: var(--text-strong);
  font-weight: 600;
}

.service-text {
  color: var(--text);
}

.subsection-label {
  margin: -0.35rem 0 0.35rem;
  color: var(--text-strong);
  font-weight: 600;
}

.inline-note {
  color: var(--text-muted);
  font-weight: 400;
}

.inline-hover {
  position: relative;
  display: inline-block;
}

.inline-hover-trigger {
  text-decoration: underline;
  text-decoration-color: #a3a3a3;
  text-underline-offset: 2px;
}

.inline-hover-caption {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.55rem);
  transform: translateX(-50%) translateY(0.2rem);
  width: 18rem;
  padding: 0.45rem 0.55rem;
  border-radius: 0.55rem;
  background: rgba(17, 24, 39, 0.96);
  color: #ffffff;
  font-size: 0.78rem;
  line-height: 1.3;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-decoration: none;
}

.inline-hover:hover .inline-hover-caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 640px) {
  .project-pair {
    grid-template-columns: 1fr 2fr;
  }
}

.project-title {
  color: var(--text-strong);
  font-weight: 500;
}

.project-status {
  margin-top: 0.125rem;
  font-size: 1rem;
  line-height: 1.5rem;
  color: var(--text-muted);
}

.footer {
  margin-top: 5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.footer-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  line-height: 1.4;
}

.footer-label,
.footer-credit {
  color: var(--text-muted);
}

.footer-divider {
  flex: 1;
  border: 0;
  border-top: 1px dotted var(--line);
  margin: 0;
}

.footer-credit {
  margin-top: 2rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.toc-wrap {
  background: var(--bg-dark);
  color: var(--text-dark);
}

.toc {
  padding: 3rem 0;
}

.toc-inner {
  max-width: var(--content-width);
}

.toc-title {
  margin-bottom: 1rem;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  color: #ffffff;
}

.toc-list {
  list-style: none;
  padding: 0;
  columns: 1;
}

@media (min-width: 640px) {
  .toc-list {
    columns: 2;
  }
}

.toc-list li {
  break-inside: avoid;
  margin-bottom: 0.35rem;
}

.filter-bar {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-soft);
}

.filter-inner {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: #000000;
  font-size: 1rem;
}

.filter-icon {
  width: 1rem;
  height: 1rem;
  border: 1.5px solid currentColor;
  border-radius: 0.2rem;
  position: relative;
}

.filter-icon::before,
.filter-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.filter-icon::before {
  width: 100%;
  height: 1.5px;
  left: 0;
  top: 0.35rem;
}

.filter-icon::after {
  width: 1.5px;
  height: 0.35rem;
  left: 0.25rem;
  top: -0.2rem;
  box-shadow: 0.4rem 0 0 currentColor;
}

.research-section {
  padding: 2.5rem 0;
}

.research-title {
  margin-bottom: 0.5rem;
  color: var(--text-strong);
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
}

.research-date {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 400;
  white-space: nowrap;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  margin-right: 0.375rem;
  margin-bottom: 0.5rem;
  border-radius: 999px;
  padding: 1px 0.375rem;
  background: var(--bg-hover);
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
}

.research-grid {
  display: grid;
  gap: 1rem;
}

.research-grid > :only-child {
  grid-column: 1 / -1;
}

@media (min-width: 768px) {
  .research-grid {
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .research-grid {
    gap: 3rem;
  }
}

.research-summary {
  margin-bottom: 0.75rem;
  color: var(--text-strong);
  font-weight: 300;
}

.research-body p + p {
  margin-top: 1rem;
}

.research-image {
  align-self: start;
}

.research-image img {
  border: 1px solid var(--line-soft);
}

@media (max-width: 580px) {
  .page-title {
    display: block;
    margin-left: 0;
    font-size: 1.25rem;
    line-height: 1.75rem;
  }

  .page-title-dash {
    display: none;
  }
}

@media (max-width: 420px) {
  .header {
    align-items: flex-start;
  }

  .avatar {
    border-radius: 1rem;
  }

  .avatar-wrap {
    width: 4.45rem;
    height: 4.45rem;
  }

  .avatar-caption {
    left: 0;
    transform: translateX(0) translateY(0.2rem);
    white-space: normal;
    width: 10rem;
  }

  .avatar-wrap:hover .avatar-caption {
    transform: translateX(0) translateY(0);
  }

  .nav {
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
  }
}
