/* ============================================================
   TAOREIN i18n — Language Switcher, CJK Fonts, RTL Support
   Replaces Nuxt BaseLanguageSwitcher with hover-based version
   that preserves the original gradient-line animation language.
   ============================================================ */

/* --- Hide original Nuxt BaseLanguageSwitcher --- */
.baseLanguageSwitcher,
[class*="baseLanguageSwitcher"] {
  display: none !important;
}

/* ============================================================
   Language Switcher — matches original Oberig design language:
   gradient decorative lines, CalibriBold uppercase, fade+slide
   transitions. Trigger changed from click to hover.
   ============================================================ */

.taorein-lang {
  position: relative;
  z-index: 100;
  display: inline-block;
  text-align: center;
  min-width: 48px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

/* Fallback: if not inside header, use fixed positioning */
body > .taorein-lang {
  position: fixed;
  top: 28px;
  right: 40px;
}

@media (max-width: 1199px) {
  body > .taorein-lang { top: 34px; right: 34px; }
}

@media (max-width: 767px) {
  body > .taorein-lang { top: 14px; right: 14px; min-width: 42px; }
}

/* --- Current language label --- */
.taorein-lang__current {
  position: relative;
  z-index: 2;
  display: inline-block;
  font-family: CalibriBold, sans-serif;
  font-size: 14px;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  /* gradient text matching original */
  background: linear-gradient(135deg, #506a8c, #3a4a5c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: all 0.4s ease;
}

@media (max-width: 767px) {
  .taorein-lang__current { font-size: 13px; }
}

/* White mode (over dark backgrounds) */
.js-white .taorein-lang__current {
  background: none;
  -webkit-text-fill-color: #fff;
  color: #fff;
}

/* Fade up current label on hover — matches original .js-active behavior */
.taorein-lang:hover .taorein-lang__current,
.taorein-lang.js-open .taorein-lang__current {
  transform: translateY(-40px);
  opacity: 0;
}

/* --- Decorative lines (::before = horizontal, ::after = vertical) ---
   Exact replica of original BaseDropdown pseudo-elements */
.taorein-lang::before,
.taorein-lang::after {
  content: '';
  display: block;
  position: absolute;
  right: 0;
}

/* Horizontal gradient line — expands on hover */
.taorein-lang::before {
  top: 11px;
  width: 0;
  height: 1px;
  box-shadow: inset 0 0 8px #5d6672;
  background-image: linear-gradient(90deg, #506a8c 50%, #c95842);
  z-index: 3;
  transition: width 0.3s ease-out;
  will-change: width;
}

.taorein-lang:hover::before,
.taorein-lang.js-open::before {
  width: 100%;
}

/* Vertical gradient tick — shrinks on hover */
.taorein-lang::after {
  top: 7px;
  width: 1px;
  height: 9px;
  background-image: linear-gradient(90deg, #49546e 50%, #ba6946);
  transition: height 0.3s ease-out, transform 0.3s ease-out;
  will-change: height, transform;
}

.js-white .taorein-lang::after {
  background: #fff;
}

.taorein-lang:hover::after,
.taorein-lang.js-open::after {
  height: 0;
}

@media (max-width: 767px) {
  .taorein-lang::after { top: 7.5px; }
}

/* --- Dropdown panel --- */
.taorein-lang__dropdown {
  position: absolute;
  right: 0;
  top: calc(50% - 1px);
  min-width: 48px;
  padding: 10px 0;
  /* Hidden by default — same timing as original */
  opacity: 0;
  visibility: hidden;
  background-color: transparent;
  box-shadow: none;
  transition:
    box-shadow 0.4s ease-out,
    background-color 0.4s ease-out,
    opacity 0.4s ease-out,
    visibility 0s ease-out 0.4s;
}

/* Show on hover */
.taorein-lang:hover .taorein-lang__dropdown,
.taorein-lang.js-open .taorein-lang__dropdown {
  box-shadow: 0 4px 6px rgba(30, 75, 120, 0.2);
  background-color: #fff;
  opacity: 1;
  visibility: visible;
  transition:
    box-shadow 0.4s ease-out,
    background-color 0.4s ease-out,
    opacity 0.4s ease-out,
    visibility 0s ease-out 0s;
}

/* --- Language items inside dropdown --- */
.taorein-lang__item {
  display: block;
  width: 100%;
  padding: 3px 0;
  font-family: CalibriBold, sans-serif;
  font-size: 14px;
  line-height: 24px;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  /* gradient text */
  background: linear-gradient(135deg, #506a8c, #8b6d5c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: opacity 0.2s ease;
}

@media (max-width: 767px) {
  .taorein-lang__item { font-size: 13px; }
}

.taorein-lang__item:hover {
  background: linear-gradient(135deg, #3d5470, #c95842);
  -webkit-background-clip: text;
  background-clip: text;
}

.taorein-lang__item.is-active {
  opacity: 0.4;
  pointer-events: none;
}

/* --- Language group divider (subtle line between regions) --- */
.taorein-lang__divider {
  height: 1px;
  margin: 4px 8px;
  background: linear-gradient(90deg, transparent, #e2e8f0 50%, transparent);
}

/* ============================================================
   Language Detection Banner
   ============================================================ */

.taorein-lang-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 24px;
  background: linear-gradient(135deg, #f8fafc, #edf2f7);
  border-bottom: 1px solid #e2e8f0;
  font-family: CalibriBold, 'Noto Sans', sans-serif;
  font-size: 13px;
  color: #4a5568;
  opacity: 0;
  transform: translateY(-100%);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.taorein-lang-banner.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.taorein-lang-banner__switch {
  padding: 4px 14px;
  background: #506a8c;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: CalibriBold, sans-serif;
  font-size: 12px;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: background 0.2s;
}

.taorein-lang-banner__switch:hover {
  background: #3d5470;
}

.taorein-lang-banner__dismiss {
  padding: 4px 8px;
  background: none;
  border: none;
  color: #a0aec0;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* ============================================================
   Video Popup Overlay
   ============================================================ */

.taorein-video-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
  cursor: pointer;
}

.taorein-video-overlay.is-visible {
  background: rgba(0, 0, 0, 0.85);
}

.taorein-video-popup {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  cursor: default;
}

.taorein-video-popup video {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.taorein-video-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.taorein-video-close:hover {
  opacity: 1;
}

/* ============================================================
   CJK & Arabic Font Override (per-language)
   ============================================================ */

html[lang="ja"] body,
html[lang="ja"] .AppMenu__link-text {
  font-family: 'Noto Sans JP', Calibri, sans-serif;
}

html[lang="zh-Hans"] body,
html[lang="zh-Hans"] .AppMenu__link-text {
  font-family: 'Noto Sans SC', Calibri, sans-serif;
}

html[lang="zh-Hant"] body,
html[lang="zh-Hant"] .AppMenu__link-text {
  font-family: 'Noto Sans TC', Calibri, sans-serif;
}

html[lang="ko"] body,
html[lang="ko"] .AppMenu__link-text {
  font-family: 'Noto Sans KR', Calibri, sans-serif;
}

html[lang="ar"] body,
html[lang="ar"] .AppMenu__link-text {
  font-family: 'Noto Sans Arabic', Calibri, sans-serif;
}

/* ============================================================
   RTL Support (Arabic)
   ============================================================ */

[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .TheHeader__cart {
  right: auto;
  left: 22px;
}

/* Language switcher stays on the right even in RTL — it's a global UI element */

[dir="rtl"] .taorein-lang__dropdown {
  right: 0;
  left: auto;
}

[dir="rtl"] .taorein-lang::before,
[dir="rtl"] .taorein-lang::after {
  right: auto;
  left: 0;
}

[dir="rtl"] .AppMenu__link {
  letter-spacing: 0;
}

[dir="rtl"] p,
[dir="rtl"] .text-block,
[dir="rtl"] .SectionPhilosophy__text {
  text-align: right;
}

[dir="rtl"] .SectionMain__scrolldown {
  right: auto;
  left: -15px;
}

[dir="rtl"] .FixedCategories__inner {
  direction: rtl;
}
