/* Colours are taken from the save-the-date film, so the video blends into the page. */
:root {
  --paper: #d4c6b0;
  --paper-light: #e2d6c4;
  --ink: #1b1a17;
  --ink-soft: #4a4438;
  --terracotta: #c9604f;
  --terracotta-deep: #8f3226;
  --olive: #8ba04a;
  --line: #a99a82;
  --font-type: 'Special Elite', 'Courier New', monospace;
  --font-body: 'Courier Prime', 'Courier New', monospace;
  --font-script: 'Homemade Apple', cursive;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-body);
}

.layout {
  display: grid;
  gap: 8px;
  max-width: 460px;
  margin: 0 auto;
  padding: 0 0 64px;
}

.film__frame { position: relative; max-width: 420px; margin: 0 auto; }

.film video {
  display: block;
  width: 100%;
  height: auto;
  /* Browsers render video colours slightly differently from the page, so a matching
     background isn't enough. Fading the plain outer edges hides the rectangle. */
  -webkit-mask-image:
    linear-gradient(to right, transparent, #000 6%, #000 94%, transparent),
    linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent, #000 6%, #000 94%, transparent),
    linear-gradient(to bottom, transparent, #000 4%, #000 96%, transparent);
  mask-composite: intersect;
}

.film__replay {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 4px 10px;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: .875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.invite { padding: 0 24px; text-align: center; }

.greeting {
  min-height: 2.6em;
  margin: 0 0 4px;
  font: 400 1.05rem/2 var(--font-script);
  word-spacing: .35em;
  opacity: 0;
  transition: opacity .5s ease;
}
.greeting.is-visible { opacity: 1; }

.title {
  margin: 0 0 12px;
  font: 400 clamp(2rem, 9vw, 2.75rem)/1.1 var(--font-type);
  letter-spacing: .01em;
}
.title__amp { color: var(--terracotta-deep); }

.lede { margin: 0 0 24px; }

.details {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 16px;
  margin: 0 0 16px;
  padding: 16px 0;
  border-block: 1px solid var(--line);
}
.details dt {
  margin-bottom: 4px;
  color: var(--terracotta-deep);
  font: 400 .8125rem/1.3 var(--font-type);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.details dd { margin: 0; font-weight: 700; line-height: 1.35; }

.small { margin: 0; color: var(--ink-soft); font-size: .9375rem; line-height: 1.5; }

.panel { margin-top: 32px; }
.panel__title { margin: 0 0 16px; font: 400 1.375rem/1.25 var(--font-type); }

.state { display: grid; gap: 12px; justify-items: center; }
#state-form { justify-items: stretch; gap: 20px; }
#state-form .panel__title { margin: 0; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.choice span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: 8px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-weight: 700;
  line-height: 1.2;
  transition: background-color .15s ease, color .15s ease;
}
.choice input:checked + span { background: var(--ink); color: var(--paper-light); }
.choice input:focus-visible + span { outline: 3px solid var(--terracotta-deep); outline-offset: 2px; }
@media (hover: hover) {
  .choice:hover input:not(:checked) + span { background: var(--paper-light); }
}

.field { display: grid; gap: 8px; justify-items: center; }
.field__label { font-weight: 700; }
.optional { color: var(--ink-soft); font-weight: 400; }

.stepper { display: flex; align-items: center; gap: 20px; }
.stepper__button {
  width: 48px;
  height: 48px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: 700 1.5rem/1 var(--font-body);
  cursor: pointer;
}
.stepper__button:disabled { border-color: var(--line); color: var(--line); cursor: default; }
.stepper__value { min-width: 2ch; font: 400 2rem/1 var(--font-type); }

.identity { display: grid; gap: 16px; }
.field--wide { justify-items: stretch; text-align: left; }
.phone-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 12px; align-items: end; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

input[type='text'], input[type='email'], input[type='tel'], textarea {
  width: 100%;
  padding: 12px;
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  background: var(--paper-light);
  color: var(--ink);
  font: inherit;
  font-size: 1rem; /* Below 16px, iPhones zoom in when the box is tapped. */
  resize: vertical;
}

.button { font: inherit; font-weight: 700; cursor: pointer; }
.button--primary {
  width: 100%;
  min-height: 56px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--terracotta-deep);
  color: #fff;
}
.button--primary:disabled { opacity: .7; cursor: progress; }
.button--link {
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 3px;
}
:is(button, textarea, input):focus-visible { outline: 3px solid var(--terracotta-deep); outline-offset: 2px; }

.error { margin: 0; color: var(--terracotta-deep); font-weight: 700; }

/* A small vinyl record, echoing the one in the film. */
.record {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--paper) 0 3px, var(--terracotta) 4px 26%, transparent 27%),
    repeating-radial-gradient(circle, #1b1a17 0 2px, #2c2a25 3px 4px);
}
.record--small { width: 44px; height: 44px; }
.record--spin { animation: spin 1.8s linear infinite; }
.record--muted { filter: grayscale(.7); }
@keyframes spin { to { transform: rotate(360deg); } }

.state--done .panel__title { margin: 4px 0 0; }

@media (prefers-reduced-motion: reduce) {
  .record--spin { animation: none; }
  .greeting, .choice span { transition: none; }
}

/* On wide screens the film sits beside the invitation. */
@media (min-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 420px) minmax(0, 440px);
    gap: 64px;
    align-items: center;
    justify-content: center;
    max-width: none;
    min-height: 100vh;
    padding: 32px;
  }
  .invite { padding: 0; text-align: left; }
  .details { justify-items: start; }
  .state { justify-items: start; }
  .field { justify-items: start; }
}
