/* ============================================================
   Costa Global Capital — footer language picker
   Drops up from the footer, dark glass pill, columned menu of
   native-name language buttons. Pairs with /assets/js/translate.js
============================================================ */
.cgc-lang-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-family: 'Inter', system-ui, sans-serif;
}

.cgc-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(245, 237, 224, 0.06);
  border: 1px solid rgba(245, 237, 224, 0.14);
  color: rgba(245, 237, 224, 0.78);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.cgc-lang-trigger:hover {
  background: rgba(245, 237, 224, 0.1);
  color: #F5EDE0;
  border-color: rgba(245, 237, 224, 0.25);
}
.cgc-lang-globe { font-size: 13px; line-height: 1; }
.cgc-lang-chev {
  font-size: 9px;
  opacity: 0.65;
  transition: transform 0.22s ease;
}
.cgc-lang-picker.open .cgc-lang-chev { transform: rotate(180deg); }

/* ─── Menu (drops UP since it's in the footer) ─── */
.cgc-lang-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  z-index: 12000;
  min-width: 540px;
  max-width: 92vw;
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, #14110D 0%, #0A0907 100%);
  border: 1px solid rgba(245, 237, 224, 0.14);
  box-shadow:
    0 32px 72px -20px rgba(0, 0, 0, 0.7),
    0 8px 24px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-height: 380px;
  overflow-y: auto;
}
.cgc-lang-picker.open .cgc-lang-menu,
.cgc-lang-menu.open { display: grid; }

.cgc-lang-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: rgba(245, 237, 224, 0.78);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: left;
  text-transform: none;
  transition: background 0.18s ease, color 0.18s ease;
}
.cgc-lang-item:hover {
  background: rgba(245, 237, 224, 0.08);
  color: #F5EDE0;
}
.cgc-lang-item:focus-visible {
  outline: 2px solid var(--mc-red, #C41E3A);
  outline-offset: -2px;
}
/* Active language (currently selected) — subtle accent + checkmark via ::after */
.cgc-lang-item.is-active {
  background: rgba(196,30,58,0.10);
  color: #F5EDE0;
  position: relative;
}
.cgc-lang-item.is-active::after {
  content: '✓';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--mc-red, #C41E3A);
  font-size: 12px;
  font-weight: 700;
}

/* ─── Floating fallback (only if no footer found on the page) ─── */
.cgc-lang-picker.cgc-lang-floating {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 8999;
}
.cgc-lang-picker.cgc-lang-floating .cgc-lang-trigger {
  background: rgba(14,17,13,0.92);
  border-color: rgba(245,237,224,0.18);
  color: #F5EDE0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px -10px rgba(0,0,0,0.55);
}

/* ─── Drag handle (mobile-only, hidden on desktop) ─── */
.cgc-lang-handle { display: none; }

/* Menu title — used to label the bottom sheet on mobile. */
.cgc-lang-menu-title {
  display: none;
}

/* ─── Mobile backdrop scrim (sibling element appended to <body>) ─── */
.cgc-lang-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
  z-index: 11998;
}
@media (max-width: 767px) {
  .cgc-lang-backdrop { display: block; }
  .cgc-lang-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ─── Mobile bottom-sheet pattern (<768px) ─── */
@media (max-width: 767px) {
  /* Menu becomes a fixed bottom sheet, full viewport width.
     Always rendered (display:flex) but translated off-screen until .open.
     This avoids display toggling that breaks transitions. */
  .cgc-lang-menu {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    min-width: 0;
    max-width: none;
    width: 100%;
    padding: 6px 0 max(20px, env(safe-area-inset-bottom)) 0;
    border-radius: 20px 20px 0 0;
    background: linear-gradient(180deg, #14110D 0%, #0A0907 100%);
    border-top: 1px solid rgba(245, 237, 224, 0.14);
    box-shadow: 0 -24px 60px -16px rgba(0,0,0,0.7);
    max-height: 70vh;
    max-height: 70dvh;            /* iOS dynamic viewport — avoids address-bar overlap */
    overflow-y: auto;             /* the sheet itself scrolls */
    -webkit-overflow-scrolling: touch;  /* momentum scroll on iOS */
    overscroll-behavior: contain; /* don't propagate scroll to the page behind */
    touch-action: pan-y;          /* explicit: allow vertical pan inside the sheet */
    display: flex !important;     /* always flex; visibility via transform */
    flex-direction: column;
    grid-template-columns: 1fr;   /* override desktop's 3-col grid */
    gap: 0;
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.22,0.61,0.36,1);
    z-index: 11999;
    pointer-events: auto;
  }
  .cgc-lang-picker.open .cgc-lang-menu,
  .cgc-lang-menu.open {
    transform: translateY(0);
  }

  /* Drag handle pill at the top of the sheet (visual affordance only) */
  .cgc-lang-handle {
    display: block;
    flex: 0 0 auto;
    width: 44px;
    height: 4px;
    margin: 8px auto 8px;
    border-radius: 999px;
    background: rgba(245,237,224,0.28);
  }

  /* Sheet title row */
  .cgc-lang-menu-title {
    display: block;
    flex: 0 0 auto;
    padding: 4px 20px 12px;
    color: rgba(245,237,224,0.55);
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(245,237,224,0.08);
    margin-bottom: 6px;
  }

  .cgc-lang-item {
    /* Full-width row, 48px+ touch target */
    width: 100%;
    min-height: 48px;
    padding: 14px 20px;
    font-size: 16px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    text-align: left;
  }
  .cgc-lang-item:last-child { border-bottom: 0; }
  .cgc-lang-item:active,
  .cgc-lang-item:hover {
    background: rgba(245,237,224,0.10);
    color: #F5EDE0;
  }
  .cgc-lang-item.is-active {
    background: rgba(196,30,58,0.10);
    color: #F5EDE0;
    position: relative;
  }
  .cgc-lang-item.is-active::after {
    content: '✓';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--mc-red, #C41E3A);
    font-size: 14px;
    font-weight: 700;
  }
}

/* Body scroll-lock when the sheet is open (mobile only).
   IMPORTANT: do NOT use `touch-action: none` here — it propagates to inner
   scroll containers and would block scrolling inside the sheet itself.
   `overflow: hidden` alone stops the page from scrolling behind. */
@media (max-width: 767px) {
  body.cgc-lang-open { overflow: hidden; }
}

/* ─── Translating... toast ─── */
.cgc-lang-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 13000;
  padding: 11px 22px;
  border-radius: 999px;
  background: rgba(14,17,13,0.94);
  color: #F5EDE0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  border: 1px solid rgba(245,237,224,0.16);
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.cgc-lang-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── Auto-detect banner (bottom-right, dismissable) ─── */
.cgc-lang-banner {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 13500;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  background: linear-gradient(180deg, #14110D 0%, #0A0907 100%);
  color: #F5EDE0;
  border: 1px solid rgba(245,237,224,0.16);
  border-radius: 14px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  box-shadow:
    0 24px 60px -16px rgba(0,0,0,0.6),
    0 6px 20px rgba(0,0,0,0.4);
  animation: cgcLangBannerIn 0.32s cubic-bezier(0.22,0.61,0.36,1);
}
@keyframes cgcLangBannerIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cgc-lang-banner-msg { flex: 1; color: rgba(245,237,224,0.85); }
.cgc-lang-banner-msg strong { color: #fff; font-weight: 700; }
.cgc-lang-banner-cta {
  padding: 8px 14px;
  border-radius: 999px;
  border: 0;
  background: #C41E3A;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.2s ease;
}
.cgc-lang-banner-cta:hover { background: #9B1530; transform: translateY(-1px); }
.cgc-lang-banner-close {
  background: transparent;
  border: 0;
  color: rgba(245,237,224,0.5);
  cursor: pointer;
  width: 26px;
  height: 26px;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  border-radius: 6px;
  flex-shrink: 0;
  transition: color 0.18s, background 0.18s;
}
.cgc-lang-banner-close:hover {
  color: #F5EDE0;
  background: rgba(245,237,224,0.08);
}

@media (max-width: 640px) {
  .cgc-lang-banner {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}

/* ─── Hide Google's default UI artefacts so only OUR picker shows ─── */
.goog-te-banner-frame,
.goog-te-banner-frame.skiptranslate,
iframe.goog-te-banner-frame,
iframe.skiptranslate,
.goog-te-gadget-icon,
#goog-gt-tt,
.goog-te-balloon-frame,
.goog-text-highlight,
.skiptranslate > iframe {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  width: 0 !important;
  position: absolute !important;
  top: -9999px !important;
}

/* Google sets body { top: 40px } via inline style to make room for the banner.
   Force it back to 0 via high-specificity rule + JS observer in translate.js. */
html body { top: 0 !important; position: static !important; }
html { margin-top: 0 !important; }

.goog-te-gadget { height: 0; overflow: hidden; }
.goog-te-gadget > span > a { display: none; }
.goog-te-gadget .goog-te-combo { margin: 0; }
.goog-tooltip, .goog-tooltip:hover { display: none !important; }

/* ─── Desktop top-nav language control (injected into .top-nav) ─── */
.cgc-lang-top {
  pointer-events: auto;
  margin-right: 8px;
}
.cgc-lang-top .cgc-lang-trigger {
  padding: 10px 14px;
  background: rgba(12, 11, 10, 0.6);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(245, 240, 232, 0.82);
  letter-spacing: 0.14em;
}
.cgc-lang-top .cgc-lang-trigger:hover {
  background: rgba(20, 18, 16, 0.78);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}
.cgc-lang-top .cgc-lang-globe { display: inline-flex; }
/* menu drops DOWN from the top nav, right-aligned */
.cgc-lang-top .cgc-lang-menu {
  top: calc(100% + 10px);
  bottom: auto;
  left: auto;
  right: 0;
  min-width: 240px !important;
  grid-template-columns: 1fr 1fr !important;
}
/* chevron: ▼ when closed, ▲ when open (override the footer's up-pill default) */
.cgc-lang-top .cgc-lang-chev { transform: rotate(180deg); }
.cgc-lang-top.open .cgc-lang-chev { transform: rotate(0deg); }
/* burger owns mobile -> hide the top-nav pill there */
@media (max-width: 880px) {
  .cgc-lang-top { display: none !important; }
}

/* pill + CTA always travel as one unit -> identical placement on every page */
.cgc-lang-ctagroup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.cgc-lang-ctagroup .cgc-lang-top { margin-right: 0; }

/* ============================================================
   Translation overflow guard
   FR/DE/RU/ES/AR translations run 20-50% longer than English. ONLY in the
   translated state (Google adds .translated-ltr / .translated-rtl to <html>),
   relax forced single-line text and let long words break — so translated copy
   never overflows its column or slides behind an adjacent image (e.g. the
   "DOWNLOAD OUR APP" phone). The English layout is never touched.
   ============================================================ */
html.translated-ltr :is(h1,h2,h3,h4,.mc-eyebrow,[class*="eyebrow"],[class*="-tag"],[class*="-label"],[class*="-pill"],[class*="btn"],[class*="badge"],[class*="chip"]),
html.translated-rtl :is(h1,h2,h3,h4,.mc-eyebrow,[class*="eyebrow"],[class*="-tag"],[class*="-label"],[class*="-pill"],[class*="btn"],[class*="badge"],[class*="chip"]) {
  white-space: normal !important;
  overflow-wrap: anywhere;
}
html.translated-ltr [style*="nowrap"]:not(.notranslate),
html.translated-rtl [style*="nowrap"]:not(.notranslate) {
  white-space: normal !important;
}
html.translated-ltr :is(p,li,td,figcaption,blockquote),
html.translated-rtl :is(p,li,td,figcaption,blockquote) {
  overflow-wrap: break-word;
}
