/* Self-hosted fonts (SIL OFL, see fonts/*-LICENSE.txt). Latin subset only. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url(fonts/inter-latin.woff2) format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(fonts/jetbrains-mono-700-latin.woff2) format("woff2");
}

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f4;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #e11d48;
  --accent-ink: #ffffff;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --bad: #e11d48;
  --bad-bg: #fff1f2;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --plate-blue: #003399;
  --shadow: 0 1px 2px rgb(15 23 42 / .04), 0 8px 24px rgb(15 23 42 / .06);
  --radius: 18px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020;
    --surface: #131a2e;
    --surface-2: #1b2340;
    --text: #e5e9f5;
    --muted: #8b95b0;
    --border: #232c4a;
    --ok: #34d399;
    --ok-bg: rgb(52 211 153 / .1);
    --bad: #fb7185;
    --bad-bg: rgb(251 113 133 / .1);
    --warn: #fbbf24;
    --warn-bg: rgb(251 191 36 / .1);
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #131a2e;
  --surface-2: #1b2340;
  --text: #e5e9f5;
  --muted: #8b95b0;
  --border: #232c4a;
  --ok: #34d399;
  --ok-bg: rgb(52 211 153 / .1);
  --bad: #fb7185;
  --bad-bg: rgb(251 113 133 / .1);
  --warn: #fbbf24;
  --warn-bg: rgb(251 191 36 / .1);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Brand */
.brand h1 {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.05em;
  line-height: 1;
}
.brand h1 span { color: var(--accent); }
.brand p { margin: 10px 0 8px; color: var(--muted); max-width: 42ch; }

/* Search: input styled like a Norwegian licence plate */
.search { display: flex; gap: 10px; }
.plate {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-width: 0;
  background: #fff;
  border: 3px solid #111;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.plate:focus-within { box-shadow: 0 0 0 4px rgb(225 29 72 / .25), var(--shadow); }
.plate__eu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  width: 34px;
  padding: 6px 0 5px;
  background: var(--plate-blue);
  color: #fff;
  font-weight: 700;
  font-size: .8rem;
}
.plate__flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  /* Norwegian flag */
  background:
    linear-gradient(90deg, transparent 6px, #00205b 6px 8px, transparent 8px),
    linear-gradient(0deg, transparent 6px, #00205b 6px 8px, transparent 8px),
    linear-gradient(90deg, transparent 5px, #fff 5px 9px, transparent 9px),
    linear-gradient(0deg, transparent 5px, #fff 5px 9px, transparent 9px),
    #ba0c2f;
}
.plate input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 10px 14px;
  background: transparent;
  color: #111;
  font: 700 clamp(1.5rem, 7vw, 2rem)/1.2 "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.plate input::placeholder { color: #c4c9d4; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .1s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn--primary {
  padding: 0 24px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 1.05rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgb(225 29 72 / .3);
}
.btn--primary:hover { background: #be123c; }
.btn--danger { background: var(--bad); border-color: transparent; color: #fff; }
.btn:focus-visible, .link:focus-visible, summary:focus-visible { outline: 3px solid rgb(225 29 72 / .45); outline-offset: 2px; }

.hint { margin: -6px 2px 0; min-height: 1.2em; font-size: .85rem; color: var(--warn); }

.recent { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 0; padding: 0; list-style: none; }
.recent:empty { display: none; }
.recent button {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 700 .8rem "JetBrains Mono", ui-monospace, monospace;
  cursor: pointer;
}
.recent button:hover { color: var(--text); }

/* Cards */
.vehicle, .summary, .row, .about {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.vehicle { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; }
.vehicle small { display: block; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.vehicle strong { font-size: 1.05rem; }
.vehicle .meta { color: var(--muted); font-size: .85rem; text-align: right; }

.summary { padding: 18px 20px; display: flex; gap: 14px; align-items: center; animation: rise .3s ease-out; }
.summary__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 800;
}
.summary h2 { margin: 0; font-size: 1.1rem; }
.summary p { margin: 2px 0 0; color: var(--muted); font-size: .9rem; }
.summary[data-tone="ok"] .summary__icon { background: var(--ok-bg); color: var(--ok); }
.summary[data-tone="bad"] { border-color: var(--bad); }
.summary[data-tone="bad"] .summary__icon { background: var(--bad-bg); color: var(--bad); }
.summary[data-tone="warn"] .summary__icon { background: var(--warn-bg); color: var(--warn); }

/* Provider rows */
.results { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 14px 18px;
  animation: rise .25s ease-out both;
}
.row__main { min-width: 0; }
.row__name { display: block; font-weight: 700; }
.row__hint { display: block; color: var(--muted); font-size: .8rem; }
.row__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}
.row__items, .row__action { grid-column: 1 / -1; }
.row__items { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.row__items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bad-bg);
  font-size: .88rem;
}
.row__items li span:first-child { min-width: 0; overflow-wrap: anywhere; }
.row__items li b { white-space: nowrap; }
.row__action { margin-top: 8px; justify-self: start; }

.row[data-state="clear"] .row__status { background: var(--ok-bg); color: var(--ok); }
.row[data-state="clear"] { opacity: .8; }
.row[data-state="found"] { border-color: var(--bad); }
.row[data-state="found"] .row__status { background: var(--bad); color: #fff; }
.row[data-state="error"] .row__status,
.row[data-state="manual"] .row__status { background: var(--warn-bg); color: var(--warn); }
.row[data-state="clear"] .spinner,
.row[data-state="found"] .spinner,
.row[data-state="error"] .spinner,
.row[data-state="manual"] .spinner { display: none; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.local { margin: -4px 4px 0; color: var(--muted); font-size: .8rem; }
.local a { color: var(--text); font-weight: 600; }
.nowrap { white-space: nowrap; }

.notfound .btn { padding: 14px 24px; }

/* About + footer */
.about { padding: 4px 18px; margin-top: 8px; }
.about summary { padding: 12px 0; font-weight: 600; cursor: pointer; }
.about p { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: .8rem; padding: 0 4px; }
.link { border: 0; background: none; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 420px) {
  .shell { padding-top: 32px; }
  .btn--primary { padding: 0 16px; }
}

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