/* =========================================================================
   BASE — reset, typography, focus, motion
   ========================================================================= */

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

/*
 * The hidden attribute must always win. An element with an explicit display
 * value in CSS — a fixed dialog set to grid, a flex list — otherwise ignores
 * [hidden] and shows when it should be gone. This keeps the mobile menu, the
 * shortlist tray and the brief view hidden until JavaScript reveals them.
 */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 16px);
}

body {
  margin: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* The grain sits behind everything and never intercepts a click. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: var(--grain);
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
}

body > * {
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 460;
  line-height: var(--leading-heading);
  letter-spacing: var(--tracking-tight);
  color: var(--ink);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 144, "SOFT" 0, "WONK" 0;
  text-wrap: balance;
}

h1 {
  font-size: var(--h1);
  line-height: var(--leading-tight);
  font-weight: 480;
}
h2 {
  font-size: var(--h2);
  font-weight: 470;
}
h3 {
  font-size: var(--h3);
}
h4 {
  font-size: var(--h4);
}

p {
  margin: 0 0 1em;
  max-width: 66ch;
  text-wrap: pretty;
}

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

a {
  color: var(--burgundy);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent);
  transition: color var(--duration) var(--ease), text-decoration-color var(--duration) var(--ease);
}

a:hover {
  color: var(--burgundy-deep);
  text-decoration-color: var(--burgundy-deep);
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.15em;
}

li {
  margin-bottom: 0.35em;
}

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

strong,
b {
  font-weight: 650;
}

em {
  font-style: italic;
}

hr {
  border: 0;
  border-top: var(--hairline);
  margin: var(--space-6) 0;
}

small {
  font-size: var(--text-sm);
}

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

/* ---- Focus: always visible, never removed ---- */
:focus-visible {
  outline: var(--focus);
  outline-offset: var(--focus-offset);
  border-radius: var(--radius);
}

/* ---- Skip link ---- */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 200;
  transform: translateY(-160%);
  background: var(--burgundy);
  color: var(--white);
  padding: 10px 18px;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  transition: transform 160ms var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--white);
  outline-color: var(--charcoal);
}

/* ---- Screen-reader only ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Motion: gentle by default, absent when the visitor prefers that ---- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 620ms var(--ease),
    transform 620ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

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

@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;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
