/* ======================================
   Kengo Miyamoto — Academic Website
   New Design 2026
   スマホ用（カード型テーブルレイアウト対応版）
====================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+JP:wght@300;400;500;700&display=swap');

/* ======================================
   CSS Variables
====================================== */
:root {
  --color-bg:           #f5f7f5;
  --color-surface:      #ffffff;
  --color-text:         #1a1a1a;
  --color-text-light:   #555555;
  --color-text-muted:   #999999;
  --color-accent:       #2e7d32;
  --color-accent-hover: #1b5e20;
  --color-accent-light: #4caf50;
  --color-accent-subtle:#e8f5e9;
  --color-header-bg:    #162016;
  --color-border:       #dde2dd;
  --color-border-light: #eef2ee;
  --font-sans: 'Inter', 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'メイリオ', sans-serif;
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 14px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:  0 4px 14px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 28px rgba(0,0,0,0.13);
  --transition: 0.2s ease;
  --max-width:  980px;
  --header-height: 64px;
}

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

html { scroll-behavior: smooth; overflow-y: scroll; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
  background-color: var(--color-bg);
}

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

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

ol, ul { padding-left: 1.4em; }

/* ======================================
   Header & Navigation
====================================== */
#site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: var(--color-header-bg);
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}
.header-logo img {
  height: 34px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.header-divider {
  width: 1px;
  height: 22px;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.header-site-name {
  font-size: 17px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.header-site-name:hover {
  color: var(--color-accent-light);
  text-decoration: none;
}

#site-nav { margin-left: auto; }

#site-nav ul {
  display: flex;
  list-style: none;
  gap: 2px;
  padding-left: 0;
}

#site-nav ul li a {
  display: block;
  padding: 7px 13px;
  color: rgba(255,255,255,0.82);
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
#site-nav ul li a:hover,
#site-nav ul li a.active {
  color: #fff;
  background: var(--color-accent);
  text-decoration: none;
}

/* Hamburger (mobile) */
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  margin-left: auto;
  line-height: 1;
}

/* ======================================
   Main Content Wrapper
====================================== */
#main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 44px 24px 72px;
}

/* ======================================
   Page Headings
====================================== */
h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 32px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--color-accent);
  display: inline-block;
}

.section-block {
  margin-bottom: 52px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 18px;
  padding-left: 14px;
  border-left: 4px solid var(--color-accent);
  line-height: 1.4;
}

h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--color-text);
}

h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--color-text-light);
}

/* ======================================
   Hero (index.html only)
====================================== */
.hero {
  background: linear-gradient(130deg, var(--color-header-bg) 0%, #263526 60%, #2e4a2e 100%);
  color: #fff;
  padding: 64px 24px 56px;
  margin-bottom: 0;
}

.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px;
  align-items: center;
}

.hero-name {
  font-size: 44px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.hero-name-ja {
  font-size: 19px;
  opacity: 0.75;
  margin-bottom: 20px;
  font-weight: 300;
}

.hero-position {
  display: inline-block;
  background: rgba(76,175,80,0.25);
  border: 1px solid rgba(76,175,80,0.4);
  color: #a5d6a7;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
}

.hero-affiliation {
  font-size: 14px;
  opacity: 0.80;
  line-height: 1.9;
}

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

.hero-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
}
.hero-link-btn:hover {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

.hero-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.hero-img img {
  width: 280px;
  height: 210px;
  object-fit: cover;
}

/* ======================================
   Profile Info Section
====================================== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 48px;
}

.info-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.info-card h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  border-left: none;
  padding-left: 0;
  margin-bottom: 16px;
}

.info-row {
  display: flex;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 14px;
}
.info-row:last-child { border-bottom: none; }

.info-label {
  font-weight: 600;
  color: var(--color-text-muted);
  font-size: 12px;
  min-width: 72px;
  flex-shrink: 0;
  padding-top: 2px;
}

.info-value {
  color: var(--color-text);
  line-height: 1.6;
}

/* ======================================
   Research Tags
====================================== */
.research-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.research-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.research-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-accent);
  flex-shrink: 0;
  margin-top: 7px;
}

.research-en {
  font-size: 15px;
  font-weight: 500;
}

.research-ja {
  font-size: 13px;
  color: var(--color-text-light);
  margin-top: 2px;
}

/* ======================================
   News
====================================== */
.news-list { list-style: none; padding-left: 0; }

.news-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.news-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent-light);
}

.news-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.news-title {
  font-size: 14.5px;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.news-date {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  margin-left: auto;
}

.news-detail {
  display: none;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-text-light);
  line-height: 1.75;
}
.news-item.open .news-detail { display: block; }

/* Tags */
.tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tag-green  { background: #e8f5e9; color: #2e7d32; }
.tag-purple { background: #ede7f6; color: #6a1b9a; }
.tag-orange { background: #fff3e0; color: #e65100; }
.tag-blue   { background: #e3f2fd; color: #1565c0; }

/* ======================================
   Data Tables (CV, Members, etc.)
====================================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 28px;
}

.data-table thead th {
  background: var(--color-accent);
  color: #fff;
  padding: 11px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.data-table tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
  line-height: 1.65;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: #f7faf7; }
.data-table tbody tr:hover { background: var(--color-accent-subtle); }

/* highlight row (e.g. current member) */
.row-highlight td { background: var(--color-accent-subtle) !important; font-weight: 500; }

/* small timetable cell */
.timetable-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 28px;
}
.timetable {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--color-surface);
}
.timetable thead th {
  background: var(--color-accent);
  color: #fff;
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
}
.timetable tbody th {
  background: #f7faf7;
  border-right: 1px solid var(--color-border);
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-light);
  white-space: nowrap;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
}
.timetable tbody td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--color-border-light);
  border-right: 1px solid var(--color-border-light);
  font-size: 13px;
}
.timetable tbody td:last-child { border-right: none; }
.timetable .period-time { display: block; font-weight: 400; font-size: 11px; color: var(--color-text-muted); }

/* ======================================
   Publications (Papers)
====================================== */
.papers-list {
  list-style: none;
  padding-left: 0;
  counter-reset: paper-counter;
}

.paper-item {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  transition: box-shadow var(--transition);
}
.paper-item:hover { box-shadow: var(--shadow-md); }

.paper-title {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 5px;
  line-height: 1.5;
}

.paper-authors {
  font-size: 13.5px;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.paper-journal {
  font-size: 13.5px;
  font-style: italic;
  color: var(--color-text);
  margin-bottom: 10px;
}

.paper-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.paper-link-btn {
  display: inline-block;
  padding: 4px 12px;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(46,125,50,0.2);
  text-decoration: none;
  transition: all var(--transition);
}
.paper-link-btn:hover {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

/* MISC / Preprint simple list */
.misc-list {
  list-style: none;
  padding-left: 0;
}
.misc-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  line-height: 1.75;
}
.misc-item:last-child { border-bottom: none; }
.misc-authors { color: var(--color-text-light); font-size: 13px; }
.misc-journal { font-style: italic; font-size: 13px; }

/* ======================================
   Presentations / Talks
====================================== */
.year-label {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}
.year-label:first-of-type { margin-top: 0; }

.talks-list {
  list-style: none;
  padding-left: 0;
}

.talk-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-border-light);
}
.talk-item:last-child { border-bottom: none; }

.talk-date {
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-weight: 500;
  padding-top: 3px;
  white-space: nowrap;
}

.talk-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 3px;
}

.talk-meta {
  font-size: 13px;
  color: var(--color-text-light);
}

.talk-authors {
  font-size: 13px;
  color: var(--color-accent);
  margin-top: 2px;
}

/* ======================================
   Lecture Materials (class_abst)
====================================== */
.lecture-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 12px;
  margin-bottom: 28px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}
.lecture-table thead th {
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}
.lecture-table tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}
.lecture-table tbody tr:last-child td { border-bottom: none; }
.lecture-table tbody tr:hover { background: var(--color-accent-subtle); }

/* ======================================
   Access Page
====================================== */
.contact-block {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 32px;
  font-size: 15px;
  line-height: 1.9;
}

.map-wrapper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 28px;
}
.map-wrapper iframe {
  display: block;
  width: 100%;
  height: 340px;
  border: none;
}

/* ======================================
   Footer
====================================== */
#site-footer {
  background: var(--color-header-bg);
  color: rgba(255,255,255,0.75);
  padding: 52px 24px 24px;
  margin-top: 0;
}

.footer-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-section h3 {
  color: var(--color-accent-light);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.footer-section ul {
  list-style: none;
  padding-left: 0;
}
.footer-section ul li { margin-bottom: 5px; }
.footer-section ul li a {
  color: rgba(255,255,255,0.65);
  font-size: 13px;
  text-decoration: none;
  transition: color var(--transition);
}
.footer-section ul li a:hover {
  color: var(--color-accent-light);
  text-decoration: none;
}

.footer-bottom {
  max-width: 1140px;
  margin: 28px auto 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.footer-logos {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.footer-logos img {
  height: 26px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.5;
  transition: opacity var(--transition);
}
.footer-logos a:hover img { opacity: 0.85; }

.footer-copyright {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ======================================
   Utilities
====================================== */
.mt-0 { margin-top: 0; }
.mb-24 { margin-bottom: 24px; }

p { margin-bottom: 1em; }
p:last-child { margin-bottom: 0; }

/* ======================================
   Responsive
====================================== */
@media (max-width: 900px) {
  .info-grid { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; }
  .hero-img { display: none; }
  .hero-name { font-size: 34px; }

  .footer-inner { grid-template-columns: 1fr 1fr; gap: 28px; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }
  .header-inner { padding: 0 16px; }
  .header-logo img { height: 28px; }
  .header-site-name { font-size: 15px; }

  .nav-toggle { display: block; }

  #site-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0; bottom: 0;
    background: var(--color-header-bg);
    padding: 20px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    overflow-y: auto;
    z-index: 199;
  }
  #site-nav.open { display: block; }
  #site-nav ul { flex-direction: column; gap: 4px; }
  #site-nav ul li a { font-size: 16px; padding: 12px 16px; }

  #main { padding: 28px 16px 56px; }
  h1 { font-size: 22px; }
  h2 { font-size: 17px; }

  .talk-item { grid-template-columns: 1fr; gap: 4px; }
  .talk-date { font-size: 12px; color: var(--color-text-muted); }

  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .hero-name { font-size: 28px; }
  .data-table, .timetable { font-size: 13px; }
  .data-table thead th,
  .data-table tbody td { padding: 9px 12px; }
}

/* ======================================
   Year Accordion（使用テキスト・過去メンバー）
====================================== */
.year-accordion-group {
  margin-bottom: 28px;
}

.year-accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.year-accordion summary {
  padding: 12px 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
  background: var(--color-accent-subtle);
  border-bottom: 1px solid transparent;
  transition: background var(--transition);
}
.year-accordion summary::-webkit-details-marker { display: none; }
.year-accordion[open] summary {
  border-bottom-color: var(--color-border);
}
.year-accordion summary::after {
  content: '▶';
  font-size: 11px;
  color: var(--color-accent);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.year-accordion[open] summary::after {
  transform: rotate(90deg);
}
.year-accordion summary:hover {
  background: #c8e6c9;
}

/* アコーディオン内のテーブルは枠線・影をリセット */
.year-accordion .data-table {
  margin-bottom: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* ======================================
   Mobile Card Layout for data-table
   スマホでの各行カード表示（640px以下）
====================================== */
@media (max-width: 640px) {
  /* テーブル全体をブロックに変換 */
  .data-table {
    display: block;
    background: transparent;
    box-shadow: none;
    border: none;
    border-radius: 0;
    overflow: visible;
  }

  /* ヘッダー行を非表示 */
  .data-table thead {
    display: none;
  }

  /* tbody・tr をブロックに */
  .data-table tbody {
    display: block;
  }

  /* 各行をカードとして表示 */
  .data-table tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--color-surface);
    overflow: hidden;
    transition: box-shadow var(--transition);
  }
  .data-table tbody tr:hover {
    box-shadow: var(--shadow-md);
    background: var(--color-accent-subtle);
  }

  /* 偶数行の背景色リセット（カード単位で色分けするため） */
  .data-table tbody tr:nth-child(even) {
    background: var(--color-surface);
  }
  .data-table tbody tr:nth-child(even):hover {
    background: var(--color-accent-subtle);
  }

  /* highlight行（スタッフなど） */
  .data-table tbody tr.row-highlight {
    background: var(--color-accent-subtle) !important;
  }
  .row-highlight td {
    background: transparent !important;
    font-weight: 500;
  }

  /* 各セルをラベル付きの横並び行として表示 */
  .data-table tbody td {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 9px 14px;
    border-bottom: 1px solid var(--color-border-light);
    border-right: none;
    font-size: 14px;
    line-height: 1.6;
  }

  /* 最後のセルは区切り線なし */
  .data-table tbody td:last-child {
    border-bottom: none;
  }

  /* 中身が空のセルは非表示 */
  .data-table tbody td:empty {
    display: none;
  }

  /* data-label 属性を列見出しとして表示 */
  .data-table tbody td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 700;
    color: var(--color-accent);
    min-width: 64px;
    flex-shrink: 0;
    padding-top: 2px;
    line-height: 1.6;
    letter-spacing: 0.02em;
  }

  /* 480px以下のフォントサイズ上書きをカード用にリセット */
  .data-table tbody td {
    padding: 9px 14px !important;
    font-size: 14px !important;
  }
}
