@font-face {
  font-family: "Instrument Serif";
  src: url("./assets/instrument-serif.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Sans";
  src: url("./assets/instrument-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #1d1c1b;
  --ivory: #f4e8d1;
  --muted-ivory: #d9cdb9;
  --page-inset: clamp(32px, 6.4vw, 112px);
  --collage-image: url("./assets/collage.webp");
  font-family: "Instrument Sans", sans-serif;
  background: var(--ink);
  color: var(--ivory);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.hero {
  --header-top: clamp(28px, 5vh, 64px);
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-height: max(600px, 100svh);
  padding: var(--header-top) var(--page-inset) 64px;
}

.cursor-effects {
  --star-shape: polygon(54% 0, 66% 39%, 100% 53%, 62% 64%, 45% 100%, 37% 64%, 0 47%, 38% 36%);
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
}

.cursor-star,
.cursor-paper {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

.cursor-star {
  visibility: hidden;
  width: 23px;
  height: 23px;
  margin: -11.5px 0 0 -11.5px;
  filter: drop-shadow(0 0 1px var(--ink));
}

.cursor-star::before {
  position: absolute;
  inset: 0;
  background: #e5d5b9;
  clip-path: var(--star-shape);
  content: "";
}

.cursor-paper {
  isolation: isolate;
  background: var(--paper-color);
}

.cursor-paper::before {
  position: absolute;
  inset: 0;
  background: url("./assets/collage.webp") -626px -224px / 1000px 563px;
  filter: grayscale(1) brightness(0.88) contrast(2.05);
  mix-blend-mode: multiply;
  content: "";
}

.cursor-paper::after {
  position: absolute;
  inset: 0;
  background: var(--paper-fold);
  clip-path: polygon(4% 0, 41% 100%, 0 100%);
  opacity: 0.34;
  content: "";
}

@media (any-hover: hover) and (any-pointer: fine) and (prefers-reduced-motion: no-preference) {
  .hero.has-star-cursor {
    cursor: none;
  }

  .has-star-cursor .cursor-star {
    visibility: visible;
  }
}

@media (prefers-reduced-motion: reduce), (any-hover: none), (any-pointer: none) {
  .cursor-effects {
    display: none;
  }
}

.artwork {
  position: absolute;
  z-index: -1;
  top: 50%;
  right: 0;
  width: max(100%, 177.68svh);
  aspect-ratio: 1672 / 941;
  transform: translateY(-50%);
  pointer-events: none;
}

.artwork-base {
  display: block;
  width: 100%;
  height: 100%;
}

.artwork[data-artwork-version="2"] {
  --collage-image: url("./assets/collage-v2.webp");
  --drift-amount: 1;
  --artwork-width: max(104%, calc(max(600px, 100svh) * 1.7768));
  top: 50%;
  right: auto;
  bottom: auto;
  left: calc((100% - var(--artwork-width)) * 0.3);
  width: var(--artwork-width);
  transform: translateY(-50%);
  mask-image: none;
}

@media (min-aspect-ratio: 6/5) {
  .artwork[data-artwork-version="2"]::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, #1d1c1bd9 0 32%, #1d1c1b80 45%, transparent 59%);
    mask-image: linear-gradient(to bottom, transparent 13%, #000 23% 56%, transparent 69%);
    content: "";
  }
}

.artwork-grain {
  position: absolute;
  inset: 0;
  opacity: 0.22;
  animation: grain-frames 2.1s steps(1, end) infinite;
}

.artwork-patch,
.fragment {
  position: absolute;
}

.artwork-patch,
.fragment-paper {
  background-image: var(--collage-image);
  background-repeat: no-repeat;
}

.artwork[data-artwork-version="2"] .fragment-paper {
  animation-name: reveal, drift-in-space;
}

.artwork-patch {
  mask-image:
    linear-gradient(to right, transparent, #000 var(--fade-x), #000 calc(100% - var(--fade-x)), transparent),
    linear-gradient(to bottom, transparent, #000 var(--fade-y), #000 calc(100% - var(--fade-y)), transparent);
  mask-composite: intersect;
}

.fragment-paper {
  position: absolute;
  inset: 0;
  animation:
    reveal var(--reveal-time) ease-out var(--reveal-delay) both,
    drift var(--period) ease-in-out var(--phase) infinite;
}

.fragment[data-glimmer] {
  animation: glimmer var(--glimmer-period) ease-in-out infinite;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  animation: reveal 500ms ease-out both;
}

.brand-logo {
  display: block;
  width: clamp(94px, 8.9vw, 139px);
  height: auto;
}

.contact {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ivory);
  cursor: pointer;
  font: inherit;
  font-size: clamp(14px, 1.22vw, 17px);
  text-underline-offset: 4px;
  user-select: none;
}

.contact::before {
  position: absolute;
  inset: -12px -8px;
  content: "";
}

.contact:hover,
.contact:focus-visible {
  text-decoration: underline;
}

.contact:focus-visible {
  outline: 1px solid var(--ivory);
  outline-offset: 6px;
}

.contact-note {
  inset: calc(var(--header-top) + 38px) var(--page-inset) auto auto;
  isolation: isolate;
  width: min(328px, calc(100% - 2 * var(--page-inset)));
  margin: 0;
  padding: 19px 24px 18px;
  border: 0;
  background: transparent;
  color: #352a25;
  cursor: auto;
  filter: drop-shadow(0 5px 9px #0005);
}

.contact-note::before,
.contact-note::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  clip-path: polygon(0.4% 1%, 40% 0, 96% 0.7%, 100% 9%, 99.7% 96%, 78% 99%, 39% 98.5%, 0 100%);
  content: "";
}

.contact-note::before {
  background: linear-gradient(135deg, #f3e4c9, #e2c9a5);
}

.contact-note::after {
  background: var(--collage-image) -1320px -760px no-repeat;
  filter: grayscale(1) brightness(4.3) contrast(2.8);
  mix-blend-mode: multiply;
  opacity: 0.24;
}

.contact-note p {
  margin: 0 0 10px;
  font: 400 clamp(22px, 2vw, 26px) / 1.05 "Instrument Serif", Georgia, serif;
  text-wrap: pretty;
}

.contact-note a {
  color: inherit;
  font-size: 14px;
  text-decoration-color: #786354;
  text-underline-offset: 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .contact-note:popover-open {
    animation: contact-note-in 240ms cubic-bezier(0.2, 0.65, 0.3, 1);
  }
}

@keyframes contact-note-in {
  from { opacity: 0; transform: translateY(-6px) rotate(0.6deg); }
  to { opacity: 1; transform: none; }
}

@media (forced-colors: active) {
  .contact-note {
    border: 1px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }

  .contact-note::before,
  .contact-note::after {
    display: none;
  }
}

.hero-copy {
  position: relative;
  width: fit-content;
  margin-top: clamp(124px, 18.5vh, 208px);
}

.hero-copy h1 {
  --headline-entrance: rise 900ms cubic-bezier(0.2, 0.65, 0.3, 1) 300ms both;
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(60px, 6.2vw, 106px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.025em;
  animation: var(--headline-entrance);
}

.hero-copy h1 > span {
  display: block;
}

@media screen and (forced-colors: none) {
  @supports (background-clip: text) or (-webkit-background-clip: text) {
    .hero-copy h1 {
      background-color: var(--ivory);
      /* Frame the textured ivory area of the first collage behind the heading. */
      background-image:
        linear-gradient(#f4e8d196, #f4e8d196),
        var(--headline-grain, none),
        url("./assets/collage.webp");
      background-position: 0 0, 0 0, 65% 41.3%;
      background-size: auto, 192px 192px, auto 44em;
      background-repeat: no-repeat, repeat, no-repeat;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    @media (prefers-reduced-motion: no-preference) {
      .hero-copy h1 {
        animation:
          var(--headline-entrance),
          headline-static 2.1s steps(1, end) 1.2s infinite;
      }
    }

    .hero-copy h1 ::selection {
      background: var(--ivory);
      color: var(--ink);
    }
  }
}

.site-footer {
  position: absolute;
  right: var(--page-inset);
  bottom: clamp(20px, 3.6vh, 38px);
  left: var(--page-inset);
  color: var(--muted-ivory);
  font-size: 11px;
  line-height: 1.4;
  animation: reveal 600ms ease-out 600ms both;
}

@keyframes reveal {
  from { opacity: var(--start-opacity, 0); }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes headline-static {
  0%, 100% { background-position: 0 0, 0 0, 65% 41.3%; }
  16.67% { background-position: 0 0, 37px -59px, 65% 41.3%; }
  33.33% { background-position: 0 0, -79px 23px, 65% 41.3%; }
  50% { background-position: 0 0, 11px 101px, 65% 41.3%; }
  66.67% { background-position: 0 0, -47px -31px, 65% 41.3%; }
  83.33% { background-position: 0 0, 89px 53px, 65% 41.3%; }
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  47% { transform: translate(var(--drift-x), var(--drift-y)) rotate(var(--tilt)); }
  76% {
    transform: translate(calc(var(--drift-x) * 0.27), calc(var(--drift-y) * 0.53))
      rotate(calc(var(--tilt) * 0.42));
  }
}

@keyframes drift-in-space {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  47% {
    transform: translate(calc(var(--drift-x) * var(--drift-amount)), calc(var(--drift-y) * var(--drift-amount)))
      rotate(var(--tilt));
  }
  76% {
    transform: translate(calc(var(--drift-turn-x) * var(--drift-amount)), calc(var(--drift-turn-y) * var(--drift-amount)))
      rotate(calc(var(--tilt) * -0.5));
  }
}

@keyframes glimmer {
  0%, 100% { opacity: var(--glimmer-floor, 0.65); }
  42% { opacity: 1; }
  68% { opacity: 0.84; }
}

@keyframes grain-frames {
  0%, 100% { background-position: 0 0; }
  16.67% { background-position: 43px -31px; }
  33.33% { background-position: -81px 64px; }
  50% { background-position: 19px 93px; }
  66.67% { background-position: 72px 23px; }
  83.33% { background-position: -35px -74px; }
}

@media (max-width: 1060px), (max-aspect-ratio: 6/5) {
  .artwork {
    top: auto;
    right: -4%;
    bottom: 0;
    width: max(100%, 1050px);
    transform: none;
    mask-image: linear-gradient(to bottom, transparent, #000 15%);
  }

  .hero-copy {
    margin-top: clamp(110px, 15.5vh, 170px);
  }
}

@media (max-width: 760px) {
  :root {
    --page-inset: clamp(23px, 6.4vw, 48px);
  }

  .hero {
    --header-top: 25px;
    min-height: max(690px, 100svh);
  }

  .contact-note {
    /* Clear the headline and keep the note inside short viewports. */
    top: min(max(49svh, 68vw, 300px), calc(100dvh - 150px));
    width: min(290px, calc(100% - 2 * var(--page-inset)));
    padding: 15px 19px;
  }

  .brand-logo {
    width: clamp(112px, 30vw, 144px);
  }

  .artwork {
    right: -8%;
    width: max(700px, 130%);
  }

  .artwork[data-artwork-version="2"] {
    --drift-amount: 0.58;
    --artwork-width: max(100%, calc(max(690px, 100svh) * 1.7768));
    left: calc((100% - var(--artwork-width)) * 0.09);
  }

  .artwork[data-artwork-version="2"]::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 10%, #1d1c1ba6 20% 46%, transparent 60%);
    content: "";
  }

  .hero-copy {
    margin-top: clamp(85px, 12.5vh, 132px);
  }

  .hero-copy h1 {
    font-size: clamp(56px, 16.6vw, 94px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header,
  .hero-copy h1,
  .site-footer,
  .artwork-grain {
    animation: none;
  }

  .artwork-patch,
  .fragment {
    display: none;
  }
}
