/*
 * Takashi Taniguchi — personal website
 * Shared by index.html, index_j.html, outreach.html and homework.html.
 *
 * DESIGN: sage green (GA), white rounded content cards,
 *         pale yellow-green page introduction (v19 B).
 * Keep one source of truth: edit the values below, not older revisions.
 * The algebra seminar and historical workshop pages use their own CSS.
 */

/* --- Theme variables --- */
:root {
  color-scheme: light;
  --ink: #394137;
  --muted: #6a7466;
  --link: #527b51;
  --line: #dce8d8;
  --accent: #88af74;

  /* Current palette: selected tab, introduction strip and warm accent. */
  --tab-selected: #557d48;
  --intro-background: #f0f5e6;
  --intro-border: #879f69;
  --intro-accent: #c18f82;
}

/* --- Base and links --- */
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 44%, transparent);
  text-underline-offset: .16em;
  text-decoration-thickness: 1px;
}

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans CJK JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  line-height: 1.65;
  letter-spacing: .005em;
  background: radial-gradient(ellipse at 85% 10%, #eef7e8 0, transparent 37%),#f8fbf6;
  font-size: 15.2px;
}

/* --- Header and artwork --- */
*, *::before, *::after {
  box-sizing: border-box;
}

.school-link {
  text-decoration: none;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.meta-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 6px;
  font-size: 12px;
}

.site-header {
  position: relative;
  isolation: isolate;
  background: linear-gradient(126deg, #eff7ea, #f6fbf2 68%, #fbfdf9);
  border-bottom: 1px solid #dde9d8;
}

.hero-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .19em;
  font-weight: 700;
  margin: 0 0 9px;
  color: #5f8b5d;
}

h1 {
  line-height: 1.25;
  margin: 0 0 10px;
  font-family: "Noto Sans CJK JP", "Yu Gothic", sans-serif;
  font-weight: 750;
  font-size: clamp(35px, 4.2vw, 47px);
  letter-spacing: .035em;
  color: #475742;
}

.site-shell {
  max-width: 1050px;
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}

.site-header-inner {
  position: relative;
  max-width: 1050px;
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  padding: 18px 0 19px;
  min-height: 168px;
}

body.document-index .site-tabs a {
  font-family: "Noto Sans", system-ui, sans-serif;
}

body.document-index .content-section h2 {
  font-family: "Noto Sans", system-ui, sans-serif;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: .025em;
  line-height: 1.5;
}

body.document-index .content-section h2:before {
  height: 22px;
  margin-top: 0;
}

body.document-index .hero-label {
  font-family: "Noto Sans", system-ui, sans-serif;
  font-size: 11px;
}

.hero-art {
  pointer-events: none;
  position: absolute;
  z-index: 0;
  width: 228px;
  height: 126px;
  right: 14px;
  top: 18px;
  opacity: .9;
  transform: none;
}

.hero-art .hero-symbol {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  object-fit: contain;
  object-position: center;
  filter: none;
}

body.document-index .page-index .outline-label {
  font-family: "Noto Sans", system-ui, sans-serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
  font-size: 16px;
}

body.document-index .site-tabs a.language-switch {
  margin-left: 0;
}

/* --- Main tabs and language switching --- */
.site-tabs {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
  padding: 0 0 20px;
}

.site-tabs a[aria-current=page] {
  font-weight: 750;
  background: var(--tab-selected);
  border-color: var(--tab-selected);
  color: #fff;
}

.site-tabs a:hover {
  border-color: var(--accent);
  background: #f1f8ec;
  color: #567952;
}

.site-tabs a[aria-current=page]:hover {
  background: #466d3a;
  border-color: #466d3a;
  color: #fff;
}

.site-tabs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #d9e6d5;
  text-decoration: none;
  font-weight: 550;
  line-height: 1.5;
  white-space: nowrap;
  border-radius: 11px;
  background: #fcfefb;
  color: #5a7556;
  box-shadow: 0 2px 4px rgba(73, 110, 67, .05);
  font-size: 16px;
  padding: 6px 12px;
}

.site-tabs a.language-switch {
  margin-left: auto;
  align-self: center;
  padding: 6px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: #527b51;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  white-space: nowrap;
}

.site-tabs a.language-switch:hover {
  background: transparent;
  color: #385e39;
  text-decoration-color: currentColor;
}

.site-tabs a.language-switch:focus-visible {
  outline: 2px solid var(--tab-selected);
  outline-offset: 3px;
}

/* --- Page overview: introduction and navigation unified --- */
/* Visually separate this overview from the white content cards.
 * Keep the overview inset from the page edges; the subdued yellow-green
 * background is shared by its introduction and its navigation. */
.page-overview {
  position: relative;
  margin: 18px clamp(26px, 3.5vw, 48px) 22px;
  padding: 18px 24px 17px;
  background: var(--intro-background);
  border-left: 4px solid var(--intro-border);
  border-radius: 3px;
}

/* Small warm-color accent, kept separate from the main green palette. */
.page-overview::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  width: 34px;
  height: 3px;
  background: var(--intro-accent);
}

.page-overview .page-intro {
  margin: 0 0 13px;
  padding: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.72;
}

.page-overview .page-index {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 17px;
  margin: 0;
  padding: 12px 0 0;
  background: transparent;
  border: 0;
  border-top: 1px solid #d6e3ca;
  border-radius: 0;
}

.page-index .outline-label {
  margin-right: 6px;
  color: #5e8053;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* Contents are text links, not tabs: keep a visible but restrained underline. */
.page-index a {
  color: #456d43;
  text-decoration: underline;
  text-decoration-color: rgba(69, 109, 67, .65);
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  text-decoration-skip-ink: auto;
  white-space: normal;
  font-size: 15.5px;
}

.page-index a:hover {
  color: #284f2b;
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

/* --- Content cards --- */
.content-section p {
  margin: 0 0 1em;
}

.content-section ul ul {
  margin-top: 7px;
  margin-bottom: 8px;
  padding-left: 1.2rem;
}

.content-section ul ul li {
  margin: .25em 0;
}

.content-section .publication-list {
  font-size: 14.2px;
  line-height: 1.48;
}

.content-section ol.asahi-articles {
  padding-left: 0;
  margin: 9px 0 9px 0;
  list-style: none;
  font-size: 13px;
  line-height: 1.62;
}

.body-grid {
  display: grid;
  gap: 30px;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
}

.content-section li a {
  overflow-wrap: anywhere;
}

.content-section li {
  padding-left: 3px;
  margin: .2em 0 .45em;
  overflow-wrap: break-word;
}

.content-section h2:before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 22px;
  border-radius: 5px;
  flex: none;
  background: #8cb06f;
}

.content-section li::marker {
  font-size: .9em;
  color: #92b67b;
}

.content-section {
  scroll-margin-top: 16px;
  min-width: 0;
  margin: 0 0 18px;
  padding: 26px 30px 23px;
  background: #fffefd;
  border: 1px solid #e2ecdf;
  border-radius: 18px;
  box-shadow: 0 8px 29px rgba(73, 110, 67, .07);
}

.content-section h2 {
  letter-spacing: .035em;
  line-height: 1.5;
  font-size: 20px;
  font-weight: 750;
  margin: 0 0 17px;
  color: #4b6847;
  display: flex;
  align-items: center;
  gap: 11px;
}

.content-section .publication-list>li {
  margin: 0 0 .72rem;
  padding-left: 2px;
}

.content-section ul {
  padding-left: 1.25rem;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}

main.page-main {
  min-width: 0;
  padding-bottom: 0;
}

main.page-main > .content-section:last-of-type {
  margin-bottom: 12px;
}

.content-section .minor-heading {
  font-size: 15.5px;
  margin: 14px 0 7px;
  font-weight: 700;
  color: var(--ink);
}

.content-section .minor-heading:first-of-type {
  margin-top: 0;
}

.content-section .talk-list > li {
  margin: 0 0 .7rem;
}

/* --- Publication lists --- */
.publication-list .paper-title strong {
  font-weight: 700;
}

.publication-list .paper-details em {
  color: var(--ink);
}

.publication-list .paper-details strong {
  color: var(--ink);
}

.paper-coauthors {
  color: var(--muted);
}

.publication-list .paper-title {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 14.7px;
  font-weight: 580;
  line-height: 1.45;
  color: #384537;
}

.publication-list .paper-details {
  display: block;
  margin: 0;
  padding: 0;
  font-size: 13.2px;
  line-height: 1.48;
  color: #687565;
}

/* --- Books and reviews --- */
.books-layout {
  display: grid;
  gap: 22px;
}

.book-entry {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.book-entry + .book-entry {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.book-entry .book-cover {
  display: block;
  width: 112px;
  max-width: 100%;
  height: auto;
  margin: 0;
  border-radius: 4px;
  box-shadow: 0 5px 12px rgba(55, 71, 50, .10);
}

.book-entry .book-info {
  min-width: 0;
}

.book-entry h3 {
  font-size: 16px;
  margin: 0 0 9px;
  line-height: 1.5;
  font-weight: 700;
}

.book-entry .book-info p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 1.6;
}

.book-entry .book-links {
  color: var(--muted);
}

.related-book-title {
  font-size: 14.5px;
  margin-bottom: 12px !important;
}

/* --- Talks and workshops --- */
.talk-title {
  display: block;
  line-height: 1.45;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
}

.talk-details {
  display: block;
  line-height: 1.45;
  color: var(--muted);
  font-size: 13.5px;
}

/* --- Homework articles --- */
.asahi-articles>li {
  margin: 0 0 10px !important;
  border-left: 2px solid var(--line);
  padding-left: 13px !important;
}

.article-pubdate {
  font-size: 12px;
  color: var(--muted);
}

.article-fallback {
  font-size: 12px;
  color: var(--muted);
}

/* --- Footer --- */
footer address {
  font-style: normal;
  font-size: 12px;
  line-height: 1.75;
  color: var(--muted);
}

footer address a {
  color: var(--muted);
}

footer.site-footer {
  margin: 0;
  padding: 8px 0 46px;
  border-top: 0;
  color: #667063;
}

/* --- Responsive styles: (max-width:720px) --- */
@media (max-width:720px) {
  .meta-row {
    padding: 22px 0 4px;
  }
  .school-link {
    font-size: 10px;
    letter-spacing: .065em;
  }
  .hero-label {
    font-size: 9.8px;
    letter-spacing: .13em;
  }
  .site-tabs {
    gap: 6px;
  }
  .content-section ul {
    font-size: 13.2px;
  }
  .content-section .publication-list {
    font-size: 13.2px;
  }
  .publication-list .paper-title {
    font-size: 13.7px;
  }
  .publication-list .paper-details {
    font-size: 12.8px;
  }
  .body-grid {
    gap: 10px;
  }
  .page-overview {
    margin: 14px 12px 17px;
    padding: 15px 16px 14px;
  }
  .page-overview .page-intro {
    font-size: 15px;
    margin-bottom: 12px;
  }
  .page-overview .page-index {
    padding-top: 10px;
    gap: 7px 12px;
  }
  .content-section h2 {
    font-size: 18px;
  }
  .site-shell {
    padding-left: 16px;
    padding-right: 16px;
  }
  .site-header-inner {
    min-width: 0;
    padding-left: 16px;
    padding-right: 16px;
  }
  .hero {
    min-height: 128px;
    padding-top: 14px;
    padding-bottom: 14px;
  }
  body.document-index .content-section h2 {
    font-size: 18px;
  }
  .content-section {
    padding: 18px 16px 15px;
    border-radius: 14px;
  }
  .hero-art {
    width: 116px;
    height: 82px;
    right: 0;
    top: 15px;
    opacity: .80;
  }
  .site-tabs a {
    font-size: 14px;
    padding: 6px 9px;
  }
  .page-index .outline-label {
    width: 100%;
    margin: 0;
    font-size: 14px;
  }
  body.document-index .page-index .outline-label {
    font-size: 14px;
  }
  .page-index a {
    font-size: 14px;
  }
  .book-entry {
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
  }
  .book-entry .book-cover {
    width: 88px;
  }
  .book-entry h3 {
    font-size: 14.5px;
  }
  .book-entry .book-info p {
    font-size: 13px;
  }
  .talk-title {
    font-size: 13.7px;
  }
  .talk-details {
    font-size: 13px;
  }
  .site-tabs a.language-switch {
    font-size: 13px;
  }
}

/* --- Responsive styles: (max-width:360px) --- */
@media (max-width:360px) {
  .site-tabs {
    gap: 4px;
  }
  .content-section ul {
    padding-left: 1.05rem;
  }
  .hero-art {
    width: 101px;
    height: 75px;
    right: -1px;
    top: 18px;
    opacity: .78;
  }
  .site-tabs a {
    font-size: 13.5px;
    padding: 6px 7px;
  }
  .book-entry {
    grid-template-columns: 78px minmax(0, 1fr);
    gap: 10px;
  }
  .book-entry .book-cover {
    width: 78px;
  }
  .page-overview {
    margin-right: 9px;
    margin-left: 9px;
    padding-right: 12px;
    padding-left: 12px;
  }
}

/* English header only: prevent the S31 tree fern from overlapping the
   one-line name on medium-width mobile screens (e.g. 390–430px). */
@media (min-width: 361px) and (max-width: 480px) {
  body.document-index .hero-art {
    width: 96px;
    height: 52px;
    top: -8px;
    right: 0;
  }
}
