/* The album as an uncut sheet of labels, the RSVP where the guest strikes
   their own match, and the viewer that holds one label up to the light. */

/* ---------- album head ---------- */
.album-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
}

.album-head .card-title {
  flex: 1 1 100%;
}

.album-sub {
  display: grid;
  font-weight: 700;
}

.album-count {
  color: var(--red);
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

/* ---------- the sheet: dashed cut lines between labels ---------- */
.sheet {
  --cols: 3;

  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  margin: 0;
  padding: 0;
  border-top: 2px dashed var(--black);
  border-left: 2px dashed var(--black);
  list-style: none;
}

.sheet.is-dense {
  --cols: 4;
}

.sheet li {
  padding: 6px;
  border-right: 2px dashed var(--black);
  border-bottom: 2px dashed var(--black);
}

.shot {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 4px 4px 5px;
  border: 0;
  border-radius: 0;
  background: var(--red);
  color: var(--paper);
  cursor: zoom-in;
  font: 700 0.6875rem / 1.2 var(--text);
  letter-spacing: 0.06em;
}

.shot-well {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  outline: 1.5px solid var(--paper);
  outline-offset: -1.5px;
}

/* the printed placeholder under every photo: shows while it loads or if it fails */
.shot-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  color: var(--paper);
  font-family: var(--display);
  font-size: 1.25rem;
  font-stretch: 80%;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.shot-ph svg {
  width: 26px;
  height: 40px;
}

.shot img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}

.shot img.is-loaded {
  opacity: 1;
}

.shot img.is-failed {
  visibility: hidden;
}

.shot-no {
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.shot:hover {
  background: var(--black);
}

/* ---------- RSVP ---------- */
.card--rsvp .card-inner {
  gap: 22px;
}

.rsvp-message {
  max-width: 34em;
  font-size: 1.0625rem;
}

.rsvp-side {
  display: grid;
  align-content: start;
  gap: 24px;
}

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

.rsvp-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label {
  padding: 0;
  font-weight: 700;
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--black);
  font: 500 1.0625rem / 1.3 var(--text);
}

.input::placeholder {
  color: #6a5648;
}

.card--black :focus-visible {
  outline-color: var(--paper);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips label {
  position: relative;
  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(--paper);
  font-family: var(--display);
  font-size: 1.25rem;
  font-stretch: 100%;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

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

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

.striker--rsvp {
  height: 64px;
  margin-top: 4px;
  outline: 2px solid var(--paper);
  outline-offset: -2px;
}

.striker--rsvp .match {
  left: 12px;
}

/* no name yet: the head is still dull and does not catch */
.striker--rsvp:not(.is-ready) .match-head {
  background: var(--grit);
  border-color: var(--paper);
}

.strike-row {
  position: relative;
  display: grid;
  gap: 10px;
}

.strike-submit {
  min-width: 44px;
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--black);
  cursor: pointer;
  font: 700 1rem / 1.2 var(--text);
}

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

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

.rsvp-status {
  min-height: 1.5em;
  font-weight: 700;
}

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

/* sent: the fields go, the struck match keeps burning on its strip */
.rsvp-form.is-sent .field,
.rsvp-form.is-sent .strike-submit,
.rsvp-form.is-sent .rsvp-status {
  display: none;
}

.done-title {
  color: var(--red);
  font-family: var(--display);
  font-size: clamp(2.25rem, 9vw, 3.25rem);
  font-stretch: 75%;
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
}

.done-text {
  font-size: 1.0625rem;
}

/* ---------- the viewer ---------- */
.loupe {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 72px 12px;
  background: var(--black);
  color: var(--paper);
}

.loupe-frame {
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 100%;
}

.loupe-frame img {
  max-width: min(92vw, 1000px);
  max-height: calc(100svh - 190px);
  border: 8px solid var(--paper);
  background: var(--red);
  object-fit: contain;
}

.loupe-frame.is-failed img {
  min-width: 240px;
  min-height: 300px;
}

.loupe-caption {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sq-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
  color: var(--black);
  cursor: pointer;
}

.sq-btn:hover {
  background: var(--red);
  color: var(--paper);
}

.loupe :focus-visible {
  outline-color: var(--red);
}

.loupe-close {
  top: 12px;
  right: 12px;
}

.loupe-prev,
.loupe-next {
  bottom: 12px;
}

.loupe-prev {
  left: 12px;
}

.loupe-next {
  right: 12px;
}

@media (min-width: 600px) {
  .sheet {
    --cols: 4;
  }

  .strike-submit {
    position: absolute;
    top: 12px;
    right: 8px;
    bottom: 8px;
    min-height: 0;
  }
}

@media (min-width: 900px) {
  .sheet {
    --cols: 6;
  }

  .sheet.is-dense {
    --cols: 8;
  }

  .album-head .card-title {
    flex: 0 1 auto;
  }

  .album-sub {
    margin-right: auto;
  }

  .card--rsvp .card-inner {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: 48px;
  }

  .card--rsvp .card-foot {
    grid-column: 1 / -1;
  }

  .loupe-prev,
  .loupe-next {
    top: 50%;
    bottom: auto;
    margin-top: -26px;
  }

  .loupe-prev {
    left: 24px;
  }

  .loupe-next {
    right: 24px;
  }
}
