:root {
  --bg: #ffffff;
  --text: #1f1f1f;
  --muted: #4a4a4a;
  --accent: #71847e;
  --accent-2: #4f5f59;
  --card-bg: #ffffff;
  --border: #e2ddd4;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --font-heading: "Playfair Display", serif;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  scroll-behavior: smooth;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  min-height: 100vh;
  padding: 1.5rem;
  padding-top: 4.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.hero {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 18%, transparent),
    color-mix(in srgb, var(--accent-2) 18%, transparent)
  );
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  padding: 0.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  max-width: 1200px;
  width: 100%;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

.logo {
  font-family: var(--font-heading);
  letter-spacing: 0.08em;
  font-size: 1rem;
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav a {
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.nav a.is-active {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.nav-logout {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-logout svg {
  width: 16px;
  height: 16px;
}

.nav-logout:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-switcher {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.theme-label {
  font-weight: 700;
  color: var(--muted);
}

.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.custom-theme {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.65rem;
}

.custom-theme-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.custom-theme .pill-label {
  font-weight: 800;
}

.custom-note {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 0.2rem;
}

.custom-theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.custom-theme label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 700;
}

.custom-theme input[type="color"] {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}

.theme-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s ease;
}

.pill-label {
  white-space: nowrap;
}

.theme-pill .swatches {
  display: inline-flex;
  gap: 4px;
}

.theme-pill .swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.theme-pill:hover,
.theme-pill.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.hero-content {
  max-width: 760px;
  padding: 1rem 0 0.5rem;
}

.hero h1 {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  margin: 0.2rem 0 0.6rem;
}

.hero .eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 600;
  color: var(--muted);
  margin: 0;
}

.hero .subhead {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.greeting {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-2);
  margin: 0 0 1rem;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--border);
  border-radius: 999px;
}

#login {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 12%, transparent),
    color-mix(in srgb, var(--accent-2) 12%, transparent)
  );
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 1.75rem;
}

#login .lead {
  color: var(--muted);
  max-width: 640px;
}

#closeScanner {
  margin-top: 10px;
}

.hero-meta .divider {
  opacity: 0.6;
}

.section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-top: 1.25rem;
  scroll-margin-top: 90px;
}

.section + .section {
  margin-top: 1.25rem;
}

.section-header h2 {
  font-family: var(--font-heading);
  margin: 0 0 0.4rem;
  font-size: clamp(1.8rem, 4vw, 2.2rem);
}

.section-header p {
  margin: 0 0 1rem;
  color: var(--muted);
}

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

.small-note {
  font-size: 0.95rem;
}

.notice {
  margin: 0.5rem 0 1rem;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, #fff);
  color: color-mix(in srgb, var(--accent-2) 70%, #000);
  font-weight: 600;
}

.rsvp-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem;
}

.rsvp-section.collapsed .rsvp-card {
  display: none;
}

.rsvp-section.collapsed .section-header {
  margin-bottom: 0;
}

.rsvp-section .section-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.rsvp-section .section-header-text {
  flex: 1 1 320px;
  min-width: 0;
}

.rsvp-section .section-header .status-chip {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: flex-start;
}

.status-chip.rsvp-done {
  background: color-mix(in srgb, var(--accent-2) 20%, #fff);
  color: color-mix(in srgb, var(--accent-2) 70%, #000);
  border-color: color-mix(in srgb, var(--accent-2) 50%, transparent);
}

.progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.eyebrow.small {
  font-size: 0.9rem;
  letter-spacing: 0.1em;
}

.progress-text {
  font-weight: 800;
  font-size: 1.1rem;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s ease;
}

.answered-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, #fff);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  font-weight: 700;
  font-size: 0.95rem;
}

.status-chip.ghost {
  background: color-mix(in srgb, var(--border) 40%, #fff);
  color: var(--muted);
  border-color: var(--border);
}

.status-chip.done {
  background: color-mix(in srgb, var(--accent-2) 20%, #fff);
  color: color-mix(in srgb, var(--accent-2) 70%, #000);
  border-color: color-mix(in srgb, var(--accent-2) 50%, transparent);
}

.rsvp-card .form-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.rsvp-options {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  margin: 0.5rem 0 0.75rem;
}

.rsvp-options legend {
  padding: 0 0.35rem;
  font-weight: 800;
}

.option-list {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.option-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
}

.option-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
}

.option-card input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.option-title {
  font-weight: 800;
}

.timeline {
  --time-width: 116px;
  --marker-col: 26px;
  --line-offset: 15px;
  --line-x: calc(var(--time-width) + var(--marker-col) / 2 + var(--line-offset));
  position: relative;
  padding: 1rem 0;
}

.timeline::before {
  content: "";
  position: absolute;
  left: var(--line-x);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: var(--time-width) var(--marker-col) 1fr;
  column-gap: 16px;
  align-items: flex-start;
  padding-left: 0;
  margin-bottom: 1.4rem;
}

.timeline-item.is-clickable {
  cursor: pointer;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-time {
  position: relative;
  left: auto;
  top: 0;
  min-width: var(--time-width);
  min-height: 55px;
  justify-self: center;
  text-align: center;
  background: var(--accent);
  color: #fff;
  padding: 0.3rem 0.55rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
}

.timeline-time.is-empty {
  background: transparent;
  box-shadow: none;
  padding: 0;
  color: transparent;
}

.time-end {
  font-size: 0.85rem;
  opacity: 0.9;
}

.timeline-marker {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  background: var(--card-bg);
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
  margin-top: 20px;
}

.timeline-content {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  box-shadow: var(--shadow);
  min-height: 55px;
}

.timeline-title {
  margin: 0 0 0;
  font-weight: 700;
}

.timeline-desc {
  margin: 0;
  color: var(--muted);
  white-space: pre-line;
}

.map {
  width: 100%;
  height: 340px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0.75rem 0 1.25rem;
  border: 1px solid var(--border);
}

.map-marker {
  background: transparent;
}

.map-marker svg {
  display: block;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.25));
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.card-break {
  grid-column: 1 / -1;
  height: 0;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.card.is-clickable {
  cursor: pointer;
}

.card h3 {
  margin-top: 0;
  font-family: var(--font-heading);
}

.card p {
  margin-bottom: 0.4rem;
  color: var(--muted);
}

.location-address .address-line {
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.btn.small {
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
}

.btn.primary {
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 82%, #000 18%)
  );
  color: #fff;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 35%, transparent);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn.ghost {
  background: transparent;
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.btn.ghost:hover {
  background: rgba(77, 108, 141, 0.08);
}

.login-content {
  max-width: 540px;
  margin: 0 auto;
}

.lead {
  margin-top: 0;
  color: var(--muted);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}

label {
  font-weight: 700;
}

input[type="text"] {
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
}

.code-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(32px, 1fr));
  gap: 0.35rem;
  max-width: 320px;
}

.code-input {
  text-align: center;
  padding: 0.65rem 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.code-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.code-input.filled {
  animation: code-pop 160ms ease-out;
}

@keyframes code-pop {
  0% {
    transform: scale(1);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

textarea {
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
  resize: vertical;
  min-height: 120px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 0.35rem;
}

.message {
  min-height: 1.2em;
  color: #b14d4d;
  font-weight: 600;
}

.message.success {
  color: var(--accent-2);
}

.message.error {
  color: #b14d4d;
}

.scanner {
  margin-top: 1rem;
  border: 1px dashed var(--border);
  padding: 0.75rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.02);
}

.scanner #qr-reader,
.scanner #qr-reader__scan_region,
.scanner #qr-reader video {
  border-radius: 10px;
  overflow: hidden;
}

.hidden {
  display: none;
}

.accordion-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}

.accordion-header {
  padding: 0.9rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-weight: 700;
}

.accordion-body {
  padding: 0 1rem 1rem;
  color: var(--muted);
  display: none;
}

.accordion-item.active .accordion-body {
  display: block;
}

.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0 0.25rem;
  color: var(--muted);
  font-weight: 600;
}

.to-top {
  color: var(--accent-2);
  font-weight: 700;
}

@media (min-width: 720px) {
  .page {
    padding: 2.5rem 3rem 3rem;
  }

  .hero {
    padding: 2rem 2rem 2.5rem;
  }
}

@media (max-width: 820px) {
  .page {
    padding-top: 5rem;
  }

  .nav {
    align-items: center;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 0.6rem 1.25rem 0.9rem;
    background: rgba(255, 255, 255, 0.98);
    border-bottom: 1px solid var(--border);
  }

  .nav.is-open .nav-links {
    display: flex;
  }
}

@media (max-width: 720px) {
  .timeline {
    padding: 0.5rem 0;
  }

  .timeline::before {
    display: none;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    row-gap: 0.6rem;
  }

  .timeline-marker {
    display: none;
  }

  .timeline-time {
    grid-row: 1;
    width: 100%;
    justify-self: stretch;
    text-align: left;
    padding: 0.25rem 0.8rem;
    min-height: 0;
    height: auto;
  }

  .timeline-time.is-empty {
    display: none;
  }

  .timeline-content {
    grid-row: 2;
    width: 100%;
  }
}

@media (max-width: 540px) {
  .timeline {
    --time-width: 96px;
    --marker-col: 22px;
  }

  .timeline-item {
    margin-bottom: 1rem;
    column-gap: 12px;
  }
}

@media (max-width: 500px) {
  .rsvp-section .section-header {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .rsvp-section .section-header-text {
    grid-column: 1;
  }

  .rsvp-section .section-header .status-chip {
    grid-column: 2;
    justify-self: end;
  }
}

@media (max-width: 450px) {
  .hero h1 {
    font-size: 2.2rem;
  }
}

@media (max-width: 400px) {
  .hero .eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.12em;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .timeline-title {
    font-size: 1rem;
  }

  .rsvp-card {
    padding: 0.85rem;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .rsvp-card .form-grid,
  .rsvp-card .form-group,
  .rsvp-card .rsvp-options,
  .rsvp-card .option-list {
    min-width: 0;
  }

  .rsvp-card .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .rsvp-card .actions .btn {
    width: 100%;
  }
}
