/* ============================================================
   Sun Travel Design System
   Editorial travel design. Warm coral primary, deep teal accent.
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Colour palette */
  --color-primary: #0d9488;
  --color-primary-light: #f0fdfa;
  --color-primary-dark: #0f766e;
  --color-accent: #ea580c;
  --color-accent-light: #fff7ed;
  --color-accent-dark: #c2410c;
  --color-heading: #111827;
  --color-text: #4b5563;
  --color-text-muted: #9ca3af;
  --color-border: #e5e7eb;
  --color-border-light: #f3f4f6;
  --color-bg: #ffffff;
  --color-bg-subtle: #f9fafb;
  --color-bg-warm: #fff7ed;
  --color-success: #059669;
  --color-success-bg: #ecfdf5;
  --color-warning: #d97706;
  --color-warning-bg: #fffbeb;
  --color-info: #2563eb;
  --color-info-bg: #eff6ff;

  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-lg: 1.0625rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 28px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Radius */
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --radius-xl: 6px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;

  /* Layout */
  --container-max: 1200px;
  --container-narrow: 800px;
  --header-height: 72px;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
ul, ol { list-style: none; }

/* Global focus ring for keyboard users */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Prevent iOS zoom on input focus (font-size must be >= 16px) */
@media (max-width: 768px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-heading);
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: 0.01em;
}

h1 { font-size: var(--text-4xl); line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: var(--text-2xl); line-height: 1.3; }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin-bottom: var(--space-4); }
p:last-child { margin-bottom: 0; }

/* --- Container --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container-narrow {
  max-width: var(--container-narrow);
}

/* --- Grid System --- */
.grid {
  display: grid;
  gap: var(--space-5);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Main + Sidebar layout */
.layout-sidebar {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: var(--space-8);
  align-items: start;
}

.sidebar-sticky {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
}

@media (max-width: 1024px) {
  .layout-sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar-sticky { position: static; }
}

/* --- Skip link (a11y) --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 200;
  padding: var(--space-3) var(--space-4);
  background: var(--color-heading);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) 0;
  transition: top 150ms;
}
.skip-link:focus { top: 0; }

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
}
.site-header .header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: var(--header-height);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-heading);
  flex-shrink: 0;
}
.site-logo-img {
  height: 48px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.footer-logo-img {
  height: 66px;
  width: auto;
  display: block;
}
.site-logo-text {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
}
.site-logo-word {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-heading);
  letter-spacing: -0.02em;
  line-height: 1;
}
.site-logo-tld {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: 0;
}

/* --- Nav --- */
.nav-main {
  flex: 1;
  display: flex;
  justify-content: center;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav-item { position: relative; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color 150ms, background 150ms;
  white-space: nowrap;
}
.nav-link:hover,
.nav-has-menu:hover > .nav-link,
.nav-has-menu:focus-within > .nav-link {
  color: var(--color-primary);
}
.nav-caret { transition: transform 150ms; opacity: 0.6; }
.nav-has-menu:hover .nav-caret,
.nav-has-menu:focus-within .nav-caret { transform: rotate(180deg); opacity: 1; }

.nav-item-mobile-only { display: none; }

/* --- Mega menu --- */
.mega-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 600px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 180ms;
}
.mega-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
}
.nav-has-menu:hover > .mega-menu,
.nav-has-menu:focus-within > .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.mega-menu-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 200px;
  gap: var(--space-6);
}
.mega-col { min-width: 140px; }
.mega-heading {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-3);
}
.mega-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mega-list a {
  display: block;
  padding: 6px 8px;
  margin: 0 -8px;
  font-size: var(--text-sm);
  color: var(--color-text);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: background 150ms, color 150ms;
}
.mega-list a:hover {
  background: var(--color-bg-warm);
  color: var(--color-primary);
}
.mega-promo {
  background: var(--color-bg-subtle);
  margin: calc(var(--space-6) * -1) calc(var(--space-6) * -1) calc(var(--space-6) * -1) 0;
  padding: var(--space-5);
  border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mega-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 0 0 var(--space-2);
}
.mega-promo-link {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-heading);
  text-decoration: none;
  padding: 4px 0;
}
.mega-promo-link:hover { color: var(--color-primary); }
.mega-promo-sub {
  margin-top: auto;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* --- Header tools (search + CTA + hamburger) --- */
.header-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}
.header-search { display: flex; }
.header-search-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  height: 36px;
  background: var(--color-bg-subtle);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  transition: background 150ms, border-color 150ms;
}
.header-search-inner:focus-within {
  background: var(--color-bg);
  border-color: var(--color-border);
}
.header-search-inner input {
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: var(--text-sm);
  color: var(--color-heading);
  width: 180px;
}
.btn-header-cta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: background 150ms, transform 150ms;
  white-space: nowrap;
}
.btn-header-cta:hover { background: var(--color-primary-dark); transform: translateY(-1px); }
.btn-header-cta-mobile {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--radius-full);
  text-decoration: none;
}

/* --- Hamburger --- */
.nav-toggle {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.nav-toggle span {
  position: absolute;
  left: 10px;
  width: 20px;
  height: 2px;
  background: var(--color-heading);
  border-radius: 1px;
  transition: transform 200ms var(--ease-out), opacity 150ms var(--ease-out);
}
.nav-toggle span:nth-child(1) { top: 14px; }
.nav-toggle span:nth-child(2) { top: 19px; }
.nav-toggle span:nth-child(3) { top: 24px; }
.site-header.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
.site-header.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}
.site-header.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

/* --- Mobile backdrop --- */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  border: none;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms, visibility 200ms;
  z-index: 90;
}
.nav-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 1024px) {
  :root { --header-height: 60px; }
  .header-search input { width: 140px; }
  .nav-list { gap: 0; }
  .nav-link { padding: var(--space-2); font-size: 11px; }
  .mega-menu { min-width: 520px; }
  .mega-menu-inner { grid-template-columns: 1fr 1fr; }
  .mega-promo { display: none; }
}

@media (max-width: 900px) {
  .header-search { display: none; }
}

@media (max-width: 768px) {
  :root { --header-height: 56px; }
  /* backdrop-filter creates a containing block for fixed descendants in Safari,
     which would trap .nav-main and .nav-backdrop inside the header's box. */
  .site-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: var(--color-bg);
  }
  .site-header .header-inner {
    gap: var(--space-3);
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }
  .site-logo-img { height: 40px; }
  .nav-toggle { display: flex; }
  .btn-header-cta { display: none; }
  .btn-header-cta-mobile { display: inline-flex; }
  .header-tools { margin-left: auto; }
  .nav-main {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    height: calc(100dvh - var(--header-height));
    background: var(--color-bg);
    flex-direction: column;
    justify-content: flex-start;
    padding: var(--space-4) var(--space-6) calc(var(--space-10) + env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: transform 220ms var(--ease-out), opacity 180ms var(--ease-out), visibility 180ms;
    z-index: 95;
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.12);
  }
  .nav-main.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  .nav-list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 2px;
  }
  .nav-item { width: 100%; }
  .nav-item-mobile-only { display: block; }
  .nav-link {
    width: 100%;
    padding: var(--space-4);
    font-size: var(--text-sm);
    text-transform: none;
    letter-spacing: 0;
    color: var(--color-heading);
    border-radius: var(--radius-lg);
    min-height: 48px;
    justify-content: space-between;
  }
  .nav-link:hover { background: var(--color-bg-subtle); color: var(--color-heading); }
  .nav-caret { transform: rotate(-90deg); }
  .nav-has-menu.is-expanded .nav-caret { transform: rotate(0); }
  /* Mega-menu opens inline as a tap-to-toggle accordion on mobile.
     Hover/focus-within are unreliable on touch, so JS toggles .is-expanded. */
  .mega-menu {
    position: static;
    transform: none;
    min-width: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 var(--space-3);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    background: transparent;
    display: none;
  }
  .nav-has-menu.is-expanded .mega-menu {
    display: block;
  }
  .mega-menu-inner {
    grid-template-columns: 1fr;
    gap: var(--space-3);
    padding-left: var(--space-3);
  }
  /* Force readable contrast for the inline accordion links/headings, defeating
     any inherited light color from the header context. */
  .nav-main .mega-heading {
    margin-bottom: var(--space-2);
    color: var(--color-text-muted);
  }
  .nav-main .mega-list a {
    padding: var(--space-3);
    margin: 0;
    font-size: var(--text-sm);
    min-height: 44px;
    display: flex;
    align-items: center;
    color: var(--color-heading);
  }
  .nav-main .mega-list a:hover {
    color: var(--color-primary);
  }
  .nav-mobile-cta {
    margin-top: var(--space-4);
    background: var(--color-primary);
    color: #fff !important;
    text-align: center;
    justify-content: center !important;
    font-weight: 600;
    min-height: 48px;
  }
  .nav-mobile-cta:hover { background: var(--color-primary-dark); color: #fff !important; }
}

/* --- Back to top --- */
.back-to-top {
  position: fixed;
  right: var(--space-6);
  bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  z-index: 80;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.96);
  color: var(--color-heading);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 180ms, background 150ms, color 150ms;
}
.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.back-to-top:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
@media (max-width: 768px) {
  .back-to-top {
    right: var(--space-4);
    bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
    width: 42px;
    height: 42px;
  }
}

/* --- Footer --- */
.site-footer {
  position: relative;
  background: var(--color-heading);
  color: rgba(255, 255, 255, 0.7);
  padding: var(--space-16) 0 0;
  margin-top: 0;
}
/* Brand accent hairline across the top of the footer */
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}

.footer-top {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: var(--space-12);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-brand { max-width: 380px; }

.footer-logo-lockup {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: #fff;
  margin-bottom: var(--space-3);
}
.footer-logo-lockup svg { color: var(--color-primary); }
.footer-logo-text {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: rgba(255,255,255,0.95);
}
.footer-tagline {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 var(--space-5);
}

.footer-trust {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}
.footer-trust-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
}
.footer-trust-item svg { color: var(--color-primary); flex-shrink: 0; }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}
.footer-col h5 {
  position: relative;
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
}
.footer-col h5::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
}
.footer-col a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: var(--text-sm);
  padding: var(--space-1) 0;
  color: rgba(255, 255, 255, 0.62);
  text-decoration: none;
  transition: color 150ms;
}
/* Bright teal (teal-400) reads cleanly on the dark footer */
.footer-col a:hover { color: #2dd4bf; }
.footer-col-count {
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
}

/* --- Footer regions accordion --- */
.footer-regions {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.footer-regions-toggle summary {
  display: flex;
  align-items: center;
  padding: var(--space-4) 0;
  cursor: pointer;
  list-style: none;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.55);
  min-height: 44px;
}
.footer-regions-toggle summary::-webkit-details-marker { display: none; }
.footer-regions-toggle summary::after {
  content: "Browse 16 regions  +";
  margin-left: auto;
  color: rgba(255,255,255,0.4);
}
.footer-regions-toggle[open] summary::after {
  content: "Hide  −";
}
.footer-region-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px var(--space-4);
  padding: 0 0 var(--space-5);
}
.footer-region-grid a {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.45);
  padding: 4px 0;
  text-decoration: none;
  transition: color 150ms;
}
.footer-region-grid a:hover { color: #2dd4bf; }

/* --- Footer legal bar --- */
.footer-legal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0;
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.3);
}
.footer-legal-bar p { margin: 0; }
.footer-legal-links {
  display: flex;
  gap: var(--space-4);
}
.footer-legal-links a {
  color: rgba(255, 255, 255, 0.3);
  transition: color 150ms;
  text-decoration: none;
}
.footer-legal-links a:hover { color: rgba(255, 255, 255, 0.7); }

@media (max-width: 900px) {
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .footer-top {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }
  .footer-region-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-legal-bar {
    flex-direction: column;
    gap: var(--space-2);
    text-align: center;
  }
  .site-footer { padding-top: var(--space-12); }
}

/* --- Section Spacing --- */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-10) 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}

.section-header h2 {
  font-size: var(--text-2xl);
}

.section-header .subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* --- Card System --- */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

a.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: var(--space-6);
}

.card-compact .card-body {
  padding: var(--space-4) var(--space-5);
}

/* --- Stat Cards (horizontal layout) --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
}

@media (max-width: 480px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

.stat-card {
  position: relative;
  z-index: 0;
  padding: var(--space-5) var(--space-5);
  text-align: center;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  transform: skewX(-6deg);
  border-radius: 4px;
  z-index: -1;
}

.stat-value {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-heading);
  line-height: 1.2;
}

.stat-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

/* --- Model Card (for make pages) --- */
.model-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-out);
  text-decoration: none;
  color: inherit;
  min-height: 150px;
}

.model-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.model-card-name {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-heading);
  margin-bottom: var(--space-1);
}

.model-card-years {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.model-card-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text);
}

.model-card-meta strong {
  font-weight: 600;
  color: var(--color-heading);
}

.model-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-light);
}

.model-card-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: all var(--duration-fast);
}

.model-card:hover .model-card-arrow {
  background: var(--color-primary);
  color: #fff;
}

/* --- Ranked List Row --- */
.ranked-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border-light);
  text-decoration: none;
  color: inherit;
  transition: background var(--duration-fast);
}

.ranked-row:last-child { border-bottom: none; }
.ranked-row:hover { background: var(--color-bg-subtle); }

.rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.ranked-row:first-child .rank-badge,
.ranked-row:nth-child(2) .rank-badge,
.ranked-row:nth-child(3) .rank-badge {
  background: var(--color-primary);
  color: #fff;
}

.ranked-info { flex: 1; min-width: 0; }

.ranked-name {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-heading);
}

.ranked-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.ranked-tags {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .ranked-tags { display: none; }
}

/* --- Tags / Badges (parallelogram, speed aesthetic) --- */
.tag {
  display: inline-block;
  height: 26px;
  line-height: 26px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  position: relative;
  z-index: 0;
  border-radius: 0;
}

/* The parallelogram shape is on a pseudo-element so text stays straight */
.tag::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: skewX(-10deg);
  border-radius: 3px;
  z-index: -1;
}

.tag-primary { color: #fff; }
.tag-primary::before { background: var(--color-heading); }

.tag-neutral { color: var(--color-text); }
.tag-neutral::before { background: var(--color-bg-subtle); border: 1px solid var(--color-border); }

.tag-success { color: #fff; }
.tag-success::before { background: var(--color-success); }

.tag-outline { color: var(--color-text); }
.tag-outline::before { background: transparent; border: 1px solid var(--color-border); }

.tag-accent { color: #fff; }
.tag-accent::before { background: var(--color-primary); }

/* Clickable tags */
a.tag {
  text-decoration: none;
  cursor: pointer;
  transition: opacity 150ms;
}

a.tag:hover { opacity: 0.8; }
a.tag-primary:hover::before { background: var(--color-primary); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: none;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  z-index: 0;
  transition: color var(--duration-fast);
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  transform: skewX(-6deg);
  border-radius: 4px;
  z-index: -1;
  transition: background var(--duration-fast), border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.btn-primary { color: #fff; }
.btn-primary::before { background: var(--color-primary); }
.btn-primary:hover::before { background: var(--color-primary-dark); box-shadow: var(--shadow-md); }

.btn-outline { color: var(--color-heading); }
.btn-outline::before { border: 1px solid var(--color-border); }
.btn-outline:hover::before { border-color: var(--color-heading); background: var(--color-bg-subtle); }

.btn-sm {
  height: 32px;
  padding: 0 var(--space-3);
  font-size: var(--text-xs);
}

@media (max-width: 768px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 0 var(--space-4); }
}

.btn-lg {
  height: 48px;
  padding: 0 var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

/* --- Breadcrumb --- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-6) 0 var(--space-5);
}

.breadcrumb a {
  color: var(--color-text-muted);
  transition: color var(--duration-fast);
}

.breadcrumb a:hover { color: var(--color-primary); }

.breadcrumb .sep {
  font-size: 0.7em;
  opacity: 0.5;
}

.breadcrumb .current {
  color: var(--color-heading);
  font-weight: 500;
}

/* --- Page Hero --- */
.page-hero {
  padding: var(--space-10) 0 var(--space-8);
}

.page-hero h1 {
  margin-bottom: var(--space-3);
}

.page-hero .lead {
  font-size: var(--text-lg);
  color: var(--color-text);
  max-width: 640px;
  line-height: 1.65;
}

/* Homepage hero (dark) */
.hero-dark {
  background: var(--color-heading);
  color: #fff;
  padding: var(--space-20) 0;
  text-align: center;
}

.hero-dark h1 {
  color: #fff;
  font-size: var(--text-5xl);
  margin-bottom: var(--space-4);
}

.hero-dark .lead {
  color: rgba(255, 255, 255, 0.65);
  max-width: 560px;
  margin: 0 auto var(--space-8);
}

.hero-dark .lead strong { color: #fff; }

.hero-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

.hero-actions .btn-outline {
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.hero-actions .btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
  .hero-dark { padding: var(--space-12) 0; }
  .hero-dark h1 { font-size: var(--text-3xl); }
  .hero-actions { flex-direction: column; align-items: center; }
}

@media (max-width: 375px) {
  .hero-dark h1 { font-size: var(--text-2xl); }
  h1 { font-size: var(--text-3xl); }
}

/* --- Distribution Bar --- */
.dist-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.dist-label {
  width: 120px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-heading);
  flex-shrink: 0;
}

.dist-track {
  flex: 1;
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.dist-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
}

.dist-value {
  width: 60px;
  text-align: right;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* --- Widget Box (sidebar cards) --- */
.widget {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}

.widget h4 {
  font-size: var(--text-base);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
}

/* --- Comparison Table --- */
.comparison-grid {
  display: grid;
  grid-template-columns: 140px 1fr 1fr;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.comparison-header {
  display: contents;
}

.comparison-header > div {
  background: var(--color-heading);
  color: #fff;
  padding: var(--space-4);
}

.comparison-header > div:first-child {
  display: flex;
  align-items: flex-end;
}

.comparison-row {
  display: contents;
}

.comparison-row > div {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
}

.comparison-row > div:first-child {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-heading);
}

.comparison-row > div:not(:first-child) {
  justify-content: center;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.comparison-row:nth-child(odd) > div {
  background: var(--color-bg-subtle);
}

.is-winner {
  background: var(--color-success-bg) !important;
  font-weight: 600;
  color: var(--color-heading);
}

@media (max-width: 640px) {
  .comparison-grid { grid-template-columns: 80px 1fr 1fr; font-size: var(--text-sm); }
}

/* --- Article Styles --- */
.article {
  max-width: var(--container-narrow);
}

.article-header {
  margin-bottom: var(--space-8);
}

.article-header h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-2);
}

.article-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.article-body p {
  font-size: var(--text-base);
  line-height: 1.8;
  margin-bottom: var(--space-5);
}

.article-body h2 {
  font-size: var(--text-xl);
  margin: var(--space-10) 0 var(--space-4);
}

.article-body a {
  color: var(--color-primary);
  font-weight: 500;
}

.article-body a:hover {
  text-decoration: underline;
}

/* --- FAQ --- */
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-3);
  overflow: hidden;
  transition: box-shadow var(--duration-normal);
}

.faq-item[open] {
  box-shadow: var(--shadow-sm);
}

.faq-question {
  padding: var(--space-4) var(--space-5);
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--color-heading);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question::-webkit-details-marker { display: none; }

.faq-question::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--color-primary);
  flex-shrink: 0;
  margin-left: var(--space-4);
}

.faq-item[open] .faq-question::after { content: "\2212"; }

.faq-answer {
  padding: 0 var(--space-5) var(--space-5);
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
}

/* --- Insight / Alert Cards --- */
.insight-card {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  border: 1px solid;
}

.insight-card.good { background: var(--color-success-bg); border-color: #bbf7d0; }
.insight-card.warning { background: var(--color-warning-bg); border-color: #fde68a; }
.insight-card.info { background: var(--color-info-bg); border-color: #bfdbfe; }

.insight-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  flex-shrink: 0;
}

.insight-card.good .insight-icon { background: var(--color-success); }
.insight-card.warning .insight-icon { background: var(--color-warning); }
.insight-card.info .insight-icon { background: var(--color-info); }

/* --- Data Source Note --- */
.data-source {
  margin-top: var(--space-10);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-heading { color: var(--color-heading); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.shrink-0 { flex-shrink: 0; }

/* --- Year buttons (sidebar) --- */
.year-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.year-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  position: relative;
  z-index: 0;
  transition: color var(--duration-fast);
}

.year-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--color-border);
  transform: skewX(-6deg);
  border-radius: 3px;
  z-index: -1;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.year-btn:hover { color: var(--color-primary); }
.year-btn:hover::before { border-color: var(--color-primary); }

.year-btn.active { color: #fff; }
.year-btn.active::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

/* --- Spec Grid (year pages) --- */
.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-3);
}

.spec-item {
  position: relative;
  z-index: 0;
  padding: var(--space-4) var(--space-5);
}

.spec-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  transform: skewX(-6deg);
  border-radius: 4px;
  z-index: -1;
}

.spec-item .spec-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.spec-item .spec-value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-heading);
  text-transform: uppercase;
  letter-spacing: 0.01em;
}

/* --- Running Cost Calculator refinement --- */
.calc-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}

.calc-card {
  padding: var(--space-5);
  border-radius: var(--radius-md);
  text-align: center;
}

.calc-card.primary {
  background: var(--color-primary);
  color: #fff;
}

.calc-card.secondary {
  background: var(--color-bg-warm);
}

@media (max-width: 640px) {
  .calc-results { grid-template-columns: 1fr; }
}

/* --- Intro text blocks --- */
.intro-text p {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .nav-toggle, .back-to-top { display: none; }
  .section { padding: 1rem 0; }
}

/* --- Bottom CTA (above footer) --- */
.bottom-cta {
  position: relative;
  padding: var(--space-16) 0;
  background: var(--color-accent);
  overflow: hidden;
}
.bottom-cta-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-dark) 100%);
  opacity: 1;
}
.bottom-cta-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}
.bottom-cta-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: #fff;
  letter-spacing: -0.01em;
}
.bottom-cta-text {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--text-base);
  margin: 0;
  max-width: 540px;
}
.bottom-cta-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-shrink: 0;
}
.bottom-cta-actions .btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--color-accent-dark);
  padding: 0 var(--space-6);
  height: 48px;
  font-weight: 600;
  border-radius: var(--radius-full);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: background 150ms, transform 150ms;
}
.bottom-cta-actions .btn-primary::before { display: none; }
.bottom-cta-actions .btn-primary:hover {
  background: rgba(255,255,255,0.94);
  transform: translateY(-1px);
}
.bottom-cta-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
}
.bottom-cta-link:hover { color: #fff; }
@media (max-width: 640px) {
  .bottom-cta { padding: var(--space-10) 0; }
  .bottom-cta-inner { flex-direction: column; text-align: center; }
  .bottom-cta-title { font-size: var(--text-2xl); }
  .bottom-cta-actions { flex-direction: column; width: 100%; }
  .bottom-cta-actions .btn-primary { width: 100%; justify-content: center; }
}
