@charset "utf-8";

.btn-private-mobile {
  display: none;
}

.research-menu-toggle,
.research-menu-close,
.research-menu-backdrop,
.page-menu-toggle,
.page-menu-close,
.page-menu-backdrop {
  display: none;
}

#top #main_textbox .intro-more-wrap {
  display: none;
}

/* Safety guard: no drawer toggle on top page */
body#top .research-menu-toggle,
body#top .page-menu-toggle,
body#top .research-menu-backdrop,
body#top .page-menu-backdrop {
  display: none !important;
}

/* Mobile-only overrides for legacy fixed-frame layout */
@media screen and (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  #allWrap {
    min-width: 0;
  }

  .wrapper {
    width: auto;
    margin: 0;
    padding: 0 12px;
    box-sizing: border-box;
  }

  #header .wrapper {
    position: relative;
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: 12px;
    padding-right: 12px;
  }

  #header .logo {
    position: absolute;
    top: 44px;
    left: 8px;
    margin: 0;
    z-index: 1;
  }

  #header .logo img {
    width: 140px;
    height: auto;
  }

  #header .lang_btn {
    float: right;
    display: inline-block;
    text-align: right;
    margin: 0 0 8px;
  }

  #header .pagetitle {
    padding-left: 152px;
    margin: 0 0 10px;
    text-align: left;
  }

  #header .pagetitle img {
    width: min(100%, 460px);
    height: auto;
  }

  #navi {
    padding-left: 152px;
  }

  #navi ul {
    display: flex;
    flex-wrap: nowrap;
    margin: 0;
    gap: 4px;
    justify-content: flex-start;
  }

  #navi ul li {
    float: none;
    flex: 1 1 0;
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 0;
    box-sizing: border-box;
    text-align: center;
  }

  #navi ul li img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
  }

  #imageWrap,
  #top #imageWrap {
    height: auto;
    padding-bottom: 10px;
    background: none;
  }

  #topimage {
    background: none;
  }

  #topimage p img {
    width: 100%;
    height: auto;
  }

  #botton .wrapper {
    width: auto;
  }

  #botton ul.btnbox {
    width: auto;
    margin-right: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  #botton ul.btnbox li {
    float: none;
    margin-right: 0;
    width: calc(50% - 3px);
  }

  #top #botton ul.btnbox li {
    width: calc((100% - 12px) / 3);
  }

  #top #botton ul.btnbox li.btn-private-mobile {
    display: block;
    margin-left: auto;
  }

  #top #botton ul.btnbox li.btn-private-mobile img {
    width: 100%;
    height: auto;
  }

  #botton ul.btnbox li img {
    width: 100%;
    height: auto;
  }

  #botton p.mab10 img {
    width: 100%;
    max-width: 960px;
    height: auto;
  }

  #main,
  #botton,
  #pankuzu {
    margin-bottom: 10px;
  }

  #main .wrapper {
    display: block;
  }

  #top #main .wrapper {
    display: block;
  }

  #page,
  #top #page {
    float: none;
    width: auto;
    min-height: 0;
    box-sizing: border-box;
  }

  body:not(#top) #main .wrapper {
    display: flex;
    flex-direction: column;
  }

  #top #main #side .bnrbox {
    display: none;
  }

  body:not(#top) #main .wrapper #side {
    float: none;
    width: auto;
    margin-top: 0;
    display: contents;
  }

  body:not(#top) #main .wrapper #side .sidemenu {
    order: 1;
    margin-bottom: 10px;
  }

  body:not(#top) #main .wrapper #page {
    order: 2;
  }

  body:not(#top) #main .wrapper #side .bnrbox {
    order: 3;
    margin-top: 10px;
    text-align: center;
  }

  body:not(#top) #main .wrapper #side .bnrbox li {
    margin-bottom: 0;
  }

  body:not(#top) #main .wrapper #side .bnrbox li img {
    width: min(140px, 40vw);
    height: auto;
  }

  .section {
    padding: 12px;
  }

  #main_textbox {
    padding: 0 6px 14px;
  }

  #top #page .news {
    width: auto;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 0 4px;
  }

  #top #page .news dt,
  #top #page .news dd {
    float: none;
    width: auto;
    padding-left: 0;
  }

  #top #page .newslist {
    position: static;
    margin: 0 0 10px;
    text-align: right;
  }

  #pankuzu li {
    float: none;
    margin-right: 0;
    margin-bottom: 3px;
  }

  #member dl.memberList dt,
  #member dl.memberList dd {
    float: none;
    width: auto;
    padding-left: 0;
  }

  #member .former-members-toggle {
    min-width: 0;
    width: 100%;
    font-size: 100%;
  }

  ul.member_list li {
    float: none;
    width: auto;
  }

  #research #page,
  #publication #page {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #research #side,
  #publication #side {
    position: static !important;
    top: auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  #research .image-row {
    display: block;
  }

  #research .image-row .Bimg {
    min-width: 0;
  }

  #footer .wrapper {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #footer {
    background: #8f9072;
  }

  #footer .fnavi01,
  #footer .fnavi02,
  #footer .fnavi03,
  #footer .fnavi04,
  #footer .fnavi04Wrap {
    float: none;
    width: auto;
    height: auto;
    padding: 0;
    border: 0;
    margin-bottom: 10px;
  }

  #footer .fnavi03 {
    display: flex;
    flex-wrap: nowrap;
    gap: 0 16px;
  }

  #footer .fnavi03 .first,
  #footer .fnavi03 .second {
    float: none;
    width: calc((100% - 16px) / 2);
    margin-bottom: 0;
  }

  #footer li {
    margin-bottom: 6px;
  }

  #copy p {
    padding: 8px 12px;
  }

  #pagetop {
    right: 10px;
    bottom: 10px;
  }

  #pagetop a img {
    width: 112px;
    height: auto;
  }

  #page img,
  #main_textbox img,
  #topimage img,
  #footer img {
    max-width: 100%;
    height: auto;
  }

  .tableWrap {
    overflow-x: auto;
  }

  table.type01 {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media screen and (max-width: 640px) {
  #research #main .wrapper {
    display: block;
    position: relative;
  }

  #research #main .wrapper #page {
    float: none;
    width: auto;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    font-size: 15px;
    line-height: 1.8;
  }

  #research #main .wrapper #page .section {
    font-size: 1.05em;
    line-height: 1.8;
  }

  #research #main .wrapper #side {
    float: none;
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    left: auto !important;
    width: min(84vw, 320px) !important;
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #fff;
    z-index: 1200;
    transform: translate3d(105%, 0, 0);
    transition: transform 0.24s ease;
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.28);
    padding: 12px 10px 20px;
    box-sizing: border-box;
    margin: 0;
  }

  body.research-menu-open {
    overflow: hidden;
  }

  body#research.research-menu-open #main .wrapper #side {
    transform: translate3d(0, 0, 0) !important;
  }

  body#research .research-menu-toggle {
    display: block;
    position: fixed;
    right: 10px;
    top: auto;
    bottom: 74px;
    z-index: 1150;
    border: 1px solid #506234;
    background: rgba(64, 95, 32, 0.78);
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 18px;
    cursor: pointer;
  }

  .research-menu-close {
    display: block;
    margin: 0 0 8px auto;
    border: 1px solid #8f9072;
    background: #f5f5f0;
    color: #403000;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
  }

  .research-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1140;
  }

  body.research-menu-open .research-menu-backdrop {
    display: block;
  }

  #research #side .sidemenu dt div {
    font-size: 126%;
    padding: 14px 10px;
  }

  #research #side .sidemenu dt span {
    display: block;
    font-size: 96%;
    padding: 6px 0 2px;
  }

  #research #side .sidemenu dd a {
    font-size: 108%;
    line-height: 1.5;
  }

  #research #side .sidemenu {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #research #main .wrapper #side .bnrbox {
    margin-top: 10px;
  }
}

@media screen and (max-width: 640px) {
  body.mobile-menu-page #main .wrapper {
    display: block;
    position: relative;
  }

  body.mobile-menu-page #main .wrapper #page {
    float: none;
    width: auto;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    font-size: 15px;
    line-height: 1.8;
  }

  body.mobile-menu-page #main .wrapper #page .section {
    font-size: 1.05em;
    line-height: 1.8;
  }

  body.mobile-menu-page #main .wrapper #side {
    float: none;
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    left: auto !important;
    width: min(84vw, 320px) !important;
    height: 100vh !important;
    min-height: 0 !important;
    overflow: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: #fff;
    z-index: 1200;
    transform: translate3d(105%, 0, 0);
    transition: transform 0.24s ease;
    box-shadow: -8px 0 20px rgba(0, 0, 0, 0.28);
    padding: 12px 10px 20px;
    box-sizing: border-box;
    margin: 0;
  }

  body.page-menu-open {
    overflow: hidden;
  }

  body.page-menu-open.mobile-menu-page #main .wrapper #side {
    transform: translate3d(0, 0, 0) !important;
  }

  body#publication .page-menu-toggle,
  body#seminar .page-menu-toggle {
    display: block;
    position: fixed;
    right: 10px;
    top: auto;
    bottom: 74px;
    z-index: 1150;
    border: 1px solid #506234;
    background: rgba(64, 95, 32, 0.78);
    color: #fff;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.2;
    border-radius: 18px;
    cursor: pointer;
  }

  .page-menu-close {
    display: block;
    margin: 0 0 8px auto;
    border: 1px solid #8f9072;
    background: #f5f5f0;
    color: #403000;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
  }

  .page-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1140;
  }

  body.page-menu-open .page-menu-backdrop {
    display: block;
  }

  body.mobile-menu-page #side .sidemenu dt div {
    font-size: 126%;
    padding: 14px 10px;
  }

  body.mobile-menu-page #side .sidemenu dd a {
    font-size: 108%;
    line-height: 1.5;
  }

  body.mobile-menu-page #side .sidemenu {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.mobile-menu-page #main .wrapper #side .bnrbox {
    margin-top: 10px;
  }

  body.mobile-menu-seminar #main .wrapper #side .bnrbox {
    display: none;
  }
}

@media screen and (max-width: 640px) {
  body {
    font-size: 14px;
  }

  h2 {
    font-size: 124%;
  }

  #botton ul.btnbox li {
    width: calc(50% - 3px);
  }

  #header {
    background: #f4f3ed;
  }

  #header .wrapper {
    --mobile-logo-width: clamp(112px, 31vw, 126px);
    position: relative;
    padding-top: 8px;
    padding-bottom: 4px;
    padding-left: 10px;
    padding-right: 10px;
    background: #f4f3ed;
  }

  #header .lang_btn {
    position: absolute;
    top: 8px;
    right: 10px;
    float: none;
    margin: 0;
    text-align: right;
    z-index: 5;
  }

  #header .lang_btn img {
    width: min(96px, 28vw);
    height: auto;
  }

  #header .pagetitle {
    padding-left: 0;
    margin: 0 104px 8px 0;
    text-align: left;
    min-height: 52px;
  }

  #header .pagetitle img {
    width: auto;
    max-width: 100%;
    height: auto;
  }

  #header .logo {
    position: absolute;
    top: 64px;
    left: 8px;
    margin: 0;
    z-index: 3;
  }

  #header .logo img {
    width: 164px;
    width: var(--mobile-logo-width);
    height: auto;
  }

  #navi {
    padding-left: calc(var(--mobile-logo-width) + 12px);
    padding-top: 0;
    min-height: 0;
    margin-bottom: 0;
  }

  #navi ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
    max-width: none;
  }

  #navi ul li {
    flex: none;
    width: calc(100% / 3);
    max-width: none;
  }

  /*
   * EN nav icons are shorter at the same rendered width.
   * Measured source sizes:
   *  JA: avg width 116.333, height 55  -> ratio 0.472779
   *  EN: avg width 139.600, height 55  -> ratio 0.393983
   * Difference = 0.0787966 per icon width.
   * With 3 columns, equivalent EN li padding is 1.313% top + 1.313% bottom (of nav width).
   */
  html[lang="en"] #navi ul li {
    padding-top: 1.313%;
    padding-bottom: 1.313%;
    box-sizing: border-box;
  }

  #navi ul li img {
    width: 100%;
    height: auto;
  }

  /* Add left separator for the first icon in the 2nd row (4th item). */
  #navi ul li:nth-child(3n + 4) {
    position: relative;
  }

  #navi ul li:nth-child(3n + 4):before {
    content: "";
    position: absolute;
    left: 0;
    top: 1px;
    bottom: 1px;
    width: 1px;
    background: #ddd9cc;
    opacity: 0.92;
    pointer-events: none;
  }

  #top #imageWrap,
  #top #topimage {
    background: #f4f3ed;
  }
  #top #imageWrap { margin-top: -12px; }  /* -2 ～ -6px で調整 */

  #top #main_textbox .intro-text {
    max-height: calc(1.8em * 5);
    overflow: hidden;
    position: relative;
  }

  #top #main_textbox .intro-text:after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.4em;
    background: linear-gradient(to bottom, rgba(244, 243, 237, 0), rgba(244, 243, 237, 1));
    pointer-events: none;
  }

  #top #main_textbox .intro-text.is-expanded {
    max-height: none;
  }

  #top #main_textbox .intro-text.is-expanded:after {
    display: none;
  }

  #top #main_textbox .intro-more-wrap {
    display: block;
    text-align: right;
    margin: 8px 0 0;
  }

  #top #main_textbox .intro-more-btn {
    display: inline-block;
    border: 1px solid #8f9072;
    background: #f5f5f0;
    color: #403000;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
  }

  #footer .wrapper {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr) clamp(108px, 24vw, 128px);
    column-gap: 10px;
    row-gap: 12px;
    align-items: start;
  }

  #footer .fnavi01 {
    grid-column: 1;
    grid-row: 1;
    width: 76px;
    margin: 0;
  }

  #footer .fnavi01 img {
    display: block;
    width: 76px;
    max-width: 76px;
    height: auto;
  }

  #footer .fnavi02 {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    margin: 0;
  }

  #footer .fnavi02 p {
    margin: 0;
  }

  #footer .fnavi04 {
    grid-column: 3;
    grid-row: 1;
    width: 100%;
    margin: 0;
  }

  #footer .fnavi04Wrap {
    width: 100%;
  }

  #footer .fnavi04 li a {
    white-space: nowrap;
  }

  #footer .fnavi03 {
    grid-column: 1 / 4;
    grid-row: 2;
    width: 100%;
  }

  #member .former-members-toggle {
    padding-left: 34px;
  }

  #pankuzu {
    display: none;
  }

  body#member #main .wrapper #side .bnrbox,
  body#recruitment #main .wrapper #side .bnrbox,
  body#publication #main .wrapper #side .bnrbox {
    display: none;
  }
}

@media screen and (max-width: 640px) {
  body {
    font-size: 14px;
  }
}
