:root {
  color-scheme: light;
  --ink: #25211d;
  --muted: #657174;
  --paper: #fffdf8;
  --line: #d7dbe1;
  --accent: #2f4d7b;
  --accent-dark: #203b63;
  --sage: #dfe7d5;
  --leaf: #7f8f58;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(245, 248, 251, 0.82), rgba(246, 248, 245, 0.9)),
    radial-gradient(circle at 12% 18%, rgba(127, 143, 88, 0.2), transparent 26%),
    radial-gradient(circle at 88% 0%, rgba(47, 77, 123, 0.18), transparent 28%),
    url("assets/principal.jpeg"),
    linear-gradient(135deg, #faf7ef 0%, #f5f7fb 48%, #edf1ee 100%);
  background-size: cover, auto, auto, cover, cover;
  background-position: center, center, center, center, center;
  background-attachment: fixed;
  font-family: Georgia, "Times New Roman", serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.26;
  background-image:
    linear-gradient(30deg, rgba(47, 77, 123, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(47, 77, 123, 0.08) 87.5%, rgba(47, 77, 123, 0.08)),
    linear-gradient(150deg, rgba(47, 77, 123, 0.08) 12%, transparent 12.5%, transparent 87%, rgba(47, 77, 123, 0.08) 87.5%, rgba(47, 77, 123, 0.08));
  background-size: 72px 120px;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.hero {
  min-height: 88vh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  padding: 44px 0 32px;
}

.hero-copy {
  width: min(760px, 100%);
  margin: 20px auto 0;
  padding: 18px 0;
  text-align: center;
  transition: opacity 420ms ease, transform 420ms ease;
}

body:not(.is-open) .hero-copy,
body:not(.is-open) .panel,
body:not(.is-open) .details {
  display: none;
}

.stationery {
  position: relative;
  display: block;
  width: min(500px, 100%);
  min-height: clamp(680px, 84vw, 760px);
  margin: 0 auto;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  isolation: isolate;
  perspective: 1200px;
}

.stationery:focus-visible {
  outline: 3px solid rgba(47, 77, 123, 0.48);
  outline-offset: 8px;
}

.cover-names {
  position: absolute;
  top: 8px;
  left: 50%;
  z-index: 4;
  width: min(90%, 440px);
  transform: translateX(-50%);
  color: #29323a;
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 1;
  text-align: center;
  transition: opacity 320ms ease, transform 320ms ease;
}

body.is-open .cover-names,
body.is-open .guest-slip,
body.is-open .tap-hint {
  opacity: 0;
  pointer-events: none;
}

.guest-slip {
  position: absolute;
  left: 50%;
  top: 350px;
  z-index: 7;
  display: grid;
  width: min(62%, 300px);
  min-height: 66px;
  align-content: center;
  gap: 4px;
  padding: 12px 16px 10px;
  transform: translateX(-50%);
  border: 1px solid rgba(47, 77, 123, 0.14);
  border-radius: 4px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 10px 26px rgba(26, 39, 57, 0.1);
  backdrop-filter: blur(4px);
  text-align: center;
  transition: opacity 420ms ease, transform 420ms ease;
}

.cover-guest {
  display: block;
  color: #26303a;
  font-size: clamp(1.1rem, 2.7vw, 1.55rem);
  font-style: italic;
  line-height: 1.05;
}

.cover-quota {
  display: block;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.45;
  text-transform: uppercase;
}

.envelope {
  position: absolute;
  left: 50%;
  top: 346px;
  z-index: 7;
  width: min(86%, 410px);
  aspect-ratio: 1.45;
  transform: translateX(-50%) rotate(1.5deg);
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(145deg, #4c70a4, #2f5489 58%, #274879);
  box-shadow: 0 22px 48px rgba(26, 39, 57, 0.2);
  overflow: visible;
  transform-style: preserve-3d;
  transition: transform 1200ms cubic-bezier(0.19, 1, 0.22, 1);
}

body.is-open .envelope {
  transform: translateX(-50%) translateY(-28px) rotate(1.5deg);
}

.envelope::before,
.envelope::after {
  position: absolute;
  inset: 0;
  content: "";
  clip-path: polygon(0 0, 50% 62%, 100% 0, 100% 100%, 0 100%);
}

.envelope::before {
  z-index: 2;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.12), transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(28, 48, 82, 0.28));
}

.envelope::after {
  z-index: 3;
  clip-path: polygon(0 100%, 50% 38%, 100% 100%);
  background: rgba(22, 39, 68, 0.28);
}

.envelope-flap {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: block;
  transform-origin: 50% 0;
  transition: transform 1100ms cubic-bezier(0.19, 1, 0.22, 1);
  clip-path: polygon(0 0, 50% 64%, 100% 0);
  background: linear-gradient(170deg, #5579ae, #31588c 70%);
  backface-visibility: hidden;
}

body.is-open .envelope-flap {
  transform: rotateX(178deg);
}

.seal {
  position: absolute;
  left: 50%;
  top: 48%;
  z-index: 5;
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #f9f3df;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 58%),
    linear-gradient(135deg, #cdb47a, #876636);
  box-shadow: 0 8px 18px rgba(16, 29, 50, 0.28);
  font-size: 1rem;
  letter-spacing: 0.08em;
  transition: opacity 360ms ease, transform 360ms ease;
}

body.is-open .seal {
  opacity: 0;
  transform: translate(-50%, -40%) scale(0.8);
}

.tap-hint {
  position: absolute;
  left: 50%;
  bottom: 20px;
  z-index: 6;
  width: 100%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.82);
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 240ms ease;
}

body.is-open .tap-hint {
  opacity: 0;
}

body.is-open .stationery {
  display: none;
}

.flowers {
  position: absolute;
  left: 6%;
  top: 348px;
  z-index: 8;
  width: 142px;
  height: 202px;
  transform: rotate(-10deg);
  background: url("assets/flowers.png") center / contain no-repeat;
  filter: drop-shadow(0 10px 16px rgba(16, 29, 50, 0.22));
  pointer-events: none;
}


.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-family: Arial, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(3rem, 12vw, 7.5rem);
  font-weight: 400;
  line-height: 0.95;
}

.date-line {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: clamp(1.15rem, 3vw, 1.7rem);
}

.countdown {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 10px;
  width: min(460px, 100%);
  margin: 24px auto 0;
}

.countdown div {
  display: grid;
  min-height: 82px;
  place-items: center;
  border: 1px solid rgba(47, 77, 123, 0.18);
  border-radius: 8px;
  padding: 12px 8px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 12px 30px rgba(26, 39, 57, 0.08);
}

.countdown strong {
  color: var(--accent-dark);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 400;
  line-height: 1;
}

.countdown span {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.music-player {
  display: grid;
  gap: 12px;
  width: min(460px, 100%);
  margin: 18px auto 0;
  border: 1px solid rgba(47, 77, 123, 0.18);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 12px 30px rgba(26, 39, 57, 0.08);
}

.music-meta,
.music-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.music-label,
#music-time {
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.music-button {
  min-width: 56px;
  min-height: 42px;
  border: 1px solid rgba(47, 77, 123, 0.24);
  border-radius: 999px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.music-play {
  min-width: 104px;
  color: var(--white);
  background: linear-gradient(135deg, #203b63, #355989);
}

.music-progress {
  width: 100%;
  accent-color: var(--accent);
}

.actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  gap: 10px;
  margin-top: 28px;
  justify-content: center;
}

.button {
  min-height: 46px;
  border: 1px solid rgba(47, 77, 123, 0.36);
  border-radius: 6px;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, background 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  width: 100%;
  color: var(--white);
  background: linear-gradient(135deg, #203b63, #355989);
}

.button.primary:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button.secondary {
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.74);
  backdrop-filter: blur(6px);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 4vw, 34px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 253, 248, 0.94)),
    radial-gradient(circle at 100% 0%, rgba(47, 77, 123, 0.08), transparent 32%);
  box-shadow: 0 22px 70px rgba(26, 39, 57, 0.12);
  animation: reveal 520ms ease both;
}

h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 7vw, 4.5rem);
  font-weight: 400;
}

.muted {
  color: var(--muted);
}

fieldset {
  min-width: 0;
  margin: 26px 0;
  padding: 0;
  border: 0;
}

legend,
.field {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
}

.count-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.choice {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--paper);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--sage);
}

.choice input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--white);
}

.status {
  min-height: 24px;
  margin: 14px 0 0;
  font-family: Arial, sans-serif;
  font-size: 0.95rem;
}

.status[data-kind="success"] {
  color: #24663d;
}

.status[data-kind="error"] {
  color: #9b2d22;
}

.details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-top: 22px;
  animation: reveal 520ms ease both;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.details article {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.details h3 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  font-weight: 400;
}

.details p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 22px, 1060px);
    padding: 18px 0;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding-top: 18px;
  }

  .stationery {
    min-height: 560px;
    order: -1;
  }

  .envelope {
    top: 296px;
  }

  .guest-slip {
    top: 312px;
    width: min(68%, 250px);
    min-height: 58px;
    padding: 10px 12px 8px;
  }

  .flowers {
    left: -4px;
    top: 270px;
    width: 116px;
    height: 165px;
    transform: rotate(-10deg);
  }

  .cover-quota {
    font-size: 0.58rem;
  }

  .cover-guest {
    font-size: 1.08rem;
  }

  .button.secondary {
    width: 100%;
  }

  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .countdown {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .details {
    grid-template-columns: 1fr;
  }
}
