/* ==========================================================================
   MARQUEE — Base: reset, typography, focus, layout primitives
   ========================================================================== */

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

* { margin: 0; }

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

body {
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  letter-spacing: var(--ls-body);
  color: var(--ink);
  background: var(--bg);
  /* `clip` rather than `hidden`: it stops elements that deliberately hang off
     a container from creating a horizontal scrollbar, without turning body
     into a scroll container (which would break position: sticky). */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  min-height: 100vh;
}

img, svg, video, canvas { display: block; max-width: 100%; }
img, video { height: auto; }

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

button { background: none; border: 0; padding: 0; cursor: pointer; }

p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

ul, ol { list-style: none; padding: 0; }

table { border-collapse: collapse; border-spacing: 0; }

a { color: inherit; text-decoration: none; }

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

/* --------------------------------------------------------------------------
   Headings — app defaults. Marketing overrides these in marketing.css.
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-title);
  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-base); }
h5, h6 { font-size: var(--fs-sm); }

p { text-wrap: pretty; }

strong, b { font-weight: var(--fw-semi); }

small { font-size: var(--fs-2xs); }

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

/* --------------------------------------------------------------------------
   Focus — visible everywhere, never removed. Ring sits outside the element so
   it survives on tinted surfaces.
   -------------------------------------------------------------------------- */
:focus { outline: none; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-sm);
  position: relative;
  z-index: var(--z-raised);
}

/* Focus inside the dark chrome needs the ring's inner gap to match the chrome. */
.chrome :focus-visible,
.sidebar :focus-visible {
  box-shadow: 0 0 0 2px var(--chrome), 0 0 0 4px var(--signal);
}

.skip-link {
  position: absolute;
  left: var(--s-3);
  top: var(--s-3);
  z-index: var(--z-tooltip);
  transform: translateY(calc(-100% - var(--s-6)));
  background: var(--ink);
  color: var(--bg);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus-visible { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Selection
   -------------------------------------------------------------------------- */
::selection {
  background: var(--signal);
  color: var(--on-signal);
}

/* --------------------------------------------------------------------------
   Scrollbars — restrained, not reinvented. Native behaviour kept intact.
   -------------------------------------------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--r-full);
  border: 3px solid var(--bg);
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.chrome *::-webkit-scrollbar-thumb {
  background: var(--chrome-3);
  border-color: var(--chrome);
}

/* --------------------------------------------------------------------------
   Type utilities
   -------------------------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-weight: var(--fw-black);
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
  text-wrap: balance;
}

/* Tabular figures — ONLY where numbers stack and must align: table columns,
   stat values in a grid, ledger rows. In Schibsted Grotesk the comma and the
   digit 1 take a full digit advance, which makes "A$162,000" read as
   "A$162 , 000" at small sizes. Inline currency inside a sentence or a label
   row stays proportional. */
.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

.metric {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--ink);
}

.label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  color: var(--muted);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  letter-spacing: -0.01em;
}

.prose { max-width: var(--prose-max); }
.prose p + p { margin-top: 1em; }

.t-ink    { color: var(--ink); }
.t-ink-2  { color: var(--ink-2); }
.t-muted  { color: var(--muted); }
.t-primary{ color: var(--primary); }
.t-success{ color: var(--success); }
.t-warning{ color: var(--warning); }
.t-danger { color: var(--danger); }

.fs-3xs { font-size: var(--fs-3xs); }
.fs-2xs { font-size: var(--fs-2xs); }
.fs-xs  { font-size: var(--fs-xs); }
.fs-sm  { font-size: var(--fs-sm); }
.fs-md  { font-size: var(--fs-md); }
.fs-lg  { font-size: var(--fs-lg); }
.fs-xl  { font-size: var(--fs-xl); }
.fs-2xl { font-size: var(--fs-2xl); }
.fs-3xl { font-size: var(--fs-3xl); }
.fs-4xl { font-size: var(--fs-4xl); }

.fw-regular { font-weight: var(--fw-regular); }
.fw-medium  { font-weight: var(--fw-medium); }
.fw-semi    { font-weight: var(--fw-semi); }
.fw-bold    { font-weight: var(--fw-bold); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Layout utilities — flexbox for 1D, grid for 2D
   -------------------------------------------------------------------------- */
.row   { display: flex; align-items: center; }
.row-t { display: flex; align-items: flex-start; }
.row-b { display: flex; align-items: baseline; }
.col   { display: flex; flex-direction: column; }
.wrap  { flex-wrap: wrap; }
.between { justify-content: space-between; }
.center  { justify-content: center; }
.end     { justify-content: flex-end; }
.grow  { flex: 1 1 auto; min-width: 0; }
.shrink-0 { flex-shrink: 0; }

.g-1 { gap: var(--s-1); } .g-2 { gap: var(--s-2); }
.g-3 { gap: var(--s-3); } .g-4 { gap: var(--s-4); }
.g-5 { gap: var(--s-5); } .g-6 { gap: var(--s-6); }
.g-7 { gap: var(--s-7); } .g-8 { gap: var(--s-8); }

.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); }
.mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); }
.mt-5 { margin-top: var(--s-5); } .mt-6 { margin-top: var(--s-6); }
.mt-7 { margin-top: var(--s-7); } .mt-8 { margin-top: var(--s-8); }
.mb-2 { margin-bottom: var(--s-2); } .mb-3 { margin-bottom: var(--s-3); }
.mb-4 { margin-bottom: var(--s-4); } .mb-6 { margin-bottom: var(--s-6); }

/* Breakpoint-free responsive card grid */
.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--min, 280px), 1fr));
  gap: var(--s-4);
}

.hide { display: none !important; }

@media (max-width: 900px)  { .hide-md { display: none !important; } }
@media (max-width: 640px)  { .hide-sm { display: none !important; } }
@media (min-width: 901px)  { .show-md-only { display: none !important; } }

/* Wide content must scroll inside its own container — the body never does. */
.scroll-x {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.sr-only {
  position: absolute;
  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;
}

/* --------------------------------------------------------------------------
   Reduced motion — fewer and gentler, not zero. Opacity and colour survive
   because they carry meaning; movement does not.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* Keep the transitions that aid comprehension, drop the movement. */
  .btn, .card, .toast, .drawer, .modal, .reveal {
    transition-property: opacity, background-color, border-color, color !important;
    transition-duration: 120ms !important;
    transform: none !important;
  }

  .reveal { opacity: 1 !important; transform: none !important; }
}
