/*
 * The language switcher, in the header and the footer.
 *
 * Built to the header's own measurements rather than to a generic dropdown.
 * Taken from tolinku-header.css, which is the scoped extract of app.min.css:
 *
 *   Sign in      16px / 700, line-height 1.5em, padding 14px 24px,
 *                border-radius 50px, 1px border  ->  54px tall
 *   Start free   16px / 700, Inter, padding 14px 24px, radius 50px
 *   the wrapper  display:flex; gap:24px; align-items:center
 *   dropdowns    #fff, box-shadow -2px 2px 70px -25px rgba(0,0,0,.3)
 *   mobile CTA   16px / 600, padding 17px 15px, border-radius 6px
 *
 * So the trigger is 54px tall, 16px/700, fully rounded, and takes its spacing
 * from the wrapper's gap instead of adding a margin of its own. The panel
 * borrows the shadow the site's other dropdowns use. The mobile copy follows
 * the mobile button instead, which is a 6px radius, not a pill.
 *
 * It is a ghost button on purpose: outline is Sign in and solid is Start free,
 * so a third bordered pill would read as a third call to action. Language is a
 * utility.
 *
 * Scoped under .tlk-lang with !important throughout, for the reason recorded
 * in functions.php: marketing pages load Bootstrap and Azzle, the blog and
 * support pages load Tailwind, and both own utility class names. Bootstrap's
 * .hidden{display:none!important} has already erased elements on this site.
 * Colours are literal because the custom properties here belong to Azzle on
 * one half of the site and to Tailwind's build on the other.
 */

.tlk-lang,
.tlk-lang *,
.tlk-lang *::before,
.tlk-lang *::after {
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  text-shadow: none !important;
  float: none !important;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
}

.tlk-lang {
  position: relative !important;
  display: inline-block !important;
  line-height: 1.5em !important;
}

.tlk-lang-root { position: relative !important; display: block !important; }

/* ------------------------------------------------------------- the trigger */

.tlk-lang-trigger::-webkit-details-marker { display: none !important; }
.tlk-lang-trigger::marker { content: '' !important; }

.tlk-lang-trigger {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  /* 14 + 24 + 14 + 2px of transparent border = 54px, the height of Sign in. */
  padding: 14px 18px !important;
  border: 1px solid transparent !important;
  border-radius: 50px !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.5em !important;
  color: rgba(0, 0, 0, 1) !important;
  background-color: transparent !important;
  cursor: pointer !important;
  list-style: none !important;
  white-space: nowrap !important;
  transition: all 0.4s ease-in-out !important;
  -webkit-tap-highlight-color: transparent !important;
}

.tlk-lang-trigger:hover { background-color: rgba(0, 0, 0, 0.055) !important; }

.tlk-lang-root[open] > .tlk-lang-trigger { background-color: rgba(0, 0, 0, 0.055) !important; }

.tlk-lang-trigger:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 1) !important;
  outline-offset: 2px !important;
}

.tlk-lang-icon { flex: 0 0 auto !important; opacity: 0.75 !important; }

/* The label is a language code (EN, ES, KO): Latin and upright in any script. */
.tlk-lang-current { font-variant-numeric: tabular-nums !important; }

.tlk-lang-chevron {
  flex: 0 0 auto !important;
  opacity: 0.5 !important;
  transition: transform 0.3s ease !important;
}

.tlk-lang-root[open] .tlk-lang-chevron { transform: rotate(180deg) !important; }

.tlk-lang-sr {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* --------------------------------------------------------------- the panel */

.tlk-lang-panel {
  position: absolute !important;
  z-index: 1001 !important; /* the site's own sub-menus sit at 500 */
  top: calc(100% + 0.5rem) !important;
  right: 0 !important;
  min-width: 15.5rem !important;
  max-height: min(60vh, 23rem) !important;
  overflow-y: auto !important;
  overscroll-behavior: contain !important;
  padding: 0.5rem !important;
  text-align: left !important;
  background-color: #ffffff !important;
  border-radius: 10px !important;
  /* The shadow the site's other dropdowns use, from app.min.css. */
  box-shadow: -2px 2px 70px -25px rgba(0, 0, 0, 0.3), 0 2px 10px -4px rgba(0, 0, 0, 0.12) !important;
}

/*
 * Nine languages overflow the panel, and the platform default scrollbar is a
 * wide grey trough that reads as a form control sitting inside the menu.
 */
.tlk-lang-panel { scrollbar-width: thin !important; scrollbar-color: rgba(0, 0, 0, 0.22) transparent !important; }
.tlk-lang-panel::-webkit-scrollbar { width: 6px !important; }
.tlk-lang-panel::-webkit-scrollbar-track { background: transparent !important; }
.tlk-lang-panel::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.18) !important;
  border-radius: 6px !important;
}
.tlk-lang-panel:hover::-webkit-scrollbar-thumb { background-color: rgba(0, 0, 0, 0.3) !important; }

.tlk-lang-list { list-style: none !important; }

.tlk-lang-item {
  display: flex !important;
  align-items: center !important;
  gap: 0.6rem !important;
  padding: 0.6rem 0.75rem !important;
  border-radius: 6px !important;
  color: rgba(0, 0, 0, 1) !important;
  text-decoration: none !important;
  transition: background-color 0.2s ease !important;
}

.tlk-lang-item:hover,
.tlk-lang-item:focus-visible {
  background-color: rgba(239, 234, 227, 1) !important; /* --light-color2 */
  color: rgba(0, 0, 0, 1) !important;
  text-decoration: none !important;
}

.tlk-lang-item:focus-visible { outline: 2px solid rgba(0, 0, 0, 1) !important; outline-offset: -2px !important; }
.tlk-lang-item.is-current { background-color: rgba(246, 246, 235, 1) !important; } /* --light-color5 */

.tlk-lang-names {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.tlk-lang-native {
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  color: rgba(0, 0, 0, 1) !important;
}

.tlk-lang-english {
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  color: rgba(65, 65, 65, 0.65) !important; /* --light-color4, softened */
}

.tlk-lang-flag {
  flex: 0 0 auto !important;
  width: 18px !important;
  height: 12px !important;
  border-radius: 2px !important;
  object-fit: cover !important;
}

.tlk-lang-tick { flex: 0 0 auto !important; color: rgba(0, 0, 0, 1) !important; opacity: 0.75 !important; }

/* ------------------------------------------------------------ in the header */

/*
 * No margin: .azzle-header-button-wraper is a flex row with gap:24px, so a
 * margin here would be a second gap on top of it.
 */
@media (max-width: 1199px) {
  /* The desktop button row is hidden below this width, and the mobile menu
     has its own copy, so showing both would be two switchers on one page. */
  .tlk-lang--header { display: none !important; }
}

/* The header turns dark on some templates. */
.azzle-header-section.section2 .tlk-lang-trigger,
.dark-mode-texts .tlk-lang-trigger {
  color: rgba(255, 255, 255, 1) !important;
}

.azzle-header-section.section2 .tlk-lang-trigger:hover,
.dark-mode-texts .tlk-lang-trigger:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

/* ------------------------------------- in the mobile menu, beside the button */

/*
 * It shares the drawer's bottom row with "Start free", on the left.
 *
 * It used to be a full-width block under the button, and tolinku-nav.css
 * records what that cost: the row is flex with wrap, so the switcher was the
 * item that wrapped onto a second line, and that line sat below the bottom of
 * a drawer that cannot scroll. Side by side there is no second line to fall
 * off, and the pair reads as one bar rather than two stacked calls to action.
 *
 * The code is two or five characters (EN, ES-MX), so it needs no width of its
 * own: it takes the icon, the code and the chevron, and the button takes the
 * rest of the row. 310px is the drawer's width, so the row has 280px of
 * content box: about 86px here against 194px for the button, which holds the
 * longest translation the site has.
 */

/* The mobile CTA is a 6px radius at 600 weight, not the desktop pill. */
.tlk-lang--mobile { display: inline-block !important; width: auto !important; flex: 0 0 auto !important; }
.tlk-lang--mobile .tlk-lang-root { display: block !important; }

/*
 * Stretched rather than given a height, so the two controls stay the same
 * height without this file knowing what the button's padding is. The button
 * is the taller of the two, so it sets the row and the trigger follows. A
 * hard-coded height here would be a second copy of a number app.min.css
 * already owns, and it would be wrong the first time that number changed.
 */
.azzle-mobile-menu-btn .tlk-lang--mobile { align-self: stretch !important; }
.azzle-mobile-menu-btn .tlk-lang--mobile .tlk-lang-root,
.azzle-mobile-menu-btn .tlk-lang--mobile .tlk-lang-trigger { height: 100% !important; }

.tlk-lang--mobile .tlk-lang-trigger {
  width: auto !important;
  justify-content: center !important;
  gap: 0.3rem !important;
  padding: 0 11px !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  border-radius: 6px !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
}

/*
 * It sits at the bottom of the drawer, so the list opens upward, and over the
 * menu rather than inside the row: in the flow it would grow the row and push
 * the menu it belongs under off the top. Pinned to the left edge of the
 * drawer's padding, because the trigger is the leftmost thing in the row and a
 * panel wider than it has only one direction to go.
 */
.tlk-lang--mobile .tlk-lang-panel {
  position: absolute !important;
  top: auto !important;
  bottom: calc(100% + 0.5rem) !important;
  left: 0 !important;
  right: auto !important;
  min-width: 13.5rem !important;
  max-height: min(50vh, 15rem) !important;
  border: 1px solid rgba(0, 0, 0, 0.1) !important;
  border-radius: 6px !important;
}

/* ------------------------------------------------------------ in the footer */

/*
 * The footer is cream, not dark: .azzle-footer-section is
 * background-color:var(--light-color2) on every template, and there is no
 * dark variant of it anywhere in the theme. An earlier version of this file
 * styled the footer copy white on the assumption that footers are dark, which
 * left the trigger as pale grey text on cream, legible only if you knew it was
 * there. It takes the same dark text as the header.
 *
 * .azzle-footer-bottom-text is text-align:center, so the inline-block centres
 * itself above the copyright line with no extra rule.
 */
.tlk-lang--footer { margin-bottom: 0.5rem !important; }

.tlk-lang--footer .tlk-lang-trigger {
  padding: 10px 14px !important;
  font-size: 15px !important;
  color: rgba(0, 0, 0, 1) !important;
}

.tlk-lang--footer .tlk-lang-trigger:hover,
.tlk-lang--footer .tlk-lang-root[open] > .tlk-lang-trigger {
  background-color: rgba(0, 0, 0, 0.06) !important;
}

/* It is the last thing on the page, so the list opens upward. */
.tlk-lang--footer .tlk-lang-panel {
  top: auto !important;
  bottom: calc(100% + 0.5rem) !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}

/* ------------------------------------------------------------- preferences */

@media (prefers-reduced-motion: reduce) {
  .tlk-lang-chevron,
  .tlk-lang-item,
  .tlk-lang-trigger { transition: none !important; }
}

/* ------------------------------------------------------------------ *
 * The dark header.
 *
 * A post whose hero artwork sits on sand, cream or tint inverts the
 * chrome: functions.php puts .tolinku-dark-chrome on <body> and the bar
 * turns black. The switcher kept its light styling and went on painting
 * rgba(0,0,0,1) text on it, so it was still there, still 105px wide and
 * still clickable, and completely invisible. Reported as "not shown".
 *
 * Nothing here changes the shape. Only the colours flip, so the pill
 * stays the same object it is on every other page.
 * ------------------------------------------------------------------ */

body.tolinku-dark-chrome .azzle-header-section:not(.sticky-menu) .tlk-lang--header .tlk-lang-trigger {
  color: rgba(255, 255, 255, 1) !important;
}

body.tolinku-dark-chrome .azzle-header-section:not(.sticky-menu) .tlk-lang--header .tlk-lang-trigger:hover,
body.tolinku-dark-chrome .azzle-header-section:not(.sticky-menu) .tlk-lang--header .tlk-lang-root[open] > .tlk-lang-trigger {
  background-color: rgba(255, 255, 255, 0.12) !important;
}

body.tolinku-dark-chrome .azzle-header-section:not(.sticky-menu) .tlk-lang--header .tlk-lang-trigger:focus-visible {
  outline-color: rgba(255, 255, 255, 0.65) !important;
}

/* The panel stays light. It opens over the page rather than over the bar,
   and a dark panel on a dark bar loses its edge entirely. */

/* ------------------------------------------------------------------ *
 * Optical spacing against Sign in.
 *
 * The wrapper gap is 24px and it is 24px on both sides of Sign in, so
 * on paper the row is even. It does not look even. Sign in and Start
 * free carry a visible border or fill to their edge, while the switcher
 * is bare text at rest and its 18px of padding exists only to give the
 * hover pill a shape. So the eye measures 24px on the right of Sign in
 * and 42px on its left, and the switcher drifts away from the pair.
 *
 * Trimming the padding to 14px and pulling 10px back closes the visible
 * gap to about 28px while leaving 14px between the hover pill and the
 * Sign in border, which is what stops it feeling cramped on hover.
 * ------------------------------------------------------------------ */

.tlk-lang--header { margin-right: -16px !important; }

/* Asymmetric on purpose. The left padding still separates the globe from the
   nav, but on the right the chevron is the last ink and does not need 14px
   behind it before the gap starts. */
.tlk-lang--header .tlk-lang-trigger {
  padding-left: 14px !important;
  padding-right: 12px !important;
}
