@charset "UTF-8";

/* ============================================================
   common.css（英語版）— 全ページ共通レイアウト・コンポーネント
   1. レイアウト
   2. ヘッダー（PC / SP）
   3. SP メニュー
   4. フッター
   5. アイコン
   6. セクション見出し
   7. ボタン
   8. タグ
   9. プロジェクトカード
   10. ニュースカード
   11. 論文カード
   12. カードグリッド
   13. スクロールフェードイン
   ============================================================ */

/* ============================================================
   1. レイアウト
   ============================================================ */
.l-container {
  width: 100%;
  max-width: calc(var(--content-max) + var(--side) * 2);
  margin-inline: auto;
  padding-inline: var(--side);
}

/* SP メニュー展開中は背面スクロールを止める */
body.is-menu-open {
  overflow: hidden;
}

/* ============================================================
   2. ヘッダー
   ============================================================ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--gap-s) var(--side-s);
  pointer-events: none;

  > * {
    pointer-events: auto;
  }

  @media (max-width: 840px) {
    padding: var(--gap-s);
  }
}

/* ロゴ: 背景が暗い領域（.js-header-dark）に重なっている間は白抜きに切り替え（common.js が .is-dark を付与） */
.site-header-logo {
  position: relative;
  display: block;

  img {
    transition: opacity 0.3s;
  }

  .site-header-logo-w {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
  }

  .site-header.is-dark & {
    img:first-child {
      opacity: 0;
    }

    .site-header-logo-w {
      opacity: 1;
    }
  }
}

.site-header-logo img {
  width: 169px;
  height: auto;

  @media (max-width: 840px) {
    width: 110px;
  }
}

/* PC ナビ（白いピル） */
.gnav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 16px 24px;
  background: var(--neutral-0);
  border-radius: var(--radius);
  filter: drop-shadow(0 0 5.5px var(--neutral-200));

  @media (max-width: 840px) {
    display: none;
  }
}

.gnav-list {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: var(--text-p-s);
  line-height: 1.4;

  a {
    position: relative;
    display: block;
    padding-block: 4px;
    transition: color 0.2s;

    &::after {
      content: "";
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      height: 1px;
      background: currentColor;
      transform: scaleX(0);
      transform-origin: right;
      transition: transform 0.3s var(--ease-out-expo);
    }

    @media (hover: hover) {
      &:hover {
        color: var(--blue-500);

        &::after {
          transform: scaleX(1);
          transform-origin: left;
        }
      }
    }
  }
}

/* 言語切替ボタン（ヘッダー / SP メニュー / フッター共通） */
.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-ss);
  padding: 10px 18px;
  font-size: var(--text-p-s);
  line-height: 1.4;
  color: var(--neutral-0);
  background: var(--blue-600);
  border-radius: 4px;
  transition: background-color 0.2s;

  .icn {
    width: 10px;
    height: 10px;
  }

  @media (hover: hover) {
    &:hover {
      background: var(--blue-400);
    }
  }
}

.lang-btn--dark {
  background: var(--blue-500);
}

/* SP メニューボタン */
.menu-btn {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--blue-500);
  border-radius: 4px;

  span {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 1px;
    background: var(--neutral-0);

    &:nth-child(1) {
      top: 14px;
    }

    &:nth-child(2) {
      top: 20px;
    }

    &:nth-child(3) {
      top: 26px;
    }
  }

  @media (max-width: 840px) {
    display: block;
  }
}

/* ============================================================
   3. SP メニュー
   開く  : 背面をぼかす → パネルがメニューボタンの位置から広がる
           → リンクが右から順に出る → ヘッダー・コピーライトがフェードイン
   閉じる: リンクが下から順に消える → パネルがメニューボタンの位置へ縮む
   ============================================================ */
.sp-menu {
  /* パネルが広がり始める位置 = .menu-btn（ヘッダーの padding − .sp-menu の padding） */
  --menu-origin: calc(var(--gap-s) - 8px);
  --menu-origin-size: 40px;

  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  padding: 8px;
  visibility: hidden;
  pointer-events: none;
  transition: visibility 0s linear 0.5s;

  /* 背面のぼかし */
  &::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgb(0 0 0 / 20%);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.645, 0.045, 0.355, 1);
  }

  &.is-open {
    visibility: visible;
    pointer-events: auto;
    transition: none;

    &::before {
      opacity: 1;
      transition: opacity 1s var(--ease-out-expo);
    }
  }
}

.sp-menu-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  background: linear-gradient(to bottom, var(--blue-1000), var(--blue-900));
  border-radius: 12px;
  /* 閉じた状態 = メニューボタンと同じ位置・大きさ・角丸 */
  clip-path: inset(
    var(--menu-origin) var(--menu-origin) calc(100% - var(--menu-origin) - var(--menu-origin-size))
      calc(100% - var(--menu-origin) - var(--menu-origin-size)) round 4px
  );
  transition: clip-path 0.4s var(--ease-out-expo) 0.1s;

  .sp-menu.is-open & {
    clip-path: inset(0 round 12px);
    transition: clip-path 0.4s var(--ease-out-expo);
  }
}

.sp-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;

  img {
    width: 110px;
    height: auto;
  }
}

.menu-close {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--neutral-0);
  border-radius: 4px;

  &::before,
  &::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 1px;
    background: var(--blue-500);
  }

  &::before {
    transform: translate(-50%, -50%) rotate(30deg);
  }

  &::after {
    transform: translate(-50%, -50%) rotate(-30deg);
  }
}

.sp-menu-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 32px;
  padding: var(--tb-s) var(--side);
  overflow-y: auto;
}

.sp-menu-nav ul {
  display: flex;
  flex-direction: column;
  gap: var(--gap-m);
  font-size: var(--title-m);
  font-weight: 500;
  line-height: 1.2;
  color: var(--neutral-200);
}

.sp-menu-copy {
  padding: 8px;
  font-size: var(--text-p-xs);
  line-height: 1.4;
  color: var(--neutral-600);
  text-align: center;
}

/* リンク: 右から順に出る（開く: 上から 0.02s ずつ / 閉じる: 下から 0.01s ずつ） */
.sp-menu-nav li,
.sp-menu-body > .lang-btn {
  opacity: 0;
  translate: 15px 0;
  transition:
    opacity 0.3s var(--ease-out-expo),
    translate 0.3s var(--ease-out-expo);

  .sp-menu.is-open & {
    opacity: 1;
    translate: 0 0;
    transition-duration: 0.6s;
  }
}

.sp-menu-nav li:nth-child(1) {
  transition-delay: 0.04s;
}

.sp-menu-nav li:nth-child(2) {
  transition-delay: 0.03s;
}

.sp-menu-nav li:nth-child(3) {
  transition-delay: 0.02s;
}

.sp-menu-nav li:nth-child(4) {
  transition-delay: 0.01s;
}

.sp-menu.is-open {
  .sp-menu-nav li:nth-child(1) {
    transition-delay: 0.05s;
  }

  .sp-menu-nav li:nth-child(2) {
    transition-delay: 0.07s;
  }

  .sp-menu-nav li:nth-child(3) {
    transition-delay: 0.09s;
  }

  .sp-menu-nav li:nth-child(4) {
    transition-delay: 0.11s;
  }

  .sp-menu-body > .lang-btn {
    transition-delay: 0.13s;
  }
}

/* ヘッダー（ロゴ・閉じるボタン）・コピーライト: パネルが広がってからフェードイン */
.sp-menu-head,
.sp-menu-copy {
  opacity: 0;
  transition: opacity 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);

  .sp-menu.is-open & {
    opacity: 1;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
  }
}

/* ============================================================
   4. フッター
   ============================================================ */
.site-footer {
  padding: var(--tb-l) var(--side) 32px;
  color: var(--neutral-200);
  background: linear-gradient(to bottom, var(--blue-1000), var(--blue-900));
}

.site-footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 40px;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-bottom: 48px;
  border-bottom: 1px solid rgb(255 255 255 / 0.3);

  @media (max-width: 840px) {
    flex-direction: column;
    padding-bottom: 32px;
  }
}

.site-footer-info {
  display: flex;
  flex-direction: column;
  gap: var(--gap-m);
}

.site-footer-logo img {
  width: 169px;
  height: auto;
}

.site-footer-address {
  font-size: var(--text-p-s);
  font-style: normal;
  line-height: 1.4;
}

.site-footer-links {
  display: flex;
  align-items: flex-start;
  gap: 32px;

  @media (max-width: 840px) {
    flex-direction: column;
  }
}

.footer-nav ul {
  display: flex;
  flex-direction: column;
  gap: var(--gap-s);
  font-size: var(--text-p);
  line-height: 1.5;

  a {
    transition: color 0.2s;

    @media (hover: hover) {
      &:hover {
        color: var(--neutral-0);
        text-decoration: underline;
        text-underline-offset: 4px;
      }
    }
  }
}

.site-footer-copy {
  padding-top: 48px;
  font-size: var(--text-p-xs);
  line-height: 1.4;
  color: var(--neutral-0);
  text-align: center;

  @media (max-width: 840px) {
    padding-top: 32px;
  }
}

/* ============================================================
   5. アイコン（mask で currentColor 着色）
   ============================================================ */
.icn {
  display: inline-block;
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  background-color: currentColor;
  mask: var(--icn) center / contain no-repeat;
}

.icn-arrow {
  --icn: url("/en/common/images/icn_arrow.svg");
}

/* ↖（BACK TO LIST） */
.icn-arrow-back {
  --icn: url("/en/common/images/icn_arrow.svg");
  transform: rotate(-90deg);
}

/* 24px 枠の中に 14×12 の絵柄（Figma の download コンポーネントと同じ構成） */
.icn-download {
  --icn: url("/en/common/images/icn_download.svg");
  width: 24px;
  height: 24px;
}

/* ============================================================
   6. セクション見出し
   ============================================================ */
.section-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--gap-ss);
  text-align: center;
}

.section-head-label {
  font-size: var(--title-s);
  font-weight: 600;
  line-height: 1.3;
  color: var(--blue-600);
}

.section-head-title {
  font-size: var(--title-xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--blue-1000);
}

/* ============================================================
   7. ボタン
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 204px; /* Figma: 200px の外側に 2px の枠線 */
  padding: 16px;
  font-size: var(--text-p-xs);
  font-weight: 600;
  line-height: 1;
  color: var(--blue-600);
  background: var(--neutral-150);
  border: 2px solid var(--neutral-200);
  border-radius: 3px;
  transition:
    color 0.2s,
    background-color 0.2s,
    border-color 0.2s;

  @media (hover: hover) {
    &:hover {
      color: var(--neutral-0);
      background: var(--blue-500);
      border-color: var(--blue-600);
    }
  }
}

/* ボタンを中央に置くラッパー */
.btn-wrap {
  display: flex;
  justify-content: center;
}

/* ============================================================
   8. タグ
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  padding: 4px 8px;
  font-size: var(--text-tag);
  line-height: 1;
  color: var(--blue-600);
  background: var(--blue-100);
  border-radius: var(--radius);
}

/* ============================================================
   9. プロジェクトカード
   ============================================================ */
.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--neutral-0);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card-l);
  transition: background-color 0.2s;

  @media (hover: hover) {
    &[href]:hover {
      background: var(--neutral-200);
    }
  }
}

/* 日本語版のサムネイルと同じく画角固定（3:2）。Figma の PC 280px / SP 200px 高さとほぼ一致する
   画像なし → img を省略すると thumb_default_en.jpg を表示（日本語版と同じ仕組み） */
.project-card-img {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background-image: url("/en/common/images/thumb_default_en.jpg");
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);

  img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

.project-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap-m);
  padding: var(--side-s);
}

.project-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap-s);
}

.project-card-title {
  font-size: var(--title-s);
  font-weight: 600;
  line-height: 1.3;
}

.project-card-desc {
  font-size: var(--text-p-s);
  line-height: 1.4;
}

.project-card-more {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--gap-ss);
  padding-top: var(--gap-m);
  font-size: var(--text-p-xs);
  font-weight: 600;
  line-height: 1.4;
  color: var(--blue-600);
  border-top: 1px solid var(--neutral-400);

  .icn {
    width: 10px;
    height: 10px;
  }

  @media (max-width: 840px) {
    justify-content: center;
  }
}

/* ============================================================
   10. ニュースカード
   ============================================================ */
.news-card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-s);
  height: 100%;
  /* Figma のボーダーは内側描画（余白に含まない）ため、ボーダー幅を差し引く */
  padding: calc(var(--side-s) - 2px);
  background: var(--neutral-0);
  border: 2px solid var(--neutral-0);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s;

  @media (hover: hover) {
    &[href]:hover {
      border-color: var(--blue-500);
    }
  }
}

.news-card-title {
  font-size: var(--title-s);
  font-weight: 600;
  line-height: 1.3;
}

.news-card-date {
  font-size: var(--text-p-s);
  line-height: 1.4;
  color: var(--neutral-400);
}

/* ============================================================
   11. 論文カード
   カード全体が PDF へのリンク（a.pub-card）。「Open PDF」は見た目だけのボタン
   href を省略するとリンクなし（ホバーなし・ボタン非表示）
   ============================================================ */
.pub-card {
  display: flex;
  flex-direction: column;
  gap: var(--gap-s);
  height: 100%;
  padding: calc(var(--tb-s) - 2px) calc(var(--side-s) - 2px); /* ボーダー分を差し引く */
  background: var(--neutral-0);
  border: 2px solid var(--neutral-0);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s;

  @media (hover: hover) {
    &[href]:hover {
      border-color: var(--blue-500);

      .pub-card-pdf {
        background: var(--neutral-700);
      }
    }
  }

  &:not([href]) .pub-card-pdf {
    display: none;
  }
}

.pub-card-title {
  padding-bottom: var(--gap-s);
  font-size: var(--title-s);
  font-weight: 600;
  line-height: 1.3;
  border-bottom: 1px solid var(--neutral-200);
}

.pub-card-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--text-p-xs);
  line-height: 1.4;
  color: var(--neutral-800);
}

.pub-card-authors {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--neutral-200);
}

.pub-card-pdf {
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  gap: 8px;
  /* Figma: 上下 = 間隔-ss / 左 = side-s（PC 133×40・SP 125×36） */
  padding: var(--gap-ss) 21px var(--gap-ss) var(--side-s);
  font-size: var(--text-p-xs);
  line-height: 1;
  color: var(--neutral-0);
  background: var(--blue-500);
  border-radius: 24px;
  transition: background-color 0.2s;
}

/* ============================================================
   12. カードグリッド（3 カラム → SP 1 カラム）
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;

  @media (max-width: 840px) {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--gap-s);
  }
}

.card-grid--wide {
  gap: var(--gap-m);
}

/* ============================================================
   13. スクロールフェードイン
   .js-reveal が画面に入ると .is-visible が付く（common.js）。1 回のみ。
   --reveal-delay で個別に遅延を指定できる。
   カードのリストは li ではなく ul に付けて、まとめて表示する。
   ============================================================ */
.js .js-reveal {
  opacity: 0;
  filter: blur(14px);
  translate: 0 28px;
  transition:
    opacity var(--reveal-duration) var(--ease-out-expo),
    filter var(--reveal-duration) var(--ease-out-expo),
    translate var(--reveal-duration) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0s);

  &.is-visible {
    opacity: 1;
    filter: blur(0);
    translate: 0 0;
  }
}

/* サブコピーなど控えめな動き */
.js .js-reveal--sm {
  filter: blur(12px);
  translate: 0 22px;
}
