/* ------------------------------------------------------------------
   Toshiki Nakai — Academic Personal Website
   Design: white background, restrained accent, strong typography.
   ------------------------------------------------------------------ */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f7f8fa;
  --color-text: #1a1d24;
  --color-text-muted: #565c6b;
  --color-text-faint: #7b8191;
  --color-border: #e6e8ec;
  --color-accent: #1f4f8f;
  --color-accent-dark: #17396a;
  --color-accent-tint: #eef3fa;

  --font-serif: "Iowan Old Style", "Palatino Linotype", "Palatino", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --max-width: 880px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

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

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  z-index: 1000;
  border-radius: 0 0 6px 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------------- Header / Nav ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--color-text);
  white-space: nowrap;
}

.brand:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.site-nav {
  flex: 1;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nav-list a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-list a:hover {
  background: var(--color-accent-tint);
  color: var(--color-accent-dark);
  text-decoration: none;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--color-text);
  margin: 0 auto;
}

.lang-switcher select {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 7px 10px;
  cursor: pointer;
}

.lang-switcher select:focus {
  outline: 2px solid var(--color-accent);
  outline-offset: 1px;
}

/* ---------------- Hero ---------------- */

.hero {
  border-bottom: 1px solid var(--color-border);
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 72px 24px 64px;
  display: flex;
  align-items: center;
  gap: 56px;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-name {
  font-size: 3rem;
  margin-bottom: 12px;
}

.position {
  margin: 0 0 14px;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: 0.01em;
}

.affiliations {
  margin: 0 0 8px;
  color: var(--color-text-muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.research-tags {
  margin: 0 0 28px;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--color-text);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 6px 4px;
  border-bottom: 1px solid transparent;
}

.hero-link:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}

.hero-link .icon {
  display: inline-flex;
  color: var(--color-accent);
}

.hero-photo {
  flex-shrink: 0;
}

.hero-photo img {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  box-shadow: 0 8px 24px -8px rgba(23, 57, 106, 0.25);
}

/* ---------------- Sections ---------------- */

.section {
  border-bottom: 1px solid var(--color-border);
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px;
}

.section-heading {
  font-size: 1.7rem;
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--color-accent);
  display: inline-block;
}

.subheading {
  font-family: var(--font-sans);
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 32px 0 14px;
}

.subheading:first-of-type {
  margin-top: 8px;
}

/* ---------------- About ---------------- */

.about-text p {
  margin: 0 0 16px;
  color: var(--color-text);
  font-size: 1.05rem;
  max-width: 68ch;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text strong {
  font-weight: 600;
}

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

.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
}

.research-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 26px 26px 28px;
}

.research-card h3 {
  font-size: 1.15rem;
  color: var(--color-accent-dark);
  margin-bottom: 10px;
}

.research-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.98rem;
}

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

.pub-year {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-accent);
  margin: 36px 0 16px;
}

.pub-year:first-child {
  margin-top: 0;
}

.pub-entry {
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
}

.pub-entry:first-of-type {
  border-top: none;
  padding-top: 0;
}

.pub-title {
  font-size: 1.02rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--color-text);
}

.pub-authors {
  margin: 0 0 4px;
  font-size: 0.94rem;
  color: var(--color-text-muted);
}

.pub-authors strong {
  color: var(--color-text);
  font-weight: 700;
}

.pub-venue {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-faint);
  font-style: italic;
}

.scholar-note {
  margin-top: 32px;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* ---------------- Teaching / Education ---------------- */

.entry-block {
  padding: 18px 0;
  border-top: 1px solid var(--color-border);
}

.entry-block:first-of-type {
  border-top: none;
  padding-top: 0;
}

.entry-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--color-text);
}

.entry-meta {
  margin: 0 0 4px;
  font-size: 0.94rem;
  color: var(--color-text-muted);
}

.entry-detail {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--color-text-faint);
}

.entry-desc {
  margin: 8px 0 0;
  font-size: 0.98rem;
  color: var(--color-text);
}

/* ---------------- Languages ---------------- */

.languages-intro {
  font-size: 1.02rem;
  color: var(--color-text);
  max-width: 68ch;
  margin: 0 0 8px;
}

.table-wrap {
  overflow-x: auto;
}

.lang-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 4px;
  font-size: 0.96rem;
}

.lang-table th,
.lang-table td {
  text-align: left;
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
}

.lang-table th {
  font-weight: 700;
  color: var(--color-text);
  background: var(--color-accent-tint);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.lang-table th:first-child {
  border-top-left-radius: 8px;
}

.lang-table th:last-child {
  border-top-right-radius: 8px;
}

.lang-table td {
  color: var(--color-text-muted);
}

.lang-table td:first-child {
  color: var(--color-text);
  font-weight: 600;
}

.intermediate-langs {
  font-size: 1rem;
  color: var(--color-text-muted);
}

.intermediate-langs strong {
  color: var(--color-text);
  font-weight: 700;
}

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

.site-footer {
  background: var(--color-bg);
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-inner p {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--color-text-faint);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-text-faint);
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--color-accent);
}

/* ---------------- Responsive ---------------- */

@media (max-width: 760px) {
  .hero-inner {
    flex-direction: column-reverse;
    padding: 48px 20px 44px;
    gap: 28px;
    text-align: center;
  }

  .hero-links {
    justify-content: center;
  }

  .hero-name {
    font-size: 2.3rem;
  }

  .hero-photo img {
    width: 150px;
    height: 150px;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .section-inner {
    padding: 48px 20px;
  }

  .header-inner {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: flex;
    order: 2;
  }

  .brand {
    order: 1;
  }

  .lang-switcher {
    order: 3;
    margin-left: auto;
  }

  .site-nav {
    order: 4;
    flex-basis: 100%;
  }

  .nav-list {
    display: none;
    flex-direction: column;
    gap: 0;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    margin-top: 10px;
  }

  .nav-list.open {
    display: flex;
  }

  .nav-list a {
    padding: 10px 6px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .hero-links {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
}
