/* ==========================================================================
   Obstoon — Base: reset, document, typography, focus, utilities
   ========================================================================== */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--space-lg));
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100svh;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  transition: background-color var(--dur-3) var(--ease-out),
    color var(--dur-3) var(--ease-out);
}

/* ---- Background field: level 1 of the depth stack ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: var(--field);
  background-attachment: fixed;
  pointer-events: none;
}

/* Atmospheric layer: level 2. Grain sits on top of the two colour washes so
   large even areas pick up a material texture without adding any content. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.85;
  background:
    var(--grain),
    radial-gradient(
      46% 34% at 12% 18%,
      color-mix(in srgb, var(--accent) 12%, transparent) 0%,
      transparent 70%
    ),
    radial-gradient(
      40% 30% at 88% 72%,
      color-mix(in srgb, var(--accent-2) 12%, transparent) 0%,
      transparent 72%
    );
  background-repeat: repeat, no-repeat, no-repeat;
  /* The tile must repeat; the washes must not. */
  background-size: 140px 140px, auto, auto;
}

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

img,
video {
  height: auto;
}

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

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

ul,
ol {
  padding: 0;
  list-style: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
}

/* ---- Headings ---- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: 640;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-snug);
  text-wrap: balance;
  color: var(--text);
}

h1 {
  font-size: var(--text-4xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  font-weight: 680;
}

h2 {
  font-size: var(--text-3xl);
  line-height: 1.12;
  letter-spacing: var(--tracking-tight);
  font-weight: 660;
}

h3 {
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-snug);
}

h4 {
  font-size: var(--text-lg);
}

h5,
h6 {
  font-size: var(--text-md);
}

p {
  text-wrap: pretty;
}

/* ---- Links ---- */
a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 42%, transparent);
  text-underline-offset: 0.22em;
  text-decoration-thickness: 1px;
  transition: color var(--dur-2) var(--ease-out),
    text-decoration-color var(--dur-2) var(--ease-out);
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

/* ---- Focus: always visible, never removed ---- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-3xs);
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  color: var(--text);
}

/* ---- Scrollbar ---- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* ---- Utilities ---- */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2xs);
  left: var(--space-2xs);
  z-index: 200;
  padding: 0.7em 1.15em;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: var(--radius-2xs);
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform var(--dur-2) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--on-accent);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 1.75em;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
}

.eyebrow--plain::before {
  display: none;
}

.lede {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-soft);
  max-width: 56ch;
}

.prose {
  max-width: var(--width-prose);
}

.prose > * + * {
  margin-top: var(--space-sm);
}

.prose h2 {
  margin-top: var(--space-xl);
}

.prose h3 {
  margin-top: var(--space-lg);
}

.prose a {
  font-weight: 500;
}

.prose ul {
  display: grid;
  gap: var(--space-2xs);
}

.prose ul > li {
  position: relative;
  padding-left: 1.4em;
  color: var(--text-soft);
}

.prose ul > li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.75;
}

.text-gradient {
  background: linear-gradient(
    100deg,
    var(--text) 8%,
    color-mix(in srgb, var(--accent) 78%, var(--text)) 48%,
    color-mix(in srgb, var(--accent-2) 82%, var(--text)) 92%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.serif-accent {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

/* ==========================================================================
   Reduced motion — content stays immediately usable
   ========================================================================== */
@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;
    scroll-behavior: auto !important;
  }
}