/* ============================================================
   GMC Language Selector — powered by Google Website Translate
   Pairs with assets/js/gmc-translate.js

   To add the selector to another page, add these two lines:
     <link rel="stylesheet" href="assets/css/gmc-translate.css" />
     <script src="assets/js/gmc-translate.js"></script>

   The language list itself lives in assets/js/gmc-translate.js
   (the LANGUAGES array) — edit it there, not here.

   Palette matched to assets/css/style.css:
     #f16126 brand orange   #d94d18 deep orange   #101115 heading text
     #4d5765 muted text     #ecf0f3 light surface
   ============================================================ */

/* ------------------------------------------------------------
   1. Suppress Google's own translate chrome

   style.css sets `* { box-shadow: none }` and `* { outline: none }`, so
   every shadow and focus ring below is re-declared on a class.
   ------------------------------------------------------------ */

/* Google offsets <body> by the height of its banner frame. The banner is
   hidden, so the offset has to go too — Google writes it as an inline
   style, hence the !important. */
body {
  top: 0 !important;
}

.goog-te-banner-frame,
.goog-te-ftab-frame,
iframe.skiptranslate,
#goog-gt-tt,
.goog-te-balloon-frame {
  display: none !important;
  visibility: hidden !important;
}

/* Google wraps translated runs in <font> tags and highlights them on
   hover. That highlight is Google branding, not ours. */
.goog-text-highlight {
  background: none !important;
  box-shadow: none !important;
}

/* The widget has to stay in the DOM because it owns the <select> we
   drive. Visually hidden rather than display:none so Google still
   builds that control. */
#gmc-google-translate-host {
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ------------------------------------------------------------
   2. Trigger — sits in .header-wrapper, left of the logo
   ------------------------------------------------------------ */

.gmc-lang {
  flex: 0 0 auto;
  position: relative;
  z-index: 5;
  font-family: "Roboto", sans-serif;
  line-height: 1;
}

.header-wrapper .gmc-lang {
  margin-right: 26px;
}

.gmc-lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 14px;
  border: 1px solid #e0e5ec;
  border-radius: 100px;
  background: #ffffff;
  color: #101115;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease,
    color 0.2s ease, box-shadow 0.2s ease;
}

.gmc-lang-trigger:hover {
  border-color: #f16126;
  background: rgba(241, 97, 38, 0.06);
  color: #d94d18;
}

.gmc-lang-trigger:focus-visible {
  border-color: #f16126;
  box-shadow: 0 0 0 3px rgba(241, 97, 38, 0.25);
}

.gmc-lang-trigger[aria-expanded="true"] {
  border-color: #f16126;
  background: rgba(241, 97, 38, 0.08);
  color: #d94d18;
}

.gmc-lang-globe {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  color: #f16126;
  transition: color 0.2s ease;
}

.gmc-lang-trigger:hover .gmc-lang-globe,
.gmc-lang-trigger[aria-expanded="true"] .gmc-lang-globe {
  color: #d94d18;
}

.gmc-lang-label {
  max-width: 12ch;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gmc-lang-caret {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  opacity: 0.55;
  transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.25, 1),
    opacity 0.2s ease;
}

.gmc-lang-trigger[aria-expanded="true"] .gmc-lang-caret {
  transform: rotate(180deg);
  opacity: 1;
}

/* ------------------------------------------------------------
   3. Panel — rendered as a direct child of <body>

   It is deliberately moved out of the header. Once .header-fixed is
   applied on scroll, .header-bottom picks up `backdrop-filter:
   blur(20px)`, and a backdrop-filter makes its element the containing
   block for any position:fixed descendant. Anchoring from <body> keeps
   the panel clear of that, clear of the `overflow: auto` on the mobile
   `.menu > ul`, and clear of every z-index stack in style.css.
   Coordinates are written by gmc-translate.js.
   ------------------------------------------------------------ */

.gmc-lang-panel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  width: 268px;
  max-width: calc(100vw - 24px);
  padding: 0;
  border: 1px solid #eef1f5;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 44px rgba(5, 25, 55, 0.16),
    0 2px 6px rgba(5, 25, 55, 0.06);
  font-family: "Roboto", sans-serif;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top center;
  transition: opacity 0.16s ease,
    transform 0.19s cubic-bezier(0.2, 0.8, 0.25, 1),
    visibility 0s linear 0.19s;
}

.gmc-lang-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity 0.16s ease,
    transform 0.19s cubic-bezier(0.2, 0.8, 0.25, 1), visibility 0s;
}

/* Flipped above the trigger when there is no room below. */
.gmc-lang-panel.is-above {
  transform-origin: bottom center;
  transform: translateY(8px) scale(0.96);
}

.gmc-lang-panel.is-above.is-open {
  transform: translateY(0) scale(1);
}

.gmc-lang-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px 11px;
  border-bottom: 1px solid #f0f3f7;
  color: #4d5765;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
}

.gmc-lang-panel-head .gmc-lang-globe {
  width: 15px;
  height: 15px;
}

/* ---------- list ---------- */

/* Every language is shown at once — the list never scrolls. On short
   viewports it reflows into two columns instead of growing a
   scrollbar (see the max-height query in section 4). */
.gmc-lang-list {
  margin: 0;
  padding: 6px;
  list-style: none;
}

.gmc-lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 9px;
  color: #101115;
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease,
    transform 0.15s cubic-bezier(0.2, 0.8, 0.25, 1);
}

.gmc-lang-option:hover,
.gmc-lang-option:focus-visible {
  background: rgba(241, 97, 38, 0.08);
  color: #d94d18;
  transform: translateX(2px);
}

.gmc-lang-option:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(241, 97, 38, 0.45);
}

.gmc-lang-option[aria-selected="true"] {
  background: rgba(241, 97, 38, 0.1);
  color: #d94d18;
  font-weight: 700;
}

/* ---------- check mark ---------- */

.gmc-lang-check {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #f16126;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gmc-lang-check svg {
  width: 14px;
  height: 14px;
}

.gmc-lang-option[aria-selected="true"] .gmc-lang-check {
  opacity: 1;
  transform: scale(1);
}

/* ---------- names ---------- */

.gmc-lang-native {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gmc-lang-en {
  flex: 0 0 auto;
  color: #98a0ad;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.2px;
}

.gmc-lang-option[aria-selected="true"] .gmc-lang-en {
  color: #d98a6b;
}

/* Urdu reads right-to-left. The row itself stays LTR so the tick, the
   name and the latin gloss keep the same columns as every other row. */
.gmc-lang-native[dir="rtl"] {
  text-align: right;
}

/* ------------------------------------------------------------
   4. Responsive
   ------------------------------------------------------------ */

/* Tablet and mobile. Below 992px style.css turns .logo into an
   absolutely positioned box and hangs a 2000px margin off .header-bar,
   so the selector is taken out of that flow entirely — that way it
   cannot change the header height or nudge page content down. It is
   anchored to .header-section, the same containing block .logo uses. */
@media (max-width: 991px) {
  .header-wrapper .gmc-lang {
    position: absolute;
    top: 16px;
    left: 14px;
    margin-right: 0;
    z-index: 6;
  }

  .header-wrapper .gmc-lang-trigger {
    gap: 6px;
    padding: 7px 12px;
    font-size: 13.5px;
  }

  .header-wrapper .gmc-lang-globe {
    width: 15px;
    height: 15px;
  }

  .header-wrapper .gmc-lang-caret {
    width: 10px;
    height: 10px;
  }

  .gmc-lang-panel {
    width: 260px;
  }
}

@media (max-width: 575px) {
  .header-wrapper .gmc-lang {
    top: 12px;
    left: 12px;
  }

  .header-wrapper .gmc-lang-trigger {
    padding: 6px 11px;
    font-size: 13px;
  }
}

/* Short viewports (landscape phones, small laptop windows). Rather than
   scroll, the list becomes two columns so all thirteen languages stay
   visible and reachable at once. */
@media (max-height: 640px) {
  .gmc-lang-panel {
    width: 372px;
  }

  .gmc-lang-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 2px;
  }

  .gmc-lang-option {
    padding: 6px 10px;
    font-size: 14px;
  }

  /* No room for the latin gloss beside the native name in two columns. */
  .gmc-lang-en {
    display: none;
  }
}

@media (max-height: 640px) and (max-width: 420px) {
  .gmc-lang-option {
    gap: 6px;
    padding: 6px 7px;
    font-size: 13px;
  }
}

/* Between 992px and 1199px the nav is already tight — trim the gap
   rather than let the menu wrap. */
@media (min-width: 992px) and (max-width: 1199px) {
  .header-wrapper .gmc-lang {
    margin-right: 14px;
  }

  .header-wrapper .gmc-lang-trigger {
    padding: 8px 12px;
    font-size: 14px;
  }
}

/* ------------------------------------------------------------
   5. Articles sub-site (articles/*.html) — its own minimal header,
   Inter type and #4f8ef7 accent rather than the brand orange.
   ------------------------------------------------------------ */

.hdr-in .gmc-lang {
  margin-left: auto;
  margin-right: 18px;
}

.hdr-in .gmc-lang-trigger {
  padding: 7px 13px;
  border-color: #e6e8ec;
  border-radius: 8px;
  color: #111111;
  font-family: "Inter", sans-serif;
  font-size: 13.5px;
  font-weight: 600;
}

.hdr-in .gmc-lang-trigger:hover,
.hdr-in .gmc-lang-trigger[aria-expanded="true"] {
  border-color: #4f8ef7;
  background: rgba(79, 142, 247, 0.08);
  color: #4f8ef7;
}

.hdr-in .gmc-lang-trigger:focus-visible {
  border-color: #4f8ef7;
  box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.22);
}

.hdr-in .gmc-lang-globe,
.hdr-in .gmc-lang-trigger:hover .gmc-lang-globe,
.hdr-in .gmc-lang-trigger[aria-expanded="true"] .gmc-lang-globe {
  color: #4f8ef7;
}

@media (max-width: 575px) {
  .hdr-in .gmc-lang {
    margin-right: 12px;
  }

  .hdr-in .gmc-lang-trigger {
    padding: 6px 10px;
    font-size: 12.5px;
  }

  .hdr-in .gmc-lang-label {
    max-width: 8ch;
  }
}

/* ------------------------------------------------------------
   6. Motion preferences
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .gmc-lang-trigger,
  .gmc-lang-caret,
  .gmc-lang-panel,
  .gmc-lang-panel.is-open,
  .gmc-lang-option,
  .gmc-lang-check {
    transition-duration: 0.01ms !important;
  }

  .gmc-lang-panel,
  .gmc-lang-panel.is-above,
  .gmc-lang-option:hover,
  .gmc-lang-option:focus-visible {
    transform: none;
  }
}
