/* ==========================================================================
   言語スイッチャー

   対象: ヘッダーとフッターの言語切替、言語別フォント補正
   関連HTML: header.php / footer.php / inc/i18n.php
   ブレークポイント: 1024px以下 → モバイルナビ内表示
   ========================================================================== */

/* Header Language Switcher */
.nav-lang {
  position: relative;
}

.lang-switch {
  position: relative;
  font-family: var(--font-english);
  color: var(--color-text-main);
}

.lang-switch__summary {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  cursor: pointer;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
  transition: opacity 0.3s ease;
}

.lang-switch__summary::-webkit-details-marker {
  display: none;
}

.lang-switch__summary::after {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.3s ease;
}

.lang-switch[open] .lang-switch__summary::after {
  transform: rotate(-135deg) translateY(-1px);
}

.lang-switch__summary:hover {
  opacity: 0.7;
}

.lang-switch__list {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  min-width: 9rem;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: #fff;
  border: 1px solid rgba(208, 191, 160, 0.8);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  z-index: 1002;
}

.lang-switch__link {
  display: block;
  padding: 0.55rem 0.7rem;
  font-family: var(--font-japanese);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
}

.lang-switch__link:hover {
  color: var(--color-primary);
  opacity: 1;
}

.lang-switch__link.is-current {
  color: var(--color-text-main);
  background: rgba(208, 191, 160, 0.2);
  pointer-events: none;
}

/* Footer Language Switcher */
.footer-lang {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  opacity: 0.6;
}

.footer-lang__link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.footer-lang__link:not(:last-child)::after {
  content: "|";
  margin-left: 0.35rem;
  opacity: 0.5;
}

.footer-lang__link:hover,
.footer-lang__link.is-current {
  opacity: 1;
}

.footer-lang__link.is-current {
  pointer-events: none;
}

/* Language Font Overrides */
html[lang="en-US"] {
  --font-japanese: "minion-pro-caption", "zen-old-mincho", serif;
}

html[lang="en-US"] .font-serif {
  font-family: "minion-pro-caption", "zen-old-mincho", serif;
}

html[lang="zh-TW"] {
  --font-japanese: "Noto Serif TC", "zen-old-mincho", serif;
}

html[lang="zh-TW"] .font-serif {
  font-family: "Noto Serif TC", "zen-old-mincho", serif;
}

html[lang="zh-CN"] {
  --font-japanese: "Noto Serif SC", "zen-old-mincho", serif;
}

html[lang="zh-CN"] .font-serif {
  font-family: "Noto Serif SC", "zen-old-mincho", serif;
}

html[lang="ko-KR"] {
  --font-japanese: "Noto Serif KR", "zen-old-mincho", serif;
}

html[lang="ko-KR"] .font-serif {
  font-family: "Noto Serif KR", "zen-old-mincho", serif;
}

/* koは実機確認で再調整する前提の字間補正。 */
html[lang="ko-KR"] .tracking-widest,
html[lang="ko-KR"] .tracking-\[0\.3em\] {
  letter-spacing: 0.05em;
}

@media (max-width: 1024px) {
  .nav-lang {
    width: 100%;
    text-align: center;
  }

  .lang-switch__summary {
    justify-content: center;
    font-size: 1rem;
  }

  .lang-switch__list {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    margin-top: 0.75rem;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .lang-switch__link {
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
  }

  .footer-lang {
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .footer-lang {
    justify-content: flex-start;
  }
}
