/* ==========================================================================
   BASE — reset, document defaults, typography, links, media, utilities
   ========================================================================== */

/* ---- Reset --------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-5));
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd,
ul,
ol {
  margin: 0;
}

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

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

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

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

/* ---- Document ------------------------------------------------------------ */

body {
  min-height: 100vh;
  background-color: var(--c-ivory);
  color: var(--c-ink);
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;

  /* A barely-there woven texture, so large ivory fields are never flat. */
  background-image:
    radial-gradient(circle at 18% 12%, rgba(176, 141, 63, 0.05), transparent 42%),
    radial-gradient(circle at 86% 78%, rgba(110, 20, 35, 0.035), transparent 46%);
  background-attachment: fixed;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: var(--lh-snug);
  letter-spacing: -0.005em;
  color: var(--c-ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--t-display);
  font-weight: 300;
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--t-title);
  font-weight: 300;
}

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

h4 {
  font-size: 1.3rem;
}

/* ---- Prose --------------------------------------------------------------- */

p {
  text-wrap: pretty;
}

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

.prose > * + * {
  margin-top: var(--s-5);
}

.prose p {
  color: var(--c-ink-soft);
}

.prose h3,
.prose h4 {
  color: var(--c-ink);
  margin-top: var(--s-7);
}

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

.prose em {
  font-style: italic;
}

/* The opening paragraph of a long passage, set a touch larger. */
.prose--lead > p:first-child {
  font-size: var(--t-lead);
  line-height: var(--lh-loose);
  color: var(--c-ink);
}

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

a {
  color: var(--c-oxblood);
  text-decoration: none;
  transition: color var(--d-fast) var(--e-out);
}

a:hover {
  color: var(--c-oxblood-deep);
}

/* Inline links inside running prose get a gold underline that fills in. */
.prose a {
  background-image: linear-gradient(var(--c-gold), var(--c-gold));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 1px;
  transition: background-size var(--d-base) var(--e-out), color var(--d-fast) var(--e-out);
}

.prose a:hover {
  background-size: 100% 2px;
}

/* ---- Focus --------------------------------------------------------------- */

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

/* ---- Selection ----------------------------------------------------------- */

::selection {
  background: var(--c-gold-pale);
  color: var(--c-ink);
}

/* ---- Utilities ----------------------------------------------------------- */

.visually-hidden {
  position: absolute !important;
  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;
}

.skip-link {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: 2000;
  transform: translateY(-200%);
  background: var(--c-oxblood);
  color: #fff;
  padding: var(--s-3) var(--s-5);
  border-radius: var(--r-md);
  font-size: var(--t-small);
  font-weight: 500;
  transition: transform var(--d-base) var(--e-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: #fff;
}

.no-scroll {
  overflow: hidden;
}

/* ---- Scroll-reveal ------------------------------------------------------- */
/* Elements marked [data-reveal] start lowered and faded; site.js adds
   .is-revealed when they enter the viewport. Without JavaScript the
   .no-js rule below keeps everything visible. */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity var(--d-slow) var(--e-sacred),
    transform var(--d-slow) var(--e-sacred);
  transition-delay: var(--reveal-delay, 0ms);
}

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

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

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