/* ==========================================================================
   ANH Reservas (staff) - Base
   Reset, typography, focus, icons, skip link, utilities. Requires tokens.css.
   Colours, sizes and spacing come from tokens only (REQ-DS-02).
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; color: var(--text-primary); }
p { margin: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--text-primary); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

/* Keyboard focus is never removed: ink ring + lime halo. The transparent outline keeps it
   visible in forced-colors (high contrast) mode, where box-shadow is dropped. */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-xs);
}

/* Icons: Lucide sprite, stroke 1.75, 20px (16px small). Decorative unless the control has a label. */
.icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon--sm { width: var(--icon-size-sm); height: var(--icon-size-sm); }

/* Visually hidden but available to assistive technology. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Skip link: the first tab stop; visible on focus. Ink text on lime. */
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  font-weight: var(--fw-semibold);
  color: var(--text-on-accent);
  background: var(--accent);
  border-radius: var(--radius-sm);
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }

/* The programmatic focus target of the skip link must not show a ring around the whole page. */
main:focus { outline: none; box-shadow: none; }

[hidden] { display: none !important; }

/* Typography utilities */
.text-display { font-size: var(--fs-display); line-height: var(--lh-display); font-weight: var(--fw-extrabold); letter-spacing: var(--tracking-display); }
.text-h1 { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-extrabold); letter-spacing: var(--tracking-tight); }
.text-h2 { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); }
.text-h3 { font-size: var(--fs-h3); line-height: var(--lh-h3); font-weight: var(--fw-bold); }
.text-h4 { font-size: var(--fs-h4); line-height: var(--lh-h4); font-weight: var(--fw-semibold); }
.text-body-lg { font-size: var(--fs-body-lg); line-height: var(--lh-body-lg); }
.text-small { font-size: var(--fs-small); line-height: var(--lh-small); }
.text-caption { font-size: var(--fs-caption); line-height: var(--lh-caption); color: var(--text-secondary); }
.text-label {
  font-size: var(--fs-label);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--text-secondary);
}
.text-secondary { color: var(--text-secondary); }
.text-mono { font-family: var(--font-mono); font-size: var(--fs-small); }
.tabular { font-variant-numeric: tabular-nums; }

/* Section title with the lime bar (a fill, never text colour). */
.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}
.section-title::before {
  content: "";
  width: 6px;
  align-self: stretch;
  min-height: 1.1em;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.section-title--lg { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-extrabold); }
.section-title--lg::before { width: 8px; }
.section-title--sm { font-size: var(--fs-h4); line-height: var(--lh-h4); }
.section-title--sm::before { width: 4px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-bottom: var(--space-6);
}
.page-header__text { display: grid; gap: var(--space-2); }
.page-header__actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }

/* Reduced motion: no animation or smooth scrolling (tokens already zero the durations). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
