@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

:root {
  /* Brand palette: cocoa and biscuit, on white label stock. */
  --cocoa: #604334;
  --cocoa-deep: #43291d;
  --biscuit: #d7b28d;
  --biscuit-shade: #c79f78;
  --stock: #fffefb;

  /* Width of the 2 x 3 inch tag. Everything on the tag scales from it. */
  --w: clamp(15rem, 27vw, 21rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: "Nunito", ui-rounded, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--cocoa-deep);
  background-color: var(--biscuit);
  /* Rows of crochet stitches, barely there. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='26'%3E%3Cg fill='none' stroke='%23604334' stroke-opacity='.07' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4l7 9 7-9M22 17l7 9M22 17l-7 9M-7 26l7-9 7 9M29 26l7-9 7 9'/%3E%3C/g%3E%3C/svg%3E");
}

img,
svg {
  display: block;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--cocoa-deep);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Layout */

.page {
  flex: 1;
  display: grid;
  grid-template-columns: auto minmax(0, 34rem);
  align-items: center;
  justify-content: center;
  gap: clamp(3rem, 8vw, 8rem);
  padding: clamp(2rem, 5vw, 4rem) clamp(1.25rem, 5vw, 4rem);
}

.tag-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.25rem;
  /* Room for the string loop above and left of the tag. */
  padding-top: calc(var(--w) * 0.55);
  padding-left: calc(var(--w) * 0.34);
}

/* The tag */

.scene {
  width: var(--w);
  aspect-ratio: 2 / 3;
  perspective: calc(var(--w) * 5);
  transform: rotate(-5deg);
  animation: settle 900ms cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

@keyframes settle {
  from {
    transform: rotate(-13deg) translateY(-0.75rem);
  }
}

.tag {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 700ms cubic-bezier(0.3, 0.1, 0.2, 1);
}

.tag.is-turned {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  filter: drop-shadow(0 calc(var(--w) * 0.012) calc(var(--w) * 0.01) rgb(67 41 29 / 0.22))
    drop-shadow(0 calc(var(--w) * 0.06) calc(var(--w) * 0.07) rgb(67 41 29 / 0.2));
}

.face-back {
  transform: rotateY(180deg);
}

.paper {
  --hole-x: 13.8%;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--stock);
  border-radius: calc(var(--w) * 0.012);
  color: var(--cocoa);
  /* The punch hole: 3 mm wide, centred 7 mm from the corner edges. */
  -webkit-mask: radial-gradient(circle calc(var(--w) * 0.033) at var(--hole-x) 9.2%, transparent 96%, #000 100%);
  mask: radial-gradient(circle calc(var(--w) * 0.033) at var(--hole-x) 9.2%, transparent 96%, #000 100%);
}

.face-back .paper {
  --hole-x: 86.2%;
}

.string {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--cocoa-deep);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Front of the tag */

.face-front .paper {
  padding-top: 21%;
}

.logo {
  width: 92%;
  height: auto;
}

.origin {
  display: flex;
  align-items: center;
  gap: calc(var(--w) * 0.05);
  margin-top: calc(var(--w) * 0.05);
  font-weight: 300;
  font-size: calc(var(--w) * 0.062);
  line-height: 1.5;
}

.origin img {
  width: calc(var(--w) * 0.2);
  height: auto;
}

.paper hr {
  width: 30%;
  height: 0;
  margin: calc(var(--w) * 0.07) 0 calc(var(--w) * 0.06);
  border: 0;
  border-top: 1px solid var(--biscuit-shade);
}

.handle {
  display: flex;
  align-items: center;
  gap: calc(var(--w) * 0.03);
  font-size: calc(var(--w) * 0.058);
}

.handle svg {
  width: calc(var(--w) * 0.075);
  height: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.handle .dot {
  fill: currentColor;
  stroke: none;
}

/* Back of the tag */

.face-back .paper {
  align-items: stretch;
  padding: 17% 11.5% 0;
}

.back-title {
  font-size: calc(var(--w) * 0.068);
  line-height: 1.2;
}

.rows {
  margin-top: calc(var(--w) * 0.02);
}

.row {
  display: grid;
  grid-template-columns: 1fr 13%;
  column-gap: 7%;
  height: calc(var(--w) * 0.083);
}

.row span {
  border-bottom: 1px solid var(--biscuit-shade);
}

.row-head {
  height: calc(var(--w) * 0.075);
  font-size: calc(var(--w) * 0.04);
  line-height: 1.4;
}

.row-head span:last-child {
  text-align: center;
}

.back-subtitle {
  margin-top: calc(var(--w) * 0.075);
  font-weight: 600;
  font-size: calc(var(--w) * 0.058);
  line-height: 1.2;
}

.lines span {
  display: block;
  height: calc(var(--w) * 0.09);
  border-bottom: 1px solid var(--biscuit-shade);
}

.find {
  display: flex;
  align-items: center;
  gap: 9%;
  margin-top: calc(var(--w) * 0.09);
  font-weight: 300;
  font-size: calc(var(--w) * 0.048);
  line-height: 1.6;
  text-decoration: none;
}

.find img {
  width: 38%;
  height: auto;
}

.find strong {
  font-weight: 600;
  font-size: calc(var(--w) * 0.054);
}

.find small {
  font-size: calc(var(--w) * 0.042);
}

/* The button that turns the tag */

.turn {
  appearance: none;
  padding: 0.35rem 0.25rem;
  border: 0;
  border-bottom: 1.5px solid currentColor;
  background: none;
  color: var(--cocoa-deep);
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.3;
  cursor: pointer;
}

.turn:hover {
  border-bottom-width: 3px;
  padding-bottom: calc(0.35rem - 1.5px);
}

/* Words */

.words {
  max-width: 34rem;
}

h1 {
  margin: 0 0 2rem;
  font-weight: 300;
  font-size: clamp(2.375rem, 4.4vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--cocoa-deep);
}

.words p {
  max-width: 30rem;
}

.words p + p {
  margin-top: 1rem;
}

.words .links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  max-width: none;
  margin-top: 2.5rem;
}

.primary {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: var(--cocoa-deep);
  color: var(--stock);
  font-weight: 600;
  text-decoration: none;
}

.primary:hover {
  background: var(--cocoa);
}

.mail {
  font-weight: 600;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.3em;
}

.mail:hover {
  text-decoration-thickness: 3px;
}

footer {
  padding: 1.5rem clamp(1.25rem, 5vw, 4rem) 2rem;
  font-size: 0.9375rem;
  text-align: center;
}

/* Narrow screens: tag first, words underneath. */

@media (max-width: 56rem) {
  :root {
    --w: clamp(13rem, 58vw, 18rem);
  }

  .page {
    grid-template-columns: minmax(0, 34rem);
    gap: 3rem;
    padding-top: 1rem;
  }

  .tag-area {
    padding-top: calc(var(--w) * 0.5);
    padding-left: calc(var(--w) * 0.2);
  }
}

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

  .tag {
    transition: none;
  }
}
