:root {
  color-scheme: dark;
  --burgundy: #8f101d;
  --deep-burgundy: #21090e;
  --gold: #c39a38;
  --paper: #f5f0e8;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--deep-burgundy);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--paper);
  background: var(--deep-burgundy);
  font-family: Georgia, "Times New Roman", serif;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.invitation-shell {
  position: relative;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.9rem, 2vh, 1.4rem);
  overflow: hidden;
  padding: clamp(0.5rem, 1.5vw, 1rem);
  isolation: isolate;
}

.invitation-shell::before,
.invitation-shell::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
}

.invitation-shell::before {
  z-index: -2;
  background-image: url("/background.jpg?v=1");
  background-position: center;
  background-size: cover;
  transform: scale(1.02);
}

.invitation-shell::after {
  z-index: -1;
  background:
    radial-gradient(circle at 50% 42%, rgba(77, 18, 17, 0.12), transparent 38%),
    linear-gradient(180deg, rgba(28, 5, 7, 0.5), rgba(16, 2, 4, 0.7));
}

.flip-card {
  width: min(calc(100vw - 1rem), 80svh, 56rem);
  aspect-ratio: 1;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: clamp(0.4rem, 1.6vw, 0.75rem);
  outline: none;
  background: transparent;
  box-shadow:
    0 1.5rem 4rem rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(195, 154, 56, 0.26);
  cursor: pointer;
  perspective: 1400px;
  touch-action: manipulation;
}

.flip-card:focus-visible {
  box-shadow:
    0 1.5rem 4rem rgba(0, 0, 0, 0.42),
    0 0 0 3px var(--gold);
}

.flip-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 900ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(-180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  background: #eee9e1;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-face::after {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.card-back {
  transform: rotateY(180deg);
}

.card-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.flip-control {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(195, 154, 56, 0.42);
  border-radius: 999px;
  color: #f9f3e8;
  background: rgba(38, 10, 16, 0.83);
  box-shadow: 0 0.4rem 1.1rem rgba(0, 0, 0, 0.22);
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(0.61rem, 2vw, 0.78rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.flip-control:hover {
  border-color: rgba(195, 154, 56, 0.72);
  background: rgba(54, 14, 22, 0.92);
}

.flip-control:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.flip-icon {
  color: var(--gold);
  font-size: 1.05em;
}

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

@media (min-width: 900px) {
  .flip-card {
    width: min(calc(100vw - 2rem), calc(100svh - 5.5rem), 64rem);
  }
}

@media (max-width: 420px) {
  .invitation-shell {
    padding: 0.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flip-card-inner {
    transition-duration: 1ms;
  }
}
