/* ============================================================
   CARCHECKER — custom stylesheet
   No build step. System fonts. No external dependencies.
   ============================================================ */

/* === RESET ================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; }

/* === DESIGN TOKENS ========================================= */
:root {
  --navy:        #0B1F3A;
  --navy-hover:  #132d52;
  --yellow:      #FFC500;
  --yellow-dark: #E6B000;

  --surface:     #F2F4F7;
  --card:        #ffffff;
  --border:      #e2e8f0;
  --border-mid:  #cbd5e1;

  --text:        #1e293b;
  --muted:       #64748b;
  --subtle:      #94a3b8;

  --pass-bg:   #dcfce7;  --pass:   #15803d;
  --fail-bg:   #fee2e2;  --fail:   #dc2626;
  --warn-bg:   #fef3c7;  --warn:   #b45309;
  --info-bg:   #dbeafe;  --info:   #1d4ed8;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 2px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1),  0 2px 6px rgba(0,0,0,.06);
}

/* === BASE ================================================== */
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  background: var(--surface);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* === LAYOUT ================================================ */
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* === NAVIGATION ============================================ */
.nav {
  background: var(--navy);
  padding: .875rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.nav__inner {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav__logo {
  color: var(--yellow);
  font-weight: 800;
  font-size: 1.0625rem;
  text-decoration: none;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.nav__logo:hover { color: #ffe066; }
.nav__back {
  color: rgba(255,255,255,.55);
  font-size: .875rem;
  text-decoration: none;
  transition: color .15s;
}
.nav__back:hover { color: rgba(255,255,255,.9); }

/* === FEATURES SECTION (index) ============================== */
.features {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 3.5rem 1rem 4rem;
}
.features__inner {
  max-width: 820px;
  margin: 0 auto;
}
.features__heading {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--subtle);
  text-align: center;
  margin-bottom: 2.25rem;
}
.features__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem 2.5rem;
}
.feature {
  border-top: 3px solid var(--yellow);
  padding-top: .875rem;
}
.feature__title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .3rem;
  letter-spacing: -.01em;
}
.feature__desc {
  font-size: .8125rem;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 600px) {
  .features { padding: 2.5rem 1rem 3rem; }
  .features__grid { grid-template-columns: 1fr 1fr; gap: 1.5rem 1.25rem; }
}
@media (max-width: 380px) {
  .features__grid { grid-template-columns: 1fr; }
}

/* === HERO SECTION ========================================== */
.hero {
  background: var(--navy);
  padding: 4.5rem 1rem 5.5rem;
  text-align: center;
}
.hero__title {
  color: #fff;
  font-size: clamp(1.75rem, 6vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -.04em;
  line-height: 1;
  margin-bottom: .5rem;
}
.hero__title em {
  color: var(--yellow);
  font-style: normal;
}
.hero__sub {
  color: rgba(255,255,255,.55);
  font-size: 1.0625rem;
  margin-bottom: 2.5rem;
  font-weight: 400;
}

/* === SEARCH FORM =========================================== */
.search-form {
  display: flex;
  gap: .5rem;
  justify-content: center;
  align-items: stretch;
  max-width: 430px;
  margin: 0 auto 1rem;
}

/* UK number plate input */
.plate-input {
  background: var(--yellow);
  border: 3.5px solid #1a1a1a;
  border-radius: var(--radius-sm);
  padding: .6rem .875rem;
  font-family: "Charles Wright", "FE-Schrift", "Mandatory", "Arial Black",
               "Impact", monospace;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
  color: #1a1a1a;
  width: 13ch;
  min-width: 0;
  transition: box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
.plate-input::placeholder {
  color: rgba(26,26,26,.3);
  letter-spacing: .1em;
}
.plate-input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255,255,255,.5), 0 0 0 5px var(--yellow);
}

/* === BUTTONS =============================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  padding: .75rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, opacity .15s, transform .1s;
  line-height: 1;
  -webkit-appearance: none;
  appearance: none;
}
.btn:active { transform: scale(.97); }

.btn--light {
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.2);
}
.btn--light:hover { background: rgba(255,255,255,.2); }

.btn--primary {
  background: var(--navy);
  color: #fff;
}
.btn--primary:hover { background: var(--navy-hover); }

/* Loading state (HTMX) */
.htmx-request .btn--primary { opacity: .65; pointer-events: none; }
.btn-spinner { display: none; }
.htmx-request .btn-text { display: none; }
.htmx-request .btn-spinner { display: inline; }

/* === ERROR BAR ============================================= */
.error-bar {
  background: var(--fail-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  color: var(--fail);
  font-size: .875rem;
  font-weight: 500;
  padding: .625rem 1rem;
  margin: .5rem auto 0;
  max-width: 430px;
  text-align: center;
  animation: slideDown .2s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
[hidden] { display: none !important; }

/* === PAGE BODY ============================================= */
.page {
  padding: 2rem 1rem 5rem;
  min-height: calc(100vh - 56px);
}

/* === UK PLATE DISPLAY (vehicle page) ======================= */
.plate-display {
  display: inline-block;
  background: var(--yellow);
  border: 3.5px solid #1a1a1a;
  border-radius: var(--radius-sm);
  padding: .375rem 1.125rem;
  font-family: "Charles Wright", "FE-Schrift", "Mandatory", "Arial Black",
               "Impact", monospace;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: .1em;
  color: #1a1a1a;
  line-height: 1.25;
  flex-shrink: 0;
}

/* === VEHICLE HEADER ======================================== */
.vehicle-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.vehicle-header__meta { min-width: 0; }
.vehicle-header__title {
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.015em;
  line-height: 1.2;
}
.vehicle-header__year {
  font-size: .875rem;
  color: var(--muted);
  margin-top: .2rem;
  font-weight: 500;
}

/* === CARDS ================================================= */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.375rem 1.5rem;
  margin-bottom: .875rem;
}
.card__title {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: 1.125rem;
}

/* === DETAIL GRID =========================================== */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem 2rem;
}
.detail-item__label {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .25rem;
}
.detail-item__value {
  font-size: .9375rem;
  color: var(--text);
  font-weight: 500;
}

/* === STATUS GRID =========================================== */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.status-item__label {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: .5rem;
}
.status-item__date {
  font-size: .8125rem;
  color: var(--muted);
  margin-top: .35rem;
}

/* === BADGES ================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .6875rem;
  font-weight: 800;
  letter-spacing: .06em;
  padding: .3rem .7rem;
  border-radius: 999px;
  text-transform: uppercase;
  line-height: 1;
}
.badge::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.badge--pass    { background: var(--pass-bg); color: var(--pass); }
.badge--fail    { background: var(--fail-bg); color: var(--fail); }
.badge--warn    { background: var(--warn-bg); color: var(--warn); }
.badge--neutral { background: #f1f5f9;        color: var(--muted); }

/* === MILEAGE GRAPH ========================================= */
.mileage-graph {
  margin: 0 -.25rem;
}

/* === MOT HISTORY TIMELINE ================================== */
.mot-list { display: flex; flex-direction: column; gap: .625rem; }

.mot-test {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border-left-width: 4px;
}
.mot-test--pass { border-left-color: var(--pass); }
.mot-test--fail { border-left-color: var(--fail); }

.mot-test__summary {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  cursor: pointer;
  user-select: none;
  list-style: none;
  transition: background .12s;
}
.mot-test__summary::-webkit-details-marker { display: none; }
.mot-test__summary:hover { background: #f8fafc; }

.mot-test__date {
  font-weight: 600;
  font-size: .9375rem;
  color: var(--text);
}
.mot-test__odometer {
  margin-left: auto;
  font-size: .8125rem;
  color: var(--muted);
  font-feature-settings: "tnum";
}
.mot-test__chevron {
  color: var(--subtle);
  font-size: .75rem;
  flex-shrink: 0;
  transition: transform .2s;
}
details[open] .mot-test__chevron { transform: rotate(180deg); }

.mot-test__body {
  padding: 0 1rem .875rem;
  border-top: 1px solid var(--border);
}
.mot-test__expiry {
  font-size: .8125rem;
  color: var(--muted);
  padding: .625rem 0 .5rem;
}
.mot-no-defects {
  font-size: .8125rem;
  color: var(--subtle);
  padding-top: .5rem;
}

/* === DEFECT LIST =========================================== */
.defect-list { display: flex; flex-direction: column; gap: .375rem; }

.defect {
  display: flex;
  gap: .625rem;
  align-items: flex-start;
  font-size: .8125rem;
  line-height: 1.45;
}
.defect__type {
  display: inline-block;
  font-size: .625rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .175rem .45rem;
  border-radius: 3px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: .1rem;
}
.defect--dangerous .defect__type,
.defect--fail      .defect__type { background: #fecaca; color: #991b1b; }
.defect--major     .defect__type { background: #fed7aa; color: #92400e; }
.defect--minor     .defect__type { background: #fef08a; color: #713f12; }
.defect--advisory  .defect__type { background: var(--info-bg); color: var(--info); }
.defect            .defect__type { background: #f1f5f9; color: var(--muted); }
.defect__text { color: var(--text); }

/* === EMPTY STATE =========================================== */
.empty {
  font-size: .875rem;
  color: var(--muted);
  padding: .25rem 0;
}

/* === FOOTER ================================================ */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: .8125rem;
  color: var(--subtle);
}
.footer__links {
  margin-top: .5rem;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
}
.footer__links a {
  color: var(--subtle);
  text-decoration: none;
}
.footer__links a:hover { color: var(--muted); text-decoration: underline; }

/* === LEGAL PAGES =========================================== */
.legal-header {
  background: var(--navy);
  padding: 2.5rem 1rem 2.75rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.legal-header__inner {
  max-width: 820px;
  margin: 0 auto;
}
.legal-header__title {
  color: #fff;
  font-size: 1.75rem;
  font-weight: 900;
  letter-spacing: -.025em;
  line-height: 1.1;
  margin-bottom: .4rem;
}
.legal-header__meta {
  color: rgba(255,255,255,.4);
  font-size: .8125rem;
}

.legal-body {
  padding: 1.75rem 1rem 5rem;
  max-width: 820px;
  margin: 0 auto;
}

.legal-section {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}
.legal-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.legal-section h2 {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--subtle);
  margin-bottom: .75rem;
}
.legal-section p,
.legal-section li {
  font-size: .9375rem;
  line-height: 1.65;
  color: var(--text);
  margin-bottom: .5rem;
}
.legal-section p:last-child,
.legal-section li:last-child { margin-bottom: 0; }
.legal-section ul {
  padding-left: 1.375rem;
  margin-bottom: .5rem;
}
.legal-section a { color: var(--navy); }
.legal-section a:hover { opacity: .7; }

/* === RESPONSIVE ============================================ */
@media (max-width: 600px) {
  .hero { padding: 2.75rem 1rem 3.5rem; }

  .search-form {
    flex-direction: column;
    align-items: center;
  }
  .plate-input { width: 100%; max-width: 320px; }
  .btn--light   { width: 100%; max-width: 320px; }

  .vehicle-header { gap: .875rem; }
  .plate-display  { font-size: 1.5rem; }

  .status-grid   { grid-template-columns: 1fr 1fr; }
  .detail-grid   { grid-template-columns: 1fr 1fr; }
  .card          { padding: 1.125rem 1.125rem; }

  .mot-test__odometer { display: none; }
}

@media (max-width: 380px) {
  .status-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
