/* Site navigation, Live Trains UK (2026-11-25 responsive redesign).
   Flat, opaque, text-led navigation reused by every template.
   Mobile-first: on small screens the primary nav is a full-height panel
   below the header (opened with the hamburger button), and Performance is
   an accordion inside it. At >= 75em (1200px) the same markup becomes the
   inline desktop bar with a Performance dropdown.
   This file is unlayered on purpose so it overrides the compiled theme
   components layer. Design tokens: #14CF51 accent, #041E58 navy,
   #10233D night, existing font family inherited from the body. */

:root {
  --ltuk-nav-h: 68px;
  --ltuk-nav-bp: 75em; /* only used conceptually; the media queries below hardcode 75em */
  --ltuk-nav-accent: #14cf51;
  --ltuk-nav-text: #f8fafc;
  --ltuk-nav-bg: #041e58;
  --ltuk-nav-surface: #0b2740;
  --ltuk-nav-sub: #10233d;
  --ltuk-nav-line: rgba(255, 255, 255, 0.12);
  --ltuk-nav-muted: rgba(255, 255, 255, 0.74);
}

/* ---------- Scroll lock while the mobile panel is open ---------- */
body.ltuk-nav-locked {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

/* ---------- Header bar ---------- */
.ltuk-masthead {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: calc(var(--ltuk-nav-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) clamp(1rem, 4vw, 4rem) 0;
  background: var(--ltuk-nav-bg);
  border-bottom: 1px solid var(--ltuk-nav-line);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.ltuk-masthead .ltuk-brand {
  margin: 0.45rem 0;
  flex-shrink: 1;
  min-width: 0;
  font-size: 1.3rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.ltuk-masthead-side {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}

/* "In development" badge: desktop only, so the mobile header keeps
   exactly three elements (wordmark, language, menu). */
.ltuk-masthead .ltuk-status {
  display: none;
}


/* Self-contained masthead typography. The header must control its own
   colours independently of page-level typography: light legal pages set a
   dark body colour, and the preflight `a { color: inherit }` would otherwise
   paint the wordmark navy on navy. Direct rules here beat inherited values
   at normal priority; no !important needed. */
.ltuk-header.ltuk-masthead {
  color: var(--ltuk-nav-text);
}

.ltuk-masthead .ltuk-brand,
.ltuk-masthead .ltuk-brand-name,
.ltuk-masthead .ltuk-brand-name strong,
.ltuk-masthead .ltuk-brand-name span {
  color: var(--ltuk-nav-text);
}

.ltuk-masthead .ltuk-brand:visited,
.ltuk-masthead .ltuk-brand:hover,
.ltuk-masthead .ltuk-brand:focus-visible {
  color: var(--ltuk-nav-text);
}

/* ---------- Hamburger button ---------- */
.ltuk-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ltuk-nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  margin: 0.45rem 0;
  background: none;
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
}

.ltuk-nav-toggle-box {
  position: relative;
  display: block;
  width: 22px;
  height: 14px;
}

.ltuk-nav-toggle-box i {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  border-radius: 1px;
  background: #fff;
  transition: top 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.ltuk-nav-toggle-box i:nth-child(2) { top: 6px; }
.ltuk-nav-toggle-box i:nth-child(3) { top: 12px; }

.ltuk-nav-toggle.is-open .ltuk-nav-toggle-box i:first-child { top: 6px; transform: rotate(45deg); }
.ltuk-nav-toggle.is-open .ltuk-nav-toggle-box i:nth-child(2) { opacity: 0; }
.ltuk-nav-toggle.is-open .ltuk-nav-toggle-box i:nth-child(3) { top: 6px; transform: rotate(-45deg); }

/* ---------- Mobile panel (default presentation) ---------- */
.ltuk-primary-nav {
  position: fixed;
  top: calc(var(--ltuk-nav-h) + env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 39;
  visibility: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--ltuk-nav-bg);
  padding: 0.5rem clamp(1.25rem, 5vw, 2.5rem) calc(1.25rem + env(safe-area-inset-bottom, 0px));
}

.ltuk-primary-nav[data-open="true"] {
  visibility: visible;
}

.ltuk-primary-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ltuk-primary-nav-item + .ltuk-primary-nav-item {
  border-top: 1px solid var(--ltuk-nav-line);
}

.ltuk-primary-nav .ltuk-navlink {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0.75rem 0.25rem;
  color: #fff;
  text-decoration: none;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
}

.ltuk-primary-nav .ltuk-navlink[aria-current="page"] {
  font-weight: 700;
}

.ltuk-primary-nav .ltuk-navlink[aria-current="page"]::before {
  content: "";
  flex-shrink: 0;
  width: 3px;
  height: 1.05em;
  margin-right: 0.65rem;
  border-radius: 2px;
  background: var(--ltuk-nav-accent);
}

/* Performance accordion inside the panel */
.ltuk-perf > summary {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 52px;
  padding: 0.75rem 0.25rem;
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  list-style: none;
  cursor: pointer;
}

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

.ltuk-perf > summary .ltuk-chevron {
  margin-left: auto;
  color: var(--ltuk-nav-muted);
  transition: transform 0.15s ease;
}

.ltuk-perf[open] > summary .ltuk-chevron,
.ltuk-perf[data-current] > summary .ltuk-chevron {
  transform: rotate(180deg);
}

/* Restrained teal highlight for the expanded control (white text remains,
   state is also carried by the rotated chevron and aria-expanded). */
.ltuk-perf[open] > summary,
.ltuk-perf[data-current] > summary {
  background: rgba(20, 207, 81, 0.14);
  border-radius: 8px;
}

.ltuk-perf[open][data-current] > summary .ltuk-chevron {
  transform: rotate(180deg);
}

.ltuk-perf-menu {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0 0.6rem;
  background: var(--ltuk-nav-sub);
}

.ltuk-perf-menu li + li {
  border-top: 1px solid var(--ltuk-nav-line);
}

.ltuk-perf-menu a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0.6rem 1rem 0.6rem 1.15rem;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.9875rem;
  font-weight: 500;
  line-height: 1.3;
}

.ltuk-perf-menu a[aria-current="page"] {
  color: #fff;
  font-weight: 700;
}

.ltuk-perf-menu a[aria-current="page"]::before {
  content: "";
  flex-shrink: 0;
  width: 3px;
  height: 1.05em;
  margin-right: 0.6rem;
  border-radius: 2px;
  background: var(--ltuk-nav-accent);
}

/* ---------- Focus / keyboard ---------- */
.ltuk-masthead :is(a, button, summary):focus-visible,
.ltuk-primary-nav :is(a, summary):focus-visible {
  outline: 3px solid var(--ltuk-nav-accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Desktop navigation (>= 1200px) ---------- */
@media (min-width: 75em) {
  :root {
    --ltuk-nav-h: 72px;
  }

  .ltuk-nav-toggle { display: none; }

  .ltuk-masthead {
    justify-content: space-between;
    gap: clamp(1.25rem, 2vw, 2rem);
    height: var(--ltuk-nav-h);
    min-height: 0;
    padding: 0 clamp(1.25rem, 4vw, 4rem);
  }

  .ltuk-masthead .ltuk-brand {
    margin: 0;
    font-size: 1.45rem;
  }

  .ltuk-masthead .ltuk-status {
    display: flex;
    margin-left: auto;
  }

  .ltuk-masthead-side {
    margin-left: 0;
  }

  /* Same DOM node: inline bar instead of the fixed panel. */
  .ltuk-primary-nav {
    position: static;
    z-index: 1;
    visibility: visible;
    overflow: visible;
    background: none;
    padding: 0;
    min-width: 0;
  }

  .ltuk-primary-nav-list {
    display: flex;
    align-items: stretch;
    gap: clamp(1.25rem, 1.8vw, 2rem);
  }

  .ltuk-primary-nav-item {
    display: flex;
    align-items: stretch;
  }

  .ltuk-primary-nav-item + .ltuk-primary-nav-item {
    border-top: 0;
  }

  .ltuk-primary-nav .ltuk-navlink {
    display: flex;
    align-items: center;
    min-height: 0;
    padding: 0;
    position: relative;
    flex-shrink: 0;
    font-size: 0.975rem;
    font-weight: 600;
    white-space: nowrap;
  }

  /* Thin teal underline for the current page, hover keeps it subtle. */
  .ltuk-primary-nav .ltuk-navlink::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    border-radius: 1px;
    background: transparent;
    transition: background 0.15s ease;
  }

  .ltuk-primary-nav .ltuk-navlink:hover::after,
  .ltuk-primary-nav .ltuk-navlink[aria-current="page"]::after {
    background: var(--ltuk-nav-accent);
  }

  .ltuk-primary-nav .ltuk-navlink[aria-current="page"]::before {
    content: none;
  }

  /* Performance dropdown */
  .ltuk-perf-item {
    position: relative;
    align-items: center;
  }

  .ltuk-perf > summary {
    gap: 0.4rem;
    min-height: 40px;
    margin: auto 0;
    padding: 0.45rem 0.8rem;
    border-radius: 8px;
    font-size: 0.975rem;
    font-weight: 600;
    white-space: nowrap;
  }

  .ltuk-perf > summary .ltuk-chevron {
    margin-left: 0.15rem;
  }

  .ltuk-perf[data-current] > summary {
    background: rgba(20, 207, 81, 0.16);
  }

  .ltuk-perf[open] > summary {
    background: rgba(20, 207, 81, 0.16);
  }

  .ltuk-perf-menu {
    position: absolute;
    left: -12px;
    top: calc(100% - 6px);
    width: 264px;
    padding: 0.4rem;
    background: var(--ltuk-nav-surface);
    border: 1px solid var(--ltuk-nav-line);
    border-radius: 10px;
    box-shadow: 0 18px 44px rgba(2, 8, 20, 0.45);
  }

  .ltuk-perf-menu li + li {
    border-top: 0;
  }

  .ltuk-perf-menu a {
    min-height: 44px;
    padding: 0.55rem 0.8rem;
    border-radius: 7px;
    font-size: 0.9rem;
    font-weight: 500;
  }

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

  .ltuk-perf-menu a[aria-current="page"]::before {
    margin-right: 0.5rem;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ltuk-nav-toggle-box i,
  .ltuk-perf > summary .ltuk-chevron,
  .ltuk-primary-nav .ltuk-navlink::after {
    transition: none;
  }
}
