/*
  EnsouWorks — Base layer.
  Reset, document defaults, and the typographic voice.
*/

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

* {
  margin: 0;
}

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

@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 {
  background-color: var(--c-ground);
  color: var(--c-ink);
  font-family: var(--f-body);
  font-size: var(--t-base);
  font-weight: 400;
  line-height: var(--lh-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}

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

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

/* ---- Headings --------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--f-display);
  font-weight: 400;
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}

h1 {
  font-size: var(--t-3xl);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--t-2xl);
  line-height: var(--lh-tight);
}

h3 {
  font-size: var(--t-lg);
}

h4 {
  font-size: var(--t-md);
}

p {
  text-wrap: pretty;
}

/* ---- Links ------------------------------------------------------------ */

a {
  color: inherit;
  text-decoration-color: var(--c-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--d-fast) var(--ease-sand),
    text-decoration-color var(--d-fast) var(--ease-sand);
}

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

:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

::selection {
  background-color: var(--c-accent);
  color: var(--c-ground);
}

/* ---- Utility voices ---------------------------------------------------- */

.label {
  font-family: var(--f-mono);
  font-size: var(--t-xs);
  font-weight: 400;
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-ink-mute);
}

.lede {
  font-size: var(--t-md);
  line-height: 1.55;
  color: var(--c-ink-soft);
  max-width: var(--measure);
}

.prose {
  max-width: var(--measure);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  color: var(--c-ink-soft);
}

.prose strong {
  color: var(--c-ink);
  font-weight: 500;
}

/* Screen-reader-only, but focusable when it needs to be seen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  background-color: var(--c-ink);
  color: var(--c-ground);
  font-family: var(--f-mono);
  font-size: var(--t-sm);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--d-base) var(--ease-sand);
}

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

/* ---- Shell ------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell--narrow {
  max-width: 62rem;
}

/* ---- Reveal on scroll --------------------------------------------------
   Elements start settled; JS lifts the flag once they enter the viewport.
   Without JS, or with reduced motion, everything is simply visible. */

[data-reveal] {
  opacity: 1;
}

.js [data-reveal] {
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity var(--d-slow) var(--ease-out),
    transform var(--d-slow) var(--ease-out);
}

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

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
