/* The one stylesheet. Phone first: the plain rules are the phone's, and the
   print rules at the foot put it on paper. */

:root {
  --ink: #1c1f23;
  --soft: #5b636c;
  --line: #d9dde1;
  --paper: #ffffff;
  --page: #f4f5f6;
  --accent: #1d4f91;
  --on-accent: #ffffff;
  --bad: #a3261b;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eceef0;
    --soft: #a3abb3;
    --line: #3a4046;
    --paper: #1e2125;
    --page: #15171a;
    --accent: #8fb8ee;
    --on-accent: #10151b;
    --bad: #f0938a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 1.0625rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-wrap: anywhere;
}

header, main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}

/* The cars and the drivers: under the name on a phone, beside it on a wider
   screen. */
.site-links { display: flex; flex-basis: 100%; order: 2; gap: 1.5rem; }
.site-links a { padding: 0.375rem 0; font-weight: 600; text-decoration: none; }

h1 { margin: 0.5rem 0 1rem; font-size: 1.5rem; line-height: 1.25; }
h2 { margin: 2rem 0 0.75rem; font-size: 1.125rem; line-height: 1.25; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }

.site { color: inherit; font-size: 1.25rem; font-weight: 700; text-decoration: none; }
.signed-in { display: flex; align-items: center; gap: 0.75rem; color: var(--soft); }
.error { color: var(--bad); }

label { display: block; margin-bottom: 0.25rem; font-weight: 600; }
label + .error { margin-bottom: 0.25rem; }

/* 1rem or more in a box, or an iPhone zooms the page when it is tapped. */
input, select, textarea {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--paper);
  color: inherit;
  font: inherit;
}

input[type="checkbox"] { width: 1.25rem; height: 1.25rem; margin: 0; }
label.tick { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; font-weight: 400; }

button {
  min-height: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

main button { width: 100%; margin-bottom: 1rem; }

a.button {
  display: block;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--accent);
  border-radius: 0.5rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

button.quiet {
  padding: 0.25rem 0.75rem;
  border-color: var(--line);
  background: transparent;
  color: inherit;
  font-weight: 400;
}

section { margin-bottom: 2rem; }

/* A quiet line, such as the way to the earlier cars. */
.soft, .soft a { color: var(--soft); }
.gone { padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--paper); font-weight: 600; }
.lines { white-space: pre-line; }

/* The same on a light page and a dark one, as a plate is. */
.plate {
  display: inline-block;
  padding: 0 0.5rem;
  border: 1px solid #8a7410;
  border-radius: 0.25rem;
  background: #f5d33b;
  color: #14120a;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.cars, .photos { margin: 0 0 1.5rem; padding: 0; list-style: none; }

.cars li { margin-bottom: 0.75rem; }
.cars a {
  display: grid;
  grid-template-columns: 7rem 1fr;
  grid-template-rows: 1fr auto auto 1fr;
  column-gap: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
}
.cars .thumb { grid-row: 1 / -1; width: 7rem; height: 5.25rem; }
.cars .car-name { grid-column: 2; grid-row: 2; padding-right: 0.75rem; font-weight: 600; }
.cars .plate { grid-column: 2; grid-row: 3; justify-self: start; }

.thumb { display: block; background: var(--line); object-fit: cover; }
.main-photo {
  display: block;
  width: 100%;
  max-height: 70vh;
  border-radius: 0.5rem;
  background: var(--line);
  object-fit: contain;
}

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 1rem; }
.photos .thumb { width: 100%; aspect-ratio: 4 / 3; margin-bottom: 0.5rem; border-radius: 0.5rem; }
.photos button { width: 100%; margin: 0; }

/* Straight to one of them, from the first screen: a car's records, or a type
   of record for every car. */
.jump { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.jump a { padding: 0.375rem 0.75rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); text-decoration: none; }

/* What is current on a car: a block for each, two across where there is room. */
.records { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.record { margin: 0; scroll-margin-top: 0.75rem; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--paper); }
.record .heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; column-gap: 1rem; margin-bottom: 0.25rem; }
.record h2 { margin: 0; }
.record h3 { margin: 0 0 0.25rem; font-size: 1rem; }
.record p { margin: 0 0 0.25rem; }
.record .dates { font-size: 0.9375rem; }
.provider, .reference { font-weight: 600; }
.phone { font-size: 1.25rem; font-weight: 600; white-space: nowrap; }
.soon, .overdue .far { color: var(--bad); font-weight: 600; }
.record:target, .history li:target { border-color: var(--accent); outline: 2px solid var(--accent); }

/* What DVSA says beside what the garage has, for an editor to answer. */
.question { margin: 0 0 1rem; padding: 0.75rem 1rem; border: 1px solid var(--accent); border-radius: 0.5rem; background: var(--paper); scroll-margin-top: 0.75rem; }
.question h2 { margin: 0 0 0.5rem; }
.question p { margin: 0 0 0.25rem; }
.compare { width: 100%; margin: 0 0 1rem; border-collapse: collapse; font-size: 0.9375rem; }
.compare th, .compare td { padding: 0.375rem 0.5rem 0.375rem 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.compare thead th { color: var(--soft); font-weight: 400; }
.question .tools a.button { padding: 0.375rem 1rem; }

/* What an editor may do to something, kept small beside it. */
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; font-size: 0.875rem; }
.record .tools { margin: 0.25rem 0 0; }
.tools a { padding: 0.5rem 0; color: var(--soft); }
.tools a.button { padding: 0.375rem 1rem; color: var(--accent); }
.tools button, .mistakes button { width: auto; min-height: 2.25rem; margin: 0; }
.mistakes button { margin: 0.375rem 0; }

.history summary { padding: 0.5rem 0; color: var(--accent); cursor: pointer; }
.history h3 { margin: 1rem 0 0.25rem; font-size: 1rem; }
.history ul, .mistakes, .running-out { margin: 0 0 1rem; padding: 0; list-style: none; }
.history li, .mistakes li { padding: 0.375rem 0; border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.detail { display: block; }

/* What runs out: what it is and how far off, then whose and the date. */
.running-out a { display: grid; grid-template-columns: 1fr auto; column-gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.running-out .what { font-weight: 600; }
.running-out .far, .running-out .when { text-align: right; }
.running-out .whose, .running-out .when { color: var(--soft); font-size: 0.9375rem; }
.drivers .soon { text-align: right; }
.drivers .when { grid-column: 1 / -1; text-align: left; }

/* Who can sign in: a block each, and what is done from the Mac. */
.people, .commands { margin: 0 0 1rem; padding: 0; list-style: none; }
.people li { margin-bottom: 0.75rem; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--paper); scroll-margin-top: 0.75rem; }
.people h2 { margin: 0 0 0.25rem; }
.people p { margin: 0 0 0.25rem; }
.people li:target { border-color: var(--accent); outline: 2px solid var(--accent); }
.commands li { margin-bottom: 0.75rem; }
.commands code { display: block; margin-top: 0.25rem; padding: 0.5rem 0.75rem; border-radius: 0.5rem; background: var(--paper); font-size: 0.875rem; overflow-wrap: anywhere; }

dl { margin: 0 0 1.5rem; }
dl div { padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
dt { color: var(--soft); font-size: 0.9375rem; }
dd { margin: 0; }

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

@media (min-width: 40rem) {
  .site-links { flex-basis: auto; order: 0; margin-right: auto; }
  main button { width: auto; }
  a.button { display: inline-block; }
  dl div { display: grid; grid-template-columns: 11rem 1fr; gap: 1rem; }
}

/* The glovebox page: black on white on a screen as on paper, and on paper
   one side of A4. */
body.glovebox { --ink: #000; --soft: #333; --line: #000; --paper: #fff; --page: #fff; --accent: #000; color-scheme: light; }
.glovebox main { max-width: 56rem; }
.glovebox h1 { margin: 0 0 0.5rem; }
.glovebox .ids { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1.5rem; }
.glovebox .plate { border-color: #000; background: #fff; color: #000; }
.glovebox a { color: inherit; }
.slips { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); gap: 0.5rem; margin-bottom: 1rem; }
.slip { margin: 0; padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: 0.25rem; break-inside: avoid; }
.slip h2 { margin: 0 0 0.125rem; font-size: 1.0625rem; }
.slip p { margin: 0; }
.printed { font-size: 0.875rem; }

@media print {
  :root { --ink: #000; --soft: #333; --paper: #fff; --page: #fff; --line: #999; --accent: #000; }
  body { font-size: 11pt; }
  header, main { max-width: none; padding: 0; }
  form, button, .button, .tools, .jump, .jump-to-runs-out, .by-type, .site-links { display: none; }
  .record, .history li { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  /* The history is on paper too, folded away on the screen or not. */
  .history::details-content { content-visibility: visible; block-size: auto; }
  a { color: inherit; text-decoration: none; }
  .glovebox main { page: glovebox; }
  body.glovebox { font-size: 10pt; line-height: 1.3; }
  .glovebox h1 { font-size: 16pt; }
  .slips { grid-template-columns: 1fr 1fr; gap: 2.5mm; }
  .slip { padding: 1.5mm 2.5mm; }
  .slip h2 { font-size: 11pt; }
  .glovebox .phone { font-size: 12pt; }
}

@page glovebox { size: A4; margin: 12mm; }
