:root {
  color-scheme: light;
  --navy: #101f3b;
  --ink: #17253c;
  --muted: #5b6069;
  --gold: #93723d;
  --paper: #faf6eb;
  --line: #d9ceb9;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  font: 100%/1.55 var(--sans);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--navy); }
body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 0%, #254363 0, transparent 59%),
    linear-gradient(155deg, #142d49 0%, #101e37 78%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .55;
  background-image:
    radial-gradient(circle at 62px 83px, #ddcfab 0 1px, transparent 1.5px),
    radial-gradient(circle at 39px 28px, #f6e7be 0 .7px, transparent 1.3px),
    radial-gradient(circle at 93px 173px, #f3dfaa 0 1.2px, transparent 1.7px);
  background-size: 131px 187px, 93px 119px, 197px 281px;
}
.invitation {
  position: relative;
  width: min(100%, 36rem);
  margin: auto;
  padding: max(1.45rem, env(safe-area-inset-top)) max(1.12rem, env(safe-area-inset-right))
    max(2rem, env(safe-area-inset-bottom)) max(1.12rem, env(safe-area-inset-left));
}
.masthead { text-align: center; }
.wordmark {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #f1dec0;
  font: 600 .75rem/1.5 var(--sans);
  letter-spacing: .24em;
}
.wordmark::before, .wordmark::after {
  content: ""; width: 2.2rem; height: 1px; background: #c3aa7d;
}
.crest {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 6.8rem;
  height: 6.8rem;
  margin: 1rem auto -2.5rem;
  border-radius: 50%;
  padding: 4px;
  background: var(--navy);
  outline: 1px solid #b99d69;
  box-shadow: 0 5px 17px #0b142c35;
}
.crest img { width: 100%; height: 100%; display: block; }
.paper {
  position: relative;
  background: var(--paper);
  padding: .48rem;
  border: 1px solid #e4d6b9;
  box-shadow: 0 18px 50px #07101f50;
}
.paper-inner {
  padding: 3.05rem clamp(1rem, 5vw, 2.4rem) 1.8rem;
  border: 1px solid var(--line);
}
.ornament { display: flex; align-items: center; justify-content: center; gap: .55rem; height: .5rem; }
.ornament::before, .ornament::after { content: ""; width: 1.45rem; height: 1px; background: #b29b70; }
.ornament i { height: .35rem; width: .35rem; background: var(--gold); transform: rotate(45deg); }
h1 {
  margin: 1.05rem auto .7rem;
  color: var(--ink);
  font: 400 clamp(2rem, 7.5vw, 3rem)/1.09 var(--serif);
  letter-spacing: -.035em;
  text-wrap: balance;
  overflow-wrap: anywhere;
  text-align: center;
}
h1:focus { outline: none; }
.eyebrow {
  margin: 1.25rem 0 -.53rem;
  text-align: center;
  color: #76592b;
  font: 650 .69rem/1.6 var(--sans);
  text-transform: uppercase;
  letter-spacing: .13em;
}
.lead { text-align: center; color: var(--muted); max-width: 27rem; margin: .75rem auto 1.4rem; }
.guest {
  border-block: 1px solid var(--line);
  margin: 1.45rem 0;
  padding: .9rem .25rem;
  text-align: center;
}
.guest strong { display: block; font: 500 1.3rem/1.3 var(--serif); overflow-wrap: anywhere; }
.guest small, .greeting small { display: block; margin-top: .32rem; color: var(--muted); font-size: .81rem; font-variant-numeric: tabular-nums; }
.greeting { text-align: center; margin: 1.15rem 0; }
.greeting .salutation { margin: 0; font: 500 1.35rem/1.35 var(--serif); overflow-wrap: anywhere; }
.greeting .lead { margin: .25rem auto; }
.personal-card { display: block; width: 100%; max-height: 72vh; margin: 1rem auto; object-fit: contain; }
.invitation-viewer { margin-top: .9rem; }
.invitation-preview { margin-top: .5rem; padding: .5rem; border: 1px solid var(--line); }
button.quiet { min-height: 2.75rem; padding: .4rem; border-color: transparent; background: none; color: var(--ink); font-size: .9rem; text-decoration: underline; text-underline-offset: .22em; }
button.quiet:hover:not(:disabled) { background: #f1eadb; }
.santa-recipient { margin: 1.6rem 0; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.santa-recipient h2 { font: 500 clamp(1.4rem, 5vw, 1.85rem)/1.2 var(--serif); margin: 0; }
.recipient-name { margin: .65rem 0; font-weight: 650; overflow-wrap: anywhere; }
.santa-recipient dl { margin-top: .4rem; }
.santa-recipient dl > div { display: block; }
.santa-recipient dd { white-space: pre-wrap; margin-top: .2rem; font-weight: 500; }
button {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 3.1rem;
  padding: .7rem 1rem; border: 1px solid var(--navy); border-radius: .4rem;
  background: var(--navy); color: #fff9ed;
  font: 650 .99rem/1.35 var(--sans); cursor: pointer;
}
button:hover:not(:disabled) { background: #253c55; }
button:disabled { cursor: progress; background: #435269; }
button:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #8e6a2d; outline-offset: 3px;
}
label { display: block; color: var(--ink); font-size: .96rem; font-weight: 650; margin: 1rem 0 .35rem; }
textarea, select {
  display: block; width: 100%; min-height: 5.1rem; resize: vertical;
  padding: .7rem .8rem; border: 1px solid #a89c87; border-radius: .35rem;
  color: var(--ink); background: #fffdf7; font: 1rem/1.4 var(--sans);
}
select { min-height: 3rem; }
textarea::placeholder { color: #636873; }
form button { margin-top: 1.25rem; }
.field-hint, .field-error { display: block; font-size: .85rem; line-height: 1.4; }
.field-hint { color: var(--muted); margin: .15rem 0 .4rem; }
.field-error { color: #813721; margin: .25rem 0 0; }
.field-error:empty { margin: 0; }
[aria-invalid="true"] { border-color: #a23b25; }
button.secondary { background: transparent; color: var(--navy); border-color: var(--line); margin-top: .65rem; }
button.secondary:hover:not(:disabled) { background: #f1eadb; }
dl { margin: 1.35rem 0 .3rem; }
dl + button { margin-top: 1.3rem; }
dl > div { display: grid; grid-template-columns: minmax(4rem, 27%) 1fr; gap: 1rem; padding: .7rem .15rem; border-bottom: 1px solid var(--line); }
dt { color: var(--muted); font-size: .9rem; }
dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
#feedback { color: #813721; font-size: .9rem; margin: .9rem 0 0; }
#feedback:empty { margin: 0; }
@media (min-width: 42rem) {
  .invitation { padding-top: 3rem; }
  .crest { margin-top: 1.45rem; width: 8rem; height: 8rem; }
  .paper-inner { padding-bottom: 2.2rem; }
}
@media (max-height: 620px) {
  .invitation { padding-top: max(.65rem, env(safe-area-inset-top)); }
  .crest { width: 4.6rem; height: 4.6rem; margin-top: .55rem; margin-bottom: -1.25rem; }
  .paper-inner { padding-top: 1.9rem; }
}

/* At entry the printed invitation is the cover. The form retains its own stationery. */
body[data-screen="entry"] .masthead, body[data-screen="entry"] .ornament,
body[data-screen="loading"] .masthead, body[data-screen="loading"] .ornament { display: none; }
body[data-screen="entry"] .invitation {
  width: min(100%, 31rem);
  width: min(100%, 31rem, max(22.5rem, calc(80svh - 9rem)));
  padding: max(.5rem, env(safe-area-inset-top)) max(.5rem, env(safe-area-inset-right))
    max(1.2rem, env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
}
body[data-screen="entry"] .paper,
body[data-screen="entry"] .paper-inner { padding: 0; border: 0; box-shadow: none; }
body[data-screen="entry"] #heading {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); margin: 0; white-space: nowrap;
}
.entry-art {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #132a47;
}
.entry-art .personal-card {
  position: absolute; inset: 0; width: 100%; height: 100%; max-height: none;
  display: block; margin: 0; object-fit: contain;
}
.cover-fallback {
  height: 100%; padding: 1.5rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: #f7f0e1;
  background: radial-gradient(ellipse at 50% 15%, #294965, #132a47 75%);
}
.cover-brand { color: #e0c69b; font-size: .75rem; letter-spacing: .2em; font-weight: 650; }
.cover-title { margin: 1.2rem 0 .75rem; font: 400 clamp(2rem, 8vw, 2.85rem)/1.14 var(--serif); overflow-wrap: anywhere; }
.cover-fallback p { max-width: 22em; margin: 0; overflow-wrap: anywhere; }
.entry-info { padding: .8rem 1rem .75rem; }
.entry-info > dl { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem 1rem; margin: 0; }
.entry-info > dl > div { display: block; border: none; padding: 0; }
.entry-info > dl dt { font-size: .77rem; }
.entry-info > dl dd { font-size: 1rem; line-height: 1.35; }
.entry-info > dl > .detail-place { grid-column: 1 / -1; }
.entry-info > button { margin: .75rem 0 0; }
.entry-id { display: block; text-align: center; color: var(--muted); font-size: .76rem; margin-top: .4rem; }
body[data-screen="entry"] #feedback:not(:empty) { padding: 0 1rem 1rem; }
