/* ========== 基本 ========== */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Noto Sans JP", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  margin: 0;
  color: #222;
  background: #f6f7fb;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

/* ========== ヘッダー ========== */
header {
  background: linear-gradient(135deg, #1E90FF, #0066CC);
  color: #fff;
  padding: 16px 16px;
}
.header-flex {
  display: flex;
  align-items: center;
  gap: 20px;
}
.logo {
  height: 80px;
  width: auto;
  flex-shrink: 0;
}
.header-text {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.sub-title {
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 2px 0;
  letter-spacing: 0.3px;
  color: rgba(255,255,255,0.95);
}
.site-title {
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
  font-size: 1.35rem;
  line-height: 1.35;
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: #fff;
}

/* ========== グローバルナビ ========== */
nav {
  background: #181892;
}
nav .nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  padding: 0 8px;
}
nav a {
  color: #fff;
  text-decoration: none;
  padding: 12px 14px;
  display: inline-block;
}
nav a:hover,
nav a[aria-current="page"] {
  background: #324ae0;
  border-radius: 8px;
}

/* ========== メイン領域 ========== */
main h1 { font-size: 1.6rem; margin-top: 16px; }
main h2 { font-size: 1.3rem; margin-top: 20px; }

.card {
  background: #fff;
  border: 1px solid #e6e8f0;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 6px rgba(17, 48, 110, .06);
  margin-top: 16px;
}

/* ========== お知らせ（スクロール枠） ========== */
.news {
  max-height: 220px;
  overflow-y: auto;
  padding-left: 0;
  margin: 12px 0 0;
  list-style: none;
}
.news li {
  padding: 4px 6px;
  margin: 0;
  border-bottom: 1px solid #eceff6;
  line-height: 1.0;
}
.news li:last-child { border-bottom: none; }
.news time {
  font-weight: 600;
  color: #11306e;
  margin-right: .4em;
  white-space: nowrap;
  font-family: "Courier New", monospace;
  font-size: 1.0em;
}

/* フッター */
footer {
  color: #666;
  text-align: center;
  padding: 24px 16px 40px;
  font-size: .9rem;
  line-height: 1.6;
}
footer p { margin: 4px 0; }

/* 研究室紹介：補足文 */
.research-note {
  font-size: 0.9em;
  color: #000000;
  margin: 0.3em 0 0.8em;
}

/* ボタン */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
}
.btn-primary { background: #230dc2; color: #fff; }
.btn-primary:hover { background: #1c448f; }

/* 代表的業績の体裁 */
.pubs {
  list-style: none;
  padding-left: 0;
  margin: 8px 0 0;
}
.pubs li {
  margin: 0.6em 0;
  line-height: 1.6;
  padding-left: 1.2em;
  text-indent: -1.2em;
}
.pubs em { font-style: italic; }
.pubs a { text-decoration: none; }
.pubs a:hover { text-decoration: underline; }

/* レスポンシブ微調整 */
@media (max-width: 640px) {
  .logo { height: 64px; }
  .sub-title { font-size: 0.9rem; }
  .site-title { font-size: 1.2rem; }
  .header-flex { flex-wrap: wrap; }
  nav .nav-inner { flex-wrap: wrap; justify-content: center; }
  nav a { padding: 10px 12px; }
  .container { padding: 12px; }
  .card { padding: 14px; }
}

/* ヘッダー内の英語サブタイトル */
.en-sub-title {
  font-size: 0.8rem;
  line-height: 1.4;
  margin: 4px 0 0;
  color: #e0e0e0;
  font-style: italic;
}
.signature {
  text-align: right;
  margin-top: 1em;
  font-style: normal;
}

/* 研究紹介の図版用 */
.research-figure {
  display: block;
  max-width: 80%;
  height: auto;
  margin: 10px auto 20px;
  border-radius: 8px;
  border: 1px solid #e6e8f0;
  background: #fff;
}

/* メンバーページ用 */
.avatar {
  width: 120px;
  height: auto;
  border-radius: 80%;
  margin-right: 12px;
}

/* リンク集ページ */
.card ul li { margin-bottom: 12px; font-size: 1.05rem; }
.card ul li a { text-decoration: none; color: #1f4aa8; }
.card ul li a:hover { text-decoration: underline; color: #11306e; }

/* 見出し横の花アイコン */
.title-with-icon {
  display: flex;
  align-items: center;
  gap: 8px;
}
.title-with-icon .icon-flower {
  width: 90px;
  height: auto;
  border-radius: 4px;
}

/* callout */
.callout {
  background: #f1f5ff;
  border: 1px solid #dbe5ff;
  color: #11306e;
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
}
.callout p { margin: 6px 0; }

/* 研究テーマ見出し */
.research-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: #11306e;
  border-left: 4px solid #324ae0;
  padding-left: 8px;
  margin: 0.6em 0 0.3em;
  line-height: 1.5;
}
.research-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.research-note { margin-left: 1em; }

/* publications アイコン */
.icon-flower-pub {
  width: 90px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
}
.cosmos-icon { object-position: 40% 60%; }

/* DOIリンク折返し */
.pubs a { word-break: break-word; }

/* ========== アニメーション系 ========== */
.fade-in {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 3.5s ease forwards;
}
@keyframes fadeInUp {
  to { opacity: 1; transform: translateY(0); }
}
.scroll-fade {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.scroll-fade.visible {
  opacity: 1;
  transform: translateY(0);
}
.icon-flower {
  opacity: 0;
  transform: scale(0.9);
  animation: fadeInIcon 5.0s ease forwards;
}
@keyframes fadeInIcon {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* ========== スライドショー ========== */
.photo-frame {
  margin: 20px auto;
  max-width: 960px;
  width: 100%;
}
.photo-frame .slideshow {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
}
.photo-frame .slideshow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  animation: fadeSlideshow 25s infinite;
}
.photo-frame .slideshow img:nth-child(1) { animation-delay: 0s;  }
.photo-frame .slideshow img:nth-child(2) { animation-delay: 5s;  }
.photo-frame .slideshow img:nth-child(3) { animation-delay: 10s; }
.photo-frame .slideshow img:nth-child(4) { animation-delay: 15s; }
.photo-frame .slideshow img:nth-child(5) { animation-delay: 20s; }
@keyframes fadeSlideshow {
  0% { opacity: 0; }
  5% { opacity: 1; }
  25% { opacity: 1; }
  30% { opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .photo-frame .slideshow img { animation: none; opacity: 1; }
}

/* NEW!! バッジ */
.new-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 6px;
  background: rgb(240, 13, 89);
  color: #fff;
  font-size: 0.75em;
  font-weight: bold;
  border-radius: 4px;
  animation: blink 2.5s infinite;
}
@keyframes blink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0; }
}

/* 教員カードフリップ効果 */
.flip-card {
  background-color: transparent;
  width: 130px;
  height: 180px;
  perspective: 1000px;
}
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}
.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 10px;
  border: 1px solid #e0e3ec;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.flip-card-front { background-color: #fff; }
.flip-card-front img {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  object-fit: cover;
}
.flip-card-back {
  background-color: #113db5;
  color: white;
  transform: rotateY(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* 共通フェードイン（テキスト順次表示用） */
.fade-in-text {
  opacity: 0;
  transform: translateY(12px);
  animation: fadeInUpText 1.8s ease forwards;
}

@keyframes fadeInUpText {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 遅延制御（順番に登場） */
.delay-1 { animation-delay: 0.5s; } /* 見出し */
.delay-2 { animation-delay: 1.5s; } /* 本文 */
.delay-3 { animation-delay: 4s; }   /* お知らせ */

/* Researchmap検索ボックス風リンク */
.search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 320px;            /* 横幅はお好みで */
  padding: 10px 14px;
  background: #fff;
  border: 2px solid #ccc;
  border-radius: 24px;     /* 角を丸くして検索窓っぽく */
  text-decoration: none;
  color: #333;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.search-btn:hover {
  border-color: #1a73e8;   /* Googleブルーっぽい色 */
  box-shadow: 0 0 6px rgba(26,115,232,0.3);
  color: #1a73e8;
}

/* 左側テキスト */
.search-text {
  flex: 1;
}

/* 右側の虫眼鏡 */
.search-icon {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
  margin-left: 8px;
}
.search-icon::after {
  content: "";
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 8px;
  height: 2px;
  background: currentColor;
  transform: rotate(45deg);
}

/* データサイエンス風の背景アニメーション */
#bg-network {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;       /* 背景にするため */
  background: #f6f7fb; /* ページ背景と同じに */
}

/* ===== 幾何学背景（控えめアニメ） ===== */
.geom-bg {
  position: fixed;
  inset: 0;           /* 画面全体 */
  pointer-events: none;
  z-index: -1;        /* 背景化 */
}

/* 基本スタイル（全シェイプ共通） */
.geom-bg .shape {
  position: absolute;
  left: var(--x);
  top:  var(--y);
  width: var(--size);
  height: var(--size);
  opacity: 0.14;             /* 上品に薄く */
  filter: blur(0.2px);       /* ほんのり柔らかく */
  animation: floaty 18s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

/* 形ごとの見た目（大学サイトに馴染むブルー系） */
.shape.square   { background: #324ae0; border-radius: 6px; }
.shape.circle   { background: #1f4aa8; border-radius: 50%; }
.shape.triangle {
  width: 0; height: 0; opacity: 0.16;
  border-left: calc(var(--size) / 2) solid transparent;
  border-right: calc(var(--size) / 2) solid transparent;
  border-bottom: var(--size) solid #6b8cff;
}

/* ゆったり浮遊＋回転＋フェード */
@keyframes floaty {
  0%   { transform: translateY(0)      rotate(0deg);   opacity: 0.00; }
  8%   { opacity: 0.16; }
  50%  { transform: translateY(-16px)  rotate(180deg); opacity: 0.16; }
  92%  { opacity: 0.00; }
  100% { transform: translateY(0)      rotate(360deg); opacity: 0.00; }
}

/* 形に応じて回転速度を少し変える（自然なランダム感） */
.shape.square   { animation-duration: 22s; }
.shape.circle   { animation-duration: 26s; }
.shape.triangle { animation-duration: 28s; }

/* ダークモードや色弱配慮を特にしなくても薄いので大丈夫。
   ただし動きが苦手な方には停止 */
@media (prefers-reduced-motion: reduce) {
  .geom-bg .shape { animation: none; opacity: 0.08; }
}

/* ボタン内のメールアイコン */
.btn .icon-mail {
  margin-left: 6px;  /* 文字とアイコンの余白 */
  vertical-align: middle; /* テキストと縦位置をそろえる */
}

/* リンクリスト（リンク＋説明） */
.link-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.link-list li {
  margin-bottom: 16px;   /* 各リンク間に余白 */
}

.link-list a {
  font-weight: 600;
  color: #1f4aa8;
  text-decoration: none;
}

.link-list a:hover {
  text-decoration: underline;
  color: #11306e;
}

.link-list p {
  margin: 4px 0 0 0;     /* リンクの直下に余白を少なく */
  font-size: 0.95rem;
  color: #555;
}

/* SNSアイコンリンク */
.sns-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.sns-icon .icon-img {
  width: 22px;   /* アイコンサイズ */
  height: 22px;
  display: block;
  filter: brightness(0) invert(1); /* 白っぽく（ナビの青背景で映える） */
  transition: transform 0.2s ease;
}

.sns-icon:hover .icon-img {
  transform: scale(1.15); /* ホバー時に拡大 */
  filter: brightness(0.8) invert(1); /* 少し暗め */
}

/* ========== スマホ用ヘッダー調整 ========== */
@media (max-width: 640px) {
  /* ヘッダーの上下余白を減らす */
  header {
    padding: 8px 12px;   /* 16px → 8pxに縮小 */
  }
    
  /* ロゴをさらに小さめに */
  .logo {
    height: 48px;   /* 64px → 48pxに変更 */
  }

  /* レイアウトを縦並びに */
  .header-flex {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px; /* 余白を詰める */
  }

  /* テキストサイズを少し縮小 */
  .sub-title { font-size: 0.7rem; }
  .site-title { font-size: 1.0rem; }
  .en-sub-title { font-size: 0.6rem; }
}

/* ===== スマホ用スライドショー調整 ===== */
@media (max-width: 640px) {
  .photo-frame {
    width: 100%;         /* 横幅いっぱい */
    max-width: 100%;     /* 最大幅の制限を解除 */
    margin: 0;           /* 余白をなくす */
  }

  .photo-frame .slideshow {
    aspect-ratio: 16 / 9;  /* 常に16:9を維持 */
    min-height: auto;      /* 固定高さを解除 */
  }

  .photo-frame .slideshow img {
    object-fit: cover;     /* 黒帯なしで全画面を埋める */
    width: 100%;
    height: 100%;
  }
}
