* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: var(--color-scheme);
  background-color: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background: var(--body-background);
  min-height: 100vh;
  /* Prevent horizontal scrollbar from content that slightly exceeds the
     viewport (e.g. wide code blocks, landing canvas edge effects). Using
     clip instead of hidden avoids creating a new scroll container that
     would interfere with position: sticky on the header. */
  overflow-x: clip;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: var(--grid-pattern);
  background-size: 32px 32px;
  z-index: -1;
}

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

a {
  color: inherit;
  text-decoration: none;
}

p {
  margin: 0;
  color: var(--text-soft);
  text-wrap: pretty;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  color: var(--text);
}

h1,
h2 {
  font-family: var(--font-serif);
  letter-spacing: 0.02em;
}

h1 {
  font-size: var(--step-4);
}

h2 {
  font-size: var(--step-3);
}

h3 {
  font-size: var(--step-1);
}

small,
.meta {
  font-size: var(--step--1);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-soft);
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-enter {
  opacity: 0;
  transform: translateY(8px);
}

.page-ready {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--motion-mid) var(--ease-standard),
    transform var(--motion-mid) var(--ease-standard);
}

/* Skip link: keyboard and screen-reader users can jump past the site
   header straight to the main content. Visually hidden until focused. */
.skip-link {
  position: absolute;
  top: -10rem;
  left: 0;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background-color: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 0 0 var(--radius) 0;
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: top var(--motion-fast) var(--ease-standard);
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Default focus-visible outline for interactive elements that do not
   already supply their own. Component-level rules elsewhere in the
   stylesheet override this. Kept subtle so it does not fight the
   calm-tone design direction, but always visible when tabbed to. */
:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Honour the operating system's reduced-motion preference. Disables
   the intersection-observer-driven reveal animations, scroll smoothing,
   landing-canvas orb drift, and the hover/press transforms across the
   site. Users who care about motion sickness or prefer calmer UIs get
   the static rendering without losing any content. */
@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;
    scroll-behavior: auto !important;
  }

  .reveal,
  .reveal.is-visible {
    opacity: 1 !important;
    transform: none !important;
  }

  .page-enter,
  .page-ready {
    opacity: 1 !important;
    transform: none !important;
  }
}