/* ==========================================================================
   Base - reset, typography, focus, small utilities
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchored sections shouldn't hide behind the sticky nav. */
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-weight: 450;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Tilted stickers and overhanging photos must never create a sideways
     scroll. `clip` is preferred over `hidden` because it does not turn the
     body into a scroll container, which would break the sticky header. */
  overflow-x: hidden;
  overflow-x: clip;
}

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

img { height: auto; background-color: var(--paper-3); }

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

ul, ol { padding: 0; }

:where(h1, h2, h3, h4) {
  font-family: var(--display);
  font-variation-settings: var(--display-settings);
  font-weight: 700;
  line-height: var(--leading-snug);
  text-wrap: balance;
  letter-spacing: -0.015em;
}

h1 { font-size: var(--step-5); line-height: var(--leading-tight); }
h2 { font-size: var(--step-4); line-height: 1.06; }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }

/* The reset zeroes every margin, so a big heading sitting directly on top of
   its body copy has no gap at all. This puts one back, but only for h1/h2
   followed by running text - inside cards and .section-head the spacing is
   already handled by the component.

   Written with :where() so it carries zero specificity: any component that
   wants a different gap simply sets one and wins. */
:where(h1, h2) + :where(p, ul, ol, dl, .flow) { margin-top: var(--space-m); }

a { color: var(--link); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--coral); }

strong, b { font-weight: 700; }

/* ---- Focus --------------------------------------------------------------
   Visible, chunky and always on-brand. Mouse users never see it; keyboard
   users can never lose it. */
:focus-visible {
  outline: 3px solid var(--pitch);
  outline-offset: 3px;
  border-radius: var(--radius-s);
}

.btn:focus-visible,
.nav__cta:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

::selection { background: var(--sun); color: var(--ink); }

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: 0;
  left: var(--space-s);
  z-index: 200;
  transform: translateY(-120%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 var(--radius-m) var(--radius-m);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out);
}

.skip-link:focus-visible { transform: translateY(0); }

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

/* ---- Text helpers ------------------------------------------------------- */
.measure { max-width: var(--measure); }
.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 34ch;
}
.lede--wide { max-width: 52ch; }

.text-center { text-align: center; }

/* A line break that only applies once there is room for it. Headings set
   their own breaks for rhythm on wide screens; on a phone that would turn two
   lines into four, so below 46em the break is switched off and `text-wrap:
   balance` decides instead. */
br.br-md { display: none; }

@media (min-width: 46em) {
  br.br-md { display: inline; }
}

/* A short all-caps label above a heading. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  font-size: var(--step--1);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--berry-deep);
  margin-bottom: var(--space-s);
}

.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.eyebrow--on-dark { color: var(--sun); }
.eyebrow--plain::before { display: none; }

/* Hand-drawn highlight behind a word or two inside a heading. The SVG is a
   rough brush sweep, so it never looks like a rectangle. */
.mark {
  position: relative;
  white-space: nowrap;
}

.mark > span { position: relative; z-index: 1; }

.mark::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: -0.13em;
  right: -0.13em;
  bottom: 0.075em;
  height: 0.36em;
  background: var(--sun);
  border-radius: 0.3em 0.9em 0.4em 0.7em;
  transform: rotate(-0.7deg);
}

.mark--coral::after { background: var(--coral-wash); }
.mark--sky::after { background: var(--sky-wash); }
.mark--pitch::after { background: var(--pitch-wash); }

/* A wobbly underline, drawn rather than ruled. */
.squiggle {
  position: relative;
  white-space: nowrap;
}

.squiggle::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.22em;
  height: 0.3em;
  background: no-repeat center/100% 100%
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8.5C22 3.2 38 3 58 6.4c20 3.4 38 3.2 60-2.6' fill='none' stroke='%23ff5a47' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

.squiggle--pitch::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8.5C22 3.2 38 3 58 6.4c20 3.4 38 3.2 60-2.6' fill='none' stroke='%232f7d52' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ---- Scroll reveal -----------------------------------------------------
   reveal.js adds .is-in once an element has been scrolled to. Without JS, or
   with reduced motion, everything is simply visible - the class only ever
   removes a starting offset. */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--t-slow) var(--ease-out),
              transform var(--t-slow) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

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

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

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