/* Reset, typography, links, focus, buttons. Colours come from tokens.css only. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-block-start: calc(var(--header-h) + var(--space-4));
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  min-block-size: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  overflow-wrap: break-word;
}

main {
  flex: 1 0 auto;
}

img,
svg,
picture {
  display: block;
  max-inline-size: 100%;
}

img {
  block-size: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Headings: Poppins, bold, sentence case */
h1,
h2,
h3,
h4 {
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h3,
h4 {
  font-weight: 600;
  letter-spacing: 0;
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.15;
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.2;
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.3;
}

p,
li {
  text-wrap: pretty;
}

p,
ul,
ol {
  max-inline-size: var(--measure);
}

small,
.text-small {
  font-size: var(--fs-small);
  line-height: 1.5;
}

/* Links */
a {
  color: var(--c-emerald);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Focus ring: emerald on light surfaces, brass on night surfaces (set by --focus) */
:root {
  --focus: var(--c-emerald);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

.on-night {
  --focus: var(--c-brass);
  background: var(--c-night);
  color: var(--c-on-night);
}

.on-night a:not(.btn) {
  color: var(--c-on-night);
}

/* Skip link: hidden until focused */
.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--c-emerald);
  color: var(--c-on-emerald);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.visually-hidden {
  position: absolute !important;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Icons from assets/icons.svg; always next to visible text */
.icon {
  inline-size: 1.25em;
  block-size: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Brass crescent glyph (filled, decorative only: olive fails contrast on light surfaces) */
.glyph {
  inline-size: 1.25em;
  block-size: 1.25em;
  flex: none;
  fill: var(--c-brass);
}

/* Buttons: <a> when it navigates, <button> when it acts */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: 48px;
  padding: var(--space-2) var(--space-5);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--fs-small);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--c-emerald);
  color: var(--c-on-emerald);
}

.btn--primary:hover {
  background: var(--c-emerald-deep);
}

.btn--secondary {
  border-color: var(--c-emerald);
  color: var(--c-emerald);
  background: transparent;
}

.btn--secondary:hover {
  background: var(--c-dawn);
}

/* On night surfaces the emerald fill would vanish into the green, so invert. */
.btn--on-night {
  background: var(--c-on-night);
  color: var(--c-night);
}

.btn--on-night:hover {
  background: var(--c-on-night-soft);
}

.btn--on-night-outline {
  border-color: var(--c-on-night);
  color: var(--c-on-night);
  background: transparent;
}

.btn--on-night-outline:hover {
  background: color-mix(in srgb, var(--c-on-night) 12%, transparent);
}

/* Content RHSGP still has to supply: visible to reviewers, never mistaken for real data */
.placeholder {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

/* Reduced motion: no transitions or animations at all. (Shortening durations instead would
   make every property transition, because transition-property defaults to "all".)
   Animated elements must therefore have their final state as their base style. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
