:root {
  /* Align the transparent flame frames to the painting here. */
  --flame-top: 67.4%;
  --flame-left: 36.1%;
  --flame-width: 24%;

  --green: #183829;
  --red: #752a2b;
  --paper: #f4ecdc;
  --paper-light: #faf2e2;
  --paper-deep: #eadbbe;
  --frame-gold: #b8893a;
  --ribbon: #8a2b2b;
  --ink: #30271d;
  --muted: #665444;
  --gold: #b08a50;
  --line: #cfb583;
  --heading: "Cormorant Garamond", Georgia, serif;
  --body: "Source Sans 3", system-ui, sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  background-image: linear-gradient(#f4ecdce3, #f4ecdce3), url("images/paper-texture.png");
  color: var(--ink);
  font: 1.0625rem/1.5 var(--body);
}

h1, h2, p, ul { margin: 0; }
h1, h2 { font-family: var(--heading); line-height: 1.01; font-weight: 700; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 4px;
}

.hearth {
  --bow-clearance: clamp(1.65rem, min(7vw, 6svh), 4rem);
  --bottom-gap: .7rem;
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  padding: var(--bow-clearance) .65rem var(--bottom-gap);
  place-items: center;
}

.card-frame {
  position: relative;
  width: min(100%, calc((100vh - 3.5rem) * .75));
  width: min(100%, calc((100svh - var(--bow-clearance) - var(--bottom-gap)) * .75));
  padding: clamp(3px, .65vw, 7px);
  border: 3px solid var(--frame-gold);
  background: var(--paper);
  box-shadow: 0 10px 32px #5f391932, 0 2px 5px #70481d33;
  container-type: inline-size;
}

.painting { position: relative; }

.gift-trim {
  --ribbon-width: clamp(13px, 4.4cqw, 28px);
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.gift-trim::before,
.gift-trim::after {
  position: absolute;
  border-radius: 2px;
  content: "";
}

.gift-trim::before {
  /* The cross sits across the top frame, above the words in the painting. */
  top: calc(var(--ribbon-width) * -.4);
  right: -5px;
  left: -5px;
  height: var(--ribbon-width);
  background: linear-gradient(to bottom, #5b191a, var(--ribbon) 16% 83%, #631c1d);
  box-shadow: 0 2px 3px #3d191f30;
}

.gift-trim::after {
  top: calc(var(--ribbon-width) * -.85);
  left: 50%;
  width: var(--ribbon-width);
  height: calc(var(--ribbon-width) * 2.55);
  transform: translateX(-50%);
  background: linear-gradient(to right, #5b191a, var(--ribbon) 16% 83%, #631c1d);
  box-shadow: 2px 0 3px #3d191f30;
}

.bow {
  position: absolute;
  z-index: 1;
  top: 0;
  left: 50%;
  width: clamp(4.75rem, 30%, 11rem);
  height: auto;
  transform: translate(-50%, -50%);
}

.painting-link {
  position: absolute;
  inset: .7% 18.5% auto 20%;
  height: 34.5%;
  border: 0;
  border-radius: 8%;
  padding: 0;
  background: transparent;
}

.painting-link:focus-visible {
  outline: 3px solid #fff2cb;
  outline-offset: -6px;
  box-shadow: inset 0 0 0 9px #552924;
}

.room { width: 100%; height: auto; }

.fire {
  position: absolute;
  top: var(--flame-top);
  left: var(--flame-left);
  width: var(--flame-width);
  aspect-ratio: 256 / 172;
  pointer-events: none;
}

.flame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  visibility: hidden;
}

.flame.is-lit { visibility: visible; }

body:has(dialog[open]) { overflow: hidden; }

#card-dialog {
  width: min(calc(100% - 1.25rem), 38rem);
  max-height: calc(100dvh - 1.25rem);
  padding: 0;
  border: 5px double #94602d;
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at center, var(--paper-light) 25%, transparent 100%),
    repeating-linear-gradient(0deg, #98643416 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, #98643416 0 1px, var(--paper-deep) 1px 4px);
  color: var(--ink);
  box-shadow: 0 12px 50px #21170b45;
  scrollbar-color: #9f7648 var(--paper-deep);
}

#card-dialog::backdrop { background: #251608a6; }

.dialog-controls {
  position: sticky;
  top: .55rem;
  z-index: 1;
  height: 0;
}

.dialog-close {
  position: absolute;
  top: 0;
  right: .55rem;
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  place-content: center;
  border: 1px solid #a77743;
  border-radius: 50%;
  background: var(--paper);
  color: var(--red);
  font: 700 1.8rem/1 var(--heading);
}

.invitation {
  margin: .55rem;
  padding: 1.5rem .7rem 1.1rem;
  border: 1px dashed #9d6e3f;
  text-align: center;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  margin: 0 auto .8rem;
  color: var(--red);
}

.ornament::before, .ornament::after {
  width: 2.6rem;
  border-top: 1px solid var(--gold);
  content: "";
}

h1 {
  font-size: clamp(2.25rem, 8vw, 3.25rem);
  letter-spacing: -.025em;
  color: var(--red);
}

.intro {
  margin: .65rem auto .8rem;
  color: var(--muted);
}

.postboxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .8rem;
  max-width: 21rem;
  margin-inline: auto;
}

.postbox {
  display: grid;
  justify-items: center;
  align-content: start;
  padding: .3rem .4rem .6rem;
  border: 2px double #b38753;
  border-radius: 45% 45% .15rem .15rem / 30% 30% .15rem .15rem;
  background: #eadbbeb3;
  color: var(--green);
}

.postbox-email { color: var(--red); }

.postbox[aria-expanded="true"] {
  border-color: currentColor;
  box-shadow: inset 0 0 0 1px currentColor;
}

.postbox img {
  width: min(100%, 5.4rem);
  height: auto;
  margin-bottom: .2rem;
}

.postbox-label {
  font-family: var(--heading);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: .13em;
  line-height: 1;
  text-transform: uppercase;
}

.postbox-detail { margin-top: .15rem; color: var(--muted); font-size: .95rem; }

.deadline {
  margin: .95rem auto 0;
  font-size: .97rem;
  color: var(--muted);
}

.deadline time { color: var(--red); font-weight: 600; }

.card-panel {
  max-width: 35rem;
  margin: 1.8rem auto 0;
  padding: 1.15rem clamp(.75rem, 5vw, 1.6rem);
  border: 3px double #ab8050;
  background: var(--paper);
  text-align: left;
}

.card-panel h2 {
  margin-bottom: 1.1rem;
  color: var(--green);
  font-size: 2rem;
}

.field { margin-bottom: .8rem; }
.field label { display: block; margin-bottom: .25rem; font-weight: 600; }
.required { color: var(--red); }
.optional, .hint { color: var(--muted); font-size: .93rem; font-weight: 400; }
.hint { margin-top: .25rem; }

.field input, .field textarea {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: .45rem .6rem;
  border: 1px solid #9a8060;
  border-radius: .125rem;
  background: var(--paper-light);
  color: var(--ink);
}

.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border: 2px solid var(--red); }
.field-error, .submit-status { color: var(--red); font-size: .95rem; }
.field-error:not(:empty), .submit-status:not(:empty) { margin-top: .3rem; }

.checkbox {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.75rem;
  margin-bottom: .65rem;
  width: fit-content;
  cursor: pointer;
}

.checkbox input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--green); }
.privacy { margin-bottom: .75rem; color: var(--muted); font-size: .93rem; }

.submit {
  min-height: 2.75rem;
  padding: .45rem .9rem;
  border: 1px solid var(--green);
  border-radius: .125rem;
  background: var(--green);
  color: var(--paper);
  font-weight: 600;
}

#email-panel h2 { color: var(--red); }
#email-panel .submit { border-color: var(--red); background: var(--red); }
.submit:disabled { opacity: .72; }
.thanks { font: 700 1.8rem/1.13 var(--heading); color: var(--green); }

.more {
  margin: .65rem 1rem;
  text-align: center;
}

.more summary {
  width: fit-content;
  min-height: 2.75rem;
  margin-inline: auto;
  padding: .45rem .35rem;
  color: var(--red);
  cursor: pointer;
  font-weight: 600;
}

.details {
  display: grid;
  gap: .85rem;
  margin: .5rem 0;
  padding: .75rem .3rem;
  border-top: 1px solid var(--line);
  text-align: left;
}

.details h2 {
  margin-bottom: .55rem;
  font-size: 1.6rem;
  color: var(--green);
}

.details ul { padding: 0; list-style: none; }
.personal-links a { display: inline-block; min-height: 2.75rem; padding-block: .4rem; color: var(--red); text-underline-offset: .18em; }
.events li + li { margin-top: .45rem; }
.events span { display: block; color: var(--muted); font-size: .95rem; }

footer {
  padding: .15rem 1rem .9rem;
  color: var(--green);
  text-align: center;
}

footer .ornament { margin-bottom: .15rem; }
footer p span { font: italic 600 1.65rem/1.2 var(--heading); }
noscript p { margin-top: .8rem; text-align: center; }

@media (min-width: 34rem) {
  .small-break { display: none; }
  .invitation { padding: 1.8rem 1rem 1.2rem; }
  .field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
  .details { grid-template-columns: 1fr 1.1fr; padding-inline: .8rem; }
}
