@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 400; font-display: swap; src: url("../fonts/eb-garamond-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-weight: 500; font-display: swap; src: url("../fonts/eb-garamond-latin-500-normal.woff2") format("woff2"); }

:root {
  --paper: #f1ebe4;
  --olive: #66583d;
  --brown: #4a2f1d;
  --emboss-face: #f6f0e9;
  --emboss-shade: rgb(138 102 66 / .66);
  --emboss-light: #fffdf9;
  --display: "Cormorant Garamond", Garamond, serif;
  --body: "EB Garamond", Garamond, serif;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--paper) url("../art/paper.webp") repeat;
  background-size: 480px 480px;
  color: var(--olive);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-align: center;
  -webkit-text-size-adjust: 100%;
}

.defs { position: absolute; }

.card {
  position: relative;
  width: min(100%, 680px);
  margin-inline: auto;
  container-type: inline-size;
}

/* ---- Raised arch ---- */
.frame { position: absolute; inset: 0; display: flex; flex-direction: column; pointer-events: none; }
.frame svg { display: block; width: 100%; overflow: hidden; }
.frame-top, .frame-bottom { height: auto; flex: none; }
.frame-top { aspect-ratio: 1024 / 440; }
.frame-bottom { aspect-ratio: 1024 / 200; }
.frame-sides { flex: 1; min-height: 0; margin-block: -.5px; }

.frame g.shade, .frame g.face, .frame g.light { fill: none; stroke-linecap: butt; }
.frame g.shade { stroke: var(--emboss-shade); stroke-width: 5; transform: translate(1.4px, 1.6px); }
.frame g.face  { stroke: var(--emboss-face);  stroke-width: 4.2; }
.frame g.light { stroke: var(--emboss-light); stroke-width: 1.6; transform: translate(-1px, -1px); }

/* The shapes inside <use> take these through the symbol. */
.fleuron { filter: drop-shadow(-.6px -.6px .3px #fffdf9) drop-shadow(1.2px 1.8px 1.1px rgb(116 82 48 / .62)); }
.relief { fill: url(#relief-fill); stroke: rgb(146 110 74 / .7); stroke-width: 4.5; }
.groove { fill: none; stroke: rgb(168 132 94 / .5); stroke-width: 11; stroke-linecap: round; }

/* ---- Text ---- */
.content {
  position: relative;
  padding: 25cqw 11.5cqw 17cqw;
}

.card-title {
  color: var(--brown);
  font-weight: 500;
  font-size: clamp(.82rem, 3.6cqw, 1.35rem);
  letter-spacing: .14em;
  text-indent: .14em;
  line-height: 1.5;
  text-transform: uppercase;
  text-wrap: balance;
}

.card-of {
  display: block;
  margin-top: 1.2cqw;
  font-family: var(--display);
  font-size: 1.3em;
  letter-spacing: .04em;
  text-indent: .04em;
  line-height: 1.1;
  text-transform: none;
}

.name {
  margin: 4cqw 0 0;
  font-family: var(--display);
  font-weight: 500;
  font-kerning: none; /* the card sets its names without kerning */
  font-size: 14.2cqw;
  line-height: 1;
  letter-spacing: .13em;
  text-indent: .13em; /* balances the trailing letter space so the name sits centred */
  text-transform: uppercase;
}

.and { display: block; width: 44cqw; height: auto; margin: 4cqw auto 0; }
.and + .person .name { margin-top: 3cqw; }

.reception { margin-top: 11cqw; }
/* On the invitation the double rule sits midway between the last name and the date. The
   name's line box leaves about 2.75cqw below its letters, so that is taken off the margin. */
.panel-body > .reception { margin-top: calc(2.45rem - 2.75cqw); }

/* A short run of the arch's double rule separates the names from the reception. */
.reception::before {
  content: "";
  display: block;
  width: 42%;
  height: 7px;
  margin: 0 auto 2rem;
  background: linear-gradient(var(--emboss-light) 0 1px, rgb(143 108 72 / .5) 1px 2px, transparent 2px 5px, var(--emboss-light) 5px 6px, rgb(143 108 72 / .5) 6px 7px);
  mask-image: linear-gradient(90deg, transparent, #000 25% 75%, transparent);
}
.reception h2 { color: var(--brown); font-size: 1.125rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.reception p { margin-top: 1rem; font-size: 1.125rem; text-wrap: balance; }
/* The restaurant name takes the same weight, size and colour as the date and time. */
.reception .venue-detail, .reception .address { font-size: clamp(.76rem, 3.6cqw, .875rem); }
.reception .when-where {
  margin-top: .45rem; /* with the rule's own margin, the same space as above the rule */
  padding: 1.1rem .5rem 1.2rem;
  border-radius: 1.75rem;
  background: var(--olive);
  color: var(--paper);
  box-shadow: 0 4px 10px rgb(74 47 29 / .18);
}

.button {
  display: inline-block;
  margin-top: 1.5rem;
  padding: .8rem 1.6rem;
  border: 1px solid var(--olive);
  border-radius: 999px;
  color: var(--paper);
  background: var(--olive);
  font-weight: 500;
  text-decoration: none;
}
.button:hover { background: var(--brown); border-color: var(--brown); }
.button:focus-visible { outline: 2px solid var(--brown); outline-offset: 3px; }

.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1.5rem; }
.actions .button { margin: 0; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 720px) {
  body { padding-block: 1.5rem 2.5rem; }
}

/* ---- RSVP ---- */
.section-title { color: var(--brown); font-size: 1.125rem; font-weight: 500; letter-spacing: .13em; }
.rsvp { margin-top: 2rem; scroll-margin-top: 1rem; }
.rsvp p { margin-top: .75rem; text-wrap: balance; }
.deadline { font-size: 1.2rem; color: var(--brown); }
.hint { font-size: 1rem; }
.household span { display: block; white-space: nowrap; }
.rsvp .household, .keepsake .household { font-size: clamp(.78rem, 4cqw, 1rem); }

.rsvp form { max-width: 24rem; margin: 1.5rem auto 0; text-align: left; }
.field { margin-top: 1.4rem; border: 0; min-width: 0; }
.field > label, .field legend { display: block; margin-bottom: .45rem; color: var(--brown); font-weight: 500; font-size: 1.125rem; }

/* 16px or more stops iPhones zooming in when a field is tapped. */
input[type="text"], select {
  width: 100%;
  min-height: 3rem;
  padding: .6rem 1.2rem;
  border: 1px solid #8d7a5c;
  border-radius: 999px;
  background-color: #fffcf8;
  color: var(--brown);
  font: inherit;
  font-size: 1.125rem;
}

/* iPhones ignore rounded corners on a native dropdown, so draw it ourselves, arrow included. */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%234a2f1d' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.2rem center;
}
/* The custom number dropdown that stands in for the select above when JavaScript runs. */
select[hidden] { display: none; }
.picker { position: relative; }
.picker-button {
  width: 100%;
  min-height: 3rem;
  padding: .6rem 3rem .6rem 1.2rem;
  border: 1px solid #8d7a5c;
  border-radius: 999px;
  background: #fffcf8 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1.5l6 6 6-6' fill='none' stroke='%234a2f1d' stroke-width='1.8'/%3E%3C/svg%3E") no-repeat right 1.2rem center;
  color: var(--brown);
  font: inherit;
  font-size: 1.125rem;
  text-align: left;
  cursor: pointer;
}
.picker-button:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
.picker-list {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .5rem .35rem;
  padding: .85rem .7rem;
  list-style: none;
  border: 1px solid #8d7a5c;
  border-radius: 1.75rem;
  background: #fffcf8;
  box-shadow: 0 14px 30px rgb(74 47 29 / .24);
  scroll-margin: 1rem;
}
.picker-list[hidden] { display: none; }
.picker-option {
  justify-self: center;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 3.1rem;
  aspect-ratio: 1;
  border: 1px solid #d9cbb5;
  border-radius: 50%;
  color: var(--brown);
  font-size: 1.25rem;
  font-variant-numeric: lining-nums;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.picker-option:hover { background: #efe6d8; }
.picker-option[aria-selected="true"] { background: var(--olive); border-color: var(--olive); color: var(--paper); }
.picker-option.is-active { outline: 2px solid var(--brown); outline-offset: 2px; }

.label-note { display: block; color: var(--olive); font-weight: 400; font-size: 1rem; }

.choices { display: grid; gap: .6rem; }
.choice { display: flex; align-items: center; gap: .7rem; min-height: 3rem; padding: .6rem 1.2rem; border: 1px solid #8d7a5c; border-radius: 999px; cursor: pointer; }
.choice input { width: 1.15rem; height: 1.15rem; flex: none; accent-color: var(--olive); }
.choice:has(input:checked) { background: #fffcf8; border-color: var(--brown); box-shadow: inset 0 0 0 1px var(--brown); }

/* Guests who decline are not asked for a number. Works without JavaScript. */
/* Each part appears only once it applies. A browser without :has shows them all, which still works. */
form:not(:has(input[name="attending"][value="yes"]:checked)) .when-accepting { display: none; }
form:not(:has(input[name="attending"][value="no"]:checked)) .when-declining { display: none; }

.guest-name + .guest-name { margin-top: .75rem; }
.guest-name input::placeholder { color: #9c8e75; opacity: 1; }

.rsvp form .button { display: block; width: 100%; margin-top: 1.75rem; }
button.button { font: inherit; font-weight: 500; font-size: 1.125rem; cursor: pointer; }
button.button:disabled { opacity: .65; cursor: progress; }

input:focus-visible, select:focus-visible, .text-link:focus-visible { outline: 2px solid var(--brown); outline-offset: 2px; }
[aria-invalid="true"] { border-color: #8f2d1d !important; box-shadow: 0 0 0 1px #8f2d1d; }
.rsvp .error { margin-top: .4rem; color: #8f2d1d; text-wrap: pretty; }
.alert { margin-top: 1.25rem; padding: .75rem 1rem; border: 1px solid #8f2d1d; border-radius: 1.25rem; background: #fffaf6; color: #732417; }
.text-link { display: inline-block; padding: .4rem 0; color: var(--brown); text-underline-offset: .2em; }

.answered { margin-top: 1.5rem; padding: 1.5rem 1.25rem; border: 1px solid #8d7a5c; border-radius: 1.5rem; background: #fffcf8; overflow-wrap: anywhere; }
.answered h3 { color: var(--brown); font-size: 1.35rem; font-weight: 500; line-height: 1.3; text-wrap: balance; }
.answered .button { margin-top: .5rem; }

/* ---- Keepsake and short messages ---- */
.keepsake { padding-top: 3cqw; }
.keepsake p { margin-top: 1rem; text-wrap: balance; }
.monogram { font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 9cqw, 3.4rem); letter-spacing: .08em; }
.keepsake h1 { margin-top: 1.5rem; color: var(--brown); font-weight: 500; font-size: clamp(1.35rem, 4.6cqw, 1.9rem); line-height: 1.3; text-wrap: balance; }
.keepsake .guest-name { margin-top: 1.5rem; font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 8.5cqw, 3.2rem); line-height: 1.15; overflow-wrap: anywhere; }
.party-list { list-style: none; margin-top: 1.75rem; font-family: var(--display); font-weight: 500; font-size: clamp(1.45rem, 6.2cqw, 2.1rem); line-height: 1.45; overflow-wrap: anywhere; }
.keepsake .reception { margin-top: 2.5rem; }
.keepsake .reception .when-where { margin-top: 1.25rem; }
.keepsake .hint { margin-top: 2.5rem; }

/* ---- Confirmation spacing ----
   J & S starts where "Wedding Reception" starts on the invitation. Each margin below allows for
   the space inside the line of text, so the gaps you see between blocks are all about 30px. */
.keepsake { padding-top: 0; }
.keepsake .monogram { margin-top: 0; line-height: 1; }
.keepsake h1 { margin-top: 23px; }
.keepsake .party-list { margin-top: 21px; }
.keepsake .guest-name { margin-top: 21px; }
.keepsake .guest-name + p { margin-top: 22px; }
.keepsake .reception { margin-top: 26px; }
.keepsake .reception::before { margin-bottom: 26px; }
.keepsake .reception h2 { line-height: 1.2; }
.keepsake .reception .when-where { margin-top: 26px; }
.keepsake .actions { margin-top: 30px; }
.keepsake .countdown { margin-top: 24px; }
.keepsake .hint { margin-top: 21px; }

/* ---- "Built by" credit ---- */
.built-by { display: flex; justify-content: center; align-items: center; height: 3.5rem; padding-bottom: .5rem; }
/* Sharing a baseline stands the mark on the same line as the letters. */
.built-by a { display: inline-flex; align-items: baseline; gap: .5em; padding: .6rem .8rem; color: var(--olive); font-size: 1rem; line-height: 1.2; text-decoration: none; }
.built-by svg { flex: none; height: .65em; width: 1.165em; } /* .65em is the height of the capital B */
.built-by a:hover, .built-by a:focus-visible { color: var(--brown); }
