:root {
  --bg: #f6f3f4;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --text: #141416;
  --text-secondary: #6e6e73;
  --border: rgba(0, 0, 0, 0.08);
  --accent-pink: #e85a8c;
  --muted-bg: #ececf1;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.1);
  --font-display: system-ui, -apple-system, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.47;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  position: fixed;
  top: max(20px, env(safe-area-inset-top));
  right: 16px;
  left: auto;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0;
  background: transparent;
  border: 0;
  backdrop-filter: none;
  box-shadow: none;
}

.brand {
  display: none;
}

/* Hide any old header flags if they are still in index.html */
.site-header .lang-switch {
  display: none;
}

main {
  flex: 1;
  padding-top: 0;
}

/* Shared flag button styles */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang-btn {
  width: 36px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  overflow: hidden;
  opacity: 0.78;
  transition: opacity 0.2s, transform 0.15s, border-color 0.2s;
}

.lang-btn:hover {
  opacity: 1;
}

.lang-btn[aria-pressed="true"] {
  opacity: 1;
  border-color: rgba(0, 0, 0, 0.18);
}

.lang-btn:active {
  transform: scale(0.96);
}

.lang-btn svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Buttons */
.btn-primary {
  width: 100%;
  margin-top: 8px;
  padding: 14px 20px;
  font-size: 17px;
  font-weight: 500;
  color: #fff;
  background: #1d1d1f;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background: #000;
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.btn-ghost:hover {
  background: #fff;
}

.btn-ghost:active {
  transform: scale(0.98);
}

/* Login */
.login-view {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px 48px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  margin-top: 72px;
  padding: 22px 30px 38px;
  background: var(--surface-solid);
  border-radius: 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.login-card-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.login-lang-switch {
  display: flex;
  gap: 8px;
  align-items: center;
}

.login-lang-switch .lang-btn {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  opacity: 0.82;
}

.login-card h1 {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: clamp(2rem, 4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-align: center;
}

.login-sub {
  margin: 0 0 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 15px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.field input:focus,
.phone-field input:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.form-error {
  margin-top: 14px;
  padding: 12px 14px;
  font-size: 14px;
  color: #b00020;
  background: rgba(176, 0, 32, 0.06);
  border-radius: 12px;
  display: none;
}

.form-error.visible {
  display: block;
}

/* Invite + RSVP */
.rsvp-view {
  display: none;
  min-height: 100vh;
  padding: 20px 16px 56px;
  background: #f6f3f4;
}

.rsvp-view.active {
  display: block;
}

.rsvp-page {
  max-width: 620px;
  margin: 0 auto;
}

.invitation-card {
  overflow: hidden;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
}

.invitation-image {
  position: relative;
  aspect-ratio: 682 / 1024;
  background-image: url("/images/hero.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.invitation-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(255, 246, 248, 0.1) 0%,
    rgba(255, 246, 248, 0.05) 35%,
    rgba(0, 0, 0, 0.01) 100%
  );
  pointer-events: none;
}

.invitation-copy {
  position: relative;
  z-index: 1;
  height: 100%;
  padding: clamp(48px, 7vw, 80px) clamp(22px, 5vw, 40px) clamp(170px, 27vw, 240px);
  display: flex;
  align-items: flex-start;
}

.rsvp-letter {
  max-width: 31rem;
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.15vw + 0.95rem, 1.45rem);
  font-weight: 400;
  line-height: 1.22;
  letter-spacing: -0.02em;
  color: #141416;
  text-shadow: none;
}

.rsvp-letter p {
  margin: 0 0 1.08em;
}

.rsvp-letter .signoff {
  margin-top: 1.4em;
}

.rsvp-letter a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.rsvp-letter a:hover {
  opacity: 0.72;
}

.rsvp-panel {
  margin-top: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  padding: 22px;
}

.rsvp-panel h2 {
  margin: 0 0 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-secondary);
}

.rsvp-panel .panel-intro,
.dietary-field label,
.info-panel-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.rsvp-panel .panel-intro {
  margin: 0 0 8px;
}

.dietary-field label {
  display: block;
  margin-bottom: 8px;
}

.info-panel-text {
  margin: 0;
}

.guest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.guest-row:last-of-type {
  border-bottom: none;
}

.guest-name {
  font-weight: 500;
  font-size: 17px;
}

.toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--muted-bg);
  border: 1px solid var(--border);
}

.toggle button {
  border: none;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: background 0.2s, color 0.2s;
}

.toggle button.on-yes {
  background: #34c759;
  color: #fff;
  box-shadow: 0 1px 4px rgba(52, 199, 89, 0.35);
}

.toggle button.on-no {
  background: #ff3b30;
  color: #fff;
}

.phone-field {
  margin-top: 24px;
}

.phone-field label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.phone-field input {
  width: 100%;
  max-width: 320px;
  padding: 14px 16px;
  font-size: 17px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

.save-row {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.save-status {
  font-size: 14px;
  color: var(--text-secondary);
}

.save-status.ok {
  color: #1b7f3a;
}

.dietary-field {
  margin-top: 24px;
}

.dietary-field textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px 16px;
  font-size: 16px;
  font-family: var(--font-body);
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  resize: vertical;
}

.dietary-field textarea:focus {
  outline: none;
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.btn-submit-rsvp {
  width: auto;
  margin-top: 0;
  padding: 12px 22px;
}

.info-panel {
  margin-top: 20px;
}

.info-links a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.info-links a:hover {
  opacity: 0.72;
}

.info-links {
  margin: 0 0 12px;
}

/* Tablet */
@media (min-width: 768px) {
  .site-header {
    top: max(24px, env(safe-area-inset-top));
    right: 24px;
  }

  .login-view {
    padding: 24px 20px 56px;
  }

  .login-card {
    width: 100%;
    max-width: 620px;
    margin-top: 72px;
    padding: 22px 30px 38px;
    background: var(--surface-solid);
    border-radius: 22px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
  }

  .rsvp-view {
    padding: 24px 20px 64px;
  }

  .rsvp-panel {
    padding: 28px;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .site-header {
    top: max(14px, env(safe-area-inset-top));
    right: 10px;
  }

  .lang-switch {
    gap: 8px;
  }

  .lang-btn {
    width: 34px;
    height: 24px;
  }

  .btn-ghost {
    padding: 9px 14px;
    font-size: 13px;
  }

  .login-view {
    padding: 18px 12px 40px;
  }

  .login-card {
    margin-top: 58px;
    padding: 18px 22px 32px;
    border-radius: 18px;
  }

  .login-card-top {
    margin-bottom: 8px;
  }

  .rsvp-view {
    padding: 14px 10px 40px;
  }

  .rsvp-page {
    max-width: 100%;
  }

  .invitation-card {
    border-radius: 18px;
  }

  .invitation-copy {
    padding: 36px 16px 145px;
  }

  .rsvp-letter {
    max-width: none;
    font-size: 0.98rem;
    line-height: 1.26;
  }

  .rsvp-panel {
    margin-top: 16px;
    padding: 18px;
    border-radius: 16px;
  }

  .guest-row {
    align-items: flex-start;
  }

  .toggle button {
    padding: 8px 14px;
    font-size: 13px;
  }

  .phone-field input {
    max-width: 100%;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}