/* Theme */
:root {
  --bg: #f4efcf;
  --paper: #fbf7db;
  --text: #2d2716;
  --muted: #6b5f34;
  --rule: #c3b46b;
  --rule-soft: #ddd29c;
  --accent: #6f6536;
  --link: #1f4f86;
  --link-hover: #15355a;
  --max-width: 980px;
  --side-pad: clamp(0.95rem, 2.8vw, 1.7rem);
}

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

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

/* Base typography */
body {
  margin: 0;
  font-family: "Charter", "Bitstream Charter", "Cambria", "Noto Serif", "Liberation Serif", serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: clamp(1rem, 0.98rem + 0.2vw, 1.08rem);
}

a {
  color: var(--link);
  text-decoration: none;
  overflow-wrap: break-word;
  word-break: normal;
}

a:hover,
a:focus-visible {
  color: var(--link-hover);
  text-decoration: none;
}

/* Page shell */
.site {
  width: min(var(--max-width), 100%);
  margin: 0;
  padding: 1.15rem var(--side-pad) 2rem;
  background: var(--paper);
  border-right: 0;
}

.masthead {
  border-bottom: 1px solid color-mix(in srgb, var(--rule-soft) 45%, transparent);
  padding-bottom: 1rem;
}

.masthead.compact {
  padding-bottom: 0.75rem;
}

.masthead.simple-header {
  padding-bottom: 0.7rem;
}

/* Shared header elements */
.back-home-wrap {
  margin: 0;
}

.back-home {
  display: inline-block;
  padding: 0.28rem 0.66rem;
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 86%, var(--accent) 14%);
  color: var(--text);
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.2;
}

.back-home:hover,
.back-home:focus-visible {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--paper) 76%, var(--accent) 24%);
}

/* Home page masthead */
.hero {
  display: grid;
  grid-template-columns: 172px 1fr;
  gap: 1.1rem;
  align-items: start;
}

.portrait {
  display: block;
  width: 100%;
  max-width: 172px;
  height: auto;
  border: 1px solid var(--rule);
}

h1 {
  margin: 0;
  line-height: 1.16;
  font-size: clamp(1.52rem, 1.36rem + 0.72vw, 1.96rem);
}

.name-ja {
  margin: 0.18rem 0 0;
  color: var(--muted);
  font-size: 0.98rem;
  letter-spacing: 0.02em;
}

.affiliation {
  margin: 0.42rem 0 0;
  color: var(--muted);
}

.role {
  margin: 0.34rem 0 0;
}

.meta {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.97rem;
}

.inline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.95rem;
}

.link-row {
  margin-top: 0.62rem;
  font-size: 0.95rem;
}

.nav-list {
  margin-top: 0.9rem;
  font-size: 0.95rem;
}

.nav-list a[aria-current="page"] {
  font-weight: 700;
  color: var(--link-hover);
}

/* Main content */
main {
  padding-top: 0.35rem;
}

.section {
  border-bottom: 1px solid color-mix(in srgb, var(--rule-soft) 36%, transparent);
  padding: 1.05rem 0;
}

.section:last-child {
  border-bottom: 0;
}

h2 {
  margin: 0;
  line-height: 1.25;
  font-size: clamp(1.2rem, 1.12rem + 0.3vw, 1.43rem);
}

.subhead {
  margin: 1.2rem 0 0.15rem;
  line-height: 1.25;
  font-size: 1.07rem;
  color: var(--muted);
}

p {
  margin: 0.52rem 0 0;
}

/* Lists */
ul,
ol {
  margin: 0.62rem 0 0;
  padding-left: 1.2rem;
}

li + li {
  margin-top: 0.36rem;
}

.inline-list li + li {
  margin-top: 0;
}

.pub-list {
  margin-top: 0.62rem;
  padding-left: 1.75rem;
}

.pub-list li {
  margin-top: 0.54rem;
  padding-left: 0.2rem;
  line-height: 1.55;
}

.news-list {
  list-style: none;
  margin-top: 0.68rem;
  padding-left: 0;
}

.news-list li {
  display: grid;
  grid-template-columns: 10ch minmax(0, 1fr);
  column-gap: 0.95rem;
  align-items: start;
  padding: 0.1rem 0 0.15rem;
  border-bottom: 1px dotted color-mix(in srgb, var(--rule) 32%, transparent);
}

.news-list li:last-child {
  border-bottom: 0;
}

.news-list .news-date {
  display: block;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-right: 0;
}

.news-list .news-text {
  display: block;
  min-width: 0;
}

.news-page .news-list {
  margin-top: 0.76rem;
}

.news-list a {
  overflow-wrap: normal;
  word-break: normal;
}

.section-link {
  margin-top: 0.72rem;
  font-size: 0.96rem;
}

.section-link a {
  color: var(--link);
}

.section-link a:hover,
.section-link a:focus-visible {
  color: var(--link-hover);
}

/* Publications archive */
.publications-page .publication-archive .subhead {
  border-top: 1px solid color-mix(in srgb, var(--rule-soft) 34%, transparent);
  padding-top: 0.45rem;
}

.publications-page .publication-archive .pub-list {
  margin-bottom: 0.4rem;
  padding-left: 2.35rem;
}

/* Footer and accessibility helpers */
.site-footer {
  border-top: 1px solid color-mix(in srgb, var(--rule-soft) 36%, transparent);
  margin-top: 0.4rem;
  padding-top: 0.8rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--paper);
  color: var(--accent);
  border: 1px solid var(--rule);
  padding: 0.45rem 0.65rem;
}

.skip-link:focus {
  left: 0.65rem;
  top: 0.65rem;
  z-index: 100;
}

/* Responsive adjustments */
@media (max-width: 760px) {
  .site {
    width: 100%;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 0.78rem;
  }

  .portrait {
    width: min(172px, 58vw);
    max-width: 172px;
  }

  .news-list li {
    grid-template-columns: 1fr;
    row-gap: 0.08rem;
    padding: 0.16rem 0 0.2rem;
  }

  .news-list .news-date {
    display: block;
    margin: 0 0 0.04rem;
    white-space: normal;
  }
}

@media (max-width: 560px) {
  .nav-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.34rem 0.72rem;
  }

  .nav-list a {
    display: block;
    padding: 0.14rem 0;
  }

  .pub-list {
    padding-left: 1.52rem;
  }

  .publications-page .publication-archive .pub-list {
    padding-left: 1.95rem;
  }
}

@media (max-width: 380px) {
  .nav-list {
    grid-template-columns: 1fr;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* Print */
@media print {
  .skip-link,
  .nav-list,
  .link-row {
    display: none;
  }

  body {
    font-size: 11pt;
    background: #fff;
  }

  .site {
    width: 100%;
    padding: 0;
    border: 0;
    background: #fff;
  }
}
