/* ==========================================================================
   RaqamQatar — Clean design system
   Palette: black / white / burgundy (#662046) / slate gray (#747F8A)
   Type: Montserrat 400/500/700 (Cairo fallback for Arabic)
   Spacing: 8pt grid
   ========================================================================== */

:root {
  --color-surface: #ffffff;
  --color-surface-soft: #f5f6f7;
  --color-text: #111111;
  --color-text-muted: #747f8a;
  --color-border: #e3e5e8;
  --color-border-strong: #cdd1d6;
  --color-accent: #662046;
  --color-accent-hover: #501736;
  --color-accent-soft: rgba(102, 32, 70, 0.08);
  --color-accent-strong: rgba(102, 32, 70, 0.18);
  --color-danger: #b3261e;

  --font-sans: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-24: 1.5rem;
  --fs-32: 2rem;
  --fs-40: 2.5rem;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.05);
  --shadow-md: 0 6px 18px rgba(17, 17, 17, 0.06);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-16);
  font-weight: 500;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[dir="rtl"] body {
  font-family: "Cairo", var(--font-sans);
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--color-text);
}

h1 {
  font-size: clamp(var(--fs-32), 4.5vw + 0.5rem, var(--fs-40));
}

h2 {
  font-size: var(--fs-24);
}

h3 {
  font-size: var(--fs-20);
}

p {
  margin: 0;
}

button {
  font-family: inherit;
}

/* ============================================================
   Page shell
   ============================================================ */

.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--sp-3) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

.site-brand a {
  display: inline-block;
  color: var(--color-text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.site-brand a:hover {
  text-decoration: none;
  color: var(--color-accent);
}

.header-actions {
  margin-inline-start: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* Desktop visual order: BRAND ........ NAV  TOGGLE.
   The lang-toggle is now a sibling of header-actions in the DOM (so it can
   move to the brand row on mobile via grid-template-areas), but on desktop
   we use flex `order` to keep the toggle at the far right. */
.site-brand {
  order: 1;
}
.header-actions {
  order: 2;
}
.site-header-inner > .lang-toggle {
  order: 3;
}

.nav-tabs {
  display: flex;
  gap: var(--sp-1);
}

.nav-tabs a {
  padding: var(--sp-2) var(--sp-3);
  color: #111111;
  font-size: var(--fs-14);
  font-weight: 600;
  border-radius: var(--r-sm);
  transition: color 150ms ease, background 150ms ease;
}

.nav-tabs a:hover {
  color: #111111;
  text-decoration: none;
}

.nav-tabs a.active {
  color: #111111;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.lang-toggle a {
  color: var(--color-text-muted);
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  transition: color 150ms ease, background 150ms ease;
}

.lang-toggle a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.lang-toggle a.active {
  color: var(--color-surface);
  background: var(--color-accent);
}

.lang-toggle .lang-divider {
  color: var(--color-border-strong);
  font-weight: 400;
  user-select: none;
}

/* ============================================================
   Layout
   ============================================================ */

.layout {
  flex: 1 0 auto;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-7) var(--sp-5);
  display: grid;
  gap: var(--sp-6);
  align-content: start;
}

.layout-wide {
  max-width: 1120px;
}

.layout-tight {
  gap: var(--sp-3);
}

@media (max-width: 640px) {
  .layout {
    padding: var(--sp-5) var(--sp-4);
    gap: var(--sp-5);
  }

  .layout-tight {
    gap: var(--sp-3);
  }
}

/* ============================================================
   Footer
   ============================================================ */

.site-footer {
  background: var(--color-accent);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  text-align: center;
  font-size: var(--fs-12);
  color: rgba(255, 255, 255, 0.72);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--sp-5);
  margin-bottom: var(--sp-3);
}

.footer-nav a {
  position: relative;
  display: inline-block;
  padding: 4px 2px;
  color: #ffffff;
  font-weight: 600;
  font-size: var(--fs-14);
  letter-spacing: 0.01em;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 150ms ease, opacity 150ms ease;
}

.footer-nav a:hover {
  color: #ffffff;
  text-decoration: none;
  border-bottom-color: rgba(255, 255, 255, 0.85);
}

/* Subtle middle dot between footer links — visible as the only thing
   separating them; flex `gap` carries the spacing on either side. */
.footer-nav a + a::before {
  content: "·";
  position: absolute;
  inset-inline-start: calc(-1 * var(--sp-5) / 2);
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.45);
  font-weight: 400;
  pointer-events: none;
}

html[dir="rtl"] .footer-nav a + a::before {
  inset-inline-start: auto;
  inset-inline-end: calc(-1 * var(--sp-5) / 2);
  transform: translateX(50%);
}

.footer-contact {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-12);
  color: rgba(255, 255, 255, 0.72);
}

.footer-contact a {
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.04em;
  unicode-bidi: plaintext;
}

.footer-contact a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.site-footer p:last-child {
  margin: 0;
  letter-spacing: 0.04em;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}

.card-faq {
  padding: var(--sp-3);
}

@media (max-width: 640px) {
  .card {
    padding: var(--sp-5);
    border-radius: var(--r-md);
  }

  .card-faq {
    padding: var(--sp-3);
  }
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  display: grid;
  gap: var(--sp-3);
}

.eyebrow {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.hero h1 {
  font-size: clamp(1.75rem, 6vw, var(--fs-40));
  line-height: 1.1;
}

.hero .lead {
  font-size: var(--fs-16);
  color: var(--color-text-muted);
  max-width: 60ch;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .hero .lead {
    font-size: var(--fs-14);
    line-height: 1.5;
  }
}

.hero-compact {
  gap: 0;
}

.hero-compact h1 {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--color-accent);
}

.faq-item .faq-answer:only-child {
  margin-top: 0;
}

/* ============================================================
   Forms
   ============================================================ */

.form {
  display: grid;
  gap: var(--sp-4);
}

.form-field {
  display: grid;
  gap: 6px;
}

.form-row {
  display: grid;
  gap: var(--sp-4);
}

.form-row-2 {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 560px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.form-label {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--color-text);
}

.form-input,
.form-select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: var(--fs-16);
  font-weight: 500;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:hover,
.form-select:hover {
  border-color: #b3b9c1;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.form-select {
  background-image: linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
    linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 12px) center;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-inline-end: 36px;
  cursor: pointer;
}

html[dir="rtl"] .form-select {
  background-position: 18px center, 12px center;
}

.form-hint {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
}

.form-hint-list {
  margin: 0;
  padding-inline-start: 1.2em;
  display: grid;
  gap: 4px;
  list-style: disc outside;
}

.form-hint-list li {
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  line-height: 1.5;
}

/* ----- Plate input ----- */
.plate-input-wrap {
  position: relative;
}

.plate-input {
  width: 100%;
  min-height: 64px;
  padding: 0 56px 0 18px;
  font-family: inherit;
  font-size: var(--fs-24);
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

html[dir="rtl"] .plate-input {
  padding: 0 18px 0 56px;
}

.plate-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.plate-clear-button {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 150ms ease;
}

.plate-clear-button:hover {
  background: var(--color-accent-strong);
}

.plate-clear-button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: var(--fs-16);
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms ease, transform 80ms ease;
}

.btn-primary {
  background: var(--color-accent);
  color: white;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-block {
  width: 100%;
}

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
}

.btn-outline:hover {
  background: var(--color-accent-soft);
}

.btn-whatsapp {
  background: #25D366;
  color: #ffffff;
  border: 1px solid #25D366;
}

.btn-whatsapp:hover {
  background: #1ebe5d;
  border-color: #1ebe5d;
  color: #ffffff;
}

/* Buttons rendered as <a> inherit the global a:hover underline. Suppress it
   for every button state so WhatsApp share + outline / primary buttons never
   show a stray underline (single + compare modes for both car and plate). */
.btn,
.btn:hover,
.btn:focus,
.btn:active,
.btn:visited {
  text-decoration: none;
}

/* ============================================================
   Segmented controls
   ============================================================ */

.segmented {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: var(--sp-2);
}

.segment {
  position: relative;
  display: block;
}

.segment input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segment input:disabled {
  cursor: not-allowed;
}

.segment span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--fs-14);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.segment:hover span {
  border-color: var(--color-accent);
}

.segment input:checked + span {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
}

.segment input:disabled + span {
  background: var(--color-surface-soft);
  color: var(--color-text-muted);
  border-color: var(--color-border);
  cursor: not-allowed;
}

.segment:hover input:disabled + span {
  border-color: var(--color-border);
}

/* ============================================================
   Notice cards (error / disclaimer / info)
   ============================================================ */

.notice {
  margin-top: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-soft);
  font-size: var(--fs-14);
}

.notice strong {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
  color: var(--color-text);
}

.notice p {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.notice-error {
  border-color: #f3c1bc;
  background: #fdf3f1;
}

.notice-error strong {
  color: var(--color-danger);
}

/* ============================================================
   Result panel
   ============================================================ */

.result {
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.result-eyebrow {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.result-title {
  margin-top: 4px;
  font-size: var(--fs-24);
  font-weight: 700;
  color: var(--color-text);
}

.result-subtitle {
  margin-top: 4px;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-price {
  font-size: var(--fs-32);
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.result-centered {
  display: grid;
  gap: var(--sp-3);
  justify-items: center;
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
}

.result-centered .result-eyebrow,
.result-centered .result-title,
.result-centered .result-subtitle {
  margin: 0;
}

.result-centered .btn-block {
  width: min(360px, 100%);
}

.result-centered .result-price {
  margin: 0;
  font-size: clamp(1.125rem, 4.5vw, 2rem);
  white-space: nowrap;
}

.result-price-box {
  width: fit-content;
  max-width: 100%;
  padding: var(--sp-3) var(--sp-5);
  border: 1px solid var(--color-accent-soft);
  border-radius: var(--r-md);
  background: rgba(102, 32, 70, 0.04);
  text-align: center;
  display: grid;
  gap: 4px;
  justify-items: center;
  margin-inline: auto;
}

.result-range-label {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-align: center;
}

.result-predicted {
  margin: 0;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  text-align: center;
}

/* ---- Qatar number plate ---- */
.qatar-plate {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  width: min(360px, 100%);
  padding: 10px 22px 14px;
  background: #ffffff;
  border: 3px solid #111111;
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(17, 17, 17, 0.08);
  position: relative;
}

.qatar-plate::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  pointer-events: none;
}

.qatar-plate__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.12);
  color: var(--color-accent);
}

.qatar-plate__country {
  font-weight: 700;
  line-height: 1;
}

.qatar-plate__country--en {
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.qatar-plate__country--ar {
  font-family: "Cairo", var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.qatar-plate__number {
  margin: 0;
  text-align: center;
  font-size: clamp(2.6rem, 11vw, 4rem);
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #111111;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-grid {
  margin-top: var(--sp-5);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--sp-3);
}

.result-tile {
  padding: var(--sp-4);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-surface-soft);
}

.result-tile span {
  display: block;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.result-tile strong {
  display: block;
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--color-text);
}

/* ----- Reasons ----- */
.reasons {
  margin-top: var(--sp-5);
  display: grid;
  gap: var(--sp-2);
}

.reasons-title {
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin: 0;
}

.reasons-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--sp-2);
}

.reasons-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  font-size: var(--fs-14);
}

.reason-direction {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: var(--fs-12);
  font-weight: 700;
}

@media (max-width: 560px) {
  .reasons-list li {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ============================================================
   FAQ stack
   ============================================================ */

.faq-stack {
  display: grid;
  gap: var(--sp-3);
}

.faq-item {
  padding: var(--sp-4) var(--sp-5);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-surface);
}

.faq-question {
  margin: 0;
  font-weight: 700;
  font-size: var(--fs-16);
  color: var(--color-text);
  line-height: 1.4;
}

.faq-answer {
  margin: 6px 0 0;
  color: var(--color-text-muted);
  font-size: var(--fs-14);
  line-height: 1.6;
}

/* ============================================================
   Combobox (searchable dropdown)
   ============================================================ */

.combobox {
  position: relative;
}

.combobox-input {
  cursor: text;
}

.combobox-input:disabled {
  cursor: not-allowed;
  background: var(--color-surface-soft);
  opacity: 0.65;
}

.combobox-list {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  inset-inline-end: 0;
  z-index: 30;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}

.combobox-list[hidden] {
  display: none;
}

.combobox-option {
  padding: 9px 14px;
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
}

.combobox-option:hover,
.combobox-option--active {
  background: var(--color-accent-soft);
}

.combobox-option--selected {
  font-weight: 700;
  color: var(--color-accent);
}

.combobox-empty {
  padding: 9px 14px;
  font-size: var(--fs-14);
  color: var(--color-text-muted);
}

/* ============================================================
   Mobile header
   ============================================================ */

@media (max-width: 640px) {
  /* Two-row layout on mobile:
       Row 1:  BRAND .................. TOGGLE
       Row 2:  [Car Valuation]  [How It Works]  [FAQ]
     Achieved with CSS grid named areas. */
  .site-header-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand toggle"
      "nav   nav";
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-4);
  }

  .site-brand {
    grid-area: brand;
    align-self: center;
  }

  .site-header-inner > .lang-toggle {
    grid-area: toggle;
    align-self: center;
    justify-self: end;
  }

  .header-actions {
    grid-area: nav;
    width: 100%;
    margin-inline-start: 0;
    justify-content: flex-start;
    gap: var(--sp-2);
  }

  .nav-tabs a {
    padding: 6px 8px;
    font-size: var(--fs-12);
  }

  .site-brand a {
    font-size: 0.9rem;
    letter-spacing: 0.14em;
  }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   Compare Plates view
   ============================================================ */

.compare-cta {
  margin-top: var(--sp-2);
  text-decoration: none;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.compare-back-link {
  display: block;
  margin-top: var(--sp-3);
  text-align: center;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  text-decoration: underline;
}

.compare-back-link:hover {
  color: var(--color-accent);
}

.compare-results-grid {
  margin-top: var(--sp-5);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
}

.result-compact {
  padding: var(--sp-4) var(--sp-3);
}

.result-compact .qatar-plate--compact {
  width: min(220px, 100%);
}

.result-compact .qatar-plate__number {
  font-size: clamp(1.4rem, 5vw, 2rem);
}

.result-compact .result-price {
  /* Compare cards live in half-width columns. The base .result-price uses
     white-space: nowrap which works for the full-width single view but
     overflows once the predicted price hits 7 digits (1M+ QAR) — e.g.
     "1,045,000 – 1,155,000 QAR". In compact cards we allow the range to
     wrap and clamp font slightly smaller so even 8-digit ranges stay
     inside their card. */
  font-size: clamp(0.85rem, 3.2vw, 1.2rem);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.result-compact .result-price-box {
  padding: var(--sp-2) var(--sp-3);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.result-compact .result-predicted {
  overflow-wrap: anywhere;
}

.compare-slot-label {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.compare-slot-empty {
  opacity: 0.5;
}

@media (max-width: 540px) {
  .compare-grid,
  .compare-results-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Car valuation form — compact (no labels, smaller inputs)
   ============================================================ */

/* The car form now uses placeholders instead of stacked labels, so the
   per-field label spacing collapses and the form gap can be tighter. */
.car-valuation-form {
  gap: var(--sp-2);
}

.car-valuation-form .form-row {
  gap: var(--sp-2);
}

/* Reduce input vertical height by ~15% (48px -> 41px) for the car form only.
   Padding is shaved proportionally so text stays vertically centered. */
.car-valuation-form .form-input,
.car-valuation-form .form-select {
  min-height: 41px;
  padding: 8px 14px;
}

/* ============================================================
   Compare Cars view
   ============================================================ */

.car-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.car-compare-column {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--r-md);
  background: var(--color-surface);
  margin: 0;
}

.car-compare-legend {
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: 0 var(--sp-2);
}

@media (max-width: 768px) {
  .car-compare-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Form tabs (Enter Manually / Auto Fill)
   ============================================================ */

.form-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border, #e5e5e5);
  margin-bottom: var(--sp-3);
}

.form-tab {
  flex: 1;
  padding: var(--sp-2) var(--sp-3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-family: inherit;
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--color-text-muted, #666);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.form-tab:hover {
  color: var(--color-text, #111);
}

.form-tab.is-active {
  color: var(--color-text, #111);
  border-bottom-color: var(--color-text, #111);
  font-weight: 600;
}

.form-tab-panel {
  display: none;
}

.form-tab-panel.is-active {
  display: block;
}

.car-autofill-form .form-label {
  display: block;
  font-size: var(--fs-14);
  font-weight: 500;
  margin-bottom: var(--sp-1);
}

.car-autofill-form .form-help {
  font-size: var(--fs-12, 12px);
  color: var(--color-text-muted, #666);
  margin: var(--sp-1) 0 var(--sp-3);
}

/* Suppress the brand-colored focus halo on the URL input — keeps the
   autofill panel visually quiet (no maroon ring around the field). */
.car-autofill-form .form-input:focus {
  border-color: var(--color-border-strong, #cdd1d6);
  box-shadow: none;
}

.notice-info {
  /* Override .notice defaults so the autofill-success banner sits flush at the
     top of the manual panel and leaves a small gap before the Make field. */
  margin-top: 0;
  margin-bottom: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: #f7f7f7;
}

/* ============================================================
   Confidence pill (next to predicted price in the result panel)
   ============================================================ */

.result-confidence {
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: var(--fs-12, 12px);
  text-align: center;
}

.confidence-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid;
}

.confidence-pill--high {
  background: #ecfdf5;
  color: #166534;
  border-color: #86efac;
}

.confidence-pill--medium {
  background: #fffaf0;
  color: #8a5a00;
  border-color: #d9a35a;
}

.confidence-pill--low {
  background: #fdf3f1;
  color: var(--color-danger, #b3261e);
  border-color: #f3c1bc;
}

.confidence-source {
  color: var(--color-text-muted, #747f8a);
}

/* ============================================================
   Auto-fill loading indicator (indeterminate sliding bar)
   ============================================================ */

.autofill-progress {
  height: 3px;
  background: #eaeaea;
  border-radius: 2px;
  overflow: hidden;
  margin: var(--sp-2) 0;
}

.autofill-progress[hidden] {
  display: none;
}

.autofill-progress-bar {
  height: 100%;
  width: 30%;
  background: var(--color-text, #111);
  border-radius: 2px;
  animation: autofill-slide 1.2s ease-in-out infinite;
}

@keyframes autofill-slide {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(420%); }
}

.car-autofill-form .btn.is-loading {
  opacity: 0.7;
  cursor: progress;
}

/* ============================================================
   Popular cars carousel (Qatar used-car insights)
   ============================================================ */

/* Grid items default to min-width: min-content, which lets a wide child
   (the 22-card scroll track) blow the layout open past its max-width. Force
   every direct child of the insights layout to allow shrinking, so the
   carousel is bounded by .layout-wide instead of the cards' intrinsic
   width. */
.layout-insights > * {
  min-width: 0;
}

.hero-centered {
  text-align: center;
}

.hero-centered .lead {
  margin-inline: auto;
}

.popular-cars {
  display: grid;
  gap: var(--sp-4);
  min-width: 0;
}

.popular-cars-header {
  text-align: center;
  display: grid;
  gap: 4px;
}

.popular-cars-header h2 {
  font-size: var(--fs-24);
  letter-spacing: -0.01em;
}

.popular-cars-subtitle {
  font-size: var(--fs-14);
  color: var(--color-text-muted);
  margin-inline: auto;
  max-width: 56ch;
}

.popular-cars-carousel {
  position: relative;
  min-width: 0;
}

.popular-cars-viewport {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
}

.popular-cars-track {
  list-style: none;
  margin: 0;
  padding: var(--sp-2) var(--sp-2) var(--sp-3);
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--sp-2);
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}

.popular-cars-track::-webkit-scrollbar {
  display: none;
}

.popular-card {
  flex: 0 0 280px;
}

@media (max-width: 640px) {
  .popular-card {
    flex-basis: 240px;
  }
}

/* ============================================================
   Bucket tabs (Most-Depreciating page country filter)
   ============================================================ */

.bucket-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-2);
  justify-content: center;
  margin: var(--sp-3) auto var(--sp-4);
  /* If the row ever overflows (very narrow phones, future longer labels)
     it scrolls horizontally rather than wrapping to a second row. */
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-inline: var(--sp-2);
}

.bucket-tabs::-webkit-scrollbar {
  display: none;
}

.bucket-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--fs-14);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}

@media (max-width: 640px) {
  .bucket-tabs {
    gap: var(--sp-1);
    justify-content: flex-start;
  }
  .bucket-tab {
    padding: 5px 11px;
    font-size: var(--fs-12);
  }
}

.bucket-tab:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  text-decoration: none;
}

.bucket-tab.is-active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.bucket-tab.is-active:hover {
  color: #fff;
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.popular-cars-heading-suffix {
  color: var(--color-text-muted);
  font-weight: 600;
}

/* ============================================================
   Insights analysis (below the carousel)
   ============================================================ */

.insights-analysis {
  margin-top: var(--sp-6);
  text-align: center;
  min-width: 0;
}

.insights-analysis h2 {
  font-size: var(--fs-24);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-4);
}

.insights-analysis-body {
  max-width: 33rem;
  margin: 0 auto;
  padding: var(--sp-5) var(--sp-6);
  background: var(--color-surface-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  display: grid;
  gap: var(--sp-3);
  text-align: start;
  color: var(--color-text);
  font-size: var(--fs-14);
  line-height: 1.55;
  /* ul reset — custom marker is drawn via ::before below. */
  list-style: none;
}

/* Disclaimer block under the analysis box on the ranking pages. Width-
   matched to the analysis-body so the two read as a related pair, but the
   styling is the more muted `.notice` look (lighter font, smaller). */
.data-disclaimer {
  max-width: 33rem;
  margin: var(--sp-1) auto 0;
  text-align: start;
  font-size: var(--fs-12);
  line-height: 1.6;
}

.data-disclaimer p {
  margin-top: 4px;
}

.insights-analysis-body li {
  position: relative;
  padding-inline-start: var(--sp-4);
  margin: 0;
}

.insights-analysis-body li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}

@media (max-width: 640px) {
  .insights-analysis h2 {
    font-size: var(--fs-20);
  }
  .insights-analysis-body {
    padding: var(--sp-4);
    font-size: var(--fs-12);
    line-height: 1.5;
    border-radius: var(--r-md);
  }
  .insights-analysis-body li::before {
    top: 0.55em;
  }
}

.popular-card {
  scroll-snap-align: start;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
  position: relative;
}

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

.popular-card-rank {
  position: absolute;
  top: var(--sp-3);
  inset-inline-start: var(--sp-3);
  padding: 2px 10px;
  background: var(--color-accent);
  color: #fff;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 999px;
  z-index: 1;
}

.popular-card-media {
  aspect-ratio: 16 / 10;
  background: var(--color-surface-soft);
  overflow: hidden;
}

.popular-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.popular-card-body {
  padding: var(--sp-4);
  display: grid;
  gap: var(--sp-2);
}

.popular-card-make {
  margin: 0;
  font-size: var(--fs-12);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.popular-card-model {
  margin: 0;
  font-size: var(--fs-20);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.popular-card-stats {
  margin: var(--sp-2) 0 0;
  padding: var(--sp-3) 0 0;
  border-top: 1px solid var(--color-border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
}

/* Bump specificity above the base `.popular-card-stats dd` rule so the
   accent / danger colors actually win against `color: var(--color-text)`. */
.popular-card-stats dd.popular-card-stats-trim {
  color: var(--color-accent);
}

.popular-card-stats dd.popular-card-stats-loss {
  color: var(--color-danger);
}

/* 3-column variant used by the depreciation cards.

   Alignment strategy: parent grid stretches every column wrapper to
   equal height (align-items: stretch). Each wrapper is itself a 2-row
   grid with a FIXED first row (label) of 3.2em and a flexible value
   row. Because the label row is the same height in every column, all
   <dd> values share the same vertical baseline — even when one label
   wraps to two lines and another doesn't. */
.popular-card-stats-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3) var(--sp-2);
  align-items: stretch;
}

.popular-card-stats-3 > div {
  display: grid;
  grid-template-rows: 3.2em 1fr;
  gap: 0;
  min-width: 0;
}

.popular-card-stats-3 dt {
  align-self: start;
}

.popular-card-stats-3 dd {
  align-self: start;
  font-size: var(--fs-12);
  line-height: 1.3;
  /* Cancel the truncation from the base rule so prices like "792,248 QAR"
     render fully (wrapping if the column is too narrow). */
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: normal;
  overflow-wrap: anywhere;
}

.popular-card-stats-caption {
  display: block;
  margin-top: 2px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: normal;
}

.popular-card-stats > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.popular-card-stats dt {
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  font-weight: 600;
}

.popular-card-stats dd {
  margin: 0;
  font-size: var(--fs-14);
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popular-card-desc {
  margin: var(--sp-2) 0 0;
  font-size: var(--fs-12);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.popular-cars-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(17, 17, 17, 0.08);
  color: var(--color-text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease,
    opacity 150ms ease, visibility 0s linear 150ms;
}

.popular-cars-nav:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.popular-cars-nav:active {
  transform: translateY(-50%) scale(0.95);
}

.popular-cars-prev {
  inset-inline-start: 12px;
}

.popular-cars-next {
  inset-inline-end: 12px;
}

.popular-cars-nav.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: border-color 150ms ease, color 150ms ease, transform 150ms ease,
    opacity 150ms ease;
}

@media (max-width: 640px) {
  .popular-cars-carousel {
    --edge-fade: 24px;
  }

  .popular-cars-track {
    grid-auto-columns: minmax(220px, 240px);
    gap: var(--sp-3);
  }

  .popular-cars-nav {
    display: none;
  }

  .popular-cars-header h2 {
    font-size: var(--fs-20);
  }
}
