/* Base styles: fonts, reset, typography. Uses tokens from tokens.css only. */

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

body,
h1, h2, h3, h4,
p, figure, blockquote {
  margin: 0;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Page: paper colour, grain (skill §5), body type (skill §3.2) */
body {
  background-color: var(--color-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .13 0 0 0 0 .09 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base); /* 18px: stays above the 17px mobile floor (§4.3) */
  line-height: var(--leading-body);
  font-variant-numeric: oldstyle-nums proportional-nums;
  hyphens: auto;
}

/* Headings: weight 400-500; IM Fell only at 28px and above */
h1, h2, h3, h4 {
  font-weight: 400;
  line-height: var(--leading-tight);
  text-wrap: balance;
}

h1 {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-xl);
}

h4 {
  font-size: var(--text-lg);
  font-weight: 500;
}

/* Links: colour plus underline, never colour alone (§8.2) */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
  transition: color var(--dur-fast) var(--ease-ink);
}

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

/* Focus ring (§8.1) */
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

/* Text roles: eyebrow, Latin name parts, vernacular names */
.eyebrow {
  font-family: var(--font-label);
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-caps);
  text-transform: lowercase; /* Cormorant SC renders lowercase as small caps */
  color: var(--color-text-muted);
}

.binomial {
  font-style: italic;
}

.authority {
  font-family: var(--font-label);
  font-style: normal;
  letter-spacing: .04em;
}

.vernacular {
  font-family: var(--font-label);
  letter-spacing: var(--tracking-caps);
  text-transform: lowercase;
  color: var(--color-text-muted);
}

/* Rules: single hairline and double line */
.rule {
  border: 0;
  border-top: var(--rule-thin) solid var(--ornament-gilt);
  margin-block: var(--space-6);
}

.rule-double {
  border: 0;
  border-top: 3px double var(--ornament-gilt);
  margin-block: var(--space-6);
}

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