/* Base element styling — reads only from tokens (01-tokens.css). No ap- classes here; those live in 05-components/. */

body {
  background: var(--ap-bg);
  color: var(--ap-text);
  font-family: var(--ap-font-body);
  font-size: var(--ap-fs-body);
  line-height: var(--ap-lh-body);
}

/* Site-wide heading system — the ONLY place font-size/weight/margin get set
   for h1-h6; every page and component reads from this instead of declaring
   its own. margin-top stays 0 across the board (headings are almost always
   the first thing in whatever box contains them — a card, a sidebar widget,
   a section — so top spacing comes from that box's own padding, not the
   heading). margin-bottom is real and descends with level, so a bare
   heading followed directly by a paragraph (a legal page's h1, a card's h2)
   always gets proper breathing room with zero extra markup. Components that
   position a heading inside a flex/gap layout instead (section headers next
   to a "view all" link, the hero, the store-carousel heading, the featured
   blog caption) explicitly re-zero margin-bottom themselves, since their
   parent's `gap` already provides that spacing and the two would otherwise
   stack. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--ap-font-heading);
  line-height: var(--ap-lh-tight);
  color: var(--ap-text);
  margin: 0;
}

h1 { font-size: var(--ap-fs-h1); font-weight: 800; margin-bottom: var(--ap-space-lg); }
h2 { font-size: var(--ap-fs-h2); font-weight: 700; margin-bottom: var(--ap-space-lg); }
h3 { font-size: var(--ap-fs-h3); font-weight: 700; margin-bottom: var(--ap-space-md); }
h4 { font-size: var(--ap-fs-h4); font-weight: 600; margin-bottom: var(--ap-space-md); }
h5 { font-size: var(--ap-fs-h5); font-weight: 600; margin-bottom: var(--ap-space-sm); }
h6 { font-size: var(--ap-fs-h6); font-weight: 600; margin-bottom: var(--ap-space-sm); }

small { font-size: var(--ap-fs-sm); }

a {
  color: var(--ap-primary);
  transition: color var(--ap-transition);
}

a:hover { color: var(--ap-primary-hover); }
a:active { color: var(--ap-primary-active); }

/* Every interactive element gets a visible, consistent focus ring —
   outline is only ever removed together with this replacement, never alone. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ap-focus-ring);
  border-radius: var(--ap-radius-sm);
}

::selection {
  background: var(--ap-primary);
  color: var(--ap-text-inverse);
}

/* Skip-to-content link — visually hidden until focused */
.ap-skip-link {
  position: absolute;
  top: -100%;
  left: var(--ap-space-md);
  z-index: 1000;
  padding: var(--ap-space-sm) var(--ap-space-md);
  background: var(--ap-surface);
  color: var(--ap-text);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  box-shadow: var(--ap-shadow-md);
  transition: top var(--ap-transition);
}

.ap-skip-link:focus-visible {
  top: var(--ap-space-md);
}

/* Screen-reader-only text (labels, headings kept for a11y but not shown visually) */
.ap-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;
}
