:root {
  --navy: #14264f;
  --navy-2: #1b3266;
  --cobalt: #1d4596;
  --sky: #5d86d1;
  --paper: #fbf8f1;
  --paper-2: #f3eee2;
  --ink: #1f2f57;
  --muted: #5d6a8c;
  --line: #d7dcea;
  --silver: #c9ccd3;
  --serif: "EB Garamond", "GFS Didot", Georgia, serif;
  --display: "GFS Didot", "EB Garamond", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 80% at 50% 0%, var(--navy-2), var(--navy) 60%, #0d1b3a);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  padding: 32px 16px 48px;
}

/* ---------------- Φάκελος ---------------- */
.envelope-stage {
  position: fixed; inset: 0; z-index: 10; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px;
  background: radial-gradient(120% 80% at 50% 0%, var(--navy-2), var(--navy) 60%, #0d1b3a);
  cursor: pointer; outline: none;
  transition: opacity .9s ease;
}
.stage-tiles { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .035; pointer-events: none; }
.envelope-stage.gone { opacity: 0; pointer-events: none; }

.env-float { animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-.5deg); } }

.envelope {
  position: relative;
  width: min(86vw, 460px);
  aspect-ratio: 7 / 5;
  perspective: 1400px; transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(.3,.1,.2,1) 1.05s;
}
.envelope::after {
  content: ""; position: absolute; z-index: -1;
  left: 8%; right: 8%; bottom: -34px; height: 34px;
  background: radial-gradient(closest-side, rgba(0,0,0,.45), transparent);
  transform: translateZ(-2px);
}

.env-back {
  position: absolute; inset: 0; z-index: 0; overflow: hidden; border-radius: 3px;
  box-shadow: 0 24px 48px rgba(4,10,28,.5), 0 2px 6px rgba(4,10,28,.3);
  transform: translateZ(0);
}
.env-back svg, .letter-band svg, .flap-face svg { width: 100%; height: 100%; display: block; }

.letter {
  position: absolute; z-index: 2; left: 6%; right: 6%; top: 5%; height: 88%;
  background: #fffdf8; border-radius: 2px; overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  transform: translateZ(1px);
  transition: transform 1.1s cubic-bezier(.3,.1,.2,1) 1.05s;
}
.letter-band { width: 100%; height: 17%; border-bottom: 1px solid var(--cobalt); }
.letter-names {
  margin: 8% 0 0; font-style: italic; color: var(--cobalt);
  font-size: clamp(22px, 6.4vw, 34px); line-height: 1.1;
}
.letter-names em { color: var(--sky); font-size: .7em; }
.letter-date { margin: 6px 0 0; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

.env-front { position: absolute; inset: 0; z-index: 3; transform: translateZ(2px); width: 100%; height: 100%; display: block; pointer-events: none; }
.env-front-text {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 9%; margin: 0;
  text-align: center; font-style: italic; color: var(--cobalt);
  font-size: clamp(15px, 3.8vw, 20px); letter-spacing: .03em; opacity: .85;
  transform: translateZ(2.2px);
}

.flap-shadow { position: absolute; z-index: 4; left: 0; top: 0; width: 100%; height: 60%; pointer-events: none; transition: opacity .3s ease .3s; transform: translateZ(2.4px); }
.env-flap {
  position: absolute; z-index: 5; left: 0; right: 0; top: 0; height: 60%;
  transform-origin: top center; transform-style: preserve-3d;
  transform: translateZ(3px) rotateX(0deg);
  transition: transform .9s cubic-bezier(.55,.05,.3,1) .3s, z-index 0s .75s;
}
.flap-face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.flap-in { transform: rotateX(180deg); filter: brightness(.94); }

.seal {
  position: absolute; z-index: 6; left: 50%; top: 60%;
  width: 19%; aspect-ratio: 1; margin: -9.5% 0 0 -9.5%;
  display: grid; place-items: center;
  filter: drop-shadow(0 4px 6px rgba(10,25,60,.4));
  transform: translateZ(4px);
  transition: transform .3s ease;
}
.seal svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.seal span {
  position: relative; font-family: var(--display); font-size: clamp(15px, 4.4vw, 21px);
  color: #e3ebfc; text-shadow: 0 -1px 0 rgba(0,0,0,.35), 0 1px 0 rgba(255,255,255,.2);
}
.envelope-stage:not(.open):hover .seal { transform: translateZ(4px) scale(1.06) rotate(-3deg); }

.burst { position: absolute; z-index: 7; left: 50%; top: 60%; width: 0; height: 0; pointer-events: none; transform: translateZ(5px); }
.burst i {
  position: absolute; left: 0; top: 0; opacity: 0;
  animation: fly var(--d) cubic-bezier(.15,.6,.3,1) forwards;
}
.burst .petal {
  width: 10px; height: 14px; margin: -7px 0 0 -5px;
  background: var(--c); border-radius: 0 100% 0 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.burst .spark {
  width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 8px 3px rgba(180,205,255,.85);
}
@keyframes fly {
  0%   { opacity: 1; transform: translate(0,0) scale(.3) rotate(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 70px)) scale(var(--s)) rotate(var(--r)); }
}

.env-hint {
  margin: 0; color: #c9d5f3; font-style: italic; letter-spacing: .04em;
  animation: pulse 2.4s ease-in-out infinite; transition: opacity .3s;
}
@keyframes pulse { 50% { opacity: .45; } }

/* άνοιγμα */
.envelope-stage.open .env-float { animation-play-state: paused; }
.envelope-stage.open .seal { animation: sealPop .55s ease-in forwards; }
@keyframes sealPop {
  0%   { transform: translateZ(4px) scale(1); }
  35%  { transform: translateZ(4px) scale(1.18); }
  100% { transform: translateZ(4px) scale(.2) rotate(35deg); opacity: 0; }
}
.envelope-stage.open .flap-shadow { opacity: 0; }
.envelope-stage.open .env-flap { transform: translateZ(.5px) rotateX(180deg); z-index: 1; }
.envelope-stage.open .letter { transform: translateZ(1px) translateY(-62%); }
.envelope-stage.open .envelope { transform: translateY(22%); }
.envelope-stage.gone .envelope { transform: translateY(22%) scale(1.06); transition-delay: 0s; }
.envelope-stage.open .env-hint { animation: none; opacity: 0; }

/* ---------------- Κάρτα ---------------- */
.card {
  max-width: 640px; margin: 0 auto;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: 0 30px 60px rgba(0,0,0,.35), 0 2px 0 rgba(255,255,255,.4) inset;
  overflow: hidden;
  opacity: 0; transform: translateY(24px);
  transition: opacity .8s ease, transform .8s ease;
}
.card.shown { opacity: 1; transform: none; }
.band { height: 64px; border-block: 1px solid var(--cobalt); }
.band svg { width: 100%; height: 100%; display: block; }

.invite { text-align: center; padding: 48px 32px 8px; }
.eyebrow {
  margin: 0 auto 18px; max-width: 42ch; text-wrap: balance;
  font-size: 13px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
}
.names {
  margin: 0; font-family: var(--serif); font-style: italic; font-weight: 400;
  color: var(--cobalt); font-size: clamp(44px, 11vw, 68px); line-height: 1.05;
  display: flex; flex-direction: column; align-items: center;
}
.names .amp { font-size: .55em; color: var(--sky); margin: 4px 0; }
.lead { margin: 20px auto 0; max-width: 34ch; font-size: 19px; }

.when {
  margin: 32px auto 0; padding: 18px 0;
  border-block: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; max-width: 320px;
}
.when-day { font-size: 13px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
.when-date { font-family: var(--display); font-size: 28px; color: var(--ink); }
.when-time { font-style: italic; color: var(--muted); }

.places { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 32px; }
.place h2 {
  margin: 0 0 6px; font-family: var(--display); font-weight: 400;
  font-size: 13px; letter-spacing: .24em; text-transform: uppercase; color: var(--cobalt);
}
.place p { margin: 0; }
.place-name { font-size: 19px; font-weight: 500; }
.place-addr { color: var(--muted); font-size: 16px; }
.map-link {
  display: inline-block; margin-top: 8px; color: var(--cobalt);
  font-size: 15px; text-decoration: none; border-bottom: 1px solid var(--line);
}
.map-link:hover { border-color: var(--cobalt); }

.divider { display: flex; align-items: center; gap: 14px; margin: 40px auto 0; max-width: 360px; }
.divider span { flex: 1; height: 1px; background: var(--line); }
.divider i {
  font-style: normal; font-family: var(--display); color: var(--cobalt);
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--cobalt);
  display: grid; place-items: center; font-size: 16px;
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--line);
}

/* ---------------- RSVP ---------------- */
.rsvp { padding: 32px 32px 48px; }
.rsvp-title {
  margin: 0; text-align: center; font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 36px; color: var(--cobalt);
}
.rsvp-sub { margin: 4px 0 28px; text-align: center; color: var(--muted); }
.rsvp-sub strong { color: var(--ink); font-weight: 500; }

form { display: flex; flex-direction: column; gap: 22px; max-width: 440px; margin: 0 auto; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .choice legend {
  font-size: 13px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted);
}
.field small { text-transform: none; letter-spacing: 0; font-size: 13px; }
input[type=text], textarea {
  font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 84px; }
input[type=text]:focus, textarea:focus {
  outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(29,69,150,.15);
}
::placeholder { color: #9aa3bb; }

.choice { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice legend { margin-bottom: 8px; padding: 0; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pill span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: all .15s;
}
.pill input:checked + span { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(29,69,150,.3); }

.counts {
  display: flex; flex-direction: column; gap: 4px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 16px;
}
.counts.hidden { display: none; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.counter + .counter { border-top: 1px solid var(--line); }
.counter-label { display: flex; flex-direction: column; line-height: 1.25; }
.counter-label small { color: var(--muted); font-size: 14px; font-style: italic; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper output { min-width: 36px; text-align: center; font-size: 22px; font-variant-numeric: tabular-nums; }
.stepper button {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--cobalt); background: transparent; color: var(--cobalt);
  font-size: 22px; line-height: 1; cursor: pointer; display: grid; place-items: center;
  transition: background .15s, color .15s;
}
.stepper button:hover:not(:disabled) { background: var(--cobalt); color: #fff; }
.stepper button:disabled { opacity: .3; cursor: default; }

.error { margin: 0; color: #a12d2d; text-align: center; }
.submit {
  font: inherit; font-size: 17px; letter-spacing: .14em; text-transform: uppercase;
  background: var(--navy); color: #fff; border: 0; border-radius: 8px;
  padding: 16px; cursor: pointer; transition: background .15s;
}
.submit:hover:not(:disabled) { background: var(--cobalt); }
.submit:disabled { opacity: .6; cursor: progress; }

.thanks { text-align: center; max-width: 420px; margin: 0 auto; }
.thanks-title { margin: 0; font-style: italic; font-size: 30px; color: var(--cobalt); }
.thanks-text { margin: 8px 0 18px; }
.link-btn {
  font: inherit; color: var(--cobalt); background: none; border: 0; padding: 4px;
  border-bottom: 1px solid var(--line); cursor: pointer;
}

@media (max-width: 520px) {
  body { padding: 0; font-size: 17px; }
  .card { border-radius: 0; min-height: 100vh; }
  .invite { padding: 40px 20px 4px; }
  .rsvp { padding: 28px 20px 40px; }
  .places { grid-template-columns: 1fr; gap: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
