/* Base, reset, typography, layout primitives, motion */

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

html {
  scroll-behavior: smooth;
  /* keep anchored sections clear of the sticky header */
  scroll-padding-top: 5.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-400);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100svh;
  overflow-x: hidden;
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

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

h1,
h2,
h3 {
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

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

textarea {
  resize: vertical;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.85em;
  background: var(--cyan-soft);
  color: var(--cyan-text);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}

/* Layout primitive */
.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

/* Accessibility helpers */
.visually-hidden {
  position: absolute !important;
  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: 50%;
  top: -60px;
  transform: translateX(-50%);
  background: var(--cyan);
  color: #04211f;
  font-weight: 600;
  padding: 0.6rem 1.2rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 200;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 0;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted {
  color: var(--text-faint);
  font-weight: 400;
}

/* Scroll-reveal, hidden state only applies once boot.js adds `.reveal-on`,
   so if JS never runs the content stays fully visible (no invisible trap). */
.reveal-on [data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--d, 0s);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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

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

  .reveal-on [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
