/* ---------------------------------------------------------------
   Reset + base typography + shared page furniture
   --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg { display: block; max-width: 100%; }

/* Without this the HTML height attribute wins over a percentage width
   and the image renders stretched. */
img { height: auto; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.011em;
}

p { margin: 0; }

ul { margin: 0; padding: 0; list-style: none; }

/* Visible focus for keyboard users only */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-lg);
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: var(--space-sm); }

/* --- Layout wrappers ------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--wrap-wide);
  margin-inline: auto;
  padding-inline: var(--space-2xl);
}
@media (max-width: 760px) {
  .wrap { padding-inline: var(--space-lg); }
}

.wrap-text {
  width: 100%;
  max-width: var(--wrap-text);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

/* --- Site header ------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--header-h);
  gap: var(--space-md);
}

.wordmark {
  grid-column: 2;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.011em;
  color: var(--brand-pink);
  white-space: nowrap;
  transition: opacity 160ms var(--ease);
}
.wordmark:hover { opacity: 0.75; }

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.site-nav--start { grid-column: 1; justify-content: flex-start; }
.site-nav--end { grid-column: 3; justify-content: flex-end; }

.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  font-size: 16px;
  letter-spacing: -0.011em;
  text-transform: uppercase;
}
/* Underline grows from the centre on hover */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transition: transform 260ms var(--ease);
}
.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after { transform: scaleX(1); }
/* The current page keeps its underline, a touch heavier than hover. */
.site-nav a[aria-current="page"]::after { height: 2px; }

@media (max-width: 760px) {
  .site-header__inner {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: var(--space-xs);
    padding-block: var(--space-sm);
  }
  .wordmark { grid-column: 1; }
  .site-nav--start,
  .site-nav--end { grid-column: 1; justify-content: center; }
  .site-nav--start:empty { display: none; }
}

/* --- Site footer ------------------------------------------------ */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: var(--space-4xl);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  padding-block: var(--space-xl);
  font-size: 14px;
  color: var(--ink-muted);
}
.site-footer nav { display: flex; gap: var(--space-lg); }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }

/* Hand-drawn circle around a word. The artwork, its size relative to the
   word, and its offset all come from Figma — each page sets the four
   custom properties below so the stroke sits exactly as drawn. Because
   everything is expressed as a ratio of the word, it tracks the fluid
   type scale. */
.circled {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  /* Own stacking context, so the drawing can sit behind the word
     without dropping behind the page background. */
  isolation: isolate;
}
.circled::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--circle-w, 115%);
  height: var(--circle-h, 100%);
  /* dx/dy are percentages of the artwork box, not of the word. */
  transform: translate(calc(-50% + var(--circle-dx, 0%)),
                       calc(-50% + var(--circle-dy, 0%)));
  background: var(--circle-art) center / 100% 100% no-repeat;
  pointer-events: none;
  z-index: -1;
}

/* --- Scroll reveal ---------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur) var(--ease) var(--reveal-delay, 0ms),
              transform var(--dur) var(--ease) var(--reveal-delay, 0ms);
}
.reveal.is-revealed {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
