/* Home-page hero: the engraved name, its foil, and the layout. The lattice, the band and
   the 3D turn of the letters are driven by hero.js. Colors come only from the house tokens
   (and from colors.js, which derives the foil's thin spectrum from the gold token). */

.hero {
  --hero-gutter: var(--home-gutter, clamp(1rem, 4.4vw, 4.5rem));
  --hero-ease: cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* With the network (hero.js, WebGL2), the letters' outline and a faint trace of the
   hatching fade in as it lines up on them (--hero-resolve, 0..1), instead of the reveal
   below; the network itself fills the letters. */
.hero--net .hero__name {
  animation: none;
}

.hero--net .hero__engrave {
  opacity: calc(var(--hero-resolve, 0) * 0.3);
}

.hero--net .hero__name::after {
  opacity: var(--hero-resolve, 0);
}

.hero__inner {
  position: relative;
  padding: 0 var(--hero-gutter) clamp(1.25rem, 4.5vh, 3.25rem);
  will-change: transform, opacity;
}

/* The name: real text, set large, cut as an engraved plate with a foil sheen that travels
   with the light. hero.js sets the foil colors on .hero and moves the sheen
   (background-position). */
.hero {
  --hero-foil-ink: var(--ds-color-ink);
  --hero-foil-gold: var(--ds-color-gold);
  --hero-foil-pale: var(--ds-color-gold);
  --hero-foil-rose: var(--ds-color-gold);
  --hero-foil-aqua: var(--ds-color-gold);
}

.hero__name {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 0 -0.045em;
  padding: 0.1em 0.04em 0.06em;
  font-family: var(--ds-font-display);
  font-size: clamp(3.4rem, 13.2vw, 15rem);
  font-weight: var(--ds-weight-regular);
  line-height: 0.9;
  letter-spacing: -0.022em;
  white-space: nowrap;
  color: var(--ds-color-ink);
}

/* The foil, on the hatching. */
.hero__engrave {
  background-image: linear-gradient(
    100deg,
    var(--hero-foil-ink) 0%,
    var(--hero-foil-ink) 44.5%,
    var(--hero-foil-gold) 46.9%,
    var(--hero-foil-pale) 48.6%,
    var(--hero-foil-rose) 49.35%,
    var(--hero-foil-pale) 50%,
    var(--hero-foil-aqua) 50.65%,
    var(--hero-foil-pale) 51.4%,
    var(--hero-foil-gold) 53.1%,
    var(--hero-foil-ink) 55.5%,
    var(--hero-foil-ink) 100%
  );
  background-size: 300% 100%;
  background-position: 75% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Light theme: a finer band (under half the width) with a short ramp out of the ink, so
   the ink and gold never blend into brown. */
.hero--paper .hero__engrave {
  background-image: linear-gradient(
    100deg,
    var(--hero-foil-ink) 0%,
    var(--hero-foil-ink) 47.9%,
    var(--hero-foil-gold) 48.4%,
    var(--hero-foil-pale) 49.2%,
    var(--hero-foil-rose) 49.65%,
    var(--hero-foil-pale) 50%,
    var(--hero-foil-aqua) 50.35%,
    var(--hero-foil-pale) 50.8%,
    var(--hero-foil-gold) 51.6%,
    var(--hero-foil-ink) 52.1%,
    var(--hero-foil-ink) 100%
  );
}

/* The letters are cut as an intaglio plate: each glyph filled with fine horizontal rules,
   with a diagonal cross-hatch deepening toward the foot of the letters. The gaps between
   the lines are open, so the back of the lattice shows through; the raking light (the
   foil band) turns the hatching gold as it passes. */
.hero__inner {
  padding-top: clamp(5rem, 20vh, 13rem);
}

/* Tall screens: the name sits a little above the middle. */
@media (max-aspect-ratio: 9/10) {
  .hero__inner {
    padding-top: 12vh;
  }
}

.hero__name {
  --hatch-p: clamp(2.2px, 0.0165em, 4px);
  --hatch-w: calc(var(--hatch-p) * 0.4);
  position: relative;
}

/* On paper the rules need a little more weight to hold the letters. */
.hero--paper .hero__name {
  --hatch-w: calc(var(--hatch-p) * 0.5);
}

/* Standard-density screens: whole-pixel rules, or they shimmer into bands. */
@media (max-resolution: 1.5dppx) {
  .hero__name {
    --hatch-p: 3px;
    --hatch-w: 2px;
  }

  .hero--paper .hero__name {
    --hatch-w: 1px;
  }
}

.hero__engrave {
  display: inline-block;
  padding: 0.1em 0.04em 0.06em;
  margin: -0.1em -0.04em -0.06em;
  -webkit-mask-image:
    repeating-linear-gradient(to bottom, #000 0 var(--hatch-w), transparent var(--hatch-w) var(--hatch-p)),
    repeating-linear-gradient(-58deg, #000 0 calc(var(--hatch-w) * 0.85), transparent calc(var(--hatch-w) * 0.85) calc(var(--hatch-p) * 1.3)),
    linear-gradient(to bottom, transparent 55%, #000 95%);
  mask-image:
    repeating-linear-gradient(to bottom, #000 0 var(--hatch-w), transparent var(--hatch-w) var(--hatch-p)),
    repeating-linear-gradient(-58deg, #000 0 calc(var(--hatch-w) * 0.85), transparent calc(var(--hatch-w) * 0.85) calc(var(--hatch-p) * 1.3)),
    linear-gradient(to bottom, transparent 55%, #000 95%);
  -webkit-mask-composite: source-over, source-in;
  mask-composite: add, intersect;
}

/* The outline, drawn over the hatching (generated text, hidden from assistive tech). */
.hero__name::after {
  content: attr(data-text);
  content: attr(data-text) / "";
  position: absolute;
  inset: 0;
  padding: inherit;
  white-space: inherit;
  text-wrap: inherit;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: clamp(0.6px, 0.0055em, 1.4px) var(--ds-color-ink);
  pointer-events: none;
  user-select: none;
}

.hero__band {
  position: relative;
  height: 22px;
  margin-top: clamp(0.6rem, 1.8vh, 1.4rem);
}

.hero__band-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--ds-space-2) var(--ds-space-6);
  margin-top: clamp(0.6rem, 1.6vh, 1.2rem);
  font-family: var(--ds-font-text);
  font-style: italic;
  font-size: var(--ds-text-lg);
  line-height: var(--ds-leading-snug);
}

/* Arrival: the name is unmasked from the top, then the links follow. */
/* The name is revealed in place (no movement, so the lattice drawn over it lines up). */
@keyframes hero-rise {
  from {
    opacity: 0;
    clip-path: inset(0 0 100% 0);
  }
  to {
    opacity: 1;
    clip-path: inset(-20% -12% -20% -12%);
  }
}

@keyframes hero-fade {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero__name {
  animation: hero-rise 1.9s var(--hero-ease) 0.2s both;
}

.hero__links {
  animation: hero-fade 1.4s var(--hero-ease) 1.2s both;
}

/* Held at their first frame until hero.js says the display face is ready. */
.hero:not(.hero--ready) .hero__name,
.hero:not(.hero--ready) .hero__links {
  animation-play-state: paused;
}

.hero--still .hero__name,
.hero--still .hero__links {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero__name,
  .hero__links {
    animation: none;
  }
}

/* Phones: the name breaks onto two lines and grows. */
@media (max-width: 640px) {
  .hero__name {
    font-size: 21.5vw;
    line-height: 0.88;
    white-space: normal;
    text-wrap: balance;
  }

  .hero__links {
    font-size: var(--ds-text-md);
    gap: var(--ds-space-2) var(--ds-space-5);
  }
}

@media (forced-colors: active) {
  .hero__name::after {
    content: none;
  }

  .hero__engrave {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .hero__name,
  .hero__engrave {
    background: none;
    -webkit-text-fill-color: currentColor;
    color: CanvasText;
  }
}
