/* Base: reset, typography, focus, buttons, utilities. Colours come from
 * tokens.css only. Logical properties everywhere (works in RTL and LTR). */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-block-start: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-text);
  font-size: var(--fs-base);
  line-height: var(--lh-text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0 0 .5em;
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--color-text);
  text-wrap: balance;
}
h1 { font-size: var(--fs-hero); letter-spacing: -.01em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); font-weight: 600; }
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--brand-primary); text-underline-offset: .2em; }
a:hover { color: var(--brand-primary-strong); }

/* Visible, consistent keyboard focus (WCAG 2.4.7 / 2.4.11). */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--color-focus-ring);
  border-radius: 6px;
}
main:focus { outline: none; }

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: -100px;
  z-index: 100;
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--brand-primary);
  color: var(--brand-on-primary);
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus { inset-block-start: 1rem; color: var(--brand-on-primary); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.narrow { max-width: 820px; }

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  color: currentColor;
}
/* Arrows point "forward" in the reading direction. */
[dir="rtl"] .icon--flip { transform: scaleX(-1); }

/* --- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 44px;              /* touch target */
  padding: .6rem 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn--sm { min-height: 40px; padding: .45rem 1rem; font-size: .95rem; }
.btn--lg { min-height: 52px; padding: .8rem 1.6rem; font-size: 1.05rem; }

.btn--primary { background: var(--brand-primary); color: var(--brand-on-primary); box-shadow: var(--shadow-md); }
.btn--primary:hover { background: var(--brand-primary-strong); color: var(--brand-on-primary); }

.btn--outline { border-color: var(--brand-primary); color: var(--brand-primary); background: transparent; }
.btn--outline:hover { background: var(--brand-primary-soft); color: var(--brand-primary-strong); }

.btn--ghost { color: var(--brand-primary); background: transparent; border-color: var(--color-border); }
.btn--ghost:hover { border-color: var(--brand-primary); color: var(--brand-primary-strong); }

.btn--light { background: var(--color-surface); color: var(--brand-primary); }
.btn--light:hover { background: var(--brand-accent-soft); color: var(--brand-primary-strong); }

.btn--on-brand { border-color: rgba(255, 255, 255, .7); color: var(--brand-on-primary); background: transparent; }
.btn--on-brand:hover { background: rgba(255, 255, 255, .12); color: var(--brand-on-primary); }

.btn:focus-visible { border-radius: var(--radius-pill); }
.section--brand :focus-visible { outline-color: var(--brand-on-primary); }

.cta-row { display: flex; flex-wrap: wrap; gap: .75rem; margin-block: 1.75rem 1rem; }
.cta-row--center { justify-content: center; margin-block-end: 0; }

.notice {
  margin-block-start: 1.25rem;
  padding: .9rem 1.1rem;
  border-inline-start: 4px solid var(--brand-accent);
  border-radius: var(--radius-sm);
  background: var(--brand-accent-soft);
  color: var(--color-text);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .btn:hover { transform: none; }
}
