/* ----------------------------------------------------
  基本設定（横はみ出し防止 & 余白計算統一）
---------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;        /* 右側見切れ対策 */
  font-family: 'Roboto', sans-serif;
  background-color: #f8f9fa;
  color: #212529;
  line-height: 1.6;
}

a { color: #0056b3; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------
  ヘッダー（固定）
---------------------------------------------------- */
#topbar {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  z-index: 9999;
  background-color: #1b1b2f;
  color: #fff;
  padding: 10px 20px;        /* box-sizing済みなので横はみ出ししない */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 5px rgba(0,0,0,.2);
}

.logo { display: flex; align-items: center; gap: 15px; }
.logo img { height: 48px; }
.lab-title { font-size: 1.2rem; font-weight: bold; }

/* ----------------------------------------------------
  ナビ（PCデフォルトは横並び）
---------------------------------------------------- */
.nav-links {
  margin-left: auto;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.nav-links a {
  color: #f0f0f0;
  font-size: .95rem;
  transition: color .3s;
}
.nav-links a:hover { color: #00aaff; }

.language-switch {
  margin-left: auto;
  margin-right: 20px;
  font-size: .85rem;
  color: #ccc;
}
.language-switch a { color: #ccc; }
.language-switch a:hover { color: #fff; }

/* 検索ボックス（PC） */
#search-box { width: 100%; margin-top: 10px; }

/* ----------------------------------------------------
  ヒーロー（背景固定・モバイルは scroll に切替）
---------------------------------------------------- */
.hero {
  height: 100vh;
  background-image: url('toppage1.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  color: #fff; text-align: center;
}
.hero::before {
  content:"";
  position: absolute; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1;
}
.hero-text { position: relative; z-index: 2; }
.hero-text h1 { font-size: 2rem; margin-bottom: 10px; }
.hero-text h2 { font-size: 1.1rem; }




/* ----------------------------------------------------
  本文
---------------------------------------------------- */
main#contents {
  /* ヘッダー分の余白を確実に確保（上書きされない一発指定） */
  max-width: 1000px;
  margin: 150px auto 50px;
  padding: 30px;
  background: #fff;
  box-shadow: 0 0 10px rgba(0,0,0,.05);
}
#contents h2 { margin-top: 2em; border-bottom: 2px solid #ccc; padding-bottom: 5px; }
#contents p { margin-bottom: 1.5em; }
.right-img { float: right; margin: 0 0 10px 20px; max-width: 300px; }

/* ----------------------------------------------------
  研究動画（サムネ）
---------------------------------------------------- */
.video-section { text-align: center; padding: 40px 20px; background: #f5f5f5; }
.video-container { position: relative; display: inline-block; max-width: 100%; margin-top: 20px; }
.video-container img { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 4px 10px rgba(0,0,0,.2); }
.play-button {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 64px; color: #fff; text-shadow: 0 0 15px rgba(0,0,0,.8); pointer-events: none;
}

/* ----------------------------------------------------
  ニュース / SNS / フッター
---------------------------------------------------- */
/* ページ全体で左右いっぱいに広げる */
.news-section {
  width: 90%;
  margin-left: 5%;
  margin-right: 5%;
  padding: 16px; 
  background-color: #f5f5f5;
  border: 2px solid black;
  box-sizing: border-box;

  /* 横スクロールを有効化 */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* スマホでのスムーズスクロール */
}

/* タイトル中央寄せ */
.news-section h3 {
  text-align: center;
  font-size: 1.5rem;
  margin-bottom: 20px;
}

/* objectを幅より大きくすることでスクロールできる */
.news-section object.news {
  display: block;
  width: 100%; /* 仮に横幅を固定して大きめに設定 */
  min-height: 600px; 
  border: none;
  box-sizing: border-box;
}

.x-embed {
  border: 2px solid black;   /* 黒い枠線 */
  border-radius: 8px;        /* 角を丸く（お好みで） */
  padding: 10px;             /* 内側に余白 */
  max-width: 500px;          /* 幅を制限（調整可能） */
  margin: 20px auto;         /* 中央寄せ */
}

.twitter-timeline { width: 100% !important; }

/* スマホやタブレット用のレスポンシブ調整 */
@media (max-width: 768px) {
  .news-section h3 {
    font-size: 1.2rem;
  }
  .news-section object.news {
    width: 800px; /* スマホで見切れるサイズにして横スクロール */
    min-height: 400px;
  }
}



footer {
  text-align: center; padding: 20px;
  background: #1b1b2f; color: #fff; font-size: .85rem;
}


/* チェックボックスは常に不可視（PCでもスマホでも） */
#menu-toggle,
input[type="checkbox"].menu-toggle {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important; height: 0 !important;
  pointer-events: none !important;
  display: none !important;
}

/* ☰ アイコン（PCは非表示） */
.menu-icon {
  display: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  margin-left: auto;
  user-select: none;
}

/* ----------------------------------------------------
  モバイル調整
---------------------------------------------------- */
@media (max-width: 768px) {
  /* iOS等での描画問題回避：背景固定をオフ */
  .hero { background-attachment: scroll; }

  #topbar {
    flex-direction: column;
    align-items: stretch;   /* 幅100%で揃える */
    padding: 10px;
    gap: 8px;
  }

  .logo img { width: 40px; height: auto; }
  .lab-title { font-size: 14px; }

  /* ☰ を表示して右端に */
  .menu-icon {
    display: block;
    align-self: flex-end;
  }

  /* ナビはデフォルト非表示・縦並び・全幅 */
  .nav-links {
    display: none;
    flex-direction: column;
    gap: 0;
    width: 100%;
    background: #1b1b2f;
    border-top: 1px solid #333;
  }
  .nav-links a {
    padding: 12px 14px;
    border-bottom: 1px solid #333;
  }

  /* チェックONでメニュー開く（JS不要） */
  #menu-toggle:checked ~ .nav-links {
    display: flex;
  }

  /* 言語/検索は下にフル幅で */
  .language-switch {
    margin: 6px 0 0;
    width: 100%;
    text-align: right;
  }
  #search-box { width: 100%; margin-top: 10px; }

  /* 本文内の画像回り込みを解除 */
  .right-img {
    float: none; display: block;
    margin: 10px auto; max-width: 90%;
  }

  /* SNS縦並び */
  #social-sidebar { flex-direction: column; align-items: center; }
}

/* 念のため：埋め込み要素のはみ出し防止 */
img, video, iframe { max-width: 100%; height: auto; }


/* 他のページのhtml用 */
/* research */
.research {
  width: 80%;
  margin: 0 auto;           /* 左右中央寄せ */
  padding-top: 140px;        /* 固定の余白 */
  text-align: left;
}
.research h1,
.research h2 {
  text-align: center;  /* 見出しだけ中央揃え */
}


@media (min-width: 768px) {
  .research {
    padding-top: 90px; 
    width: 80%;
  }
}

.icon {
  height: 1em;   /* 文字の高さと同じ */
  width: auto;   /* 縦横比を保つ */
  vertical-align: middle; /* 文字の高さにきれいに揃える */
}

table.about {
  border:1px #aaaaaa solid;
  border-collapse:collapse;
  width:90%;        /* 画面幅の90% */
  max-width:600px;  /* ただし最大600px */
  margin: 20px auto;
}

td.aboutcol {
  border:1px #aaaaaa solid;
  border-collapse:collapse;
  padding:5px;
  width:150px;
  vertical-align:top;
}
td.about {
  border:1px #aaaaaa solid;
  border-collapse:collapse;
  padding:5px;
  vertical-align:top;
}

/* メンバー部分用 */
.member {
  text-align: center;
  margin: 20px auto;
  padding: 80px;
}

.member .staff {
  font-size: 2em;   /* 基本より少し大きめ */
  font-weight: bold;  /* 太字にして見やすく */
  margin-bottom: 0.5em;
}

/* 学年ごとの区切り */
.member .student-group {
  border: 2px solid #333;   /* 枠線 */
  border-radius: 12px;      /* 角を丸く */
  padding: 15px;            /* 内側の余白 */
  margin: 20px 0;           /* 外側の余白 */
  background-color: #f9f9f9; /* 背景色（薄グレーなど） */
  margin-top: 40px;
}

.member .student-group h3 {
  margin-bottom: 20px;
  font-size: 18px;
  border-bottom: 2px solid #333;
  display: inline-block;
  padding-bottom: 5px;
}

.member .students {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 600px;
  margin: 0 auto;
}

.member .person img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
}

.member .person p {
  margin-top: 8px;
  font-size: 14px;
}

/* スマホ用 */
@media (max-width: 600px) {
  .member {
    margin-top: 35%;
    padding: 20px;       /* スマホは余白少なめでOK */
    width: 100%;
    text-align: center;
  }
  .member .students {
    display: grid;               /* 念のため grid を指定 */
    grid-template-columns: 1fr;  /* 1列 */
    gap: 16px;                   /* 要素間にスペースを確保 */
  }
}

/* ギャラリー用 */
/* ギャラリーの外枠 */
ul.slide {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* PC: 横4列 */
  gap: 16px;
  list-style: none;
  padding: 20px;         /* 周囲の余白 */
  margin: 32px auto;     /* 上下余白 + 中央寄せ */
  max-width: 1200px;     /* 全体の幅上限（調整可） */
  box-sizing: border-box;
}

/* 各カード（画像＋文字） */
ul.slide li {
  text-align: center;    /* 文字を中央寄せ */
  background: #fff;
  border-radius: 10px;
  padding: 8px;
  transition: transform .22s ease, box-shadow .22s ease;
  will-change: transform, box-shadow;
}

/* 画像の雛形：等しい見た目にするためaspect-ratioを推奨 */
ul.slide li img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  object-fit: cover;       /* 切り取りで均一に見せたい時有効 */
  aspect-ratio: 4 / 3;     /* 任意：統一感を出す（変更可） */
  box-shadow: 0 6px 18px rgba(0,0,0,0.08); /* ベースの浮き */
  transition: transform .22s ease, box-shadow .22s ease;
}

/* マウスホバー / フォーカスでさらに浮く（アクセシビリティ対応でフォーカスも） */
ul.slide li:hover,
ul.slide li:focus-within {
  transform: translateY(-8px);
  box-shadow: 0 18px 36px rgba(0,0,0,0.14);
}

/* キャプション（画像下の文字） */
ul.slide li .caption {
  margin: 10px 0 0;
  font-size: 0.95rem;
  color: #222;
  text-align: center;
}

/* リンクはカード全体を使いやすくする */
ul.slide li a { display: block; text-decoration: none; color: inherit; }

/* スマホ（幅600px以下）：1列表示に切替 */
@media (max-width: 600px) {
  ul.slide {
    grid-template-columns: 1fr;   /* 1列 */
    gap: 12px;
    padding: 12px;
    margin: 20px auto;
  }

  ul.slide li {
    padding: 10px;
  }

  /* 画像の高さを控えめにしたい場合は aspect-ratio を変える：
     ul.slide li img { aspect-ratio: 16/9; } など */
}

/* ギャラリー全体のラッパー（中央寄せ・余白の調整） */
.gallery {
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 120px;
  padding: 20px;
  box-sizing: border-box;
}

/* ギャラリー内の見出しを中央揃えに */
.gallery h1,
.gallery h2,
.gallery h3 {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  color: #222;
}

/* 見出しごとの微調整（好みで変更） */
.gallery h1 { font-size: 1.8rem; margin-bottom: 12px; }
.gallery h2 { font-size: 1.25rem; margin-top: 8px; margin-bottom: 8px; }
.gallery h3 { font-size: 1rem; margin-top: 6px; margin-bottom: 14px; color:#555; font-weight:500; }

/* スマホで左右の余白が欲しい場合 */
@media (max-width: 600px) {
  .gallery {
     padding-left: 12px;
     padding-right: 12px;
     margin-top: 35%;
    }
  
}

/* リンク用 */

/* リンクページ全体の中央寄せと余白調整 */
.links {
  max-width: 800px;      /* 最大幅 */
  margin: 0 auto;         /* ページ中央に配置 */
  margin-top: 7%;
  padding: 20px;          /* 全体の余白 */
  box-sizing: border-box;
  text-align: center;     /* 見出し・リスト中央寄せ */
}

/* 見出し */
.links h1,
.links h2 {
  text-align: center;
  margin-bottom: 12px;
  color: #222;
}

/* リストの中央寄せ */
.links ul {
  list-style-type: none;  /* デフォルトの箇条書き消す場合 */
  padding-left: 0;
}

.links li.contents {
  margin-bottom: 8px;
}

/* リンクの装飾 */
.links a {
  text-decoration: none;
  color: #0066cc;
}

.links a:hover {
  text-decoration: underline;
}

/* スマホ用 */
@media (max-width: 600px) {
  .links {
    padding-left: 12px;
    padding-right: 12px;
    margin-top: 35%;
  }
}

/* 住所用 */
.adress {
  margin: 0 auto;    
}

/* 個人ページ用 */

.personal{
  text-align: center;
}
