/* Save the date: Marek & Paulo
   Only a few hints of the main site: its paper colour, the terracotta
   title ink and its three type families. Nothing else. */

:root {
  --bg: #fcfafa;
  --surface: #ffffff;
  --text: #171a21;
  --muted: #6b7180;
  --line: rgba(23, 26, 33, .12);
  --ink: #b66238;           /* terracotta, the title colour of the main site */
  --ink-text: #ffffff;
  --olive: #4b4b31;
  --danger: #b3261e;

  --serif: "Lora", Georgia, serif;
  --sc: "Cormorant SC", "Cormorant Garamond", Georgia, serif;
  --script: "Beth Ellen", "Brush Script MT", cursive;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1426;
    --surface: #182038;
    --text: #eef0f7;
    --muted: #9aa2bd;
    --line: rgba(238, 240, 247, .14);
    --ink: #f0b48c;
    --ink-text: #1a1210;
    --olive: #ece4c6;
    --danger: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 72px 16px 40px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- language switch ---------- */
.lang {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 2px;
}
.lang button {
  font: 600 13px/1 var(--serif);
  letter-spacing: .04em;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 10px;
  min-width: 40px;
  cursor: pointer;
}
.lang button:hover { color: var(--text); }
.lang button[aria-pressed="true"] { color: var(--ink); }

/* ---------- the card: an arch, like an Algarve window ---------- */
.card {
  width: 100%;
  max-width: 440px;
  text-align: center;
  padding: 72px 32px 44px;
  border: 1px solid var(--ink);
  border-radius: 220px 220px 12px 12px;
}

.names {
  margin: 0;
  font-family: var(--sc);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--olive);
}

.script {
  font-family: var(--script);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
}
h1.script {
  margin: 18px 0 6px;
  font-size: clamp(44px, 12vw, 62px);
}

.lead {
  margin: 0;
  font-style: italic;
  color: var(--muted);
}

.rule {
  width: 36px;
  height: 1px;
  margin: 28px auto;
  background: var(--ink);
  opacity: .6;
}

.date {
  margin: 0;
  font-family: var(--sc);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.25;
}
.time {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.place {
  margin: 14px 0 0;
  font-family: var(--sc);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .06em;
}

.note {
  margin: 0 0 22px;
  font-size: 15px;
  color: var(--muted);
}

/* ---------- buttons ---------- */
.btn {
  font: 600 15px/1 var(--serif);
  color: var(--ink-text);
  background: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 15px 26px;
  min-height: 48px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: progress; transform: none; }

button:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.link {
  font: 600 15px/1 var(--serif);
  color: var(--ink);
  background: none;
  border: 0;
  padding: 10px 0;
  cursor: pointer;
}

/* ---------- dialog with the form ---------- */
dialog {
  width: min(520px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(16, 20, 36, .25);
}
dialog::backdrop {
  background: rgba(15, 20, 38, .45);
  backdrop-filter: blur(3px);
}

#rsvp, .thanks {
  position: relative;
  padding: 36px 28px 28px;
}
#rsvp h2, .thanks h2 {
  margin: 0 0 18px;
  font-size: 40px;
  text-align: center;
}

.close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 44px;
  height: 44px;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.close:hover { color: var(--text); }

fieldset {
  margin: 26px 0 0;
  padding: 0;
  border: 0;
}
legend, .sc {
  font-family: var(--sc);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  padding: 0;
  margin-bottom: 8px;
}

.field { margin-top: 12px; }
.row { display: flex; gap: 12px; }
.row .field:first-child { flex: 0 0 34%; }
.row .grow { flex: 1; }

label {
  display: block;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 4px;
}

input[type="text"], input[type="email"] {
  width: 100%;
  font: 400 16px/1.4 var(--serif);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
}
input:user-invalid { border-color: var(--danger); }

.hint {
  margin: 0 0 6px;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}
.hint.small { margin-top: 26px; font-size: 13px; }

#companions {
  list-style: none;
  margin: 0;
  padding: 0;
}
#companions li {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
#companions .remove {
  flex: 0 0 44px;
  font-size: 22px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.status {
  min-height: 1.4em;
  margin: 6px 0 12px;
  font-size: 14px;
  color: var(--danger);
}
#submit { width: 100%; }

.thanks { text-align: center; }
.thanks p { margin: 0 0 24px; color: var(--muted); }

@media (max-width: 420px) {
  .card { padding: 60px 22px 36px; }
  #rsvp, .thanks { padding: 32px 18px 22px; }
  .row { flex-direction: column; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}
