/* Shared locale switcher + LTR layout overrides for public card themes */

/* ---------- Floating locale switcher ---------- */

.tc-locale-switcher {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(123, 44, 191, 0.18);
  box-shadow:
    0 14px 34px rgba(31, 22, 51, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
}

html[dir='ltr'] .tc-locale-switcher {
  left: auto;
  right: max(14px, env(safe-area-inset-right));
}

.tc-locale-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 58px;
  padding: 7px 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: #7d7499;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.18s ease;
}

/* Desktop: equal inset so segments sit centered in the pill */
@media (min-width: 1025px) {
  .tc-locale-switcher {
    padding: 6px;
    gap: 6px;
  }

  .tc-locale-segment {
    margin: 0;
    padding: 10px;
    min-width: 56px;
  }
}

.tc-locale-segment:hover {
  color: #7b2cbf;
}

.tc-locale-segment.is-active {
  color: #fff;
  background: linear-gradient(145deg, #6a1fa8 0%, #7b2cbf 38%, #9d4edd 72%, #6366f1 100%);
  box-shadow: 0 8px 20px rgba(123, 44, 191, 0.32);
}

.tc-locale-segment:active {
  transform: scale(0.96);
}

.tc-locale-flag {
  display: inline-flex;
  width: 22px;
  height: 15px;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

.tc-locale-flag svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tc-locale-label {
  letter-spacing: 0.02em;
}

/* Crossfade while switching locale */
body.tc-locale-fading .page,
body.tc-locale-fading .content,
body.tc-locale-fading .avatar {
  opacity: 0.72;
  transition: opacity 0.2s ease;
}

/* ---------- English typography ---------- */

html[dir='ltr'] body.tc-locale-en,
html[dir='ltr'] body.tc-locale-en h1,
html[dir='ltr'] body.tc-locale-en h2,
html[dir='ltr'] body.tc-locale-en h3,
html[dir='ltr'] body.tc-locale-en h4,
html[dir='ltr'] body.tc-locale-en button,
html[dir='ltr'] body.tc-locale-en input,
html[dir='ltr'] body.tc-locale-en textarea {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif !important;
}

/* ---------- Classic themes LTR mirrors ---------- */

html[dir='ltr'] body.tc-theme-light-classic .title-block,
html[dir='ltr'] body.tc-theme-light-classic .title-block h2,
html[dir='ltr'] body.tc-theme-light-classic .page-title h2,
html[dir='ltr'] body.tc-theme-dark-classic .title-block,
html[dir='ltr'] body.tc-theme-dark-classic .title-block h2,
html[dir='ltr'] body.tc-theme-dark-classic .page-title h2,
html[dir='ltr'] body.tc-theme-light-modern .headline__title,
html[dir='ltr'] body.tc-theme-dark-modern .headline__title,
html[dir='ltr'] body.tc-theme-light-modern .h2__title,
html[dir='ltr'] body.tc-theme-dark-modern .h2__title {
  text-align: left;
}

html[dir='ltr'] body.tc-theme-light-classic .tc-home-lead,
html[dir='ltr'] body.tc-theme-light-classic .tc-prose,
html[dir='ltr'] body.tc-theme-light-classic .tc-item-body p,
html[dir='ltr'] body.tc-theme-dark-classic .tc-home-lead,
html[dir='ltr'] body.tc-theme-dark-classic .tc-prose,
html[dir='ltr'] body.tc-theme-dark-classic .tc-item-body p,
html[dir='ltr'] body.tc-theme-light-modern .tc-home-lead,
html[dir='ltr'] body.tc-theme-light-modern .tc-prose,
html[dir='ltr'] body.tc-theme-dark-modern .tc-home-lead,
html[dir='ltr'] body.tc-theme-dark-modern .tc-prose {
  text-align: justify;
}

html[dir='ltr'] body.tc-theme-light-classic .tc-home-nav-btn i.lnr-arrow-left,
html[dir='ltr'] body.tc-theme-dark-classic .tc-home-nav-btn i.lnr-arrow-left {
  transform: scaleX(-1);
}

html[dir='ltr'] body.tc-theme-light-classic .tc-contact-block h3::after,
html[dir='ltr'] body.tc-theme-dark-classic .tc-contact-block h3::after {
  right: auto;
  left: 0;
}

html[dir='ltr'] body.tc-theme-light-classic .tc-contact-list .value,
html[dir='ltr'] body.tc-theme-light-classic .tc-nav-cta,
html[dir='ltr'] body.tc-theme-dark-classic .tc-contact-list .value,
html[dir='ltr'] body.tc-theme-dark-classic .tc-nav-cta,
html[dir='ltr'] body.tc-theme-light-modern .tc-contact-list .value,
html[dir='ltr'] body.tc-theme-light-modern .tc-nav-cta,
html[dir='ltr'] body.tc-theme-dark-modern .tc-contact-list .value,
html[dir='ltr'] body.tc-theme-dark-modern .tc-nav-cta {
  text-align: right;
}

html[dir='ltr'] body.tc-theme-light-classic .tc-nav-open,
html[dir='ltr'] body.tc-theme-dark-classic .tc-nav-open,
html[dir='ltr'] body.tc-theme-light-modern .tc-nav-open,
html[dir='ltr'] body.tc-theme-dark-modern .tc-nav-open {
  text-align: left;
}

html[dir='ltr'] body.tc-theme-light-classic .tc-site-footer,
html[dir='ltr'] body.tc-theme-dark-classic .tc-site-footer {
  text-align: center;
}

/* ---------- simple theme LTR ---------- */

html[dir='ltr'] body.tc-locale-en .tc-page {
  direction: ltr;
  text-align: left;
}

html[dir='ltr'] body.tc-locale-en .tc-section-title,
html[dir='ltr'] body.tc-locale-en .tc-name,
html[dir='ltr'] body.tc-locale-en .tc-title,
html[dir='ltr'] body.tc-locale-en .tc-note {
  text-align: left;
}

html[dir='ltr'] body.tc-locale-en .tc-body,
html[dir='ltr'] body.tc-locale-en .tc-item p {
  text-align: justify;
}

html[dir='ltr'] body.tc-locale-en .tc-list li a,
html[dir='ltr'] body.tc-locale-en .tc-list li > div {
  flex-direction: row;
}

@media (max-width: 480px) {
  .tc-locale-switcher {
    top: auto;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  html[dir='ltr'] .tc-locale-switcher {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* Classic themes mobile: locale lives in bottom nav */
@media (max-width: 1024px) {
  body.tc-theme-light-classic .tc-locale-switcher,
  body.tc-theme-dark-classic .tc-locale-switcher {
    display: none !important;
  }
}

/* Dark floating switcher (desktop) */
body.tc-theme-dark-classic .tc-locale-switcher {
  background: rgba(26, 18, 38, 0.92);
  border-color: rgba(157, 78, 221, 0.28);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.tc-theme-dark-classic .tc-locale-segment {
  color: #a396b8;
}

body.tc-theme-dark-classic .tc-locale-segment:hover {
  color: #c77dff;
}

body.tc-theme-dark-modern .tc-locale-switcher {
  background: rgba(22, 22, 22, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

body.tc-theme-dark-modern .tc-locale-segment {
  color: #a1a1af;
}

body.tc-theme-dark-modern .tc-locale-segment:hover {
  color: #e9e9f1;
}
