/*
  Uehara Lab Website - Responsive Styles
  for screen width <= 768px
*/

@media screen and (max-width: 768px) {

  /* --- 1. Basic Layout & Typography --- */
  body {
    -webkit-text-size-adjust: 100%;
  }

  .layout {
    width: 100%;
    padding: 0 4%;
    box-sizing: border-box;
  }

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

  #main,
  #side {
    width: 100%;
    float: none;
    padding: 0;
  }

  #con {
    padding-top: 20px;
  }

  /* --- 2. Header --- */
  #hd h1 {
    font-size: 1.1rem;
    line-height: 1.4;
    padding: 15px 0;
    text-align: center;
  }

  #hd h1 span {
    font-size: 0.9rem;
    display: block;
  }

  /* --- 3. Mobile Slide-in Menu (修正・追加) --- */

  /* Hamburger Button */
  #menu {
    display: block;
    position: fixed; /* 画面に固定 */
    bottom: 15px;      /* 下からの位置 */
    left: 15px;    /* 左からの位置 */
    z-index: 1001;  /* メニューより手前に表示 */
    cursor: pointer;
  }

  /* Overlay */
  #menu-overlay {
    display: none; /* 初期状態では非表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6); /* 半透明の黒 */
    z-index: 999; /* メニューの背景 */
  }

  /* Navigation Panel */
  #g_nav,
  #nav {
    display: block; /* 常にブロック要素としておく */
    position: fixed;
    top: 0;
    right: -280px; /* 初期状態では画面外の右側に配置 */
    width: 280px;  /* メニューの幅を固定 */
    height: 100%;
    background: #fff;
    z-index: 1000;
    overflow-y: auto; /* メニュー項目が多い場合にスクロール可能に */
    transition: right 0.4s ease; /* スライドアニメーション */
    padding-top: 60px; /* 閉じるボタンとの余白 */
    box-sizing: border-box;
  }

  /* Menu Open State */
  body.menu-open #g_nav,
  body.menu-open #nav {
    right: 0; /* メニューを開いたときに右側からスライドイン */
  }

  body.menu-open #menu-overlay {
    display: block; /* オーバーレイを表示 */
  }

  /* Close Button (×) */
  #g_nav .close-button,
  #nav .close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    color: #333;
    text-decoration: none;
    line-height: 1;
  }

  /* Menu List */
  #g_nav nav ul,
  #nav nav ul {
    flex-direction: column;
    padding: 0;
    margin: 0;
  }

  #g_nav nav li,
  #nav nav li {
    list-style: none;
    border-bottom: 1px solid #e0e0e0;
    width: 100%;
  }

  #g_nav nav li a,
  #nav nav li a {
    display: block;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    background: #f8f8f8;
  }

  #g_nav nav li a.current,
  #nav nav li a.current {
    font-weight: bold;
    background: #e9e9e9;
  }
  
  /* --- 4. Page Specific Styles --- */
  #main_v .main_v_txt { display: none; }
  #i_intro .i_intro_img { float: none; width: 100%; margin-right: 0; margin-bottom: 10px; }
  #i_intro .i_intro_con { padding-left: 0; }
  #i_news table, #i_news tbody, #i_news tr, #i_news td { display: block; width: 100% !important; box-sizing: border-box; border: none; }
  #i_news tr { padding: 12px 0; border-bottom: 1px solid #ccc; }
  #i_news td.date { padding: 0 0 5px 0; font-weight: bold; }
  h2.h2_sp { font-size: 1.3rem; }
}