/* Teyseer brand line pattern: one large composition (not a tile), per the guideline pairings */
:root {
  --art-blue-on-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%232A3C8E' stroke-opacity='0.35' stroke-width='1' vector-effect='non-scaling-stroke'%3E%3Cpath d='M0 -60 L560 500 L0 1060 L-560 500 Z'/%3E%3Cpath d='M0 -26 L526 500 L0 1026 L-526 500 Z'/%3E%3Cpath d='M1600 -60 L2160 500 L1600 1060 L1040 500 Z'/%3E%3Cpath d='M1600 -26 L2126 500 L1600 1026 L1074 500 Z'/%3E%3Cpath d='M0 0 L0 1000' stroke-opacity='0.16'/%3E%3Cpath d='M1600 0 L1600 1000' stroke-opacity='0.16'/%3E%3C/g%3E%3C/svg%3E");
  --art-steel-on-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1600 1000' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%23A6A8BA' stroke-opacity='0.4' stroke-width='1' vector-effect='non-scaling-stroke'%3E%3Cpath d='M0 -60 L560 500 L0 1060 L-560 500 Z'/%3E%3Cpath d='M0 -26 L526 500 L0 1026 L-526 500 Z'/%3E%3Cpath d='M1600 -60 L2160 500 L1600 1060 L1040 500 Z'/%3E%3Cpath d='M1600 -26 L2126 500 L1600 1026 L1074 500 Z'/%3E%3Cpath d='M0 0 L0 1000' stroke-opacity='0.18'/%3E%3Cpath d='M1600 0 L1600 1000' stroke-opacity='0.18'/%3E%3C/g%3E%3C/svg%3E");
  --art-steel-on-blue-side: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 1000' preserveAspectRatio='xMidYMid slice'%3E%3Cg fill='none' stroke='%23A6A8BA' stroke-opacity='0.4' stroke-width='1' vector-effect='non-scaling-stroke'%3E%3Cpath d='M120 570 L450 900 L120 1230 L-210 900 Z'/%3E%3Cpath d='M120 596 L424 900 L120 1204 L-184 900 Z'/%3E%3C/g%3E%3C/svg%3E");
}

/* Customer-facing pages. Brand colors arrive as CSS variables from the page. */
:root {
  --primary: #1f3a93;
  --accent: #3d7eff;
  --bg: #0d1017;
  --surface: #181c25;
  --text: #ffffff;
  --muted: color-mix(in srgb, var(--text) 62%, transparent);
  --line: color-mix(in srgb, var(--text) 12%, transparent);
  --surface-2: color-mix(in srgb, var(--surface) 80%, var(--text) 6%);
  --radius: 16px;
  --font: Inter, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-ar: Cairo, 'Segoe UI', Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--primary) 45%, transparent), transparent 70%),
    radial-gradient(900px 500px at 100% 110%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.45;
}
html[lang="ar"] body { font-family: var(--font-ar); }
a { color: inherit; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

#app { max-width: 1240px; margin: 0 auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }

/* ---------- top bar */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.brand-link { display: flex; align-items: center; text-decoration: none; min-height: 44px; }
.dist-logo { max-height: 48px; max-width: 180px; object-fit: contain; }
.brand-logo { max-height: 44px; max-width: 160px; object-fit: contain; justify-self: center; }
.brand-name { font-weight: 800; font-size: 1.2rem; }
.lang-btn {
  justify-self: end;
  min-height: 44px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}
.lang-btn:hover { border-color: var(--accent); }
html[lang="en"] .lang-btn { font-family: var(--font-ar); }

/* ---------- home */
.hero { padding: 32px 0 8px; }
.hero h1 { margin: 0; font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; letter-spacing: -0.02em; }
.hero-sub { margin: 4px 0 0; color: var(--accent); font-weight: 600; font-size: 1.1rem; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 20px 0; }
.search {
  flex: 1 1 260px;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.chip:hover { border-color: var(--accent); }
/* Selected: always the accent colour with auto-contrast text, so it stands out whatever the brand colours are. */
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 35%, transparent);
}
.chip:focus-visible, .tab:focus-visible, .card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.card-visual {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 55%, var(--surface)), var(--surface));
  display: grid;
  place-items: center;
  overflow: hidden;
  position: relative;
}
/* Pinned to the box so tall photos (Jimny, Baleno…) are scaled down to fit instead of overflowing and being cut. */
.card-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 10px 14px; box-sizing: border-box; }
.card-logo img { max-width: 70%; max-height: 70%; object-fit: contain; margin: auto; display: block; }
.card-logo { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; }
.card-placeholder span { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.02em; opacity: 0.9; text-align: center; padding: 0 12px; }
.card-body { padding: 14px 16px 16px; }
.card-family { display: inline-block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.card-title { margin: 2px 0 6px; font-size: 1.15rem; }
.card-meta { margin: 0; font-size: 0.9rem; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 24px 0; }

/* ---------- prices */
.price { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.price .amount { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.price .cur { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.price.sm .amount { font-size: 1rem; }

/* ---------- vehicle */
.back { display: inline-flex; align-items: center; gap: 6px; margin: 18px 0 8px; min-height: 44px; text-decoration: none; color: var(--muted); font-weight: 600; }
.back:hover { color: var(--text); }
.v-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 16px; }
.v-img { width: min(380px, 100%); aspect-ratio: 16/10; object-fit: contain; }
.v-title { flex: 1 1 200px; }
.v-title h1 { margin: 0; font-size: clamp(1.7rem, 4.5vw, 2.6rem); font-weight: 800; letter-spacing: -0.01em; }
.v-logo { max-height: 70px; max-width: 200px; object-fit: contain; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab {
  padding: 12px 18px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.chips.variant { margin-bottom: 16px; }
.menu-note { background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); padding: 10px 14px; border-radius: 12px; margin: 0 0 14px; }

.intervals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.interval {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--accent);
  border-radius: 14px;
}
.iv-when { display: flex; flex-direction: column; }
.iv-km { font-weight: 800; font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.iv-mo { color: var(--muted); font-size: 0.9rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tags li { font-size: 0.82rem; padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.breakdown { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.breakdown b { color: var(--text); font-weight: 700; }
.iv-price { text-align: end; display: flex; flex-direction: column; align-items: flex-end; }
.iv-incl { font-size: 0.72rem; color: var(--muted); }

.parts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.part {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.part-name { display: block; font-weight: 600; }
.pn { display: block; font-size: 0.8rem; color: var(--muted); font-family: ui-monospace, Consolas, monospace; margin-top: 2px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.parts-table { width: 100%; border-collapse: collapse; }
.parts-table th, .parts-table td { padding: 12px 16px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
.parts-table thead th { font-size: 0.85rem; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
.parts-table tbody th { font-weight: 600; }
.parts-table tr:last-child > * { border-bottom: 0; }
.parts-table .price .amount { font-size: 1.05rem; }

/* ---------- footer */
.foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.foot p { margin: 0 0 4px; }
.note { font-size: 0.9rem; }
.foot-qr { display: flex; align-items: center; gap: 12px; font-weight: 600; max-width: 280px; }
.qr { border-radius: 8px; width: 120px; height: 120px; }

/* ---------- mobile */
@media (max-width: 640px) {
  .topbar { grid-template-columns: 1fr auto; }
  .brand-logo { display: none; }
  .dist-logo { max-height: 38px; max-width: 150px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card-body { padding: 10px 12px 12px; }
  .card-title { font-size: 1rem; }
  .card-placeholder span { font-size: 1.1rem; }
  .interval { grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; }
  .iv-what { grid-column: 1 / -1; grid-row: 2; }
  .iv-price { grid-row: 1; grid-column: 2; }
  .price .amount { font-size: 1.2rem; }
}
@media (max-width: 360px) { .grid { grid-template-columns: 1fr; } }

/* ---------- showroom display (large touch screen) */
.mode-display #app { max-width: none; padding: 0 3vw 3vh; }
.mode-display { font-size: clamp(16px, 1.15vw, 26px); user-select: none; -webkit-user-select: none; }
.mode-display .dist-logo { max-height: 5.5vh; max-width: 18vw; }
.mode-display .brand-logo { max-height: 5vh; }
.mode-display .grid { grid-template-columns: repeat(auto-fill, minmax(20vw, 1fr)); gap: 1.4vw; }
.mode-display .chip, .mode-display .lang-btn { min-height: 56px; padding: 10px 26px; }
.mode-display .tab { min-height: 64px; padding: 14px 28px; }
.mode-display .interval { grid-template-columns: 14vw 1fr auto; }
.mode-display .card:hover { transform: none; }

/* ---------- slideshow */
.slides-wrap { position: fixed; inset: 0; background: #000; display: grid; place-items: center; z-index: 50; cursor: pointer; }
.slides-canvas { width: 100vw; height: 56.25vw; max-height: 100vh; max-width: 177.78vh; display: block; }
.slides-hint {
  position: absolute; bottom: 4vh; left: 50%; transform: translateX(-50%);
  padding: 10px 22px; border-radius: 999px; background: rgba(0,0,0,.55); color: #fff; font-weight: 600;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .45; } }
.slideshow-only { overflow: hidden; }
.slideshow-only #app { display: none; }

/* ---------- brand directory (light: grey page, white cards, logos only) */
body.directory { display: grid; place-items: center; background-color: #F4F3EF; background-image: var(--art-blue-on-white); background-size: cover; background-position: center; background-attachment: fixed; color: #2A2A2A; }
.dir-wrap { width: min(1000px, 100% - 32px); padding: 48px 0; text-align: center; }
.dir-logo { display: block; margin: 0 auto 28px; height: clamp(56px, 9vw, 90px); max-width: 80%; object-fit: contain; }
.dir-wrap h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 0; color: #2A2A2A; }
.dir-sub { color: #686B70; margin: 8px 0 32px; }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.dir-card {
  display: flex; align-items: center; justify-content: center;
  height: 200px; padding: 28px 32px; text-decoration: none; border-radius: var(--radius);
  background: #ffffff; border: 1px solid #686B70; color: #2A2A2A;
  transition: box-shadow .15s, transform .15s;
}
.dir-card:hover { box-shadow: 0 8px 24px rgba(42, 60, 142, .18); border-color: #2A3C8E; transform: translateY(-2px); }
.dir-card:focus-visible { outline: 2px solid #2A3C8E; outline-offset: 3px; }
.dir-card img { width: 100%; height: 100%; object-fit: contain; }
.dir-name { font-size: 1.6rem; font-weight: 800; color: #2A2A2A; }
.dir-section { margin: 52px 0 0; font-size: clamp(1.4rem, 3.6vw, 2rem); color: #2A2A2A; }

/* ---------- brand spec sheet list (/brand/specs) */
.spec-index { place-items: start center; }
.si-wrap { width: min(1000px, 100% - 32px); padding: 22px 0 56px; }
.si-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 26px; }
.si-back, .si-lang { color: #2A3C8E; font-weight: 700; text-decoration: none; font-size: .95rem; }
.si-back:hover, .si-lang:hover { text-decoration: underline; }
.si-lang { justify-self: end; padding: 7px 16px; border: 1px solid #686B70; border-radius: 999px; background: #fff; }
html[lang="en"] .si-lang { font-family: var(--font-ar); }
.si-dist { height: 46px; max-width: 220px; object-fit: contain; }
.si-head { text-align: center; }
.si-brand { display: block; margin: 0 auto 14px; height: clamp(64px, 11vw, 104px); max-width: 70%; object-fit: contain; }
.si-brand-name { font-size: 2.2rem; font-weight: 800; color: #2A2A2A; margin-bottom: 8px; }
.si-head h1 { margin: 0; font-size: clamp(1.7rem, 4.6vw, 2.5rem); color: #2A2A2A; }
.si-search {
  width: min(460px, 100%); min-height: 46px; margin: 0 auto 26px; display: block; padding: 10px 16px;
  border: 1px solid #686B70; border-radius: 12px; background: #fff; color: #2A2A2A; font: inherit;
}
.si-search:focus { outline: 2px solid #2A3C8E; outline-offset: 1px; }
.si-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.si-model[hidden] { display: none; }
.si-model {
  display: flex; flex-direction: column; background: #fff; border: 1px solid #686B70; border-radius: var(--radius);
  padding: 14px 16px 16px; color: #2A2A2A; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s;
}
.si-model:hover, .si-model:focus-visible { border-color: #2A3C8E; box-shadow: 0 6px 18px rgba(42, 60, 142, .12); transform: translateY(-2px); outline: none; }
.si-photo { display: block; position: relative; aspect-ratio: 16 / 9; margin-bottom: 10px; }
.si-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.si-name { font-weight: 800; font-size: 1.08rem; line-height: 1.25; }
.si-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 6px; font-size: .88rem; color: #686B70; }
.si-from { font-weight: 800; color: #2A3C8E; white-space: nowrap; }

.si-dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100% - 48px); padding: 0; border: 0; border-radius: 16px; background: #fff; color: #2A2A2A; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.si-dialog::backdrop { background: rgba(42, 42, 42, .45); }
.si-d-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-bottom: 1px solid #e4e4e8; }
.si-d-head img { width: 96px; aspect-ratio: 16 / 9; object-fit: contain; flex: none; }
.si-d-head div { flex: 1; min-width: 0; }
.si-d-head h2 { margin: 0; font-size: 1.15rem; }
.si-d-head p { margin: 2px 0 0; color: #686B70; font-size: .88rem; }
.si-close { flex: none; width: 36px; height: 36px; border: 1px solid #d6d6dc; border-radius: 50%; background: #fff; font-size: 1.4rem; line-height: 1; color: #2A2A2A; cursor: pointer; }
.si-close:hover { border-color: #2A3C8E; color: #2A3C8E; }
.si-dialog ul { list-style: none; margin: 0; padding: 6px 0; }
.si-dialog li + li { border-top: 1px solid #efefef; }
.si-dialog a { display: grid; grid-template-columns: 1fr auto 14px; gap: 12px; align-items: center; padding: 13px 18px; min-height: 50px; color: #2A2A2A; text-decoration: none; }
.si-dialog a:hover { background: #f4f6fb; }
.si-dialog a:hover .si-go { color: #2A3C8E; }
.si-trim { font-weight: 600; }
.si-year { display: inline-block; margin-inline-start: 6px; font-size: .72rem; font-weight: 700; color: #fff; background: #2A2A2A; border-radius: 999px; padding: 1px 8px; vertical-align: 2px; }
.si-price { font-weight: 800; color: #2A3C8E; font-variant-numeric: tabular-nums; white-space: nowrap; }
.si-go { color: #A6A8BA; font-size: 1.3rem; line-height: 1; }
.si-empty { text-align: center; color: #686B70; padding: 30px 0; }
@media (max-width: 520px) {
  .si-top { grid-template-columns: 1fr auto; }
  .si-dist { display: none; }
  .si-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .si-model { padding: 10px 12px 12px; }
  .si-name { font-size: .98rem; }
  .si-meta { flex-direction: column; align-items: flex-start; gap: 2px; font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
