:root {
  --paper: #e6d2b0;
  --paper-deep: #d7bc93;
  --ink: #3a2a20;
  --ink-soft: #6a5344;
  --line: #b08960;
  --rose: #c4a4a0;
  --sage: #8b9a7d;
  --brown: #755c48;
  --gold: #b79a6a;
  --cream: #f3e6d0;
  --shadow: 0 18px 50px rgba(80, 50, 20, 0.12);
}

* {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Manrope, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, #fff8ee 0%, transparent 55%),
    linear-gradient(180deg, #f4eee4 0%, #ece3d4 100%);
  line-height: 1.6;
  overflow-x: hidden;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
}

.vine {
  pointer-events: none;
  position: fixed;
  top: 0;
  bottom: 0;
  width: 72px;
  opacity: 0.22;
  background-repeat: no-repeat;
  background-size: 72px 420px;
}

.vine-left {
  left: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 420' fill='none' stroke='%238B9A7D' stroke-width='1.2'%3E%3Cpath d='M40 0 C20 70 60 110 34 180 C10 250 58 300 40 420'/%3E%3Ccircle cx='28' cy='90' r='7' fill='%23C4A4A0' stroke='none'/%3E%3Ccircle cx='52' cy='190' r='6' fill='%23D4C4A8' stroke='none'/%3E%3Ccircle cx='26' cy='290' r='8' fill='%238B9A7D' stroke='none'/%3E%3C/svg%3E");
}

.vine-right {
  right: 8px;
  transform: scaleX(-1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 420' fill='none' stroke='%238B9A7D' stroke-width='1.2'%3E%3Cpath d='M40 0 C20 70 60 110 34 180 C10 250 58 300 40 420'/%3E%3Ccircle cx='28' cy='90' r='7' fill='%23C4A4A0' stroke='none'/%3E%3Ccircle cx='52' cy='190' r='6' fill='%23D4C4A8' stroke='none'/%3E%3Ccircle cx='26' cy='290' r='8' fill='%238B9A7D' stroke='none'/%3E%3C/svg%3E");
}

.invite,
.sheet {
  width: min(720px, calc(100% - 32px));
  margin: 40px auto 72px;
  position: relative;
}

.sheet-narrow {
  width: min(420px, calc(100% - 32px));
}

.sheet-wide {
  width: min(980px, calc(100% - 32px));
}

.sheet {
  position: relative;
  isolation: isolate;
  background-color: #f7f4ef;
  background-image:
    linear-gradient(rgba(255, 252, 247, 0.62), rgba(255, 252, 247, 0.62)),
    url("/static/img/paper.png");
  background-size: auto, 720px;
  background-repeat: repeat;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 56px 40px;
  text-align: center;
}

.hero,
.card,
.sheet {
  position: relative;
  isolation: isolate;
  background-color: #f7f4ef;
  background-image:
    linear-gradient(rgba(255, 252, 247, 0.62), rgba(255, 252, 247, 0.62)),
    url("/static/img/paper.png");
  background-size: auto, 720px;
  background-repeat: repeat;
  border: 1px solid #e0d8cc;
  box-shadow: var(--shadow);
}

.hero,
.card {
  padding: 36px 32px;
  margin-bottom: 20px;
}

.hero {
  text-align: center;
  padding: 56px 32px 48px;
}

.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold);
}

.display {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  line-height: 0.95;
  margin: 0 0 12px;
  color: var(--brown);
}

.display span {
  display: inline-block;
  font-style: italic;
  color: var(--rose);
  font-weight: 500;
}

.display-small {
  font-size: clamp(2rem, 6vw, 3.2rem);
}

.hero-line,
.lead {
  margin: 0;
  color: var(--ink-soft);
}

.card h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--brown);
}

.card h3 {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--brown);
}

.place {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(139, 90, 60, 0.25);
}

.place:first-of-type {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}

.greeting {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  margin: 0 0 10px;
}

.letter p:last-child,
.card p:last-child {
  margin-bottom: 0;
}

.when {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.55rem;
  margin: 0;
  text-transform: capitalize;
}

.time,
.venue-name {
  margin: 4px 0 16px;
  color: var(--ink-soft);
}

.venue-name {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.muted {
  color: var(--ink-soft);
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 22px;
}

.countdown div {
  background: rgba(117, 92, 72, 0.08);
  border: 1px solid rgba(117, 92, 72, 0.38);
  text-align: center;
  padding: 14px 6px 12px;
}

.countdown strong {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--brown);
}

.countdown span {
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.swatches {
  list-style: none;
  padding: 0;
  margin: 18px 0;
  display: flex;
  gap: 10px;
}

.swatches li {
  flex: 1;
  min-width: 0;
}

.swatch {
  display: block;
  height: 56px;
  border: 1px solid var(--line);
}

.swatch-name,
.swatch-hex {
  display: block;
  font-size: 0.72rem;
  line-height: 1.3;
}

.swatch-hex {
  color: var(--ink-soft);
}

.stack {
  display: grid;
  gap: 8px;
}

.question {
  border: 0;
  margin: 0;
  padding: 0 0 8px;
  border-top: 1px solid rgba(139, 90, 60, 0.18);
  display: grid;
  gap: 6px;
}

#rsvp-form > .question:first-child {
  border-top: 0;
}

.question-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--brown);
  margin: 18px 4px 0;
  padding: 0;
}

#rsvp-form > .question:first-child .question-title {
  margin-top: 16px;
}

.guest-names {
  margin-top: 8px;
}

.choice,
.field,
.btn {
  font: inherit;
}

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(139, 90, 60, 0.22);
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: rgba(117, 92, 72, 0.38);
  background: rgba(117, 92, 72, 0.08);
}

.choice input[type="radio"],
.choice input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  cursor: pointer;
}

.choice input[type="radio"] {
  background-image: url("/static/img/radio.svg?v=2");
}

.choice input[type="radio"]:checked {
  background-image: url("/static/img/radio-on.svg?v=3");
}

.choice input[type="checkbox"] {
  background-image: url("/static/img/check.svg?v=2");
}

.choice input[type="checkbox"]:checked {
  background-image: url("/static/img/check-on.svg?v=2");
}

.choice input[type="radio"]:focus-visible,
.choice input[type="checkbox"]:focus-visible {
  outline: 2px solid rgba(117, 92, 72, 0.55);
  outline-offset: 3px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span:not(.question-title) {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

input[type="text"],
input[type="number"],
input[type="password"] {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--cream);
  color: var(--ink);
  width: 100%;
}

#guest-count,
.guest-names input[type="text"] {
  border-color: rgba(117, 92, 72, 0.38);
  background: rgba(117, 92, 72, 0.08);
}

.btn {
  appearance: none;
  border: 0;
  background: var(--brown);
  color: var(--cream);
  padding: 14px 18px;
  cursor: pointer;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.btn:hover {
  background: #6f452c;
}

.btn:disabled {
  opacity: 0.65;
  cursor: default;
}

.btn-ghost {
  background: transparent;
  color: var(--brown);
  border: 1px solid rgba(117, 92, 72, 0.55);
}

.btn-ghost:hover {
  background: rgba(117, 92, 72, 0.08);
}

.rsvp-done {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.thanks {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--brown);
  margin: 0;
}

.text-link {
  color: var(--brown);
}

.form-error {
  color: #8a3b3b;
  margin: 0;
}

.form-ok {
  color: var(--sage);
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

[hidden] {
  display: none !important;
}

code {
  font-family: ui-monospace, monospace;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 0 0 24px;
  list-style: none;
}

.stats li {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 12px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.admin-table th,
.admin-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  vertical-align: top;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.8rem;
}

.tag-yes {
  background: #e7efe0;
}

.tag-no {
  background: #f3e4e2;
}

.tag-maybe {
  background: #efe8d8;
}

.tag-pending {
  background: var(--paper);
  color: var(--ink-soft);
}

@media (max-width: 640px) {
  .invite,
  .sheet {
    width: min(720px, calc(100% - 16px));
    margin: 12px auto 48px;
  }

  .hero,
  .card,
  .sheet {
    padding: 24px 16px;
  }

  .display {
    overflow-wrap: anywhere;
  }

  .vine {
    display: none;
  }

  .countdown {
    grid-template-columns: repeat(2, 1fr);
  }

  .swatches {
    gap: 6px;
  }

  .swatch-hex {
    display: none;
  }

  .swatch-name {
    font-size: 0.62rem;
  }

  .swatch {
    height: 36px;
  }

  .question-title {
    font-size: 1.22rem;
  }

  .choice {
    min-height: 44px;
  }

  input[type="text"],
  input[type="number"],
  input[type="password"],
  .btn {
    font-size: 16px;
  }
}
