/* ============================================
   無限カルーセル コンポーネント
   中央100%表示 + 左右半分見切れレイアウト
   ============================================ */

.cw-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  margin: clamp(32px, 6vw, 64px) 0;
}

.cw-carousel__viewport {
  position: relative;
  overflow: hidden;
  width: 100%;
}

.cw-carousel__track {
  display: flex;
  flex-wrap: nowrap;
  transition: transform 0.4s ease-in-out;
  will-change: transform;
}

/* 各スライド: 中央が100%、左右がチラ見え */
.cw-carousel__slide {
  flex: 0 0 60%;
  max-width: 60%;
  box-sizing: border-box;
  padding: 0 clamp(8px, 2vw, 24px);
  position: relative;
}

.cw-carousel__slide-inner {
  position: relative;
  width: 100%;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* 中央スライドを強調 */
.cw-carousel__slide.is-center .cw-carousel__slide-inner {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.cw-carousel__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

.cw-carousel__image-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #f0f0f0;
}

.cw-carousel__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cw-carousel__caption {
  display: none;
}

.cw-carousel__title {
  display: none;
}

.cw-carousel__desc {
  display: none;
}

/* ナビゲーションボタン */
.cw-carousel__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.cw-carousel__nav:hover,
.cw-carousel__nav:focus {
  background: rgba(0, 0, 0, 0.7);
  transform: translateY(-50%) scale(1.1);
  outline: none;
}

.cw-carousel__nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.cw-carousel__nav--prev {
  left: clamp(8px, 2vw, 16px);
}

.cw-carousel__nav--next {
  right: clamp(8px, 2vw, 16px);
}

.cw-carousel__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 3vw, 20px);
  margin-top: clamp(16px, 4vw, 24px);
  flex-wrap: wrap;
}

.cw-carousel__play-toggle {
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.cw-carousel__play-toggle:hover,
.cw-carousel__play-toggle:focus {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.05);
  outline: none;
}

.cw-carousel__play-toggle:focus-visible {
  outline: 2px solid var(--wp--preset--color--brand-cta, #F4D03F);
  outline-offset: 3px;
}

.cw-carousel__play-toggle.is-paused {
  background: rgba(0, 0, 0, 0.4);
}

.cw-carousel__play-toggle-icon {
  font-size: 1.2rem;
  line-height: 1;
  pointer-events: none;
}

/* インジケーター: ドット表示 */
.cw-carousel__indicators {
  display: flex;
  gap: clamp(8px, 2vw, 12px);
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

.cw-carousel__indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background-color: rgba(107, 114, 128, 0.5); /* neutral-600相当 */
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
  font-size: 0;
  line-height: 1;
  opacity: 0.7;
}

.cw-carousel__indicator.is-active {
  background-color: var(--wp--preset--color--brand-cta, #F4D03F);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.25);
  opacity: 1;
}

.cw-carousel__indicator:focus-visible {
  outline: 2px solid var(--wp--preset--color--brand-primary, #1E50A2);
  outline-offset: 2px;
}

.cw-carousel__indicator:hover {
  transform: scale(1.1);
}

/* スライド数が2以下の場合はナビゲーションと制御を非表示 */
.cw-carousel--insufficient .cw-carousel__nav,
.cw-carousel--insufficient .cw-carousel__controls,
.cw-carousel--insufficient .cw-carousel__play-toggle,
.cw-carousel--insufficient .cw-carousel__indicators {
  display: none;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
  .cw-carousel__track {
    gap: clamp(12px, 4vw, 24px);
  }

  .cw-carousel__slide {
    flex: 0 0 64%;
    max-width: 64%;
    padding: 0 clamp(6px, 2vw, 16px);
  }

  .cw-carousel__nav {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }

  .cw-carousel__nav--prev {
    left: 4px;
  }

  .cw-carousel__nav--next {
    right: 4px;
  }

  .cw-carousel__play-toggle {
    width: 36px;
    height: 36px;
  }

  .cw-carousel__play-toggle-icon {
    font-size: 1rem;
  }
}

@media (min-width: 1200px) {
  .cw-carousel__slide {
    flex: 0 0 55%;
    max-width: 55%;
  }
}

/* アクセシビリティ: 動きを減らす設定 */
@media (prefers-reduced-motion: reduce) {
  .cw-carousel__track {
    transition: none !important;
  }

  .cw-carousel__slide-inner {
    transition: none !important;
  }
}

/* スクリーンリーダー用 */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
