/* The album block of photo stamps and its viewer, the reply that the round
   postmark cancels, and the closing sheet with its printed mark. */

/* ---------- album ---------- */

.stamp--album-head .print {
  gap: 2cqi;
  padding: 6cqi;
  border: max(2px, 0.9cqi) solid var(--blue);
}

.album-title {
  font-size: max(30px, 9cqi);
}

.stamp--album-head .stamp-note {
  font-size: max(15px, 3.8cqi);
}

.album-count {
  margin-top: auto;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

@container (min-width: 600px) {
  .album-title {
    font-size: 6.4cqi;
  }

  .stamp--album-head .stamp-note {
    font-size: 2.4cqi;
  }
}

.stamp--shot {
  width: 100%;
  border: 0;
  background: var(--paper);
  font: inherit;
  cursor: zoom-in;
  transition: transform 0.35s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.stamp--shot:focus-visible {
  outline-offset: calc(var(--p) * -0.5 + 3px);
}

@media (hover: hover) {
  .stamp--shot:hover {
    transform: translateY(-2px) rotate(-0.8deg);
  }
}

.cell--shot:nth-child(3n + 2) .stamp--shot .print {
  background: var(--blue);
}

.cell--shot:nth-child(3n + 2) .placeholder {
  color: var(--paper);
}

/* ---------- the viewer: one photo stamp, loose ---------- */

.lightbox {
  --p: 16px;

  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 72px 16px 96px;
  background: var(--blue);
  color: var(--paper);
}

.lb-stamp {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.lb-print {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 160px;
  min-height: 160px;
  padding: calc(var(--p) * 0.72);
  background: var(--paper);
  mask:
    url("../img/perf-edge.svg") 0 0 / var(--p) var(--p) round,
    linear-gradient(#000 0 0) center / calc(100% - var(--p))
    calc(100% - var(--p)) no-repeat;
}

.lb-print .placeholder {
  position: absolute;
  font-size: 24px;
}

.lb-print img {
  position: relative;
  max-width: min(100%, 1100px);
  max-height: calc(100svh - 210px);
  object-fit: contain;
  background: var(--pink);
}

.lb-print.is-failed {
  width: min(80vw, 520px);
  aspect-ratio: 4 / 5;
  background: var(--pink);
}

.lb-cap {
  font-size: 0.9375rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.round-btn {
  position: fixed;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--paper);
  color: var(--blue);
  cursor: pointer;
}

.round-btn:hover {
  background: var(--pink);
}

.lb-close {
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
}

.lb-prev,
.lb-next {
  bottom: max(18px, env(safe-area-inset-bottom));
}

.lb-prev {
  left: calc(50% - 64px);
}

.lb-next {
  left: calc(50% + 12px);
}

@media (min-width: 900px) {
  .lb-prev,
  .lb-next {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }

  .lb-prev {
    left: 24px;
  }

  .lb-next {
    right: 24px;
    left: auto;
  }
}

/* ---------- the reply ---------- */

.stamp--rsvp-head .print {
  gap: 5cqi;
  padding: 8cqi 7cqi 7cqi;
  background: var(--blue);
  color: var(--paper);
}

.stamp--rsvp-head .sentence-title {
  font-size: max(34px, 13cqi);
}

.rsvp-message {
  max-width: 34ch;
  font-size: max(15px, 4.6cqi);
  font-weight: 600;
  line-height: 1.4;
}

@container (min-width: 380px) {
  .stamp--rsvp-head .sentence-title {
    font-size: 11cqi;
  }

  .rsvp-message {
    margin-top: auto;
    font-size: 4.4cqi;
  }
}

/* the round cancellation straddles the perforation between the two stamps.
   Unstruck it is a faint ring; a written name inks it in. */
.stamp--rsvp-head .print {
  padding-bottom: max(64px, 18cqi);
}

.cancel-mark {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: min(46%, 220px);
  color: var(--pink);
  pointer-events: none;
  opacity: 0.4;
  /* the ring's centre drops below the holes so the date prints on paper */
  transform: translateY(calc(50% + 24px)) rotate(-9deg);
  transform-origin: 73% 50%;
}

.cancel-mark .cancel-waves,
.cancel-mark text {
  opacity: 0;
}

.cancel-mark.is-inked {
  opacity: 1;
  animation: strike 0.34s cubic-bezier(0.2, 1.5, 0.4, 1);
}

.cancel-mark.is-inked .cancel-waves,
.cancel-mark.is-inked text {
  opacity: 1;
}

@keyframes strike {
  from {
    opacity: 0;
    transform: translateY(calc(50% + 24px)) scale(1.18) rotate(-18deg);
  }
}

@media (min-width: 900px) and (orientation: landscape) {
  .stamp--rsvp-head .print {
    padding-bottom: 7cqi;
  }

  /* desktop: the ring sits on the upright perforation, in the empty middle */
  .cancel-mark {
    top: 30%;
    right: auto;
    bottom: auto;
    left: 100%;
    width: 240px;
    transform: translate(-86%, -50%) rotate(-9deg);
  }

  @keyframes strike {
    from {
      opacity: 0;
      transform: translate(-86%, -50%) scale(1.18) rotate(-18deg);
    }
  }

  .stamp--rsvp-form .print {
    padding-left: 120px;
  }
}

.cancel-waves,
.cancel-ring {
  fill: none;
  stroke: currentColor;
  stroke-width: 4;
}

.cancel-ring--in {
  stroke-width: 2;
}

.cancel-name,
.cancel-date,
.cancel-year {
  fill: currentColor;
  font-family: var(--face);
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
}

.cancel-name {
  font-size: 15px;
  letter-spacing: 0.06em;
}

.cancel-date {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}

.cancel-year {
  font-size: 15px;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.stamp--rsvp-form .print {
  padding: 7cqi 6cqi 6cqi;
  border: max(2px, 0.6cqi) solid var(--blue);
}

.rsvp-form {
  display: grid;
  gap: 22px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-label {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#rsvp-name {
  width: 100%;
  min-height: 52px;
  padding: 6px 2px;
  border: 0;
  border-bottom: 3px solid var(--blue);
  border-radius: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 1.375rem;
  font-weight: 700;
}

#rsvp-name::placeholder {
  color: #4b59c6;
}

#rsvp-name:focus-visible {
  outline: 0;
  border-bottom-color: var(--pink);
  box-shadow: 0 3px 0 var(--blue);
}

.chips {
  display: grid;
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 8px;
}

.chips label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 48px;
  cursor: pointer;
}

.chips input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chips span {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.chips input:checked + span {
  background: var(--blue);
  color: var(--paper);
}

.chips input:focus-visible + span {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.submit {
  min-height: 56px;
  border: 0;
  background: var(--pink);
  color: var(--blue);
  font-size: 1.125rem;
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.submit:hover {
  background: var(--blue);
  color: var(--paper);
}

.submit[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
}

.rsvp-status {
  font-weight: 800;
  line-height: 1.35;
}

.rsvp-status:empty {
  display: none;
}

.rsvp-done {
  display: grid;
  align-content: center;
  gap: 12px;
  height: 100%;
}

.done-title {
  font-size: max(30px, 9cqi);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1;
  text-transform: uppercase;
}

.done-text {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
}

/* ---------- the closing sheet ---------- */

.stamp--closing .print {
  gap: 4cqi;
  padding: 9cqi 8cqi 8cqi;
  background: var(--blue);
  color: var(--paper);
}

.closing-message {
  font-size: max(20px, 8cqi);
  font-weight: 700;
  line-height: 1.3;
  text-wrap: balance;
}

.closing-names {
  margin-top: auto;
  color: var(--pink);
  font-size: max(18px, 7cqi);
  font-weight: 800;
  font-stretch: 75%;
  line-height: 1.05;
  text-transform: uppercase;
}

.stamp--closing .stamp-note {
  font-size: max(13px, 4.6cqi);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stamp--mark .print {
  align-items: center;
  justify-content: center;
  gap: 6cqi;
  padding: 8cqi;
  background: var(--pink);
}

.monogram {
  width: 100%;
  max-width: 160px;
}

.monogram circle {
  fill: none;
  stroke: var(--blue);
  stroke-width: 3;
}

.monogram .monogram-in {
  stroke-width: 1.5;
}

.monogram text {
  fill: var(--blue);
  font-family: var(--face);
  font-size: 26px;
  font-weight: 800;
  font-stretch: 75%;
}

.mark-year {
  font-size: max(13px, 9cqi);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
}
