/* ヒーロー動画を左上に配置 */
.hero-video {
  position: absolute;
  top: 0;
  left: 0;
}

/* ヒーロー全体の高さを確保 */
.hero {
  height: 900px;
}

/* 5枚のpng画像をフェードイン・フェードアウトするアニメーション */
@keyframes fadeSlideshow {
  0%, 20%, 100% {
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
}

.fade-slideshow {
  animation: fadeSlideshow 25s infinite linear;
}

/* 各画像に開始タイミングをずらす（5秒ごと） */
.animation-delay-0  { animation-delay: 0s; }
.animation-delay-5  { animation-delay: 5s; }
.animation-delay-10 { animation-delay: 10s; }
.animation-delay-15 { animation-delay: 15s; }
.animation-delay-20 { animation-delay: 20s; }

/* 5枚のpng画像 基本のフェード＋スライドアニメーション */
@keyframes fadeSlide {
  0%, 20%, 100% {
    opacity: 0;
    transform: translate(0, 0) scale(1);
  }
  5% {
    opacity: 1;
    transform: translate(var(--move-x), var(--move-y)) scale(1.05);
  }
  10% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
}

/* スライドショー全体設定 */
.fade-slideshow {
  animation: fadeSlide 25s linear infinite;
  transition: opacity 1s ease, transform 1s ease;
}

/* 各画像の開始タイミング */
.animation-delay-0  { animation-delay: 0s; }
.animation-delay-5  { animation-delay: 5s; }
.animation-delay-10 { animation-delay: 10s; }
.animation-delay-15 { animation-delay: 15s; }
.animation-delay-20 { animation-delay: 20s; }

/* 各画像に少しずつ違う方向の動きを設定 */
.fade-slideshow:nth-child(1) { --move-x: -5px; --move-y: 0; }   /* 左へ */
.fade-slideshow:nth-child(2) { --move-x: 0; --move-y: -10px; }   /* 上へ */
.fade-slideshow:nth-child(3) { --move-x: 5px; --move-y: 0; }    /* 右へ */
.fade-slideshow:nth-child(4) { --move-x: 0; --move-y: 10px; }    /* 下へ */
.fade-slideshow:nth-child(5) { --move-x: -5px; --move-y: 8px; }  /* 左下へ */

/* キャッチコピーのフェードイン */
.fade-in {
  opacity: 0;
  animation: fadeInText 5s ease forwards;
}
@keyframes fadeInText {
  to { opacity: 1; }
}

/* 動画画像の透明度を変化させる opacity: 0.4 ←40％ */
.video-dim {
  opacity: 0.3;
  transition: opacity 0.8s ease;
}

/* グラデーションアニメーション文字 */
.gradation-text {
  background: linear-gradient(
    90deg,
    #0059ff,
    #00ffa3,
    #469500,
    #ff7f00,
    #ff0000,
    #0059ff
  );
  background-size: 400% 400%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: rainbowFlow 15s linear infinite;
}
@keyframes rainbowFlow {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ヒーローセクションロゴ出現 */
@keyframes logoAppear {
  0% {
    opacity: 0;
    transform: scale(0.6);
    filter: blur(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1.6);
    filter: blur(0);
  }
}
.animate-logoAppear {
  animation: logoAppear 3s ease forwards;
  animation-delay: 2s;
}

/* スライダー */
@keyframes slide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.animate-slide {
  animation: slide 30s linear infinite;
}

/* フェードアップ  右からでてくるようにした*/
.fade-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s ease, transform 1s ease;
}
.fade-up.show {
  opacity: 1;
  transform: translateY(0);
}

/* 事業紹介セクション */
.fadein {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.fadein.visible {
  opacity: 1;
  transform: translateY(0);
}

/* デフォルトはモバイル */
.pc-nav,
.pc-contact {
  display: none;
}
.sp-menu {
  display: block;
}

/* 1400px以上はPC表示 */
@media (min-width: 1400px) {
  .pc-nav,
  .pc-contact {
    display: block;
  }
  .sp-menu {
    display: none;
  }
}

/* フェードイン・アウト用 page top用ボタン効果*/
#back-to-top {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
#back-to-top.show {
  opacity: 1;
  transform: scale(1);
}

/* カードリンク（ホバーでふわっと浮く） */
.card-link {
  display: block;
  transition: all 0.3s ease;
}

.card-link:hover {
  opacity: 0.8;
  transform: translateY(-4px); /* 少し上に動く */
}

/* ページ遷移時にフェードイン（リンクジャンプ後） */
.section-fadein {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1s ease, transform 1s ease;
}

.section-fadein.active {
  opacity: 1;
  transform: translateY(0);
}


/* 初期状態：非表示＆縮小 */
#back-to-top {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.5s ease, transform 0.5s ease;
  filter: drop-shadow(4px 6px 8px rgba(0, 0, 0, 0.6)); /* 濃い影で浮遊感 */
   /* border-radius: 16px; は削除！ */  /* 角丸を強調（画像が透過なら特に有効） 左の一行入れると画像の角Rが消える可能性あり*/
}

/* 表示状態：不透明＆等倍 */
#back-to-top.show {
  opacity: 1;
  transform: scale(1);
}

/* -------------------------------------------------
   固定背景動画（事業紹介ページ用）
   常に画面全体に固定され、背景として表示
------------------------------------------------- */
.fixed-bg-video {
  position: fixed;
  inset: 0;
  z-index: -1;              /* 他の要素の裏に配置 */
  pointer-events: none;     /* 動画上をクリックできないように */
  overflow: hidden;         /* はみ出し防止 */
}

.fixed-bg-video video {
  object-fit: cover;
  opacity: 0.4;             /* 常に半調子 */
}

/* 固定ヘッダー対策（アンカー位置ずれ防止） 各ページに飛んだ時にヘッダーの64px分下げる役割*/
html {
  scroll-behavior: smooth; /* スムーズスクロール そのページの該当箇所にすべりこみ*/
}

[id] {
  scroll-margin-top: 115px; /* ヘッダー高さ+少し余裕 */
}

#recruit-float {
  opacity: 0;
  transform: translateY(-50%) translateX(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

#recruit-float.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ロールオーバー切替 */
#recruit-float img {
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.4s ease;
}

#recruit-float img:first-child { opacity: 1; }
#recruit-float:hover img:first-child { opacity: 0; }
#recruit-float:hover img:last-child { opacity: 1; }

/* トピックスモーダルのフェードイン */
@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.animate-fadeIn {
  animation: fadeIn 0.4s ease forwards;
}

/* モーダル内のスクロール防止（表示時） */
body.modal-open {
  overflow: hidden;
}

/* トピックホバー効果 */
.topic-item {
  display: block;
  color: #333;
  transition: color 0.3s;
}
.topic-item:hover {
  color: #f97316; /* オレンジ */
  text-decoration: underline;
}

/* 社会活動セクションモーダルフェードイン */
#image-modal {
  animation: fadeInModal 0.4s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

/* マウスオン時に出る画像のふわっと感 */
.group:hover img {
  transition: opacity 0.7s ease, transform 0.5s ease;
}

#sdgs img {
  object-fit: cover;
  height: 100%;
}

/* ==============================
   社会活動セクション 表示制御（1280pxベース）
   ============================== */

/* --- 1279px以下では常時表示にする（スマホ・タブレット） --- */
@media (max-width: 1279px) {
  .center-image {
    opacity: 1 !important;
    position: relative !important;
  }
}

/* --- 1280px以上ではhover時のみ表示（PC画面） --- */
@media (min-width: 1280px) {
  .center-image {
    opacity: 0;
    position: absolute;
    transition: opacity 0.7s ease-in-out;
  }

  .group:hover .center-image {
    opacity: 1;
  }
}

/* --- SDGs　部分　これで　表示解決 --- */
#sdgs .center-image {
  height: auto !important;
}


/* ==============================
   スタッフVoice セクション　1350pxで常時表示
   ============================== */
@media (max-width: 1350px) {
  .voice-text {
    opacity: 1 !important;
    transform: translateX(0) !important;
  }
}

/* --- 1000px以下ではカードを1列に --- */
@media (max-width: 1350px) {
  #voice .grid {
    grid-template-columns: 1fr !important;
  }
}

/* ==============================
   沿革セクション（タイムライン）
   ============================== */

/* --- 共通設定（PC用） --- */
.timeline-item {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.4s ease, font-size 0.4s ease;
}

.timeline-item:hover {
  transform: scale(1.2);
  z-index: 10;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #3b82f6;
  flex-shrink: 0;
}

/* --- 1199px以下：レイアウト調整（中央寄せ＆柔軟対応） --- */
@media (max-width: 1199px) {
  .timeline-item {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 20px auto;
    transform-origin: center;
    max-width: 90%;
  }

  .timeline-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 4px;
  }

  .timeline-item:hover {
    transform: scale(1.1);
  }
}

/* ✅ 沿革セクション 高さ自動化を1200px未満から適用 ここで、切り替わる時の項目が見切れる部分を修正*/
@media (max-width: 1200px) {
  #history .relative.w-full.h-\[600px\] {
    height: auto !important;
    padding-bottom: 3rem;
  }

  .timeline-item {
    position: static !important;
    display: block;
    text-align: center;
    margin: 5px 0;       /* ← 改行レベルの隙間をほぼゼロに */
    line-height: 1.05;   /* ← 極限まで詰める */
    transform: translateX(5%) !important; /* ← 右に5%ずらす */
  }

  .timeline-item span {
    display: block;
    font-size: 0.95rem;
  }

  .timeline-item span span {
    display: inline;       /* ← 「年」と項目を横並びにする */
    font-size: 0.85rem;
    margin-left: 3px;
    line-height: 1.1;
  }

   /* 背景グラデーションの高さも自動化（より滑らかに） */
  #history .timeline-bg {
    height: auto !important;
    min-height: 600px; /* ← 画面全体に収まるように少し小さめ 「背景が中途半端に切れる」可能性を減らす（見た目の余裕を持たせるため）*/
  }
}
/* ==============================
   代表挨拶セクション（サイン画像対応）
============================== */
#greeting {
  position: relative;
  overflow: hidden;
}

#greeting::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0) 40%, rgba(59,130,246,0.08) 100%);
  z-index: 0;
}

#greeting > div {
  position: relative;
  z-index: 1;
}

/* モバイル対応：中央寄せ */
@media (max-width: 1024px) {
  #greeting h2,
  #greeting p {
    text-align: left;
  }
  #greeting .flex.justify-end {
    justify-content: center;
  }
}

/* ==============================
   モーダル（社会活動用）表示・非表示の滑らかさ
============================== */
#image-modal {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
#image-modal.flex {
  display: flex;
  opacity: 1;
}

/* ==============================
   ホバーの滑らかさ
============================== */
.group:hover img {
  opacity: 1 !important;
  transform: scale(1.03);
}

/* ==============================
   .center-image の初期状態が明示されていない　opacity:0　不表示防止
============================== */
.center-image {
  opacity: 0;
  transition: opacity 0.7s ease-in-out, transform 0.5s ease;
}

/* ==============================
   フッター上部の余白を安定化させる
============================== */
footer {
  margin-top: 0 !important;
}

/* ==============================
   モバイルメニュー（ハンバーガー）制御
   ============================== */
#mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  width:40%;               /* メニュー幅 */
  height: 100vh;            /* 画面全体の高さ */
  background-color: #fff;
  transform: translateX(100%); /* ← 初期状態は右側に隠す */
  transition: transform 0.4s ease;
  z-index: 50;
}

/* 表示時 */
#mobile-menu.translate-x-0 {
  transform: translateX(0);
}

/* 非表示時 */
#mobile-menu.translate-x-full {
  transform: translateX(100%);
}

/* メニューの影（おしゃれ効果・任意） */
#mobile-menu {
  box-shadow: -4px 0 10px rgba(0, 0, 0, 0.15);
}

/* イラストギャラリーページヘッダーに隠れる問題「お仕事ご依頼の流れ」セクションのIDに適用 */
#flow {
  scroll-margin-top: 260px; /* ← この数値で余白を調整（ヘッダーの高さ分） */
}

/* ===== 10月26追加修正分 以下===== */
/* ===== 全ページ共通：モバイル右ズレ防止 ===== */
html, body {
  width: 100%;
  overflow-x: hidden;
}

/* ===== トピックスセクション幅をレスポンシブに ===== */
@media (max-width: 700px) {
  #topics .mx-auto {
    width: 90% !important;
    height: auto !important; /* モバイルでは高さ自動に */
  }
}

/* ===== 事業紹介カードのレイアウト調整 ===== */
#business .grid > div {
  width: 100% !important;
  max-width: 500px; /* すべてのカードに上限を設定 */
}

#business .grid {
  justify-content: center;
}

/* ===== ヒーローセクション 間隔調整（モバイル時） ===== */
@media (max-width: 768px) {
  .hero .absolute.top-\[270px\] {
    top: 260px !important; /* もとの270pxより狭める */
  }
  .hero-content h2 {
    margin-top: -160px; /* コピーを少し上に詰める */
  }
}

/* ===========================================
   トピックス レイアウト調整（モバイル対応）
=========================================== */

/* PCは今のままでOK */

/* モバイル時：日付とタイトルを縦並びに */
@media (max-width: 768px) {
  .topic-item {
    display: flex;
    flex-direction: column; /* 日付とタイトルを縦に */
    align-items: flex-start; /* 左寄せ */
    gap: 2px;
    line-height: 1.4;
    font-size: 1rem;
  }

  /* 日付部分だけグレーにしたい場合（任意） */
  .topic-item::first-line {
    color: #666;
    font-size: 0.9rem;
  }

  /* NEWアイコンをタイトルの右に */
  .topic-item img {
    display: inline-block;
    margin-left: 6px;
    vertical-align: middle;
  }
}