.site-header {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: var(--color-surface);
}

.quilt-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  cursor: crosshair; /* the field can be stitched: blocks pin on click */
}

/* ---------- Nav ---------- */

.nav {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-gutter);
  padding: var(--space-nav-y) var(--space-gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-plum);
}

.brand__mark {
  width: 44px;
  height: 44px;
  background-color: currentColor;
  -webkit-mask: url("../assets/logo-mark.png") center / contain no-repeat;
  mask: url("../assets/logo-mark.png") center / contain no-repeat;
  transition: transform var(--duration-slow) var(--ease-spring);
}

.brand:hover .brand__mark {
  transform: rotate(-8deg) scale(1.06);
}

/* Dot-matrix year: "27" at rest; on hover the dots slide into "ICH" (positions set by JS) */
.brand__year {
  position: relative;
  display: block;
  width: var(--hover-w);
}

.brand__dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(var(--x), var(--y));
  transition: transform var(--duration-slow) var(--ease-spring);
  transition-delay: var(--d, 0ms);
}

.brand:hover .brand__dot,
.brand:focus-visible .brand__dot,
.brand--ich .brand__dot {
  transform: translate(var(--hx), var(--hy));
}

.nav__links {
  display: flex;
  justify-content: center;
  gap: clamp(1rem, 0.4rem + 1.8vw, 2.25rem);
  font-size: var(--text-nav);
  font-weight: 500;
  color: var(--color-navy);
}

.nav__links a {
  position: relative;
  display: inline-block;
  padding-block: 0.35em;
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--stitch-dot);
  --stitch-color: var(--color-plum);
  background-image: var(--stitch);
  background-size: var(--stitch-pitch) var(--stitch-dot);
  background-repeat: repeat-x;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--duration-normal) var(--ease-out-expo);
}

.nav__links a:hover::after,
.nav__links a:focus-visible::after {
  transform: scaleX(1);
}

.nav__links a:hover {
  color: var(--color-plum);
}

/* ---------- Hero (centred; brand elements orbit around it) ---------- */

.hero {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: var(--space-hero-top) var(--space-gutter) var(--space-hero-bottom);
  cursor: crosshair; /* pointer events bubble to the header, so the quilt still follows the needle */
}

.hero__content {
  cursor: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 1200px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-size: var(--text-eyebrow);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--color-eyebrow);
}

.eyebrow--hero {
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 0.75rem;
}

.eyebrow__dots {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 14px 0 0 var(--color-magenta), 28px 0 0 var(--color-teal);
  margin-right: 28px;
}

.hero__title {
  position: relative;
  margin-top: clamp(1.5rem, 1rem + 2.4vw, 3.5rem);
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-hero);
  line-height: 0.96;
  letter-spacing: -0.02em;
  color: var(--color-headline);
  text-wrap: balance;
}

.hero__line {
  display: block;
}

/* Quilt patches: small sewn-on tags pinned on the headline at a slight angle */
.patch {
  position: absolute;
  z-index: 1;
  display: inline-block;
  padding: 0.6em 1.1em;
  font-family: var(--font-sans);
  font-size: clamp(0.8125rem, 0.65rem + 0.55vw, 1.125rem);
  font-weight: 700;
  letter-spacing: var(--caps-tracking);
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--patch-ink);
  background: var(--patch-hue);
  rotate: var(--tilt);
  box-shadow: 0 1px 0 color-mix(in oklab, var(--color-navy) 18%, transparent);
}

/* The stitched edge: a running stitch just inside the patch, in the ink colour */
.patch::after {
  content: "";
  position: absolute;
  inset: 5px;
  --stitch-dot: 2px;
  --stitch-color: var(--patch-ink);
  background-image: var(--stitch-dotted), var(--stitch-dotted), var(--stitch-dotted), var(--stitch-dotted);
  background-size:
    var(--stitch-pitch) var(--stitch-dot),
    var(--stitch-pitch) var(--stitch-dot),
    var(--stitch-dot) var(--stitch-pitch),
    var(--stitch-dot) var(--stitch-pitch);
  background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
  background-position: 0 0, 0 100%, 0 0, 100% 0;
  opacity: 0.7;
  pointer-events: none;
}

.patch--date {
  --patch-hue: var(--color-chartreuse);
  --patch-ink: var(--color-navy);
  --tilt: -6deg;
  top: -0.3em;
  left: -0.35em;
}

.patch--edition {
  --patch-hue: var(--color-terracotta);
  --patch-ink: var(--color-white);
  --tilt: 5deg;
  right: -0.45em;
  bottom: -0.1em;
}

.hero__lede {
  margin-top: clamp(1.25rem, 0.8rem + 1.8vw, 2.5rem);
  max-width: 52ch;
  font-size: var(--text-lede);
  line-height: 1.3;
  color: var(--color-navy);
  text-wrap: pretty;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: clamp(1.75rem, 1.2rem + 2.4vw, 3.25rem);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .nav {
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .nav__links {
    display: none;
  }
}

/* Below the desktop layout the headline fills the width, so the patches leave it: the dates sit on a tilted
   tag above it and the edition below it, in the flow, never on top of the letters */
@media (max-width: 860px) {
  .hero__title {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .patch {
    position: static;
    font-size: clamp(0.8125rem, 0.65rem + 0.55vw, 1rem);
  }

  .patch--date {
    order: -1;
    margin-bottom: 1.25rem;
  }

  .patch--edition {
    margin-top: 1.5rem;
  }
}

@media (max-width: 480px) {
  .brand__year {
    width: var(--rest-w);
    zoom: 0.85; /* the dot-matrix "27" shrinks with the screen so the button never reaches it */
  }

  .brand__mark {
    width: 40px;
    height: 40px;
  }

  .nav__cta {
    --btn-height: 42px;
    --btn-pad-x: 16px;
    font-size: 0.875rem;
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 400px) {
  .brand {
    gap: 0.5rem;
  }

  .brand__year {
    zoom: 0.72;
  }

  .brand__mark {
    width: 36px;
    height: 36px;
  }

  .nav__end {
    gap: 0.25rem;
  }

  .nav__toggle {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 350px) {
  .brand__year {
    zoom: 0.6;
  }

  .brand__mark {
    width: 32px;
    height: 32px;
  }

  .nav__cta {
    --btn-height: 38px;
    --btn-pad-x: 12px;
    font-size: 0.8125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brand__mark,
  .brand__dot,
  .nav__links a::after {
    transition-duration: 1ms;
  }
}
