/* Автодокументи — основни стилове. Без външни зависимости и шрифтове. */

:root {
  --navy: #0E2747;
  --navy-2: #163A66;
  --blue: #1F5BD6;
  --blue-dark: #1748AB;
  --blue-soft: #E9F0FD;
  --ink: #13233A;
  --muted: #56667C;
  --line: #DCE3EE;
  --surface: #F4F7FB;
  --white: #FFFFFF;

  --ok: #157A45;      --ok-bg: #E5F4EC;
  --warn: #A85A06;    --warn-bg: #FDF0DF;
  --bad: #B42318;     --bad-bg: #FDECEA;
  --none: #5B6474;    --none-bg: #EEF1F5;
  --manual: #1F5BD6;  --manual-bg: #E9F0FD;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Ubuntu, Arial, sans-serif;
  --font-plate: "DIN Condensed", "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--white);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

img, svg { max-width: 100%; }
a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-dark); }
h1, h2, h3 { color: var(--navy); line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
code { font-size: .92em; background: var(--surface); padding: .1em .35em; border-radius: 4px; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

.skip-link { position: absolute; left: -9999px; top: 0; background: var(--navy); color: #fff; padding: 8px 12px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

.icon { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
.icon-lg { width: 32px; height: 32px; color: var(--blue); }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: var(--white); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--navy); font-weight: 700; font-size: 1.1rem; }
.brand-mark { display: inline-flex; align-items: flex-end; justify-content: center; width: 26px; height: 34px; background: var(--blue); border-radius: 4px; padding-bottom: 4px; }
.brand-mark span { color: #fff; font-size: .62rem; font-weight: 700; letter-spacing: .02em; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.site-nav a, .linklike { color: var(--muted); text-decoration: none; padding: 8px 10px; border-radius: var(--radius-sm); font-size: .95rem; }
.site-nav a:hover, .linklike:hover { color: var(--navy); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--navy); font-weight: 600; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.inline-form { display: inline; margin: 0; }

/* ---------- Hero ---------- */
.hero { padding: 48px 0 40px; background: linear-gradient(180deg, var(--surface) 0%, var(--white) 100%); border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); letter-spacing: -0.015em; max-width: 18ch; }
.lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 52ch; margin-bottom: 28px; }

.plate-form { max-width: 720px; }
.plate-label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--navy); }
.plate-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* Регистрационна табела */
.plate {
  flex: 1 1 340px;
  display: flex;
  align-items: stretch;
  min-height: 76px;
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: 9px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(14, 39, 71, .08), 0 8px 24px -12px rgba(14, 39, 71, .35);
  transition: border-color .15s;
}
.plate:focus-within { border-color: var(--blue); }
.plate.has-error { border-color: var(--bad); }
.plate-band {
  flex: none; width: 52px; background: #0039A6;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 8px 0 7px;
}
.plate-stars { width: 30px; height: 30px; }
.plate-country { color: #fff; font-weight: 700; font-size: .95rem; letter-spacing: .04em; }
.plate-input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  font-family: var(--font-plate); font-weight: 700; font-stretch: condensed;
  font-size: clamp(1.9rem, 6vw, 2.6rem); letter-spacing: .08em; text-transform: uppercase;
  color: #111827; padding: 0 16px;
}
.plate-input::placeholder { font-family: var(--font); font-weight: 400; font-size: 1.05rem; letter-spacing: 0; text-transform: none; color: #8A96A8; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border-radius: var(--radius-sm); border: 2px solid transparent; padding: 10px 18px; line-height: 1.2;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-ghost { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); }
.btn[disabled] { opacity: .7; cursor: progress; }

.btn-check { flex: 0 1 auto; min-height: 76px; padding: 0 28px; font-size: 1.1rem; border-radius: 9px; }
.spinner { display: none; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.is-loading .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.plate-hint { color: var(--muted); font-size: .92rem; margin: 10px 0 0; }
.form-error { color: var(--bad); font-weight: 600; margin: 8px 0 0; }
.privacy-note { color: var(--muted); font-size: .85rem; margin: 14px 0 0; }

/* ---------- Results ---------- */
.results-section { padding: 36px 0 44px; background: var(--surface); border-bottom: 1px solid var(--line); outline: none; }
.results-head h2 { font-size: 1.5rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.plate-chip { font-family: var(--font-plate); font-weight: 700; letter-spacing: .08em; background: var(--white); border: 2px solid var(--navy); border-left: 10px solid #0039A6; border-radius: 6px; padding: 2px 12px; color: #111827; }
.results-meta { color: var(--muted); max-width: 70ch; }
.results-warn { display: flex; gap: 8px; color: var(--warn); background: var(--warn-bg); padding: 10px 12px; border-radius: var(--radius-sm); max-width: 70ch; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; margin-top: 18px; }

.card {
  --tone: var(--none); --tone-bg: var(--none-bg);
  background: var(--white); border: 1px solid var(--line); border-top: 5px solid var(--tone);
  border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.card.is-valid    { --tone: var(--ok);     --tone-bg: var(--ok-bg); }
.card.is-expiring { --tone: var(--warn);   --tone-bg: var(--warn-bg); }
.card.is-expired  { --tone: var(--bad);    --tone-bg: var(--bad-bg); }
.card.is-nodata   { --tone: var(--none);   --tone-bg: var(--none-bg); }
.card.is-manual   { --tone: var(--manual); --tone-bg: var(--manual-bg); }

.card-head { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon title" "pill pill"; align-items: center; column-gap: 10px; row-gap: 10px; }
.card-icon { grid-area: icon; display: inline-flex; width: 38px; height: 38px; align-items: center; justify-content: center; border-radius: 8px; background: var(--surface); color: var(--navy); }
.card-icon .icon { width: 22px; height: 22px; }
.card-head h3 { grid-area: title; margin: 0; font-size: 1.15rem; }
.status-pill { grid-area: pill; justify-self: start; font-weight: 700; font-size: .95rem; color: var(--tone); background: var(--tone-bg); padding: 4px 12px; border-radius: 999px; }

.mode { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; margin: 0; color: var(--muted); }
.mode-auto { color: var(--ok); }
.card.is-nodata .mode-auto { color: var(--muted); }
.mode-manual { color: var(--manual); }
.card-text { margin: 0; color: var(--ink); }

.facts { margin: 0; display: grid; gap: 8px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }
.facts .days { color: var(--tone); }

.copy-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; }
.copy-label { font-size: .85rem; color: var(--muted); width: 100%; }
.copy-value { font-family: var(--font-plate); font-weight: 700; font-size: 1.3rem; letter-spacing: .08em; background: none; padding: 0; color: #111827; user-select: all; }
.copy-btn { margin-left: auto; padding: 6px 12px; font-size: .9rem; }
.copy-btn.is-copied { border-color: var(--ok); color: var(--ok); }

.card-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.meta { margin: 0; font-size: .85rem; color: var(--muted); display: grid; gap: 2px; }
.meta div { display: block; }
.meta dt, .meta dd { display: inline; }
.meta dt::after { content: ": "; }
.meta dd { margin: 0; color: var(--ink); }
.btn-official { width: 100%; }

.results-foot { color: var(--muted); font-size: .9rem; margin: 18px 0 0; }

/* Skeleton при зареждане */
.skeleton .card { min-height: 280px; border-top-color: var(--line); }
.skeleton .bar { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface) 25%, #e6ebf3 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .bar.w60 { width: 60%; } .skeleton .bar.w40 { width: 40%; } .skeleton .bar.w80 { width: 80%; } .skeleton .bar.tall { height: 40px; margin-top: auto; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Explain / how ---------- */
.explain { padding: 52px 0 24px; }
.explain h2, .how h2 { font-size: 1.5rem; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; margin-top: 18px; }
.check-item h3 { font-size: 1.1rem; margin-top: 10px; }
.check-item p { color: var(--muted); margin-bottom: .5em; }
.check-source { font-size: .88rem; }

.how { padding: 32px 0 60px; }
.how-grid { display: grid; grid-template-columns: 1fr; gap: 32px; }
@media (min-width: 860px) { .how-grid { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.steps { padding: 0; margin: 0; list-style: none; counter-reset: s; display: grid; gap: 16px; }
.steps li { counter-increment: s; position: relative; padding-left: 48px; color: var(--muted); }
.steps li strong { color: var(--navy); display: block; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--blue); color: var(--blue); font-weight: 700; display: flex; align-items: center; justify-content: center; }
.honest-box { background: var(--navy); color: #DCE6F5; border-radius: var(--radius); padding: 24px; }
.honest-box h2 { color: #fff; font-size: 1.25rem; }
.honest-box p:last-child { margin-bottom: 0; }

/* ---------- Content pages ---------- */
.page { padding: 44px 0 64px; }
.prose h1 { font-size: clamp(1.7rem, 3.6vw, 2.3rem); }
.prose h2 { font-size: 1.25rem; margin-top: 1.6em; }
.prose p, .prose li { max-width: 72ch; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }
.updated { color: var(--muted); }
.legend { list-style: none; padding: 0 !important; }
.legend li { display: flex; align-items: center; gap: 10px; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot.is-valid { background: var(--ok); } .dot.is-expiring { background: var(--warn); } .dot.is-expired { background: var(--bad); } .dot.is-nodata { background: var(--none); } .dot.is-manual { background: var(--manual); }
.contact-list div { display: flex; gap: 10px; }
.contact-list dt { color: var(--muted); min-width: 80px; }
.contact-list dd { margin: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #C3D0E3; padding: 44px 0 20px; font-size: .93rem; }
.site-footer a { color: #fff; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand, .footer-head { color: #fff; font-weight: 700; margin-bottom: .6em; }
.footer-note { font-size: .85rem; color: #9FB0C9; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 16px; font-size: .85rem; }
.footer-bottom p { margin: 0; }

/* ---------- Mobile ---------- */
@media (max-width: 560px) {
  .hero { padding: 32px 0 28px; }
  .plate { flex-basis: 100%; min-height: 68px; }
  .btn-check { width: 100%; min-height: 56px; }
  .plate-band { width: 44px; }
  .plate-stars { width: 26px; height: 26px; }
  .site-nav a { padding: 6px 8px; font-size: .9rem; }
  .facts div { flex-direction: column; gap: 0; }
  .facts dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .site-header, .site-footer, .hero, .explain, .how, .btn-official, .copy-btn { display: none !important; }
  .results-section { background: none; }
}

.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.card-foot .meta { margin: 0; }
span.icon-lg { display: inline-flex; width: 32px; height: 32px; color: var(--blue); }
span.icon-lg .icon { width: 32px; height: 32px; }

/* VIN */
.vin-section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.vin-form { max-width: 720px; }
.vin-label { display: block; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.vin-row { display: flex; gap: 12px; flex-wrap: wrap; }
.vin-input { flex: 1 1 320px; min-width: 0; font: inherit; font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 1.15rem; letter-spacing: .06em; text-transform: uppercase; padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: var(--white); }
.vin-input::placeholder { font-family: var(--font); font-size: 1rem; letter-spacing: 0; text-transform: none; color: #8A96A8; }
.vin-input:focus { border-color: var(--blue); outline: none; }
.vin-input.has-error { border-color: var(--bad); }
.btn-vin { min-height: 52px; }
.cards-single { grid-template-columns: minmax(0, 520px); }
.vin-chip { border-left-width: 2px; font-size: .85em; letter-spacing: .04em; }
.vin-value { font-size: 1.05rem; letter-spacing: .04em; word-break: break-all; }
@media (max-width: 560px) { .btn-vin { width: 100%; } }
