/* ניר רכבים — design tokens and shared components (public site + admin) */

:root {
  --ink: #171a21;
  --ink-2: #4a515e;
  --ink-3: #636a78;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --fill: #f0f2f5;
  --fill-2: #e7eaee;
  --line: #e4e7ec;
  --line-strong: #cdd2da;
  --night: #15191f;
  --night-2: #232a34;
  --night-line: #343b46;
  --plate: #ffc400;
  --plate-hover: #f2b700;
  --plate-soft: #fff4cf;
  --plate-blue: #1c4e9d;
  /* Text on the main color, and the main color on dark areas. The settings can change the main
     color; these then follow it so text stays readable (see colors.py). */
  --on-plate: var(--ink);
  --on-plate-2: rgba(23, 26, 33, .78);
  --accent-dark: var(--plate);
  --link: #1d58c9;
  --ok: #11743f;
  --ok-soft: #e3f5ea;
  --warn: #9a4d00;
  --warn-soft: #fdefd9;
  --bad: #c0392b;
  --bad-soft: #fce9e7;
  --wa: #157f44;
  --wa-hover: #116a38;

  /* older names, still used by the admin stylesheet */
  --asphalt: var(--night);
  --asphalt-2: var(--night-2);
  --asphalt-line: var(--night-line);
  --concrete: var(--bg);
  --paper: var(--surface);
  --plate-press: var(--plate-hover);
  --focus: var(--ink);

  --font: "Rubik", "Segoe UI", "Open Sans", Arial, sans-serif;
  --font-display: var(--font);
  --font-body: var(--font);

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 32px;
  --shadow-1: 0 1px 2px rgba(17, 20, 26, .06);
  --shadow-2: 0 14px 34px -16px rgba(17, 20, 26, .32);
  --shadow-3: 0 28px 64px -24px rgba(17, 20, 26, .4);

  --wrap: 1280px;
  --gutter: 24px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.h1, .h2 { font-weight: 800; letter-spacing: -.02em; }
.h1 { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.125rem); line-height: 1.06; }
.h2 { font-size: clamp(1.625rem, 1.2rem + 1.3vw, 2.25rem); line-height: 1.12; }
.h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }

.pre { white-space: pre-line; }
.prose { max-width: 66ch; }
.muted { color: var(--ink-3); }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100;
  padding: 10px 16px; font-weight: 600; color: var(--on-plate); background: var(--plate); border-radius: 999px;
}
.skip:focus { top: 12px; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- icons ---------- */
.i {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.i .i-fill { fill: currentColor; stroke: none; }

/* ---------- the plate logo ---------- */
.plate {
  display: inline-flex;
  align-items: stretch;
  font-family: var(--font);
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--plate-text, #000);
  background: var(--plate);
  border: .09em solid #000;
  border-radius: .24em;
  box-shadow: inset 0 0 0 .07em var(--plate), inset 0 0 0 .11em rgba(0, 0, 0, .65);
  overflow: hidden;
  white-space: nowrap;
  vertical-align: middle;
}
.plate__band {
  display: flex; align-items: flex-end; justify-content: center;
  min-width: 1.15em;
  padding: 0 .16em .14em;
  font-size: max(9px, .4em);
  font-weight: 700;
  letter-spacing: .05em;
  color: #fff;
  background: var(--plate-blue);
}
.plate__text { padding: .26em .55em .22em; }
.plate--sm { font-size: 17px; }
.plate--lg { font-size: 40px; }

/* ---------- price ---------- */
.price {
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 1.1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.price--lg { font-size: clamp(1.875rem, 1.5rem + 1vw, 2.375rem); font-weight: 800; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: 48px;
  padding: .5em 1.4em;
  font: 600 1rem/1.2 var(--font);
  text-align: center;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; }
.btn .i { width: 1.2em; height: 1.2em; }
.btn--plate { color: var(--on-plate); background: var(--plate); }
.btn--plate:hover { background: var(--plate-hover); }
.btn--dark { color: #fff; background: var(--night); }
.btn--dark:hover { background: #2a313c; }
.btn--ghost { color: var(--ink); background: var(--surface); border-color: var(--line-strong); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--wa { color: #fff; background: var(--wa); }
.btn--wa:hover { background: var(--wa-hover); }
.btn--danger { color: #fff; background: var(--bad); }
.btn--danger:hover { background: #a22f23; }
.btn--sm { min-height: 40px; padding: .35em 1.05em; font-size: .9375rem; }
.btn--lg { min-height: 56px; padding: .5em 1.8em; font-size: 1.0625rem; }
.btn--block { width: 100%; }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; padding: 0;
  color: inherit; background: transparent;
  border: 0; border-radius: 50%;
  cursor: pointer;
}
.iconbtn:hover { background: var(--fill); }

.linkbtn {
  display: inline-flex; align-items: center; gap: .45em;
  padding: .3em 0;
  font: 500 .9375rem/1.3 var(--font);
  color: var(--link);
  text-decoration: none;
  background: none; border: 0;
  cursor: pointer;
}
.linkbtn:hover { text-decoration: underline; }

/* ---------- forms ---------- */
.form { display: grid; gap: 18px; }
.form__row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.field { display: grid; gap: 7px; align-content: start; margin: 0; padding: 0; border: 0; min-width: 0; }
.field__label { padding: 0; font-size: .875rem; font-weight: 600; color: var(--ink); }
.field__label small { font-size: inherit; font-weight: 400; color: var(--ink-3); }
.field__hint { margin: -6px 0 0; font-size: .875rem; color: var(--ink-3); }
.field__error { margin: 0; font-size: .875rem; font-weight: 600; color: var(--bad); }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%;
  min-height: 48px;
  padding: .6em .95em;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink);
  background-color: var(--fill);
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):hover, select:hover, textarea:hover { background-color: var(--fill-2); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):focus, select:focus, textarea:focus {
  outline: none;
  background-color: var(--surface);
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(255, 196, 0, .4);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
textarea { min-height: 120px; resize: vertical; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-inline-end: 2.4em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A515E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 18px;
  background-position: left .85em center;
  cursor: pointer;
}
select:disabled { color: var(--ink-3); cursor: not-allowed; opacity: .7; }
.is-invalid input, .is-invalid select, .is-invalid textarea { border-color: var(--bad); background-color: var(--bad-soft); }

input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 0; accent-color: var(--night); }

/* segmented switch */
.seg {
  display: inline-flex;
  margin: 0; padding: 4px;
  background: var(--fill);
  border: 0;
  border-radius: 999px;
}
.seg label { position: relative; display: block; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.seg span {
  display: block;
  padding: .5em 1.15em;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  border-radius: 999px;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg input:checked + span { color: var(--ink); background: var(--surface); box-shadow: 0 1px 3px rgba(17, 20, 26, .16); }
.seg input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 1px; }

/* ---------- badges & status pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .32em .75em;
  font-size: .8125rem; font-weight: 600; line-height: 1.2;
  color: var(--ink);
  background: var(--surface);
  border-radius: 999px;
}
.badge--new { color: var(--on-plate); background: var(--plate); }
.badge--warn { color: #fff; background: var(--warn); }
.badge--dark { color: #fff; background: rgba(21, 25, 31, .78); }

.pill {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .2em .7em;
  font-size: .8125rem; font-weight: 600; line-height: 1.5;
  color: var(--ink-2);
  background: var(--fill);
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before { content: ""; width: .5em; height: .5em; background: currentColor; border-radius: 50%; }
.pill--available { color: var(--ok); background: var(--ok-soft); }
.pill--reserved { color: var(--warn); background: var(--warn-soft); }
.pill--sold { color: var(--ink-3); background: var(--fill); }

/* ---------- notices & toasts ---------- */
.notice {
  margin: 0 0 14px;
  padding: 12px 16px;
  font-weight: 500;
  color: #6b3605;
  background: var(--warn-soft);
  border-radius: var(--r-sm);
}
.notice--sold { color: var(--ink); background: var(--fill); }
.notice--info { color: #183f7d; background: #e7eefb; }

.toasts {
  position: fixed; top: 88px; inset-inline: 0; z-index: 80;
  display: grid; justify-items: center; gap: 10px;
  padding-inline: 16px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: 540px;
  padding: 12px 12px 12px 10px;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3), 0 0 0 1px rgba(17, 20, 26, .05);
  animation: toast-in .25s ease-out;
}
.toast > .i {
  width: 34px; height: 34px; padding: 7px;
  color: var(--ok); background: var(--ok-soft);
  border-radius: 50%;
}
.toast--error > .i { color: var(--bad); background: var(--bad-soft); }
.toast p { flex: 1; margin: 0; font-weight: 500; }
.toast__close {
  display: grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  color: var(--ink-3); background: none;
  border: 0; border-radius: 50%;
  cursor: pointer;
}
.toast__close:hover { color: var(--ink); background: var(--fill); }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* ---------- lists ---------- */
.checks { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.checks li { display: flex; align-items: flex-start; gap: 12px; }
.checks .i {
  width: 26px; height: 26px; padding: 5px; margin-top: -1px;
  stroke-width: 2.6; color: var(--on-plate); background: var(--plate);
  border-radius: 50%;
}
.checks--cols { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); column-gap: 24px; }

/* key facts with icons (cards & vehicle page) */
.facts { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 9px 12px; margin: 0; padding: 0; list-style: none; }
.facts li { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: .9375rem; color: var(--ink-2); }
.facts .i { width: 18px; height: 18px; color: var(--icon, var(--ink-3)); }
.facts span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-delay: 0s !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
