/* =========================================================
   Base - reset, typography, accessibility
   ========================================================= */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--bg-page);
  background-image:
    radial-gradient(ellipse at top left, rgba(233, 161, 50, 0.06), transparent 45%),
    radial-gradient(ellipse at bottom right, rgba(30, 58, 95, 0.04), transparent 40%);
  min-height: 100vh;
  overflow-x: clip;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

body.nav-open {
  overflow: hidden;
}

body.nav-open main,
body.nav-open .site-footer {
  pointer-events: none;
}

html[lang="si"] body,
html[lang="si"] .si-text {
  font-family: var(--font-sinhala);
}

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

img[loading="lazy"] {
  background: rgba(30, 58, 95, 0.04);
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--transition);
}

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

a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--color-primary-deep);
  margin: 0 0 var(--space-4);
}

html[lang="si"] h1,
html[lang="si"] h2,
html[lang="si"] h3 {
  font-family: var(--font-sinhala);
  font-weight: 700;
  line-height: var(--lh-snug);
}

p {
  margin: 0 0 var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

ul, ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.25rem;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 1000;
  background: var(--color-primary);
  color: var(--color-white);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--space-4);
}

::selection {
  background: rgba(233, 161, 50, 0.28);
  color: var(--color-primary-deep);
}
