/* ==========================================================================
   AutoDrive — Base
   --------------------------------------------------------------------------
   Reset and document defaults. Deliberately conservative: this stylesheet is
   inherited by 300+ legacy views that were written against Bootstrap 2, so it
   sets sensible defaults without imposing layout those views cannot satisfy.
   ========================================================================== */

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

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background-color: var(--surface-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
}

/* --- Rhythm ------------------------------------------------------------ */

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  color: var(--text-strong);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-md); }
h5 { font-size: var(--fs-base); }
h6 { font-size: var(--fs-sm); }

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

small { font-size: var(--fs-xs); }
strong, b { font-weight: var(--fw-semibold); }

hr {
  height: 0;
  margin: var(--sp-6) 0;
  border: 0;
  border-top: 1px solid var(--border);
}

ul, ol { margin: 0 0 var(--sp-3); padding-left: var(--sp-5); }
ul:last-child, ol:last-child { margin-bottom: 0; }

code, pre, kbd, samp { font-family: var(--font-mono); font-size: .9em; }

code {
  padding: .12em .38em;
  border-radius: var(--radius-xs);
  background: var(--surface-sunken);
  color: var(--b-800);
}

/* --- Links ------------------------------------------------------------- */

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}

a:hover { color: var(--text-link-hover); text-decoration: underline; }

/* --- Focus ------------------------------------------------------------- */
/* Visible focus on every interactive element, always. Removing this is not
   permitted — non-technical staff rely on keyboard navigation more than they
   are usually credited for, and it is a WCAG 2.1 AA requirement. */

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* Only suppress the default ring where a custom one is supplied. */
:focus:not(:focus-visible) { outline: none; }

/* --- Media ------------------------------------------------------------- */

img, svg, video, canvas, iframe { max-width: 100%; vertical-align: middle; }
img, svg, video, canvas { height: auto; }

/* --- Tables ------------------------------------------------------------ */

table { border-collapse: collapse; border-spacing: 0; }
caption { text-align: left; color: var(--text-muted); }

/* --- Forms: inherit typography ----------------------------------------- */

button, input, select, textarea, optgroup {
  font: inherit;
  color: inherit;
  margin: 0;
}

textarea { resize: vertical; }

button, [role="button"], summary { cursor: pointer; }
button { background: none; border: 0; padding: 0; }

[disabled],
.disabled {
  cursor: not-allowed;
  opacity: .55;
}

/* --- Selection --------------------------------------------------------- */

::selection {
  background: var(--b-100);
  color: var(--b-900);
}

/* --- Scrollbars -------------------------------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--n-300) transparent;
}

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--n-300);
  border: 3px solid transparent;
  border-radius: var(--radius-full);
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background-color: var(--n-400); background-clip: content-box; }

/* --- Utility (only what legacy markup already uses) --------------------- */

.pull-left  { float: left; }
.pull-right { float: right; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
/* No !important here, deliberately. Bootstrap 2 markup is
   class="modal hide fade" and its JavaScript reveals a modal by setting an
   inline display:block. An !important rule outranks that inline style and
   every modal in the application silently stops opening. */
.hide { display: none; }
.bold { font-weight: var(--fw-semibold); }
.clear { clear: both; }

.clearfix::after {
  content: "";
  display: table;
  clear: both;
}

.mandatory { color: var(--r-600); font-weight: var(--fw-medium); }

/* Screen-reader-only text, for labelling icon-only controls. */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Brand mark -------------------------------------------------------- */
/* The learner plate: a red L on white. It is the product's own mark and the
   single most recognisable thing in the interface, so it is drawn rather than
   loaded — crisp at every size, themeable, and no image request.
   (css/ico/logo.png is a customer's own logo, not AutoDrive's.) */

.ad-plate {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 2px solid var(--r-600);
  border-radius: var(--radius-md);
  background: var(--n-0);
  color: var(--r-600);
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: var(--fw-bold);
  line-height: 1;
  letter-spacing: 0;
  user-select: none;
}

.ad-plate::before { content: "L"; transform: translateY(-1px); }

/* --- Print ------------------------------------------------------------- */

@media print {
  body { background: #fff; }
  a { color: inherit; text-decoration: none; }
}
