/* ===== トレーサビリティセクション：背景動画＋データライン演出 ===== */

/* セクション全体を背景動画に */
.trace-section {
  position: relative;
  padding: 100px 24px 80px;
  margin: 0;
  overflow: hidden;
  background: #1a2332; /* 動画読み込み前の保険（明るめに変更） */
  min-height: 720px; /* 最小高さを確保して動画全体を表示 */
}

/* 背景動画 */
.trace-bgVideo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  /* 明るさと彩度を大幅に強化（彩度をさらに1トーン強化） */
  filter: brightness(1.35) contrast(1.15) saturate(1.45);
  opacity: 1;
}

/* 文字の可読性を担保（薄い青〜紺のベール） - オーバーレイを軽減 */
.trace-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(900px 420px at 50% 20%, rgba(255, 255, 255, 0.04), rgba(0, 0, 0, 0) 60%),
    linear-gradient(180deg, rgba(7, 16, 32, 0.28), rgba(7, 16, 32, 0.42));
}

/* コンテンツは最前面 */
.trace-content {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
}

/* ヘッダー */
.trace-header {
  text-align: center;
  margin-bottom: 56px;
}

.trace-title {
  font-size: clamp(28px, 4.5vw, 46px);
  font-weight: 800;
  line-height: 1.3;
  color: #ffffff !important;
  margin: 0 0 16px;
  letter-spacing: 0.01em;
  text-shadow: 
    0 2px 16px rgba(0, 0, 0, 0.7),
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 1px 3px rgba(0, 0, 0, 0.8);
}

.trace-subtitle {
  font-size: clamp(15px, 2.2vw, 19px);
  line-height: 1.7;
  color: #ffffff !important;
  margin: 0;
  font-weight: 400;
  text-shadow: 
    0 1px 10px rgba(0, 0, 0, 0.6),
    0 2px 16px rgba(0, 0, 0, 0.4),
    0 1px 3px rgba(0, 0, 0, 0.7);
}

/* カードグリッド */
.trace-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

/* カード本体 */
.trace-card {
  backdrop-filter: blur(10px) saturate(120%);
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  padding: 32px 28px;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.14),
    0 2px 6px rgba(0, 0, 0, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.trace-card:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 12px 32px rgba(0, 0, 0, 0.20),
    0 4px 12px rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.96);
}

/* カードアイコン */
.trace-card-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(99, 102, 241, 0.12));
  color: #3B82F6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
  flex-shrink: 0;
}

.trace-card-icon--green {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(52, 211, 153, 0.12));
  color: #10B981;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.trace-card-icon--purple {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(167, 139, 250, 0.12));
  color: #8B5CF6;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

/* カードタイトル */
.trace-card-title {
  font-size: 19px;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1.4;
}

/* カード説明文 */
.trace-card-description {
  font-size: 14px;
  line-height: 1.7;
  color: #475569;
  margin: 0;
  font-weight: 400;
}

/* タブレット対応 */
@media (max-width: 900px) {
  .trace-section {
    padding: 80px 20px 64px;
    min-height: 600px;
  }

  .trace-header {
    margin-bottom: 44px;
  }

  .trace-title {
    font-size: clamp(24px, 5vw, 36px);
  }

  .trace-subtitle {
    font-size: clamp(14px, 2.5vw, 17px);
  }

  .trace-cards {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
  }

  .trace-card {
    padding: 28px 24px;
  }

  .trace-card-icon {
    width: 50px;
    height: 50px;
    font-size: 22px;
  }
}

/* モバイル対応 */
@media (max-width: 640px) {
  .trace-section {
    padding: 70px 16px 56px;
    min-height: 520px;
  }

  .trace-header {
    margin-bottom: 36px;
  }

  .trace-title {
    font-size: clamp(22px, 6vw, 30px);
    margin-bottom: 12px;
  }

  .trace-subtitle {
    font-size: clamp(13px, 3vw, 15px);
  }

  /* モバイルでは動画をさらに明るく（彩度もさらに強化） */
  .trace-bgVideo {
    filter: brightness(1.45) contrast(1.2) saturate(1.5);
  }
  
  /* モバイルでオーバーレイをさらに軽減 */
  .trace-overlay {
    background:
      radial-gradient(600px 320px at 50% 20%, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0) 60%),
      linear-gradient(180deg, rgba(7, 16, 32, 0.22), rgba(7, 16, 32, 0.36));
  }

  .trace-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .trace-card {
    padding: 24px 20px;
  }

  .trace-card-icon {
    width: 46px;
    height: 46px;
    font-size: 20px;
  }

  .trace-card-title {
    font-size: 17px;
  }

  .trace-card-description {
    font-size: 13px;
  }
}

/* アニメーション効果 */
@keyframes trace-fade-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.trace-card {
  animation: trace-fade-in 0.6s ease-out forwards;
  opacity: 0;
}

.trace-card:nth-child(1) {
  animation-delay: 0.1s;
}

.trace-card:nth-child(2) {
  animation-delay: 0.2s;
}

.trace-card:nth-child(3) {
  animation-delay: 0.3s;
}

.trace-card:nth-child(4) {
  animation-delay: 0.4s;
}

/* iOS Safari対応 */
@supports (-webkit-touch-callout: none) {
  .trace-bgVideo {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
  
  .trace-card {
    backdrop-filter: blur(6px) saturate(110%);
  }
}

/* 印刷時の最適化 */
@media print {
  .trace-section {
    background: #1e3a8a;
    padding: 40px 20px;
  }

  .trace-bgVideo,
  .trace-lines {
    display: none;
  }

  .trace-overlay {
    background: rgba(0, 0, 0, 0.2);
  }

  .trace-card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
    background: white;
  }
}

/* パフォーマンス最適化 */
.trace-bgVideo {
  will-change: opacity;
  transition: opacity 0.3s ease;
}

.trace-card {
  will-change: transform;
}
