/*
 * Reset, page background and layout primitives. Colours only through tokens (web/ui/tokens.css).
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--avb-font-body);
  font-size: var(--avb-text-md);
  font-weight: var(--avb-weight-regular);
  line-height: var(--avb-leading);
  letter-spacing: var(--avb-tracking);
  color: var(--avb-text);
  background-color: var(--avb-bg);
  background-image: var(--avb-bg-aurora);
  background-attachment: fixed;
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

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

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

button {
  cursor: pointer;
}

a {
  color: var(--avb-accent-text);
  text-underline-offset: 0.18em;
}

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

[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- typography helpers */
.avb-h1 {
  font-family: var(--avb-font-display);
  font-size: var(--avb-text-h1);
  font-weight: var(--avb-weight-heavy);
  line-height: 1.12;
  letter-spacing: var(--avb-tracking-title);
}

.avb-h2 {
  font-family: var(--avb-font-display);
  font-size: var(--avb-text-h2);
  font-weight: var(--avb-weight-strong);
  line-height: 1.3;
  letter-spacing: var(--avb-tracking-tight);
}

.avb-muted {
  color: var(--avb-text-muted);
  font-size: var(--avb-text-sm);
}

.avb-num {
  font-variant-numeric: tabular-nums;
}

.avb-mono {
  font-family: var(--avb-font-mono);
  font-size: var(--avb-text-sm);
}

.avb-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.avb-skip-link {
  position: absolute;
  left: var(--avb-space-2);
  top: var(--avb-space-2);
  z-index: var(--avb-z-toast);
  padding: var(--avb-space-2) var(--avb-space-3);
  border-radius: var(--avb-radius-md);
  background: var(--avb-surface-sheet);
  transform: translateY(-200%);
}

.avb-skip-link:focus {
  transform: none;
}

/* ---------------------------------------------------------------- layout primitives */
.avb-page {
  width: 100%;
  max-width: var(--avb-content-max);
  margin-inline: auto;
  padding-inline: calc(var(--avb-gutter) + var(--avb-safe-left)) calc(var(--avb-gutter) + var(--avb-safe-right));
  padding-block: var(--avb-space-4) var(--avb-space-6);
}

.avb-stack {
  display: flex;
  flex-direction: column;
  gap: var(--avb-stack-gap, var(--avb-space-3));
}

.avb-stack--tight {
  --avb-stack-gap: var(--avb-space-2);
}

.avb-stack--loose {
  --avb-stack-gap: var(--avb-space-5);
}

.avb-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--avb-cluster-gap, var(--avb-space-2));
}

.avb-cluster--end {
  justify-content: flex-end;
}

.avb-cluster--between {
  justify-content: space-between;
}

.avb-grid {
  display: grid;
  gap: var(--avb-space-2h);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--avb-grid-min, 190px)), 1fr));
}

.avb-grid--wide {
  --avb-grid-min: 420px;
  gap: var(--avb-space-3);
}

/* KPI tiles: two columns on phones, an odd last tile spans the row (audit 04 §4) */
@media (max-width: 719.98px) {
  .avb-grid--kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .avb-grid--kpi > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

.avb-center {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--avb-space-5) + var(--avb-safe-top)) var(--avb-gutter) calc(var(--avb-space-5) + var(--avb-safe-bottom));
}

.avb-enter {
  animation: avb-view-in var(--avb-duration-screen) var(--avb-ease-out) both;
}

@keyframes avb-view-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@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;
  }
}

@media print {
  body {
    background: none;
  }
}
