@import './themes.css';
@import './typography.css';
@import './buttons.css';
@import './ui.css';
@import './patterns.css';
@import './motion.css';

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

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: 400;
  /* Theme switching should read as a transition, not a flash. */
  transition:
    background-color var(--duration-base) ease,
    color var(--duration-base) ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-h1);
}
h2 {
  font-size: var(--text-h2);
}
h3 {
  font-size: var(--text-h3);
}
h4 {
  font-size: var(--text-h4);
}

p {
  margin: 0 0 var(--space-3);
  text-wrap: pretty;
}

a {
  color: var(--color-accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--color-accent-300);
}

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

figure {
  margin: 0;
}

/* Inputs do not inherit typography by default. */
button,
input,
select,
textarea {
  color: inherit;
}

/* ---------- Focus ----------
 * Keyboard users get a visible ring; pointer users do not. Never remove the
 * indicator outright — it is a WCAG 2.2 requirement.
 */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  /* A ground-coloured halo under the accent ring, so the ring is read against
     the page and not against whatever the element itself is painted: the rosé
     accent on a white logo tile is 2.4:1, on the night ground 6.3:1. */
  box-shadow: 0 0 0 4px var(--color-bg);
}

::selection {
  background: color-mix(in srgb, var(--color-accent) 30%, transparent);
}

/* Screen-reader-only text that stays in the accessibility tree. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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