:root {
  --surface: #ffffff;
  --surface-subtle: #f7f9f8;
  --text: #222624;
  --muted: #5a645f;
  --muted-soft: #8a948f;
  --line: rgba(0, 0, 0, 0.12);
  --line-strong: rgba(0, 0, 0, 0.22);
  --link: #118659;
  --link-hover: #0b6341;
  --link-text: #ffffff;
  --font-sans: 'Source Sans 3', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Lato', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
  --surface: #0c0f0d;
  --surface-subtle: #131815;
  --text: #e9eeeb;
  --muted: #9aa6a0;
  --muted-soft: #66736c;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.24);
  --link: #56cf96;
  --link-hover: #84e0b4;
  --link-text: #0c0f0d;
}

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

html {
  scroll-behavior: smooth;
  background: var(--surface);
  min-width: 20rem;
  min-height: 100%;
}

body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.58;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.18s ease, color 0.18s ease;
  overflow-x: hidden;
}

body > main#main-content {
  flex: 1 0 auto;
  width: 100%;
}

::selection {
  background: rgba(17, 134, 89, 0.16);
  color: var(--text);
}

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

button, a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 999;
  background: var(--link);
  color: var(--link-text);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.6rem 0.85rem;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Uppercase Labels (Source Sans 3 with tabular numerals) */
.micro-label,
.in-page-nav,
.row-num,
.pub-index {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: clamp(0.75rem, 0.8vw, 0.82rem);
  font-weight: 600;
  line-height: 1.4;
}

.micro-label,
.row-num,
.pub-index {
  color: var(--muted);
}

/* Top Navigation Bar */
.in-page-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto 6.5rem;
  min-height: 3.4rem;
}

.nav-index-slot,
.in-page-links,
.theme-toggle {
  display: flex;
  align-items: center;
}

.nav-index-slot {
  padding: 0 1.5rem;
  color: var(--text);
}

.nav-index-slot a,
.in-page-links a {
  text-underline-offset: 0.25rem;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.nav-index-slot a {
  display: flex;
  align-items: center;
  min-height: 3.4rem;
}

.in-page-links {
  align-self: stretch;
  align-items: stretch;
}

.in-page-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  min-width: 8.2rem;
  min-height: 3.4rem;
  padding: 0 1rem;
  color: var(--muted);
}

.in-page-links a span {
  color: var(--muted-soft);
  font-weight: 500;
}

.in-page-links a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}

.in-page-links a[aria-current="page"] span {
  color: var(--text);
}

.nav-index-slot a:hover,
.in-page-links a:hover,
.nav-index-slot a:focus-visible,
.in-page-links a:focus-visible {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-color: currentColor;
}

.in-page-links a:hover span,
.in-page-links a:focus-visible span {
  color: var(--link);
}

.theme-toggle {
  background: transparent;
  cursor: pointer;
  min-height: 3.4rem;
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 0;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.theme-toggle > span:first-child {
  color: var(--link);
  font-size: 0.95rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--text);
}

/* =========================================================
   HOME PAGE (Single-Screen Clean Index with -> Rows)
   ========================================================= */
.home-page {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.home-hero {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  background: var(--surface);
}

.home-hero-copy {
  width: min(100%, 74rem);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 3.4rem) clamp(1.5rem, 4vw, 3rem);
}

.home-hero-top {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.4rem);
  align-items: center;
}

.home-portrait {
  width: 12rem;
  height: 12rem;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: block;
}

.home-hero-intro h1 {
  font-family: var(--font-sans);
  font-size: clamp(2.25rem, 3.2vw, 2.95rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.08;
}

.home-hero-intro > p {
  margin-top: 0.85rem;
  font-size: clamp(1.02rem, 1.08vw, 1.1rem);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
}

.home-hero-intro > p a,
.prose-link {
  color: var(--link);
  text-decoration: underline 1px rgba(17, 134, 89, 0.45);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

[data-theme="dark"] .home-hero-intro > p a,
[data-theme="dark"] .prose-link {
  text-decoration-color: rgba(86, 207, 150, 0.45);
}

.home-hero-intro > p a:hover,
.prose-link:hover {
  color: var(--link-hover);
}

/* Horizontal -> Navigation Rows */
.home-link-list {
  width: 100%;
  margin-top: clamp(1.8rem, 2.8vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}

.home-link-list > a,
.home-link-list > .home-link-row {
  display: grid;
  grid-template-columns: minmax(9.5rem, 11rem) minmax(0, 1fr) 1.25rem;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.85rem;
  padding: 0.8rem 0.25rem;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: color 0.15s ease;
}

.home-link-title {
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.home-link-title > span {
  color: var(--muted-soft);
  font-weight: 500;
}

.home-link-description {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--muted);
  transition: color 0.15s ease;
}

.home-link-description a {
  color: var(--link);
  text-decoration: underline 1px rgba(17, 134, 89, 0.45);
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

[data-theme="dark"] .home-link-description a {
  text-decoration-color: rgba(86, 207, 150, 0.45);
}

.home-link-description a:hover {
  color: var(--link-hover);
}

.home-link-arrow {
  font-size: 1.05rem;
  color: var(--muted);
  justify-self: end;
  transition: transform 0.18s ease, color 0.18s ease;
}

.home-link-list > a:hover .home-link-title,
.home-link-list > a:focus-visible .home-link-title,
.home-link-list > .home-link-row:hover .home-link-title,
.home-link-list > .home-link-row:focus-visible .home-link-title {
  color: var(--link);
}

.home-link-list > a:hover .home-link-title > span,
.home-link-list > a:focus-visible .home-link-title > span,
.home-link-list > .home-link-row:hover .home-link-title > span,
.home-link-list > .home-link-row:focus-visible .home-link-title > span {
  color: var(--link);
}

.home-link-list > a:hover .home-link-description,
.home-link-list > a:focus-visible .home-link-description,
.home-link-list > .home-link-row:hover .home-link-description,
.home-link-list > .home-link-row:focus-visible .home-link-description {
  color: var(--text);
}

.home-link-list > a:hover .home-link-arrow,
.home-link-list > a:focus-visible .home-link-arrow,
.home-link-list > .home-link-row:hover .home-link-arrow,
.home-link-list > .home-link-row:focus-visible .home-link-arrow {
  color: var(--link);
  transform: translateX(4px);
}

/* =========================================================
   INNER PAGES (About, Experience, Blog, Publications)
   ========================================================= */
.inner-page {
  background: var(--surface);
}

.page-wrap {
  width: min(100%, 74rem);
  margin: 0 auto;
  padding: clamp(2.2rem, 4vw, 3.4rem) clamp(1.5rem, 4vw, 3rem) clamp(3rem, 5vw, 4.5rem);
}

.page-header {
  padding-bottom: 1.6rem;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  font-family: var(--font-sans);
  font-size: clamp(2.2rem, 3.2vw, 2.85rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

.page-header > p {
  margin-top: 0.9rem;
  font-size: clamp(1.04rem, 1.1vw, 1.12rem);
  font-weight: 400;
  line-height: 1.62;
  color: var(--text);
}

.page-header > p a {
  color: var(--link);
  text-decoration: underline 1px rgba(17, 134, 89, 0.45);
  text-underline-offset: 3px;
}

[data-theme="dark"] .page-header > p a {
  text-decoration-color: rgba(86, 207, 150, 0.45);
}

/* Collapsible 3rd-person Bio Dropdown on About Page */
.bio-dropdown {
  margin-top: 1.25rem;
}

.bio-dropdown summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--link);
  user-select: none;
}

.bio-dropdown summary::-webkit-details-marker {
  display: none;
}

.bio-dropdown summary::before {
  content: "▸";
  display: inline-block;
  font-size: 0.9rem;
  transition: transform 0.15s ease;
}

.bio-dropdown[open] summary::before {
  transform: rotate(90deg);
}

.bio-dropdown summary:hover {
  color: var(--link-hover);
}

.bio-dropdown p {
  margin-top: 0.75rem;
  font-size: 1.02rem;
  line-height: 1.64;
  color: var(--muted);
}

.bio-dropdown p a {
  color: var(--link);
  text-decoration: underline 1px rgba(17, 134, 89, 0.45);
  text-underline-offset: 3px;
}

/* Subsections & Clean Hairline Rows */
.sub-section {
  margin-top: 2.4rem;
}

.sub-section h2 {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.clean-list {
  list-style: none;
}

.clean-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
}

.clean-row:last-child {
  border-bottom: 0;
}

.row-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.35rem 1rem;
}

.row-heading {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
}

.row-heading a {
  color: var(--text);
}

.row-heading a.prose-link {
  color: var(--link);
}

.row-heading a:hover {
  color: var(--link);
  text-decoration: underline 1px;
  text-underline-offset: 3px;
}

.row-location {
  font-size: 0.92rem;
  color: var(--muted);
}

.row-desc {
  margin-top: 0.25rem;
  font-size: 1rem;
  line-height: 1.58;
  color: var(--muted);
}

.row-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.55rem;
}

.row-links a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--link);
}

.row-links a:hover {
  color: var(--link-hover);
  text-decoration: underline 1px;
  text-underline-offset: 3px;
}

/* Publications Clean List */
.pub-group {
  margin-top: 2.2rem;
}

.pub-group h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.pub-list {
  list-style: none;
}

.pub-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  gap: 0.45rem 1.15rem;
  align-items: baseline;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.pub-row:last-child {
  border-bottom: 0;
}

.pub-title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.42;
  color: var(--text);
}

.pub-title a:hover {
  color: var(--link);
  text-decoration: underline 1px;
  text-underline-offset: 3px;
}

.pub-authors {
  margin-top: 0.18rem;
  font-size: 0.93rem;
  line-height: 1.48;
  color: var(--muted);
}

.pub-links {
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
}

.pub-links a {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--link);
}

.pub-links a:hover {
  color: var(--link-hover);
  text-decoration: underline 1px;
  text-underline-offset: 3px;
}

.subtle-note {
  margin-top: 1.5rem;
  font-size: 0.94rem;
  color: var(--muted);
}

/* =========================================================
   SITE FOOTER
   ========================================================= */
.site-footer {
  background: var(--surface);
  min-height: 4rem;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.6rem clamp(1rem, 1.8vw, 1.9rem);
  padding: 0.9rem 1.25rem 1.25rem;
}

.footer-statement,
.footer-location,
.footer-credit {
  color: var(--muted);
  font-family: var(--font-sans);
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-size: clamp(0.8rem, 0.84vw, 0.88rem);
  font-weight: 400;
  line-height: 1.4;
}

.footer-credit a {
  color: var(--link);
  font-weight: 600;
}

.footer-credit a:hover,
.footer-credit a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline 1px;
  text-underline-offset: 3px;
}

.footer-visits {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: clamp(0.8rem, 0.84vw, 0.88rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: color 0.15s ease;
}

.footer-visits:hover,
.footer-visits:focus-visible {
  color: var(--link);
}

.visits-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--link);
  display: inline-block;
  opacity: 0.85;
}

/* Visitor Map Modal */
.vmap-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.vmap-backdrop[hidden] {
  display: none !important;
}

.vmap-dialog {
  width: min(100%, 44rem);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 1.25rem 1.4rem 1.35rem;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.vmap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.vmap-head h2 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.vmap-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
}

.vmap-close:hover {
  color: var(--text);
}

.vmap-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.95rem;
}

.vmap-stat {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
}

.vmap-stat-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.vmap-stat-val {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.3rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.vmap-canvas-wrap {
  margin-top: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-subtle);
  overflow: hidden;
  position: relative;
}

.vmap-canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 1;
}

.vmap-caption {
  margin-top: 0.7rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.footer-socials {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.65rem, 1.1vw, 1.1rem);
  white-space: nowrap;
}

.footer-socials a {
  color: var(--link);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid transparent;
  font-size: clamp(0.76rem, 0.8vw, 0.84rem);
}

.footer-socials a:hover,
.footer-socials a:focus-visible {
  color: var(--link-hover);
  border-bottom-color: currentColor;
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */
@media (max-width: 64rem) {
  .in-page-nav {
    grid-template-columns: 1fr 6.2rem;
  }

  .nav-index-slot {
    grid-column: 1;
  }

  .theme-toggle {
    grid-area: 1 / 2;
  }

  .in-page-links {
    border-top: 1px solid var(--line);
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }

  .in-page-links a {
    min-width: 0;
    min-height: 3rem;
    padding: 0 0.5rem;
  }
}

@media (max-width: 52rem) {
  .home-hero-top {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .home-portrait {
    width: 9.5rem;
    height: 9.5rem;
  }

  .pub-row {
    grid-template-columns: 2.2rem minmax(0, 1fr);
  }

  .pub-links {
    grid-column: 2;
  }
}

@media (max-width: 44rem) {
  .home-link-list > a,
  .home-link-list > .home-link-row {
    grid-template-columns: 7.6rem minmax(0, 1fr) 1rem;
    gap: 0.75rem;
    padding: 0.75rem 0.1rem;
  }

  .home-link-title {
    font-size: 0.75rem;
    gap: 0.35rem;
  }

  .home-link-description {
    font-size: 0.92rem;
  }

  .in-page-links a {
    flex-direction: column;
    gap: 0.05rem;
    font-size: 0.68rem;
  }

  .footer-separator {
    display: none;
  }

  .site-footer {
    padding: 1.2rem 0.85rem;
    gap: 0.55rem 0.9rem;
  }
}
