/* ============================================================
   服部研究室 — 森の中の白い研究所
   トークン: 白（建物）と緑3段（森 / 葉 / 発光）
   ============================================================ */
:root {
  --white: #ffffff;
  --mist: #f3f7f4;
  --mist-2: #e6f0ea;
  --forest: #0f3d2e;
  --leaf: #1f7a4d;
  --glow: #6ee7a8;
  --dim: #5b7266;
  --line: rgba(31, 122, 77, 0.18);
  --line-solid: #d7e7df;                /* --line を白に重ねた色。半透明の border は角に筋が出るので名札はこちら */

  --font-en: "Chakra Petch", system-ui, sans-serif;
  --font-ja: "Zen Kaku Gothic New", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;

  --wrap: 1120px;
  --pad: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html { scroll-behavior: smooth; color-scheme: light; }
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--white);
  color: var(--forest);
  font-family: var(--font-ja);
  font-weight: 300;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--forest); color: #fff; padding: 8px 14px; border-radius: 999px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--pad);
  transition: background 0.3s, box-shadow 0.3s;
}
.nav.is-scrolled {
  background: rgba(255, 255, 255, 0.84);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
}
.nav__brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--forest); text-decoration: none; font-weight: 500; letter-spacing: 0.08em; white-space: nowrap;
}
.nav__logo {
  width: 42px; height: 42px; flex: none;
  object-fit: contain; object-position: center;
}
.foot__mark {
  width: 10px; height: 10px; border-radius: 50%; background: var(--leaf);
  box-shadow: 0 0 0 4px rgba(110, 231, 168, 0.35);
}
.nav ul { list-style: none; display: flex; gap: clamp(14px, 3vw, 36px); margin: 0; padding: 0; }
.nav ul a {
  position: relative; display: block; padding: 6px 0;
  font-family: var(--font-en); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.04em;
  color: var(--dim); text-decoration: none; transition: color 0.25s;
}
.nav ul a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px;
  background: var(--leaf); transition: right 0.3s var(--ease);
}
.nav ul a:hover { color: var(--forest); }
.nav ul a[aria-current] { color: var(--forest); }
.nav ul a[aria-current]::after { right: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, var(--mist) 55%, var(--mist-2) 100%);
}
#field { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__inner { position: relative; text-align: center; padding: 0 var(--pad); }
.hero__en {
  margin: 0 0 14px;
  font-family: var(--font-en); font-weight: 600; font-size: clamp(0.8rem, 1.2vw, 1rem);
  letter-spacing: 0.22em; color: var(--leaf);
  animation: rise 1.2s var(--ease) 0.15s both;
}
.hero__en span { display: block; margin-top: 4px; font-weight: 500; letter-spacing: 0.14em; color: var(--dim); }
h1 {
  margin: 0; padding-left: 0.12em;
  font-weight: 500; font-size: clamp(3rem, 10vw, 8rem); line-height: 1.1; letter-spacing: 0.12em;
  animation: rise 1.2s var(--ease) 0.35s both;
}
.hero__tag {
  margin: 24px 0 0;
  font-size: clamp(1rem, 1.6vw, 1.25rem); letter-spacing: 0.22em; color: var(--dim);
  animation: rise 1.2s var(--ease) 0.8s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.hero__scroll {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  width: 24px; height: 56px; display: block;
  animation: rise 1s var(--ease) 1.6s both;
}
.hero__scroll span {
  position: absolute; left: 50%; top: 0; width: 1px; height: 100%; background: var(--line);
}
.hero__scroll span::after {
  content: ""; position: absolute; left: -2px; top: 0; width: 5px; height: 5px; border-radius: 50%;
  background: var(--leaf); box-shadow: 0 0 10px var(--glow);
  animation: drop 2.2s var(--ease) infinite;
}
@keyframes drop {
  0% { top: 0; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { top: 100%; opacity: 0; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(80px, 12vw, 160px) 0; }
.section--mist { background: var(--mist); }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--pad); }
.title {
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap;
  margin: 0 0 clamp(40px, 6vw, 72px);
}
.title__en {
  font-family: var(--font-en); font-weight: 600; line-height: 1; letter-spacing: 0.02em;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
}
.title__ja { font-weight: 500; font-size: 1rem; letter-spacing: 0.22em; color: var(--leaf); }

/* ---------- Research ---------- */
.research { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(20px, 3vw, 40px); }
.theme {
  grid-column: span 6;
  display: grid; gap: 18px; align-content: start;
  padding: clamp(24px, 3vw, 44px);
  background: var(--mist); border-radius: 2px;
  transition: background 0.3s;
}
.theme:nth-child(1), .theme:nth-child(4) {
  grid-column: span 7;
  grid-template-columns: auto 1fr; align-items: center; gap: clamp(20px, 3vw, 40px);
}
.theme:nth-child(2), .theme:nth-child(3) { grid-column: span 5; }
.theme:hover { background: var(--mist-2); }
.theme__body { display: grid; gap: 8px; }
.theme__en {
  margin: 0; font-family: var(--font-en); font-weight: 500; font-size: 0.85rem;
  letter-spacing: 0.1em; color: var(--leaf);
}
.theme h3 { margin: 0; font-weight: 500; font-size: clamp(1.25rem, 2vw, 1.6rem); letter-spacing: 0.08em; line-height: 1.4; }
.theme p { margin: 0; color: var(--dim); max-width: 30em; }
.glyph { width: clamp(88px, 9vw, 120px); height: auto; color: var(--leaf); display: block; }
.glyph .reply, .glyph .joint { fill: var(--mist); transition: fill 0.3s; }
.theme:hover .glyph .reply, .theme:hover .glyph .joint { fill: var(--mist-2); }

/* アイコンは手をふれた時だけ動く。6テーマそれぞれ別の動き */
.theme:hover .glyph--graph circle,
.theme:focus-within .glyph--graph circle { animation: pulse 1.8s ease-in-out infinite; }
.glyph--graph circle:nth-child(2) { animation-delay: 0.2s; }
.glyph--graph circle:nth-child(3) { animation-delay: 0.5s; }
.glyph--graph circle:nth-child(4) { animation-delay: 0.8s; }
.glyph--graph circle:nth-child(5) { animation-delay: 1.1s; }

.theme:hover .glyph--chat .dots circle { animation: typing 1.2s ease-in-out infinite; }
.glyph--chat .dots circle:nth-child(2) { animation-delay: 0.15s; }
.glyph--chat .dots circle:nth-child(3) { animation-delay: 0.3s; }

.theme:hover .glyph--board .stone--a { animation: slideX 2.4s ease-in-out infinite; }
.theme:hover .glyph--board .stone--b { animation: slideY 2.4s ease-in-out infinite; animation-delay: 1.2s; }

.theme:hover .glyph--route .active { animation: draw 2s ease-in-out infinite; }
.theme:hover .glyph--route .target { animation: fillIn 2s ease-in-out infinite; }

.glyph--arm .upper { transform-origin: 44px 88px; }
.glyph--arm .fore { transform-origin: 44px 48px; }
.theme:hover .glyph--arm .upper { animation: swing 2.6s ease-in-out infinite alternate; }
.theme:hover .glyph--arm .fore { animation: bend 1.3s ease-in-out infinite alternate; }

.theme:hover .glyph--trace .copy { animation: draw 2.4s ease-in-out infinite; }

@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.18); opacity: 0.6; } }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
@keyframes slideX { 0%, 20% { transform: translateX(0); } 45%, 75% { transform: translateX(25.3px); } 100% { transform: translateX(0); } }
@keyframes slideY { 0%, 20% { transform: translateY(0); } 45%, 75% { transform: translateY(-25.3px); } 100% { transform: translateY(0); } }
@keyframes draw { 0% { stroke-dashoffset: 100; } 65%, 100% { stroke-dashoffset: 0; } }
@keyframes fillIn { 0%, 60% { fill: transparent; } 75%, 100% { fill: currentColor; } }
@keyframes swing { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
@keyframes bend { from { transform: rotate(-14deg); } to { transform: rotate(12deg); } }

/* ---------- Past Research ---------- */
.section--archive { padding-top: 0; scroll-margin-top: 100px; }
.archive { border-top: 1px solid var(--line); padding-top: clamp(48px, 7vw, 88px); }
.archive__year {
  display: grid; grid-template-columns: 144px minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px); padding: 32px 0;
  border-top: 1px solid var(--line);
}
.archive__year:last-child { border-bottom: 1px solid var(--line); }
.archive__year-title {
  display: flex; align-items: baseline; gap: 10px; margin: 0;
  font-family: var(--font-en); font-size: 2rem; font-weight: 500; line-height: 1.4; color: var(--leaf);
}
.archive__year-title span { font-family: var(--font-ja); font-size: 0.85rem; letter-spacing: 0.1em; }
.archive__papers { list-style: none; margin: 0; padding: 0; min-width: 0; }
.paper + .paper { margin-top: 32px; padding-top: 32px; border-top: 1px solid var(--line); }
.paper__author { margin: 0 0 12px; font-weight: 500; letter-spacing: 0.06em; }
.paper__author span { display: inline-block; font-family: var(--font-en); font-size: 0.85rem; font-weight: 500; color: var(--dim); letter-spacing: 0.02em; }
.paper__title { margin: 0; font-size: clamp(1.1rem, 1.8vw, 1.4rem); font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.paper__title[lang="en"] { font-family: var(--font-en); }
.paper__en { margin: 8px 0 0; font-family: var(--font-en); font-size: 0.95rem; line-height: 1.7; color: var(--dim); }
.paper__link {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 10px;
  min-height: 44px; margin-top: 16px; padding: 6px 0;
  color: var(--leaf); font-size: 0.85rem; font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--line-solid); text-underline-offset: 5px;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.paper__link:hover { color: var(--forest); text-decoration-color: var(--leaf); }
.paper__format { padding: 1px 7px; border: 1px solid var(--line); border-radius: 2px; font-family: var(--font-en); font-size: 0.7rem; line-height: 1.6; letter-spacing: 0.06em; }

/* ---------- Members: 在室ボード ---------- */
.board {
  position: relative;
  margin-top: 56px;                       /* 付箋がはみ出す分 */
  background: #fff;
  border: 8px solid var(--mist-2);        /* 枠 */
  outline: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 48px rgba(15, 61, 46, 0.08);
}
/* 付箋: 「サンプルです」をボードの上に貼る */
.board__note {
  position: absolute; z-index: 2; right: clamp(8px, 4vw, 48px); top: -34px;
  width: 232px; padding: 22px 20px 18px;
  background: linear-gradient(180deg, #fff9c9, #fdf0a6);
  color: #4a4318; font-size: 0.85rem; line-height: 1.7; letter-spacing: 0.03em;
  box-shadow: 0 8px 18px rgba(60, 50, 0, 0.22), 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transform: rotate(-2.4deg); transform-origin: top center;
}
.board__note strong { display: block; font-weight: 500; font-size: 0.95rem; letter-spacing: 0.1em; margin-bottom: 4px; }
.board__note::before {                    /* マスキングテープ */
  content: ""; position: absolute; left: 50%; top: -10px; width: 84px; height: 20px;
  transform: translateX(-50%) rotate(1.5deg);
  background: rgba(255, 255, 255, 0.55); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.board__row {
  display: grid; grid-template-columns: 156px 1fr; align-items: start;
  border-bottom: 1px solid var(--line);
}
.board__row:last-child { border-bottom: 0; }
.board__role {
  margin: 0; padding: 30px 24px 30px 32px;
  font-weight: 500; font-size: 1.05rem; letter-spacing: 0.18em; line-height: 1.3;
  border-right: 1px solid var(--line); align-self: stretch;
}
.board__role small {
  display: block; margin-top: 6px;
  font-family: var(--font-en); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.08em; color: var(--dim);
}
.board__role small span { display: block; margin-top: 2px; font-family: var(--font-ja); letter-spacing: 0.1em; }

.board__cards {
  list-style: none; margin: 0; padding: 26px 28px;
  display: flex; flex-wrap: wrap; gap: 18px 14px;
}
/* 名札 */
.card {
  position: relative; display: grid; gap: 4px; align-content: start; width: 240px; text-align: left;
  padding: 20px 20px 18px; border: 1px solid var(--line-solid); border-radius: 3px;
  background: #fff; color: var(--forest);
  box-shadow: 0 1px 2px rgba(15, 61, 46, 0.06), 0 6px 16px rgba(15, 61, 46, 0.08);
}
.card__pin {                               /* マグネット */
  position: absolute; top: -7px; left: 50%; width: 14px; height: 14px; border-radius: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 32% 30%, #dff9ea 0, var(--leaf) 40%, var(--forest) 100%);
  box-shadow: 0 1px 3px rgba(15, 61, 46, 0.4);
}
.card__name { font-weight: 500; font-size: 1.3rem; letter-spacing: 0.08em; line-height: 1.3; }
/* 本人のサイトがある人は氏名がリンク */
.card__name a {
  color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--leaf); padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.card__name a:hover, .card__name a:focus-visible { color: var(--leaf); border-color: var(--glow); }
.card__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-family: var(--font-en); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--dim); }
.card__meta b { font-weight: 600; color: var(--leaf); }
/* 架空の人物であることの印。名札の右上に小さく置く */
.card__sample {
  position: absolute; top: 10px; right: 10px;
  padding: 1px 9px; border-radius: 999px; background: var(--mist);
  font-family: var(--font-ja); font-size: 0.68rem; letter-spacing: 0.1em;
}
/* 関心テーマ */
.card__tags { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.card__tags li { font-size: 0.76rem; line-height: 1.6; padding: 2px 10px; border-radius: 999px; background: var(--mist); white-space: nowrap; }

/* 教員の名札は一枚だけ大きく */
.board__row--教員 .card { width: 320px; padding: 24px 24px 22px; }
.board__row--教員 .card__name { font-size: 1.7rem; }
.board__row--教員 .card__pin { background: radial-gradient(circle at 32% 30%, #ffffff 0, var(--glow) 40%, var(--leaf) 100%); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.about__body .title { margin-bottom: 28px; }
.about__lead { margin: 0; font-size: clamp(1.05rem, 1.6vw, 1.25rem); letter-spacing: 0.04em; max-width: 26em; }
.about__lead + .about__lead { margin-top: 1.2em; font-size: 1rem; color: var(--dim); }
/* ゼミの進め方 */
.seminar { padding-top: 10px; }
.seminar__title {
  display: flex; align-items: baseline; gap: 14px; margin: 0 0 10px;
  font-weight: 500; font-size: 1.2rem; letter-spacing: 0.1em;
}
.seminar__title small {
  padding: 2px 12px; border-radius: 999px; border: 1px solid var(--leaf);
  font-weight: 500; font-size: 0.78rem; letter-spacing: 0.12em; color: var(--leaf);
}
.seminar__lead { margin: 0 0 22px; color: var(--dim); }
.seminar__roles { margin: 0; border-top: 1px solid var(--line); }
.seminar__roles > div {
  display: grid; grid-template-columns: 10.5em 1fr; gap: 16px; align-items: baseline;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.seminar__roles dt { display: flex; align-items: baseline; gap: 10px; font-weight: 500; letter-spacing: 0.06em; white-space: nowrap; }
.seminar__roles dt b { font-family: var(--font-en); font-weight: 600; font-size: 0.85rem; color: var(--leaf); letter-spacing: 0.08em; min-width: 2.6em; }
.seminar__roles dd { margin: 0; letter-spacing: 0.04em; }

/* ---------- Access ---------- */
.access { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.access__map { min-width: 0; }
.access__map img { width: 100%; height: auto; display: block; border-radius: 2px; box-shadow: 0 20px 60px rgba(15, 61, 46, 0.1); }
.access__body .title { margin-bottom: 28px; }
.access__place { margin: 0 0 6px; font-weight: 500; font-size: 1.25rem; letter-spacing: 0.06em; }
.access__addr { margin: 0; color: var(--dim); }
.btn {
  display: inline-block; margin-top: 30px; padding: 14px 32px; border-radius: 999px;
  background: var(--forest); color: #fff; text-decoration: none; font-weight: 500; letter-spacing: 0.16em;
  transition: background 0.25s, box-shadow 0.25s;
}
.btn:hover { background: var(--leaf); box-shadow: 0 0 0 5px rgba(110, 231, 168, 0.35); }

/* ---------- Footer ---------- */
.foot {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 40px var(--pad); color: var(--dim);
  font-family: var(--font-en); font-size: 0.85rem; letter-spacing: 0.1em;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav { padding: 12px 16px; flex-wrap: wrap; gap: 6px; }
  .nav nav { width: 100%; }
  .nav ul { gap: 10px; justify-content: space-between; }
  .nav ul a { font-size: 0.8rem; }
  .nav__brand { font-size: 0.9rem; gap: 8px; }
  .nav__logo { width: 34px; height: 34px; }
  .archive__year { grid-template-columns: 1fr; gap: 20px; padding: 28px 0; }
  .board { margin-top: 24px; border-width: 6px; }
  /* 付箋はボードの中の上部に貼る（段の見出しに重ねない） */
  .board__note { position: relative; top: 0; right: 0; margin: 16px 14px -6px auto; width: min(100% - 28px, 240px); font-size: 0.8rem; padding: 18px 16px 14px; }
  .board__row { grid-template-columns: 1fr; }
  .board__role { padding: 18px 18px 0; border-right: 0; display: flex; align-items: baseline; gap: 12px; }
  .board__role small { margin: 0; display: flex; gap: 8px; }
  .board__role small span { margin: 0; }
  .board__cards { padding: 16px 18px 22px; gap: 14px 10px; }
  .board__cards > li { flex: 0 0 100%; min-width: 0; }   /* 名札は1列。タグが折れないように */
  .card { width: 100%; padding: 16px 16px 14px; }
  .card__name { font-size: 1.1rem; }
  .card__meta { display: block; }
  .card__meta b { margin-right: 8px; }
  .theme, .theme:nth-child(1), .theme:nth-child(2), .theme:nth-child(3), .theme:nth-child(4) {
    grid-column: span 12; grid-template-columns: 1fr; align-items: start;
  }
  .about { grid-template-columns: 1fr; }
  .seminar__roles > div { grid-template-columns: 1fr; gap: 4px; }
  .access { grid-template-columns: 1fr; }
  .access__body .title { margin-top: 8px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
