/*
 * Base styles: reset, document defaults, page frame. Reads tokens.css only.
 * Parts (buttons, forms, cards, header…) live in components.css.
 */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text-strong);
}

h1 {
  font-size: var(--fs-2xl);
}

h2 {
  font-size: var(--fs-lg);
}

h3 {
  font-size: var(--fs-base);
  font-family: var(--font-body);
}

p {
  margin: 0;
  max-width: var(--measure);
}

a {
  color: var(--link);
}

a:hover {
  color: var(--link-hover);
}

img,
svg {
  max-width: 100%;
}

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

/* One visible ring for every focusable thing, keyboard only. */
:focus-visible {
  outline: var(--ring-w) solid var(--focus);
  outline-offset: var(--ring-offset);
}

.on-dark :focus-visible {
  outline-color: var(--focus-on-dark);
}

/* Hidden visually, still read by screen readers. */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: var(--sp-4);
  top: var(--sp-2);
  z-index: 100;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--primary);
  color: var(--on-primary);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus-visible {
  transform: none;
}

/* The page frame: gutters of at least 16px on every side, wider on larger screens. */
.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--sp-5) max(var(--gutter), env(safe-area-inset-right, 0px)) var(--sp-8)
    max(var(--gutter), env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.page:focus {
  outline: none;
}

@media (max-width: 760px) {
  .page {
    padding-top: var(--sp-4);
  }
}

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