body.contact-page {
  --page: #faf9f5;
  --contact-width: min(1408px, round(down, 80vw, 16px));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  font-family: var(--body-font);
}

body.contact-page :is(.site-header, .site-footer, main.shell) {
  width: var(--contact-width);
  max-width: none;
  margin-inline: auto;
}

.contact-main {
  container-type: inline-size;
  display: grid;
  place-items: center;
  flex: 1;
  padding-block: 48px;
}

body.contact-page header.site-header {
  height: auto;
  min-height: 74px;
  padding-top: 14px;
}

.contact-page .site-header nav { transform: translateY(8px); }

.contact-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 872px);
  min-height: 616px;
  padding: 72px 16px;
}

.contact-title {
  position: relative;
  margin: 32px 0 0;
  font: 500 var(--type-28)/1.214286 var(--body-font);
  text-align: center;
  text-wrap: balance;
}

.contact-links {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 32px;
  margin: 64px 0 0;
  padding: 0;
  list-style: none;
}

.contact-links a {
  display: block;
  font-size: var(--type-20);
  font-weight: 400;
  line-height: 24px;
  text-decoration: none;
}

.contact-links a span { position: relative; }

.contact-links a span::after {
  --underline-stitch: 4.32px;
  --yellow-end: round(nearest, 16.6667%, var(--underline-stitch));
  --orange-end: round(nearest, 33.3333%, var(--underline-stitch));
  --pink-end: round(nearest, 50%, var(--underline-stitch));
  --purple-end: round(nearest, 66.6667%, var(--underline-stitch));
  --cyan-end: round(nearest, 83.3333%, var(--underline-stitch));
  content: '';
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  width: round(nearest, 100%, var(--underline-stitch));
  height: var(--underline-stitch);
  transform: translateX(-50%);
  background: linear-gradient(90deg,
    #e8b92e var(--yellow-end), #eb6b2f 0 var(--orange-end),
    #d94658 0 var(--pink-end), #6a3b94 0 var(--purple-end),
    #48afc0 0 var(--cyan-end), #76a832 0);
  mask: url('assets/case-cross.svg') 0 0 / var(--underline-stitch) var(--underline-stitch) repeat-x;
  visibility: hidden;
  pointer-events: none;
}

.contact-links a:is(:hover, :focus-visible, :active) span::after {
  visibility: visible;
  animation: footer-stitch-in 180ms steps(20, end) both;
}

@media (prefers-reduced-motion: reduce) {
  .contact-links a:is(:hover, :focus-visible, :active) span::after { animation: none; }
}

/* Keep the original letter proportions and align the three assets at the baseline. */
.contact-ornament {
  display: grid;
  grid-template-columns: 32em 12em 4em;
  column-gap: 3em;
  align-items: end;
  width: max-content;
  font-size: var(--goat-stitch);
  pointer-events: none;
}

.contact-ornament img {
  display: block;
  width: 100%;
  height: auto;
}

.contact-corner {
  position: absolute;
  width: 25em;
  height: 25em;
  font-size: var(--goat-stitch);
  pointer-events: none;
}

.contact-corner-top-left { inset: 0 auto auto 0; }
.contact-corner-top-right { inset: 0 0 auto auto; transform: scaleX(-1); }
.contact-corner-bottom-left { inset: auto auto 0 0; transform: scaleY(-1); }
.contact-corner-bottom-right { inset: auto 0 0 auto; transform: scale(-1); }

.contact-corner img {
  position: absolute;
  width: 5em;
  height: auto;
}

.contact-corner-medallion { top: 0; left: 0; }
.contact-corner .contact-corner-top-near { top: 0; left: 6em; width: 9em; }
.contact-corner .contact-corner-top-far { top: 0; right: 0; width: 9em; }
.contact-corner-side-near { top: 6em; left: 0; }
.contact-corner-side-far { bottom: 0; left: 0; }

.contact-page .site-footer {
  min-height: 74px;
  margin-block: 0;
  gap: 16px;
}

.contact-page .copyright img {
  width: 59px;
  height: auto;
}

.contact-page .back-top { margin: 0 8px 0 0; }

@media (max-width: 1000px) {
  body.contact-page { --contact-width: round(down, 100% - 64px, 16px); }
  .contact-panel { min-height: 544px; }
}

@media (max-width: 700px) {
  body.contact-page { --contact-width: round(down, 100% - 40px, 16px); }
  body.contact-page header.site-header { min-height: 68px; padding-top: 0; }
  .contact-page .site-header nav { transform: none; }
  .contact-main { padding-block: 32px; }
  .contact-panel { min-height: max(392px, calc(52 * var(--goat-stitch))); }
  .contact-title { margin-top: 24px; font-size: var(--type-24); line-height: 1.333333; }
  .contact-links { margin-top: 32px; column-gap: clamp(12px, 5cqw, 32px); }
  .contact-links a { padding-block: 10px; font-size: var(--type-16); }
  .contact-page .copyright { width: auto; }
  .contact-page .site-footer { flex-wrap: nowrap; }
  .contact-page .back-top { margin: 0; }
}

@container (max-width: 480px) {
  .contact-ornament {
    grid-template-columns: 12em 4em;
    justify-content: center;
    row-gap: 1em;
  }
  .contact-ornament img:first-child { grid-column: 1 / -1; justify-self: center; width: 32em; }
}

