/* ======================================================
 * tab02-layout-tab.css
 * 【骨組み】全体レイアウト・グリッド
 * 【役割】全体コンテナの骨組みおよびタブ切り替えシステムの基礎制御
 * ====================================================== */

/* 💡【超重要】外部CSSの影響解除 */
html,
body,
main {
  overflow: visible !important;
}

/* --- 2. 基本レイアウト & コンテナ --- */
.tab-section {
  width: 100%;
  background: #fff;
  padding: 0 20px 60px;
  scroll-margin-top: 160px;
  overflow: visible !important;
  position: static !important;
}

.tab-inner {
  max-width: 1000px;
  margin: 0 auto;
  overflow: visible !important;
  display: block !important;
}

.menu-tab-container {
  max-width: 1000px;
  margin: 0 auto;
  color: var(--color-text-main);
  display: block !important;
  overflow: visible !important;
}

.menu-intro {
  text-align: center;
  margin-bottom: 40px;
}

.menu-intro-text {
  font-size: 16px;
  color: var(--color-text-sub);
  line-height: 1.8;
}

/* --- 3. タブナビゲーション構造 --- */
.tab-group {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0 0 20px; /* ★元の 40px から 20px に縮小して無駄な余白をカット */
  border-bottom: 2px solid var(--border-color-light);
  flex-wrap: wrap;

  position: -webkit-sticky !important;
  position: sticky !important;

  top: 165px;

  z-index: 9990 !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);

  transition: top 0.25s ease-out;
}

/* ヘッダー縮小時 */
.site-header:has(.header-top.hide) ~ main .tab-group,
.site-header:has(.header-top.hide) + .tab-section .tab-group,
body:has(.header-top.hide) .tab-group {
  top: 74px !important;
}

/* SPメニュー展開時 */
body.is-menu-open .tab-group {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

/* タブアイテム */
.tab-item {
  padding: 10px 20px; /* ★縦を15px→10px、横を25px→20pxに縮小し、タブの縦幅をスマートに */
  cursor: pointer;
  font-size: 14px;    /* ★元の 16px から 14px に変更し、視認性を保ちつつコンパクト化 */
  font-weight: 600;
  color: var(--color-text-sub);
  transition: all 0.25s ease;
  position: relative;
  text-align: center;
  background: transparent;
}

.tab-item:hover {
  color: var(--color-primary);
  background: var(--color-bg-light);
}

.tab-item.is-active {
  color: #ffffff !important;
  background: var(--color-primary) !important;
}

.tab-item.is-active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--color-accent);
}

/* ======================================================
   ★★★ 修正ポイント（ここが改善の核心）
   フェードアニメをCSSから完全排除
   → JSだけに統一して“カクつき防止”
====================================================== */

.tab-content {
  display: none;
  opacity: 0;
  transform: translateY(6px);
  will-change: opacity, transform;
}

.tab-content.is-show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* CSSアニメーション削除（重要）
   → JS fadeInと競合するため廃止 */
/*
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
*/

/* =====================================
   タブレット・スマホ
===================================== */
@media (max-width: 768px) {

  .tab-group,
  .site-header:has(.header-top.hide) ~ main .tab-group,
  .site-header:has(.header-top.hide) + .tab-section .tab-group,
  body:has(.header-top.hide) .tab-group {
    top: 61px !important;
  }

  .tab-section {
    scroll-margin-top: 80px;
  }
}