/* ==========================================================================
   SX-Tool legacy pages theme override
   Unifies the five mirrored old-site pages (pricing, jlr-enet-topix,
   jet-master-jlr-guide, apply-jlr-topix-online-access, training, downloads)
   with the new site's dark Land Rover green theme + gold accent (#C9A227)
   and Assistant font.
   Content is untouched; only palette/typography are remapped.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@400;500;600;700;800&display=swap');

:root {
  --sx-legacy-brand: #C9A227;
  --sx-legacy-brand-hover: #E3BC4E;
  --sx-legacy-brand-deep: #8A6A1A;
  --sx-legacy-onbrand: #10231A;
  --sx-legacy-bg: #0A1F16;
  --sx-legacy-panel: #102A20;
  --sx-legacy-card: #14352A;
  --sx-legacy-tile: #0C241B;
  --sx-legacy-border: #1E4234;
  --sx-legacy-text: #F4F2EA;
  --sx-legacy-text-dim: #A8B5AE;
  --sx-legacy-text-faint: #84948B;
}

/* Typography: match the new site's Assistant font on every legacy page */
html[data-legacy-page] body,
html[data-legacy-page] h1,
html[data-legacy-page] h2,
html[data-legacy-page] h3,
html[data-legacy-page] h4,
html[data-legacy-page] h5,
html[data-legacy-page] h6,
html[data-legacy-page] p,
html[data-legacy-page] li,
html[data-legacy-page] td,
html[data-legacy-page] th,
html[data-legacy-page] span,
html[data-legacy-page] a,
html[data-legacy-page] button,
html[data-legacy-page] input,
html[data-legacy-page] select,
html[data-legacy-page] textarea {
  font-family: "Assistant", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Brand-colored text links (buttons/nav keep their own styling).
   The injected new-site header/footer are excluded — their link colors
   come from /assets/style.css and the scoped chrome rules below. */
html[data-legacy-page] a:not([class*="btn"]):not([class*="button"]):not([class*="nav"]):not(.site-header *):not(.site-footer *):not(.sidebar *) {
  color: var(--sx-legacy-brand-hover);
}
html[data-legacy-page] a:not([class*="btn"]):not([class*="button"]):not([class*="nav"]):not(.site-header *):not(.site-footer *):not(.sidebar *):hover {
  color: var(--sx-legacy-brand);
}

/* Selection + focus ring in brand color */
html[data-legacy-page] ::selection {
  background: rgba(201, 162, 39, 0.35);
  color: #fff;
}
html[data-legacy-page] :focus-visible {
  outline: 2px solid var(--sx-legacy-brand);
  outline-offset: 2px;
}

/* Dark scrollbar to match */
html[data-legacy-page] {
  color-scheme: dark;
}

/* --- downloads (Flatsome/WooCommerce) dark scaffold ----------------------
   The page hardcodes light theme backgrounds in the Flatsome framework CSS;
   force the page canvas dark and let the hex-remapped sections sit on it. */
html[data-legacy-page="downloads"],
html[data-legacy-page="downloads"] body,
html[data-legacy-page="downloads"] #wrapper,
html[data-legacy-page="downloads"] #main,
html[data-legacy-page="downloads"] #content,
html[data-legacy-page="downloads"] .page-wrapper {
  background: var(--sx-legacy-bg) !important;
  color: var(--sx-legacy-text);
}
html[data-legacy-page="downloads"] .section,
html[data-legacy-page="downloads"] .row,
html[data-legacy-page="downloads"] .col {
  background-color: transparent;
}

/* Flatsome header: white bar -> dark */
html[data-legacy-page="downloads"] #header,
html[data-legacy-page="downloads"] .header-wrapper,
html[data-legacy-page="downloads"] .header-inner,
html[data-legacy-page="downloads"] .header-main,
html[data-legacy-page="downloads"] .header-bottom,
html[data-legacy-page="downloads"] .header-bg-color {
  background: var(--sx-legacy-bg) !important;
  color: var(--sx-legacy-text);
}
html[data-legacy-page="downloads"] #header .nav > li > a,
html[data-legacy-page="downloads"] .header-main .nav > li > a {
  color: var(--sx-legacy-text);
}
html[data-legacy-page="downloads"] #header .nav > li > a:hover {
  color: var(--sx-legacy-brand-hover);
}
html[data-legacy-page="downloads"] .searchform input,
html[data-legacy-page="downloads"] .search-form input {
  background: var(--sx-legacy-card);
  border-color: var(--sx-legacy-border);
  color: var(--sx-legacy-text);
}

/* --- training: mobile overflow fix ---------------------------------------
   .main is a flex child without min-width:0, so the 26 wide tables
   (min-content ~960px) push the whole page sideways on phones. */
html[data-legacy-page="training"] .main { min-width: 0; }
html[data-legacy-page="training"] table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

/* --- downloads: hero overlay + dead widget cleanup ------------------------
   The WooCommerce currency sidebar's ?wmc-currency= links are dead on a
   static mirror — hide it instead of letting it overlap content. */
html[data-legacy-page="downloads"] .section-bg-overlay {
  background-color: rgba(6, 18, 13, 0.55) !important;
}
html[data-legacy-page="downloads"] .woocommerce-multi-currency {
  display: none !important;
}

/* downloads: table headers still render light (Flatsome th background);
   force the whole table into the dark theme */
html[data-legacy-page="downloads"] table th {
  background: var(--sx-legacy-card) !important;
  color: var(--sx-legacy-text) !important;
}
html[data-legacy-page="downloads"] table td {
  color: var(--sx-legacy-text);
}
html[data-legacy-page="downloads"] table th,
html[data-legacy-page="downloads"] table td {
  border-color: var(--sx-legacy-border) !important;
}
/* The hero banner PNG has the same headline/paragraph baked into the image;
   with the banner now actually loading, that baked text collides with the
   real HTML text on top. Push this section's overlay much darker so the
   baked text fades out and the HTML text stays readable. */
html[data-legacy-page="downloads"] #section_786269508 .section-bg-overlay {
  background-color: rgba(6, 18, 13, 0.9) !important;
}

/* ==========================================================================
   Injected new-site chrome (header/footer from dist/index.html)
   /assets/style.css is linked FIRST in <head>, so legacy inline/external
   styles outrank it on equal specificity. Class collisions with the legacy
   pages (.container, .btn, .footer-grid, .site-footer, .header-inner …)
   are restored to the design-system values here, scoped to the chrome.
   ========================================================================== */

/* .container: undo legacy width/padding/position overrides inside chrome
   (enet max-width:900px · jet width:92% + position:relative · apply padding
   0 1.5rem · flatsome paddings) */
html[data-legacy-page] .site-header .container,
html[data-legacy-page] .site-footer .container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 32px;
  position: static;
  z-index: auto;
}
@media (max-width: 749px) {
  html[data-legacy-page] .site-header .container,
  html[data-legacy-page] .site-footer .container {
    padding-inline: 16px;
  }
}

/* .header-inner: jet overrides padding to 14px 0 + space-between */
html[data-legacy-page] .site-header .header-inner {
  padding: 0;
  padding-block: 0.7rem;
  justify-content: normal;
}

/* buttons in the header: legacy .btn / .btn-primary / .btn-sm all collide
   (apply padding .875rem 2rem, training dark bg + #000 text, jet black text
   + mobile width:100%) */
html[data-legacy-page] .site-header .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: auto;
  border: 1px solid transparent;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
}
html[data-legacy-page] .site-header .btn-sm {
  padding: 10px 18px;
  font-size: 13px;
  border-radius: 8px;
}
html[data-legacy-page] .site-header .btn-primary {
  background: var(--sx-legacy-brand);
  color: var(--sx-legacy-onbrand);
}
html[data-legacy-page] .site-header .btn-primary:hover {
  background: var(--sx-legacy-brand-hover);
  color: var(--sx-legacy-onbrand);
  transform: none;
  text-decoration: none;
}

/* footer chrome: jet's own .site-footer/.footer-grid/.footer-col/.footer-bottom
   and apply's .footer-grid/.footer-bottom collide with the new markup */
html[data-legacy-page] .site-footer {
  padding: 0;
  margin-top: 0;
  background: var(--sx-legacy-tile);
  color: var(--sx-legacy-text-dim);
}
html[data-legacy-page] .site-footer .footer-grid {
  grid-template-columns: 1fr;
  gap: 2rem;
  padding-block: 3rem 2rem;
  margin-bottom: 0;
}
@media (min-width: 640px) {
  html[data-legacy-page] .site-footer .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 990px) {
  html[data-legacy-page] .site-footer .footer-grid {
    grid-template-columns: 1.6fr 1fr 1fr 1fr 1fr;
  }
}
@media (max-width: 749px) {
  html[data-legacy-page] .site-footer .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.6rem;
  }
}
html[data-legacy-page] .site-footer .footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
html[data-legacy-page] .site-footer .footer-col li {
  margin-bottom: 0.45rem;
}
html[data-legacy-page] .site-footer .footer-col a {
  color: var(--sx-legacy-text-dim);
  font-size: 0.92rem;
}
html[data-legacy-page] .site-footer .footer-col a:hover {
  color: var(--sx-legacy-brand-hover);
  text-decoration: none;
}
html[data-legacy-page] .site-footer .footer-bottom {
  text-align: start;
}

/* --- training: make room for the injected sticky header -------------------
   The manual layout has a fixed 300px sidebar (top:0, z-index 1000) and an
   in-flow sticky .topbar (z-index 100). On desktop both slide under the new
   header; on mobile the header becomes static so the manual's own sticky
   topbar (hamburger) keeps its original behaviour. */
@media (min-width: 901px) {
  html[data-legacy-page="training"] .sidebar {
    top: 58px;
    height: calc(100vh - 58px);
  }
  html[data-legacy-page="training"] .topbar {
    top: 58px;
    z-index: 40;
  }
}
@media (max-width: 900px) {
  html[data-legacy-page="training"] .site-header {
    position: static;
  }
}

/* --- downloads: TranslatePress floating flag switcher ---------------------
   The new header/footer already carry the new-site language switcher; the
   legacy fixed floater would overlap them. */
html[data-legacy-page="downloads"] .trp-language-switcher-container {
  display: none !important;
}

/* enet styles the details ELEMENT as a card (bg/border/padding) — it leaks
   onto the chrome's <details> (lang switchers, mobile nav accordion). */
html[data-legacy-page] .site-header details,
html[data-legacy-page] .site-footer details {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  border-radius: 0;
}

/* downloads (Flatsome): the `button` element selector forces uppercase +
   letter-spacing onto every chrome button (nav triggers, bridge cards). */
html[data-legacy-page] .site-header button,
html[data-legacy-page] .site-footer button {
  text-transform: none;
  letter-spacing: normal;
}

/* apply: breadcrumb-nav had padding-top:90px to clear the old FIXED navbar;
   the new sticky header is in-flow, so reclaim the gap. */
html[data-legacy-page="apply-jlr-topix-online-access"] .breadcrumb-nav {
  padding-top: 1.5rem;
}
html[data-legacy-page="apply-jlr-topix-online-access"] .breadcrumb .current {
  color: var(--sx-legacy-text);
}

/* jet/apply hero badges: re-tint the pill to brand gold and brighten the label. */
html[data-legacy-page="jet-master-jlr-guide"] .hero-badge,
html[data-legacy-page="apply-jlr-topix-online-access"] .hero-badge {
  background: rgba(201, 162, 39, 0.14);
  border-color: rgba(201, 162, 39, 0.45);
  color: var(--sx-legacy-brand-hover);
}

/* ==========================================================================
   Contrast repairs (content untouched — only unreadable color combos)
   ========================================================================== */

/* pricing: .tab-glider + .card-cta.primary used var(--text-primary) as a
   DARK value (navy #111827 on the original light page). The remap turned it
   into #F5F5F5 → white pill hiding the active tab's white label, and a
   white-on-white Subscribe button. Brand pill / dark button instead. */
html[data-legacy-page="pricing"] .tab-glider {
  background: var(--sx-legacy-brand);
}
html[data-legacy-page="pricing"] .tab-switcher button.active {
  color: var(--sx-legacy-onbrand);
}

/* pricing: .card-cta.primary used background: var(--text-primary) — dark
   navy on the original white card. After the remap --text-primary is
   #F5F5F5, i.e. white-on-white. Dark tile button + brand hover instead. */
html[data-legacy-page="pricing"] .card-cta.primary {
  background: var(--sx-legacy-tile);
  color: #F4F2EA;
  border: 1px solid var(--sx-legacy-border);
}
html[data-legacy-page="pricing"] .card-cta.primary:hover {
  background: var(--sx-legacy-brand);
  border-color: var(--sx-legacy-brand);
  color: var(--sx-legacy-onbrand);
  transform: scale(1.02);
}

/* pricing: .enterprise-card is the same anti-pattern — var(--text-primary)
   as card background with white text. Repaint as a dark panel + brand CTA. */
html[data-legacy-page="pricing"] .enterprise-card {
  background: var(--sx-legacy-panel);
  border: 1px solid var(--sx-legacy-border);
  color: var(--sx-legacy-text);
}
html[data-legacy-page="pricing"] .enterprise-card p {
  color: var(--sx-legacy-text-dim);
}
html[data-legacy-page="pricing"] .enterprise-btn {
  background: var(--sx-legacy-brand);
  color: var(--sx-legacy-onbrand);
}
html[data-legacy-page="pricing"] .enterprise-btn:hover {
  background: var(--sx-legacy-brand-hover);
  color: var(--sx-legacy-onbrand);
  text-decoration: none;
}
