/* Cymraeg language selector, Live Trains UK (2026-11-25 correction).
   Closed: only the current language code (EN / CY) plus one small chevron,
   centred in the header. Expanded: an absolutely positioned dropdown with
   English / Cymraeg, the current one marked by a green checkmark. Built on
   <details> so it also opens without JavaScript. */

/* An empty slot (page without a translation) never shifts the layout. */
.ltuk-lang-slot:empty {
  display: none;
}

.ltuk-lang {
  display: block;
}

.ltuk-lang-select {
  position: relative; /* the dropdown's positioning anchor */
}

/* ---------- Closed state: language code + chevron only ---------- */
.ltuk-lang-select > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px; /* code <-> chevron */
  min-height: 44px; /* minimum interactive height */
  margin: 0; /* centred by the masthead; never grows the header */
  padding: 0 8px;
  border: 0; /* no pill-shaped border */
  color: #fff;
  background: none; /* transparent control on the navy masthead */
  font-size: 0.85rem; /* 13.6px */
  font-weight: 600;
  letter-spacing: 0.05em;
  white-space: nowrap; /* code and chevron never wrap */
  cursor: pointer;
  list-style: none;
}

/* Native disclosure marker removed on every engine. */
.ltuk-lang-select > summary::marker {
  content: none;
}

.ltuk-lang-select > summary::-webkit-details-marker {
  display: none;
}

.ltuk-lang-select .ltuk-lang-code {
  white-space: nowrap;
}

/* One chevron, fixed 12 x 12px icon box, quiet white. */
.ltuk-lang-select .ltuk-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.74);
  transition: transform 0.15s ease;
}

.ltuk-lang-select[open] > summary {
  background: rgba(255, 255, 255, 0.06);
}

.ltuk-lang-select[open] > summary .ltuk-chevron {
  transform: rotate(180deg);
}

/* ---------- Expanded dropdown ---------- */

/* Explicitly hidden while the disclosure is closed; the menu only renders
   when the parent <details> carries the open attribute. */
.ltuk-lang-select:not([open]) > .ltuk-lang-menu {
  display: none;
}

.ltuk-lang-select[open] > .ltuk-lang-menu {
  display: block;
}

/* Overlays the page (absolute); the header height never changes. */
.ltuk-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 2px);
  z-index: 60;
  min-width: 150px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: none;
  background-color: #102b43;
  color: #f8fafc;
  border: 1px solid #29445d;
  border-radius: 8px;
  box-shadow: none;
}

.ltuk-lang-menu li + li {
  border-top: 1px solid rgba(41, 68, 93, 0.6);
}

.ltuk-lang-menu a,
.ltuk-lang-menu span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 0.85rem; /* ~13.6px horizontal in the 12-16px band */
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #f8fafc;
  text-decoration: none;
}

.ltuk-lang-menu a:hover,
.ltuk-lang-menu a:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

/* Current language: bold white plus a small green checkmark, so the state
   is never conveyed by colour alone. */
.ltuk-lang-menu span[aria-current="true"] {
  color: #fff;
  font-weight: 600;
}

.ltuk-lang-menu span[aria-current="true"]::before {
  content: "\2713";
  flex-shrink: 0;
  margin-right: 0.55rem;
  color: #10e565;
  font-weight: 700;
}

.ltuk-lang-menu :is(a, span):focus-visible {
  outline: 3px solid var(--ltuk-nav-accent, #14cf51);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .ltuk-lang-select .ltuk-chevron {
    transition: none;
  }
}
