/* Base styles, typography classes and utilities. Every value comes from tokens.css. */

@font-face {
  font-family: "Geist";
  src: url("../fonts/geist/Geist-Variable.woff2") format("woff2-variations"),
       url("../fonts/geist/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Metric-compatible fallback to avoid layout shift while Geist loads. */
@font-face {
  font-family: "Geist Fallback";
  src: local("Arial"), local("Helvetica Neue"), local("Helvetica");
  ascent-override: 95.94%;
  descent-override: 28.16%;
  line-gap-override: 0%;
  size-adjust: 104.76%;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  background: var(--yb-bg);
  color: var(--yb-text);
}

body {
  min-height: 100dvh;
  font-family: var(--yb-font);
  font-size: var(--yb-text-body);
  line-height: var(--yb-leading-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}

a {
  color: var(--yb-primary);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--yb-primary-hover);
}

::selection {
  background: var(--yb-primary-soft);
  color: var(--yb-on-primary-soft);
}

/* Focus ring: 2px petrol (glacier in the dark), offset by 2px, keyboard only. "a:focus-visible" and "button:focus-visible"
   outrank MudBlazor's "a:focus-visible, button:focus { outline: none }", which hid the ring of every link and button of
   our own (navigation, search, account menu) — lot 22c. */
:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--yb-focus);
  outline-offset: 2px;
  border-radius: var(--yb-radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Headings and regions focused programmatically after navigation (FocusOnNavigate) get no ring. */
[tabindex="-1"]:focus,
h1:focus {
  outline: none;
}

img,
svg {
  vertical-align: middle;
}

/* ---------- Type scale (DESIGN §4) ---------- */
.yb-display {
  font-size: var(--yb-text-display);
  line-height: var(--yb-leading-display);
  font-weight: var(--yb-weight-display);
  letter-spacing: var(--yb-tracking-display);
}

.yb-title-1 {
  font-size: var(--yb-text-title-1);
  line-height: var(--yb-leading-title-1);
  font-weight: var(--yb-weight-title-1);
  letter-spacing: var(--yb-tracking-title-1);
}

.yb-title-2 {
  font-size: var(--yb-text-title-2);
  line-height: var(--yb-leading-title-2);
  font-weight: var(--yb-weight-title-2);
  letter-spacing: var(--yb-tracking-title-2);
}

.yb-title-3 {
  font-size: var(--yb-text-title-3);
  line-height: var(--yb-leading-title-3);
  font-weight: var(--yb-weight-title-3);
}

.yb-body {
  font-size: var(--yb-text-body);
  line-height: var(--yb-leading-body);
}

.yb-caption {
  font-size: var(--yb-text-caption);
  line-height: var(--yb-leading-caption);
  font-weight: var(--yb-weight-medium);
  letter-spacing: var(--yb-tracking-caption);
}

.yb-amount-hero {
  font-size: var(--yb-text-amount-hero);
  line-height: var(--yb-leading-amount-hero);
  font-weight: var(--yb-weight-strong);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* Tabular figures for every amount, quantity, date and document number. */
.yb-num,
.yb-money,
.mud-table-cell.yb-num,
td.yb-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.yb-muted {
  color: var(--yb-text-muted);
}

.yb-strong {
  font-weight: var(--yb-weight-strong);
}

.yb-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.yb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.yb-skip-link {
  position: absolute;
  left: var(--yb-space-4);
  top: -100px;
  z-index: 2000;
  padding: var(--yb-space-2) var(--yb-space-4);
  border-radius: var(--yb-radius-sm);
  background: var(--yb-primary);
  color: var(--yb-on-primary);
  font-weight: var(--yb-weight-medium);
  text-decoration: none;
}

.yb-skip-link:focus {
  top: var(--yb-space-2);
  color: var(--yb-on-primary);
}

kbd,
.yb-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--yb-border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--yb-surface);
  color: var(--yb-text-muted);
  font-family: var(--yb-font);
  font-size: 0.6875rem;
  font-weight: var(--yb-weight-medium);
  line-height: 1;
}

/* ---------- Blazor reconnection / error UI ---------- */
#blazor-error-ui {
  display: none;
  position: fixed;
  inset: auto var(--yb-space-4) var(--yb-space-4) auto;
  z-index: 2000;
  max-width: 420px;
  padding: var(--yb-space-3) var(--yb-space-4);
  border: 1px solid var(--yb-border);
  border-radius: var(--yb-radius-md);
  background: var(--yb-surface-raised);
  box-shadow: var(--yb-shadow-md);
  color: var(--yb-text);
}

#blazor-error-ui .reload {
  margin-left: var(--yb-space-2);
  font-weight: var(--yb-weight-medium);
}

#blazor-error-ui .dismiss {
  margin-left: var(--yb-space-3);
  cursor: pointer;
  color: var(--yb-text-muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}
