/* ===========================
   Reset & Base
=========================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:      #0d1117;
  --bg2:     #161b22;
  --bg3:     #21262d;
  --border:  #30363d;
  --text:    #e6edf3;
  --text2:   #8b949e;
  --accent:  #58a6ff;
  --accent2: #3fb950;
  --accent3: #d2a8ff;

  --font-sans: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* 格子グリッド */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ページ上部オーロラ */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 480px;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(88,166,255,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% -5%,  rgba(210,168,255,0.14) 0%, transparent 55%),
    radial-gradient(ellipse 50% 30% at 50%  0%,  rgba(63,185,80,0.07)  0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

main, nav, footer { position: relative; z-index: 1; }

#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ===========================
   Layout
=========================== */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section { padding: 5rem 0; }

.section-alt {
  background: rgba(22, 27, 34, 0.6);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ===========================
   Section Title
=========================== */
.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.section-sub {
  color: var(--text2);
  font-size: 0.875rem;
  margin-bottom: 2.5rem;
}

/* ===========================
   Buttons
=========================== */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #0d1117; }
.btn-primary:hover { background: #79c0ff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ===========================
   Nav
=========================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background: rgba(13, 17, 23, 0.96);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.nav-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent3));
  color: #0d1117;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.nav-logo-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.nav-links { display: flex; gap: 1.75rem; }
.nav-links a { font-size: 0.875rem; font-weight: 500; color: var(--text2); transition: color 0.2s; }
.nav-links a:hover { color: var(--text); }

/* ドロップダウン */
.nav-item-dropdown { position: relative; }

.nav-caret {
  font-size: 0.65rem;
  opacity: 0.6;
  transition: transform 0.2s;
  display: inline-block;
}
.nav-item-dropdown:hover .nav-caret { transform: rotate(180deg); }

.nav-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 27, 34, 0.92);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  min-width: 140px;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.nav-item-dropdown:hover .nav-dropdown { display: block; }

.nav-dropdown li a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text2);
  transition: background 0.15s, color 0.15s;
}
.nav-dropdown li a:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  z-index: 101;
}
.nav-toggle span {
  display: block; width: 22px; height: 2px;
  background: var(--text); border-radius: 2px; transition: all 0.2s;
}

/* ===========================
   Hero
=========================== */
.hero {
  display: flex;
  align-items: center;
  padding: 120px 0 5rem;
  position: relative;
  overflow: hidden;
}

.hero .container { position: relative; z-index: 1; }
.hero-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
  width: 100%;
}
.hero-label {
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}
.hero-inner h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}
.hero-name-sub {
  color: var(--text2);
  font-size: 0.65em;
  font-weight: 600;
}
.hero-sub {
  font-size: 0.95rem;
  color: var(--accent3);
  margin-bottom: 1.25rem;
  font-weight: 500;
  line-height: 1.6;
}
.hero-sub-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(210, 168, 255, 0.35);
  transition: border-color 0.2s, color 0.2s;
}
.hero-sub-link:hover {
  color: #e8c8ff;
  border-bottom-color: var(--accent3);
}

.hero-desc {
  color: var(--text2);
  font-size: 0.9rem;
  max-width: 480px;
  margin-bottom: 2rem;
  line-height: 1.8;
}
.avatar {
  width: 160px; height: 160px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===========================
   About
=========================== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.info-card {
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s;
}
.info-card:hover { border-color: #444c56; }
.info-card.wide { grid-column: 1 / -1; }
.info-card h3 {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.info-card p { font-size: 0.9rem; color: var(--text2); line-height: 1.75; }

.card-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(139, 148, 158, 0.25);
  transition: color 0.2s, border-color 0.2s;
}
.card-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ===========================
   Section-level Collapsible
=========================== */
.section-collapsible > .section-title {
  cursor: pointer;
  list-style: none;
  justify-content: space-between;
  transition: color 0.2s;
}
.section-collapsible > .section-title:hover { color: var(--accent); }
.section-collapsible > .section-title::-webkit-details-marker { display: none; }

.section-collapsible > .section-title::after {
  content: '閉じる ▾';
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text2);
  flex-shrink: 0;
  margin-left: 0.5rem;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
  transition: color 0.2s;
}
.section-collapsible > .section-title:hover::after { color: var(--accent); }
.section-collapsible:not([open]) > .section-title::after {
  content: '開く ▸';
}

/* ===========================
   Collapsible
=========================== */
.collapsible {
  margin-top: 2.5rem;
}

.collapsible + .collapsible {
  margin-top: 1.5rem;
}

.subsection-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.02em;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.subsection-title::-webkit-details-marker { display: none; }

.subsection-title::after {
  content: '閉じる ▾';
  font-size: 0.78rem;
  color: var(--text2);
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}

.collapsible:not([open]) .subsection-title::after {
  content: '開く ▸';
}

/* 開閉しない小見出し（論文・学会発表など、プレビュー表示するブロック用） */
.subsection-block { margin-top: 2.5rem; }
.subsection-block + .subsection-block { margin-top: 1.5rem; }
.subsection-heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}

.pub-list-rest { margin-top: 0.75rem; }
.pub-list-rest[hidden] { display: none; }

.show-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.show-more-btn:hover { border-color: var(--accent); color: var(--accent); }

.subsection-title:hover {
  background: rgba(255,255,255,0.04);
  border-color: #444c56;
  color: var(--text);
}

.collapsible[open] .subsection-title {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  color: var(--text);
}

.collapsible .pub-list {
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ===========================
   Publications / Awards (共通リスト)
=========================== */
.pub-list { display: flex; flex-direction: column; gap: 1rem; }

.pub-item {
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s;
}
.pub-item:hover { border-color: var(--accent); }

.pub-item-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.pub-item-link:hover { border-color: var(--accent); }
.pub-item-link:hover .pub-title { color: var(--accent); }

.pub-year {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent2);
  margin-bottom: 0.3rem;
  letter-spacing: 0.02em;
}

.pub-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.pub-venue {
  font-size: 0.85rem;
  color: var(--text2);
  line-height: 1.6;
}

.pub-desc {
  font-size: 0.85rem;
  color: var(--text2);
  margin-top: 0.4rem;
  line-height: 1.7;
}

.pub-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }

.tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--text2);
  background: var(--bg3);
}

.pub-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  transition: color 0.2s;
}
.pub-link:hover { color: #79c0ff; }

/* ===========================
   Skills
=========================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}
.skill-category {
  background: rgba(13, 17, 23, 0.55);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}
.skill-category:hover { border-color: #444c56; }
.skill-cat-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent3);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.skill-items { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.skill-badge {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.7rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text2);
  transition: all 0.2s;
  cursor: default;
}
.skill-badge:hover { border-color: var(--accent); color: var(--text); }

/* ===========================
   Contact
=========================== */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  color: var(--text);
  transition: all 0.2s;
}
.contact-item:hover { border-color: var(--accent); color: var(--accent); }
.contact-icon { font-size: 1.4rem; width: 2rem; text-align: center; flex-shrink: 0; }
.contact-info strong { display: block; font-size: 0.88rem; font-weight: 600; }
.contact-info small {
  display: block; font-size: 0.75rem;
  font-family: var(--font-mono); color: var(--text2); margin-top: 0.1rem;
}
.contact-item:hover .contact-info small { color: inherit; }

/* ===========================
   Footer
=========================== */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text2);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

/* ===========================
   Scroll Animation
=========================== */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===========================
   Responsive
=========================== */
@media (max-width: 640px) {
  /* ナビメニュー：フルスクリーンオーバーレイ */
  .nav-links {
    display: none;
    position: fixed;
    top: 60px; left: 0; right: 0; bottom: 0;
    background: rgba(13, 17, 23, 0.75);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    z-index: 98;
    overflow-y: auto;
    padding: 3rem 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links > li > a { font-size: 1.2rem; color: var(--text); }

  /* ハンバーガーボタンを常に最前面に */
  .nav-toggle {
    display: flex;
    position: relative;
    z-index: 110;
  }

  /* メニューが開いているとき × 表示 */
  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ドロップダウンをスマホでは非表示 */
  .nav-dropdown { display: none !important; }
  .nav-caret { display: none; }

  /* その他レスポンシブ */
  .hero-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .hero-text { order: 2; }
  .avatar {
    display: flex;
    order: 1;
    width: 120px;
    height: 120px;
    margin-bottom: 0.5rem;
  }
  .btn-group { justify-content: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .about-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }

  /* セクション間の余白をスマホでは少し詰める */
  .section { padding: 3.5rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
