/* /wp-content/themes/saitoworks-child/assets/css/pages/voices.css */
/* Voices Gallery - Tab + Grid Layout with Animation */

/* ===== Hero: Voices ===== */
.swx-hero.-voices{
  position:relative; min-height:clamp(220px,45vh,420px);
  overflow:clip; display:grid;
}
.swx-hero.-voices .hero-bg{ position:absolute; inset:0; }
.swx-hero.-voices .hero-bg img{
  width:100%; height:100%; display:block; object-fit:cover; object-position:center 35%;
}
.swx-hero.-voices .overlay{
  position:absolute; inset:0;
  background: linear-gradient(
    to bottom,
    color-mix(in oklab, #000 0%, transparent) 20%,
    color-mix(in oklab, #000 30%, transparent) 70%,
    color-mix(in oklab, #000 45%, transparent) 100%
  ); pointer-events:none;
}
.swx-hero.-voices .hero-inner{
  position:relative; z-index:1; align-self:end;
  width:min(1100px,90%); margin:0 auto clamp(18px,4vw,28px);
  color:#fff; text-shadow:0 2px 16px rgba(0,0,0,.35);
}
.swx-hero.-voices .hero-title{
  font-size:clamp(24px,4vw,40px); font-weight:800; color:#fff;
  letter-spacing:.02em; margin:0 0 .3em;
}
.swx-hero.-voices .hero-sub{ margin:0; font-size:clamp(14px,1.6vw,16px); opacity:.95; }

/* ===== Container ===== */
.swx-voices {
  width: 100%;
  max-width: 100vw;
  padding: clamp(24px, 4vw, 48px) clamp(16px, 3vw, 32px);
}

.swx-voices__container {
  display: grid;
  grid-template-columns: 30% 70%;
  gap: clamp(24px, 3vw, 40px);
  max-width: 1400px;
  margin: 0 auto;
}

/* ===== 左側：タブエリア ===== */
.swx-voices__tabs {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 1.5vw, 20px);
  align-items: stretch;
}

.swx-voices__tab {
  position: relative;
  width: 100%;
  padding: clamp(16px, 2vw, 24px) clamp(20px, 2.5vw, 32px);
  border: none;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--swx-c-brand) 15%, var(--swx-c-surface)),
    color-mix(in oklab, var(--swx-c-brand) 8%, var(--swx-c-surface))
  );
  color: var(--swx-c-text);
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transform: skewX(-12deg) translateX(0);
  transition: transform 0.3s ease-in-out, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.swx-voices__tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    color-mix(in oklab, var(--swx-c-brand) 25%, var(--swx-c-surface)),
    color-mix(in oklab, var(--swx-c-brand) 15%, var(--swx-c-surface))
  );
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 0;
}

.swx-voices__tab-text {
  position: relative;
  z-index: 1;
  display: block;
  transform: skewX(12deg);
}

.swx-voices__tab:hover {
  transform: skewX(-12deg) translateX(12px);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.15);
}

.swx-voices__tab:hover::before {
  opacity: 1;
}

.swx-voices__tab:focus-visible {
  outline: 2px solid var(--swx-c-brand);
  outline-offset: 3px;
}

/* アクティブタブ */
.swx-voices__tab.is-active {
  background: var(--swx-c-brand);
  color: #fff;
  box-shadow: 0 6px 24px rgba(12, 111, 249, 0.35);
  transform: skewX(-12deg) translateX(0);
}

.swx-voices__tab.is-active::before {
  opacity: 0;
}

.swx-voices__tab.is-active:hover {
  transform: skewX(-12deg) translateX(12px);
  box-shadow: 0 8px 28px rgba(12, 111, 249, 0.45);
}

/* ===== 右側：画像エリア ===== */
.swx-voices__gallery {
  position: relative;
  min-height: 400px;
}

.voices-gallery__loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.voices-gallery--loading .voices-gallery__loading {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.voices-gallery__spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(12, 111, 249, 0.2);
  border-top-color: var(--swx-c-brand);
  border-radius: 50%;
  animation: voices-spin 0.8s linear infinite;
}

@keyframes voices-spin {
  to { transform: rotate(360deg); }
}

.voices-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
}

/* グリッドブレイクパターン */
.voices-item:nth-child(3n+1) {
  grid-column: span 1;
}

.voices-item:nth-child(3n+2) {
  grid-column: span 1;
}

.voices-item:nth-child(3n+3) {
  grid-column: span 2;
}

.voices-item:nth-child(6n+4) {
  grid-column: span 1;
}

.voices-item:nth-child(6n+5) {
  grid-column: span 2;
}

.voices-item:nth-child(6n+6) {
  grid-column: span 1;
}

/* ===== 画像カード ===== */
.voices-item {
  position: relative;
  margin: 0;
  padding: 0;
  border-radius: var(--swx-radius);
  overflow: hidden;
  background: var(--swx-c-surface);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.1);
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px) scale(0.96);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
  aspect-ratio: 4 / 3;
}

.voices-item.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 表示アニメーションのディレイ */
.voices-item:nth-child(1) { transition-delay: 0.00s; }
.voices-item:nth-child(2) { transition-delay: 0.05s; }
.voices-item:nth-child(3) { transition-delay: 0.10s; }
.voices-item:nth-child(4) { transition-delay: 0.15s; }
.voices-item:nth-child(5) { transition-delay: 0.20s; }
.voices-item:nth-child(6) { transition-delay: 0.25s; }
.voices-item:nth-child(7) { transition-delay: 0.30s; }
.voices-item:nth-child(8) { transition-delay: 0.35s; }
.voices-item:nth-child(9) { transition-delay: 0.40s; }
.voices-item:nth-child(10) { transition-delay: 0.45s; }
.voices-item:nth-child(11) { transition-delay: 0.50s; }
.voices-item:nth-child(12) { transition-delay: 0.55s; }
.voices-item:nth-child(n+13) { transition-delay: 0.60s; }

.voices-item:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.voices-item:focus-visible {
  outline: 2px solid var(--swx-c-brand);
  outline-offset: 3px;
}

.voices-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  pointer-events: none;
}

.voices-item__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: clamp(12px, 1.5vw, 16px);
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8),
    rgba(0, 0, 0, 0.4),
    transparent
  );
  color: #fff;
  font-size: clamp(0.875rem, 1vw, 1rem);
  font-weight: 500;
  margin: 0;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.voices-item:hover .voices-item__caption {
  opacity: 1;
  transform: translateY(0);
}

/* ===== オーバーレイ（全画面拡大表示） ===== */
.swxv-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 40px);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
  animation: swxvFadeIn 0.25s ease;
}

.swxv-overlay.is-active {
  display: flex;
}

@keyframes swxvFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.swxv-overlay__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
}

.swxv-overlay__img {
  width: 100%;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.4);
}

.swxv-overlay__caption {
  margin-top: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  text-align: center;
  font-size: clamp(0.875rem, 1.2vw, 1rem);
  color: #333;
  font-weight: 500;
}

.swxv-overlay__close {
  position: absolute;
  top: -48px;
  right: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #333;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.swxv-overlay__close:hover {
  background: #fff;
  transform: scale(1.1);
}

/* ===== レスポンシブ（SP） ===== */
@media (max-width: 768px) {
  .swx-voices__container {
    grid-template-columns: 1fr;
    gap: clamp(20px, 4vw, 32px);
  }

  .swx-voices__tabs {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    gap: clamp(8px, 2vw, 12px);
    padding: 0 0 12px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--swx-c-brand) rgba(12, 111, 249, 0.2);
    -webkit-overflow-scrolling: touch;
    /* スクロール可能であることを示す */
    scroll-padding: 0;
    /* スクロールスナップ（オプション） */
    scroll-snap-type: x proximity;
  }

  .swx-voices__tabs::-webkit-scrollbar {
    height: 8px;
  }

  .swx-voices__tabs::-webkit-scrollbar-track {
    background: rgba(12, 111, 249, 0.1);
    border-radius: 4px;
  }

  .swx-voices__tabs::-webkit-scrollbar-thumb {
    background: var(--swx-c-brand);
    border-radius: 4px;
  }

  .swx-voices__tabs::-webkit-scrollbar-thumb:hover {
    background: color-mix(in oklab, var(--swx-c-brand) 80%, black);
  }

  .swx-voices__tab {
    flex-shrink: 0;
    /* 3つのタブを均等に配置（gap考慮） */
    width: calc((100% - (clamp(8px, 2vw, 12px) * 2)) / 3);
    min-width: 90px;
    max-width: 140px;
    padding: clamp(12px, 3vw, 16px) clamp(12px, 3vw, 16px);
    font-size: clamp(0.875rem, 2.5vw, 1rem);
    text-align: center;
    white-space: nowrap;
    scroll-snap-align: start;
    /* 確実に表示されるように */
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  .voices-gallery__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(12px, 2vw, 16px);
  }

  /* SP用グリッドブレイクパターン */
  .voices-item:nth-child(2n+1) {
    grid-column: span 1;
  }

  .voices-item:nth-child(2n+2) {
    grid-column: span 1;
  }

  .voices-item:nth-child(4n+3) {
    grid-column: span 2;
  }

  .swxv-overlay__close {
    top: -40px;
    width: 36px;
    height: 36px;
    font-size: 20px;
  }
}
