/* ============================================================
   Section 8 — 技能目錄（對話框形式）
   ============================================================ */

#skills {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  border-bottom: 1px solid var(--color-border-light);
}

/* --- Tag 篩選器 --- */
.skills-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-8);
}

.skills-filter__tag {
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: transparent;
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.skills-filter__tag:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.skills-filter__tag.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

/* --- 外層容器 --- */
.skills-list {
  /* JS 會在裡面放 .skills-grid */
}

/* --- 兩欄 Grid --- */
.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.skills-col {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* --- 每個教練的對話行 --- */
.skill-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background: #F8F8F5;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.skill-row--right {
  flex-direction: row-reverse;
}

/* --- 頭像欄 --- */
.skill-row__avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.skill-row__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  border: 2px solid var(--color-border-light);
  box-shadow: var(--shadow-sm);
}

.skill-row__name {
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-secondary);
  text-align: center;
  max-width: 60px;
}

/* --- 泡泡欄（橫向排列，塞滿換行，hug content） --- */
.skill-bubbles-col {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-start;
}

/* 右側教練：bubble 從右邊排起，first-child 靠近頭像 */
.skill-row--right .skill-bubbles-col {
  flex-direction: row-reverse;
}

/* --- 對話框 --- */
.skill-bubble {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-default);
  max-width: 440px;
}

.skill-bubble:hover {
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

/* 尾巴（左側，只有第一個泡泡） */
.skill-row:not(.skill-row--right) .skill-bubble:first-child::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 14px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-right: 8px solid var(--color-border);
}

.skill-row:not(.skill-row--right) .skill-bubble:first-child::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 15px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 7px solid var(--color-surface);
}

/* 尾巴（右側，只有第一個泡泡） */
.skill-row--right .skill-bubble:first-child::before {
  content: '';
  position: absolute;
  right: -8px;
  top: 14px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 8px solid var(--color-border);
}

.skill-row--right .skill-bubble:first-child::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 15px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 7px solid var(--color-surface);
}

/* --- 內文 --- */
.skill-bubble__text {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  line-height: var(--line-height-relaxed);
}

/* 篩選隱藏 */
.skill-row.is-hidden,
.skill-bubble.is-hidden {
  display: none;
}

/* ============================================================
   RWD
   ============================================================ */

@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .skill-row--right {
    flex-direction: row;
  }

  .skill-row--right .skill-bubbles-col {
    flex-direction: row;
  }

  .skill-row--right .skill-bubble:first-child::before,
  .skill-row--right .skill-bubble:first-child::after {
    display: none;
  }

  .skill-row:not(.skill-row--right) .skill-bubble:first-child::before,
  .skill-row:not(.skill-row--right) .skill-bubble:first-child::after {
    display: block;
  }
}
