/* ===========================================
   スライダー改善版 - レスポンシブ・アスペクト比対応
   =========================================== */

/* スライダーセクション */
.slider-section {
  margin: 0 !important;
  padding: 0 !important;
  background-color: #ffffff !important;
}

.site-header + * {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.main-content {
  margin-top: 0 !important;
  background-color: #ffffff !important;
}

.slider-section + .main-content,
.cta-section + .main-content {
  padding-top: 40px;
}

/* メインスライダーコンテナ - アスペクト比対応版 */
.main-slider {
  position: relative;
  width: 100%;
  max-width: 100%;
  /* 高さをアスペクト比で自動計算 */
  aspect-ratio: 16 / 9; /* 画像の実際の比率に合わせて調整可能 */
  min-height: 400px; /* 最小高さを確保 */
  max-height: 600px; /* 最大高さを制限 */
  margin: 0 auto;
  overflow: hidden;
  background-color: #ffffff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
  user-select: none;
  -webkit-user-drag: none;
}

/* スライダー内部のラッパー */
.slider-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1000px;
  background-color: #ffffff !important;
}

/* 各スライド */
.slide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  max-width: 900px; /* 最大幅を少し増やす */
  height: 90%; /* 上下に少し余白を持たせる */
  opacity: 0;
  visibility: hidden;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* スライド内のリンク */
.slide-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  text-decoration: none;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
  user-select: none;
  -webkit-user-drag: none;
  background-color: #ffffff;
}

/* スライド画像 - contain使用で画像全体を表示 */
.slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  transition: all 0.3s ease;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  background: #ffffff;
}

/* スライドキャプション */
.slide-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: #ffffff;
  padding: 15px 20px;
  z-index: 10;
  min-height: 60px;
  display: flex;
  align-items: center;
  backdrop-filter: blur(10px); /* ぼかし効果を追加 */
}

.slide-caption p {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
  font-weight: 500;
}

/* アクティブなスライド（中央） */
.slide.active {
  opacity: 1;
  visibility: visible;
  z-index: 3;
  transform: translate(-50%, -50%) scale(1);
}

.slide.active .slide-link {
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* 前のスライド（左側） - 画面内に収まる位置 */
.slide.prev {
  opacity: 0.9;
  visibility: visible;
  z-index: 2;
  transform: translate(-108%, -50%) scale(0.85);
  filter: brightness(0.65) grayscale(0.2);
}

/* 次のスライド（右側） - 画面内に収まる位置 */
.slide.next {
  opacity: 0.9;
  visibility: visible;
  z-index: 2;
  transform: translate(8%, -50%) scale(0.85);
  filter: brightness(0.65) grayscale(0.2);
}

/* 左右のスライドにホバーしたとき */
.slide.prev:hover,
.slide.next:hover {
  filter: brightness(0.75) grayscale(0.1);
  cursor: pointer;
  transform-origin: center;
}

.slide.prev:hover {
  transform: translate(-108%, -50%) scale(0.87);
}

.slide.next:hover {
  transform: translate(8%, -50%) scale(0.87);
}

/* 左右のスライドはキャプションを非表示 */
.slide.prev .slide-caption,
.slide.next .slide-caption {
  opacity: 0;
}

/* ドットナビゲーション */
.dots {
  position: absolute;
  bottom: 80px;
  left: 0;
  right: 0;
  text-align: center;
  z-index: 11;
  padding: 8px 0;
  margin: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
}

.dots span {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  margin: 0 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dots span:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: scale(1.15);
  border-color: #ffffff;
}

.dots span.active {
  background: #0078ff;
  border-color: #0078ff;
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(0, 120, 255, 0.5);
}

/* ワイドスクリーン対応 */
@media (min-width: 1600px) {
  .main-slider {
    max-height: 700px;
  }
  
  .slide {
    max-width: 1100px;
  }
}

/* タブレット表示 */
@media (max-width: 1024px) {
  .main-slider {
    aspect-ratio: 16 / 10;
    min-height: 350px;
    max-height: 500px;
  }

  .slide {
    width: 70%;
    height: 85%;
  }

  .slide.prev {
    transform: translate(-104%, -50%) scale(0.8);
  }

  .slide.next {
    transform: translate(4%, -50%) scale(0.8);
  }

  .slide-caption {
    padding: 12px 15px;
    min-height: 55px;
  }

  .slide-caption p {
    font-size: 15px;
  }
  
  .dots {
    bottom: 75px;
  }
}

/* スマートフォン表示 */
@media (max-width: 768px) {
  .main-slider {
    aspect-ratio: 16 / 11;
    min-height: 300px;
    max-height: 450px;
  }

  .slide {
    width: 85%;
    height: 85%;
  }

  .slide.prev {
    transform: translate(-100%, -50%) scale(0.7);
    opacity: 0.8;
  }

  .slide.next {
    transform: translate(0%, -50%) scale(0.7);
    opacity: 0.8;
  }

  .dots {
    bottom: 70px;
  }

  .dots span {
    width: 10px;
    height: 10px;
    margin: 0 5px;
  }

  .slide-caption {
    padding: 10px 15px;
    min-height: 50px;
  }

  .slide-caption p {
    font-size: 14px;
    line-height: 1.4;
  }
}

/* 小型スマートフォン表示 */
@media (max-width: 480px) {
  .main-slider {
    aspect-ratio: 4 / 3;
    min-height: 280px;
    max-height: 380px;
  }

  .slide {
    width: 90%;
    height: 85%;
  }

  .slide.prev {
    transform: translate(-97%, -50%) scale(0.65);
    opacity: 0.75;
  }

  .slide.next {
    transform: translate(-3%, -50%) scale(0.65);
    opacity: 0.75;
  }

  .dots {
    bottom: 65px;
  }

  .dots span {
    width: 8px;
    height: 8px;
    margin: 0 4px;
  }

  .slider-nav {
    width: 35px;
    height: 35px;
  }

  .slider-nav span::before {
    width: 10px;
    height: 10px;
    border-width: 2px;
  }

  .slider-nav.prev {
    left: 5px;
  }

  .slider-nav.next {
    right: 5px;
  }

  .slide-caption {
    padding: 8px 12px;
    min-height: 45px;
  }

  .slide-caption p {
    font-size: 13px;
    line-height: 1.3;
  }
}

/* 極小スクリーン */
@media (max-width: 360px) {
  .main-slider {
    min-height: 250px;
  }
  
  .slide {
    width: 92%;
  }
  
  .slide.prev,
  .slide.next {
    display: none; /* 極小画面では左右のスライドを非表示 */
  }
}

/* 左右ナビゲーションボタン */
.slider-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(0, 120, 255, 0.85);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.slider-nav:hover {
  background: rgba(0, 120, 255, 1);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 120, 255, 0.4);
}

.slider-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.slider-nav.prev {
  left: 15px;
}

.slider-nav.next {
  right: 15px;
}

/* 矢印のスタイル */
.slider-nav span {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
}

.slider-nav span::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 12px;
  border-top: 3px solid #fff;
  border-right: 3px solid #fff;
  transform: translate(-50%, -50%) rotate(45deg);
}

.slider-nav.prev span::before {
  transform: translate(-30%, -50%) rotate(-135deg);
}

.slider-nav.next span::before {
  transform: translate(-70%, -50%) rotate(45deg);
}

/* ホバー時のエフェクト */
@media (hover: hover) {
  .slider-nav:hover span::before {
    border-color: #fff;
  }
}

/* 横スクロール防止 */
body {
  overflow-x: hidden;
  background-color: #ffffff !important;
}

.slider-section {
  overflow-x: hidden;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #ffffff !important;
}

/* アクセシビリティ向上 */
.slider-nav:focus {
  outline: 3px solid rgba(0, 120, 255, 0.5);
  outline-offset: 2px;
}

.dots span:focus {
  outline: 2px solid rgba(0, 120, 255, 0.5);
  outline-offset: 2px;
}

/* ダークモード対応（オプション） */
@media (prefers-color-scheme: dark) {
  .main-slider,
  .slider-section,
  .slider-wrapper {
    background-color: #1a1a1a !important;
  }
  
  .slide img {
    background: #1a1a1a;
  }
}