/* ==========================================================================
   Charlie — reset & typographic foundation
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; }

/* The UA's `[hidden] { display: none }` is a bare attribute selector, so any
   class that sets `display` beats it — `.alert { display: flex }` would keep
   a `hidden` alert on screen. Restate it so `hidden` always means hidden. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Sticky header offset for in-page anchors. */
  scroll-padding-top: calc(var(--header-h) + var(--sp-4));
}

body {
  min-height: 100dvh;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img { height: auto; }

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button { background: none; border: none; cursor: pointer; }

p,
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul, ol { padding: 0; list-style: none; }

table { border-collapse: collapse; width: 100%; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-6) 0;
}

/* ---- Headings ---------------------------------------------------------
   Heavy weight + strongly negative tracking. At display sizes a grotesk set
   at default tracking reads like a word-processor heading; pulling it tight
   is most of what separates "designed" from "typed".                       */
h1, h2, h3, h4, h5, h6, .display {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--ink-950);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); letter-spacing: var(--tracking-display); line-height: var(--leading-none); }
h2 { font-size: var(--text-3xl); letter-spacing: var(--tracking-display); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); letter-spacing: var(--tracking-snug); }
h6 { font-size: var(--text-md); letter-spacing: var(--tracking-snug); }

.display-xl {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: 700;
  line-height: var(--leading-none);
  letter-spacing: var(--tracking-display);
}
.display-2xl {
  font-family: var(--font-display);
  font-size: var(--text-6xl);
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.05em;
}

/* Numerals that have to line up in tables, stats and money columns. */
.tabular,
.stat__value,
.kpi__value,
.money-row__amount,
.currency-row__amount { font-variant-numeric: tabular-nums; }

p { text-wrap: pretty; }

a {
  color: var(--text-brand);
  text-decoration: none;
  text-underline-offset: 0.18em;
  transition: color var(--dur-1) var(--ease-out);
}
a:hover { color: var(--red-700); text-decoration: underline; }

strong, b { font-weight: 650; }

small { font-size: var(--text-sm); }

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

/* ---- Focus ------------------------------------------------------------- */
:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--red-500);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---- Selection --------------------------------------------------------- */
::selection {
  background: var(--red-500);
  color: #fff;
}

/* ---- Scrollbar (desktop, unobtrusive) ---------------------------------- */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: var(--ink-300) transparent; }
  *::-webkit-scrollbar { width: 10px; height: 10px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: var(--ink-300);
    border-radius: var(--r-full);
    border: 3px solid transparent;
    background-clip: content-box;
  }
  *::-webkit-scrollbar-thumb:hover { background-clip: content-box; background-color: var(--ink-400); }
}

/* ==========================================================================
   Utilities
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--container-narrow); }
.container--wide { max-width: var(--container-wide); }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem); }

.stack > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-8); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
}
.cluster--tight { gap: var(--sp-2); }
.cluster--between { justify-content: space-between; }
.cluster--end { justify-content: flex-end; }

.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* A grid item is `min-width: auto`, meaning at least its content's
   min-content. A table in one of these cards was therefore able to stretch
   its own track and push the reports page 150px past the viewport. */
.grid-2 > * { min-width: 0; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-brand { color: var(--text-brand); }
.text-success { color: var(--success-700); }
.text-danger { color: var(--danger-500); }
.text-warning { color: var(--warning-700); }
.text-center { text-align: center; }
.text-right { text-align: end; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }
/* A second line under a value in a table cell — an email beneath a name, an
   event key beneath a subject. `<br>` would do it, but this survives the
   cell collapsing into a card on a phone, where the two lines need to stay
   two lines. */
.d-block { display: block; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-brand);
}
.eyebrow::before {
  content: "";
  width: 20px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}
.eyebrow--plain::before { display: none; }
.eyebrow--muted { color: var(--text-subtle); }
.eyebrow--on-dark { color: var(--red-400); }

.lead {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-muted);
  max-width: 62ch;
  text-wrap: pretty;
}

/* A single emphasised word set in the italic serif. Used sparingly — it is
   the one place the page raises its voice. */
.em-serif {
  font-family: var(--font-accent);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.hide { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: var(--sp-4);
  top: -80px;
  z-index: var(--z-toast);
  padding: var(--sp-3) var(--sp-5);
  background: var(--ink-950);
  color: #fff;
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: top var(--dur-2) var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); text-decoration: none; color: #fff; }

/*
  Icons flow with text.

  The reset above blockifies every svg, which is right for photographs and
  wrong for an icon sitting in a sentence: it takes a line of its own and the
  words drop underneath it. Inside a flex or grid parent nothing shows, which
  is why this went unnoticed — it only bites where an icon shares a plain
  <span>, <p> or <td> with words, which turned out to be 160 places across
  15 pages: every payment option, every service label in the dispatch board
  and the booking tables, the driver's job cards, the dashboard tiles.

  `flex: none` still matters in the flex cases, where an icon must never be
  squashed to make room for a long label. Flex and grid children are
  blockified anyway, so `inline-block` changes nothing there.
*/
.c-icon {
  display: inline-block;
  vertical-align: -0.16em;   /* optically centred against the text baseline */
  flex: none;
}

/* Responsive helpers */
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 768px) {
  .only-mobile { display: none !important; }
}
@media (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}
@media (min-width: 1024px) {
  .only-tablet-down { display: none !important; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}
