:root {
  --cream: #fbf4e6;
  --paper: #fffaf1;
  --ink: #3b2416;
  --muted: #7a5a44;
  --cranberry: #8e1f2f;
  --pumpkin: #d8742a;
  --gold: #e3a92f;
  --sage: #6b7b4b;
  --line: #ead9bd;
  --shadow: 0 6px 20px rgba(76, 38, 14, .12);
  --radius: 14px;
}

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

body {
  margin: 0;
  font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(227, 169, 47, .18), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(216, 116, 42, .15), transparent 45%),
    var(--cream);
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2 { font-family: "Playfair Display", Georgia, serif; margin: 0; }

/* Falling-leaf border along the top */
.leaves {
  position: absolute; inset: 0 0 auto 0; height: 120px; pointer-events: none; opacity: .5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='120' viewBox='0 0 160 120'%3E%3Ctext x='8' y='40' font-size='30' transform='rotate(-20 20 30)'%3E🍁%3C/text%3E%3Ctext x='70' y='90' font-size='24' transform='rotate(25 80 80)'%3E🍂%3C/text%3E%3Ctext x='120' y='30' font-size='20'%3E🍃%3C/text%3E%3C/svg%3E");
  background-repeat: repeat-x;
}

.hero {
  position: relative;
  text-align: center;
  padding: 56px 16px 28px;
}
.eyebrow {
  margin: 0 0 6px; letter-spacing: .2em; text-transform: uppercase;
  font-size: 13px; font-weight: 600; color: var(--pumpkin);
}
.hero h1 { font-size: clamp(40px, 9vw, 68px); font-weight: 800; color: var(--cranberry); line-height: 1.05; }
.hero h1 span { display: inline-block; font-size: .55em; color: var(--ink); font-weight: 600; margin-top: 6px; }
.date { margin: 12px 0 18px; color: var(--muted); font-size: 18px; }

.times {
  display: inline-flex; align-items: center; gap: 18px;
  background: var(--paper); border: 2px solid var(--gold); border-radius: 999px;
  padding: 10px 26px; box-shadow: var(--shadow);
}
.time { display: flex; flex-direction: column; }
.time .label { font-size: 12px; text-transform: uppercase; letter-spacing: .15em; color: var(--muted); }
.time .value { font-family: "Playfair Display", Georgia, serif; font-size: 24px; font-weight: 800; color: var(--cranberry); }
.divider { font-size: 22px; }

main { max-width: 820px; margin: 0 auto; padding: 0 16px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 5px solid var(--pumpkin);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 22px;
}
.rsvp-card { border-top-color: var(--gold); }
.request-card { border-top-color: var(--sage); }

.welcome-note { max-width: 560px; margin: 18px auto 0; font-size: 18px; color: var(--ink); }

.rsvp-box { background: var(--cream); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 16px; }
.rsvp-q { margin: 0 0 10px; }
.rsvp-choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.choice {
  font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 999px; cursor: pointer;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.choice:hover { border-color: var(--gold); }
.choice.selected { background: var(--cranberry); border-color: var(--cranberry); color: #fff; }
.choice.selected[data-status=maybe] { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.choice.selected[data-status=no] { background: var(--muted); border-color: var(--muted); }
label.party { font-weight: 400; margin-bottom: 6px; }
label.party input { display: inline-block; width: 90px; margin: 0 0 0 8px; }
.rsvp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.rsvp-list li { background: #fff; border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 15px; }
.rsvp-list li.maybe { border-style: dashed; color: var(--muted); }
.rsvp-list li.mine { border-color: var(--cranberry); }
.rsvp-no { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

.gate { max-width: 440px; }
.gate h2 { color: var(--cranberry); margin-bottom: 6px; }

.whoami { text-align: right; color: var(--muted); font-size: 15px; margin: 0 0 12px; }

.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { font-size: 28px; color: var(--cranberry); }
.sub { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

.entries { list-style: none; margin: 0; padding: 0; }
.entry {
  display: grid; grid-template-columns: auto 1fr; gap: 14px;
  padding: 14px 0; border-top: 1px dashed var(--line);
}
.entry:first-child { border-top: none; }
.entry.no-photo { grid-template-columns: 1fr; }
.thumb {
  width: 84px; height: 84px; border-radius: 10px; object-fit: cover;
  border: 2px solid var(--line); background: var(--cream); display: block;
}
.entry-main { min-width: 0; }
.item { font-weight: 600; font-size: 19px; overflow-wrap: anywhere; }
.who { color: var(--muted); font-size: 15px; }
.who strong { color: var(--ink); }
.note { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 6px; font-size: 15px; }
.meta a { color: var(--cranberry); overflow-wrap: anywhere; }
.badge {
  display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px;
  background: #f3e3c4; color: var(--ink);
}
.badge.covered { background: #e3ead2; color: #3f4a28; }
.badge.open { background: #f8dccb; color: #7a3410; }
.badge.partial { background: #f6ebc4; color: #5c4510; }
.qty { display: inline-block; margin-left: 8px; font-size: 14px; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--cranberry); color: #fff; vertical-align: 2px; }
input.qty-input { width: 110px; }
.mine-actions { display: inline-flex; gap: 10px; }

.btn {
  font: inherit; font-weight: 600; border-radius: 999px; padding: 10px 18px;
  border: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--cranberry); color: #fff; }
.btn.primary:hover { background: #761827; }
.btn.secondary { background: transparent; color: var(--cranberry); border-color: var(--cranberry); }
.btn.secondary:hover { background: #f6e6dc; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 6px 14px; font-size: 15px; }
.btn:disabled { opacity: .6; cursor: default; }
.link {
  font: inherit; background: none; border: none; padding: 0; color: var(--cranberry);
  text-decoration: underline; cursor: pointer;
}

label { display: block; font-weight: 600; margin: 0 0 14px; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--muted); font-size: 14px; }
input[type=text], input[type=password], input[type=url], input[type=number], textarea, select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-weight: 400;
  padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.hint { color: var(--muted); font-size: 14px; margin-top: -4px; }
.error { color: #a01c1c; font-weight: 600; min-height: 1em; margin: 6px 0; }
.empty { color: var(--muted); font-style: italic; margin: 6px 0 0; }

.photo-field { margin-bottom: 14px; }
.photo-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
#f-photo-preview { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); }
.file-btn { position: relative; margin: 0; display: inline-block; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }

dialog {
  border: none; border-radius: var(--radius); padding: 0; width: min(520px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(40, 20, 8, .35); background: var(--paper); color: var(--ink);
}
dialog::backdrop { background: rgba(59, 36, 22, .45); }
dialog form { padding: 22px; border-top: 5px solid var(--pumpkin); }
dialog h2 { color: var(--cranberry); margin-bottom: 14px; }
.dialog-buttons { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

footer { text-align: center; color: var(--muted); font-size: 14px; padding: 10px 16px 40px; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
  .section-head .btn { width: 100%; }
  .thumb { width: 64px; height: 64px; }
  .times { padding: 8px 18px; gap: 12px; }
  .time .value { font-size: 20px; }
}
