:root {
  --navy: #0B1C4D;
  --deep: #071338;
  --gold: #E7C574;
  --pale-gold: #F6E7BE;
  --ivory: #FBF6E9;
  --line: rgba(231, 197, 116, 0.35);
  --serif: "Libre Caslon Text", Georgia, serif;
  --script: "Alex Brush", "Snell Roundhand", cursive;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  background: radial-gradient(120% 70vh at 50% 0, #14296B 0, var(--navy) 60%) no-repeat, var(--navy);
  color: var(--ivory);
  font: 400 1.125rem/1.65 var(--serif);
}

#sparkles {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

main {
  position: relative;
  max-width: 30rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* The page never scrolls. Each view fills one screen. */

.js, .js body { height: 100%; overflow: hidden; }
.js body { height: 100vh; height: 100dvh; }
.js main { height: 100%; }
.js .view { height: 100%; }
.js .view:not(.active) { display: none; }

.view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.25rem 0 0.6rem;
  animation: rise 0.35s ease-out both;
}

.back {
  align-self: flex-start;
  display: inline-block;
  min-height: 2.75rem;
  padding: 0.6rem 0.75rem 0.5rem 0;
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back::before { content: "\2039\00a0"; }

/* Ribbons */

.js:not(.ready) .ribbon path,
.js:not(.ready) .hero,
.js:not(.ready) .hero * { animation-play-state: paused; }

.ribbon {
  position: absolute;
  top: 0;
  width: min(44vw, 400px);
  height: auto;
  overflow: visible;
  pointer-events: none;
}

.inner .ribbon { display: none; }

.ribbon-left { left: 0; }
.ribbon-right { right: 0; }

.ribbon path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.75;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.6s cubic-bezier(.45, 0, .2, 1) 0.2s forwards;
}

.ribbon path:nth-child(2) { opacity: 0.45; animation-delay: 0.45s; }
.ribbon path:nth-child(3) { opacity: 0.3; animation-delay: 0.7s; }

@keyframes draw { to { stroke-dashoffset: 0; } }

/* Hero */

.hero {
  align-items: center;
  justify-content: safe center;
  text-align: center;
  animation: none;
}

.medallion {
  position: relative;
  flex: none;
  width: min(64vw, 31dvh, 270px);
  aspect-ratio: 1;
  animation: rise 1.2s ease-out both;
}

.compact .medallion { width: min(64vw, 27dvh, 270px); }

.medallion img {
  position: absolute;
  inset: 13.5%;
  width: 73%;
  height: 73%;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--navy), 0 0 0 3px var(--gold), 0 0 34px rgba(231, 197, 116, 0.28);
}

.arc { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.arc text {
  fill: var(--ivory);
  font: 400 21px var(--serif);
  letter-spacing: 0.04em;
}

.name {
  margin: -3dvh 0 0;
  padding: 0.24em 0.12em 0.14em;
  font: 400 clamp(2.5rem, min(14vw, 10dvh), 4.2rem)/1.05 var(--script);
  white-space: nowrap;
  background: linear-gradient(100deg, #C9A04E 0%, var(--pale-gold) 40%, var(--gold) 62%, #FFF3CF 80%, #C9A04E 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-mask-image: linear-gradient(100deg, #000 46%, transparent 54%);
  mask-image: linear-gradient(100deg, #000 46%, transparent 54%);
  -webkit-mask-size: 260% 100%;
  mask-size: 260% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: 100% 0;
  mask-position: 100% 0;
  animation: write 2.6s cubic-bezier(.5, .1, .4, 1) 0.7s forwards;
}

@keyframes write {
  to { -webkit-mask-position: 0 0; mask-position: 0 0; }
}

.occasion {
  margin: -0.2rem 0 0;
  font-size: clamp(1.35rem, 4dvh, 2rem);
  line-height: 1.25;
}

.event { margin-top: clamp(0.25rem, 1.2dvh, 0.75rem); font-size: 1.0625rem; line-height: 1.4; }
.event p { margin: 0; }

.dress-line { margin-top: clamp(0.4rem, 1.6dvh, 0.9rem); font-size: 1.0625rem; line-height: 1.4; color: var(--pale-gold); }
.dress-line p { margin: 0 0 0.3rem; }

.countdown {
  min-height: 1.4em;
  margin: clamp(0.3rem, 1.4dvh, 0.9rem) 0 clamp(0.4rem, 1.6dvh, 1rem);
  color: var(--gold);
  font-size: 1.0625rem;
  line-height: 1.4;
  font-style: italic;
}

.actions { display: grid; gap: 0.5rem; width: 100%; max-width: 21rem; }
.actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.map-note { margin: 0; color: var(--pale-gold); font-size: 0.9375rem; line-height: 1.3; }

.occasion, .event, .dress-line, .countdown, .actions { animation: rise 1s ease-out 2.7s both; }

.opened .name { animation: none; -webkit-mask-image: none; mask-image: none; }
.opened .medallion, .opened .occasion, .opened .event, .opened .dress-line, .opened .countdown, .opened .actions { animation: none; }

@keyframes rise { from { opacity: 0; } to { opacity: 1; } }

/* Shared */

.button {
  display: inline-block;
  min-height: 3rem;
  padding: 0.7rem 1rem;
  text-align: center;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold);
  color: var(--deep);
  font: 700 1.0625rem/1.5 var(--serif);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.button:hover { background: var(--pale-gold); }
.button:disabled { opacity: 0.65; cursor: wait; }

.button-quiet { background: transparent; color: var(--gold); }
.button-quiet:hover { background: var(--gold); color: var(--deep); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--pale-gold);
  outline-offset: 3px;
}

h2 {
  margin: 0;
  color: var(--gold);
  font: 400 2.5rem/1.2 var(--script);
  text-align: center;
}

.lead { margin: 0.1rem auto 0.75rem; text-align: center; line-height: 1.4; }

/* Dress code */

.no-colors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-size: 1rem;
}

.no-colors li { display: flex; align-items: center; gap: 0.5rem; }

.dot {
  position: relative;
  width: 1.25rem;
  height: 1.25rem;
  overflow: hidden;
  border: 1px solid rgba(251, 246, 233, 0.75);
  border-radius: 50%;
}

.dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -10%;
  width: 120%;
  height: 2px;
  background: #FF6B6B;
  transform: rotate(-45deg);
}

.dot-black { background: #000; }
.dot-white { background: #fff; }
.dot-brown { background: #7A4A25; }

.attire { margin: 0; text-align: left; }

.attire > div {
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.see { color: var(--pale-gold); text-underline-offset: 3px; }

.attire dt { color: var(--gold); font-size: 1.0625rem; }
.attire dd { margin: 0; }

.looks {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  gap: 0.5rem;
  min-height: 0;
}

.looks svg { display: block; width: 100%; height: 100%; }

.skin { fill: #E6BB98; }
.hair { fill: #33241F; }
.garment { fill: var(--look); }
.crease { fill: none; stroke: rgba(11, 28, 77, 0.32); stroke-width: 1.3; stroke-linecap: round; }
.shade { fill: rgba(11, 28, 77, 0.08); }
.tint { fill: rgba(255, 255, 255, 0.3); }
.fold { fill: rgba(11, 28, 77, 0.45); }
.flower circle { fill: rgba(255, 255, 255, 0.55); stroke: rgba(11, 28, 77, 0.25); }

.defs { position: absolute; }

/* Form */

form { flex: 1; display: flex; flex-direction: column; min-height: 0; text-align: left; }

.field {
  display: block;
  min-width: 0;
  margin: 0 0 0.6rem;
  padding: 0;
  border: 0;
}

.field > span, .field > legend {
  display: block;
  margin-bottom: 0.2rem;
  padding: 0;
  color: var(--pale-gold);
  line-height: 1.35;
}

.field-inline { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; color: var(--pale-gold); }
.field-inline select { width: 5rem; flex: none; }

.field-grow { flex: 1; display: flex; flex-direction: column; min-height: 4.5rem; max-height: 9rem; }
.field-grow textarea { flex: 1; min-height: 2.75rem; }

form:has(.error:not([hidden])) .field small { display: none; }

.field small { display: block; margin-top: 0.2rem; font-size: 0.9375rem; line-height: 1.3; color: var(--pale-gold); }

input[type="text"], select, textarea {
  display: block;
  width: 100%;
  min-height: 2.875rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--gold);
  border-radius: 8px;
  background: var(--deep);
  color: var(--ivory);
  font: 400 1.0625rem/1.4 var(--serif);
}

textarea { resize: none; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

.choice { position: relative; display: block; cursor: pointer; }

.choice input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }

.choice span {
  display: block;
  min-height: 2.875rem;
  padding: 0.6rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--deep);
  text-align: center;
  line-height: 1.4;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.choice input:checked + span { border-color: var(--gold); background: var(--gold); color: var(--deep); font-weight: 700; }
.choice input:focus-visible + span { outline: 2px solid var(--pale-gold); outline-offset: 3px; }

.trap { position: absolute; left: -9999px; }

.error {
  margin: 0 0 0.5rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid #FFB4A8;
  font-size: 1rem;
  line-height: 1.3;
  border-radius: 8px;
  color: #FFD9D2;
}

form .button { flex: none; width: 100%; }

.thanks {
  position: relative;
  overflow: hidden;
  padding: 2rem 1.25rem;
  border: 1px solid var(--gold);
  border-radius: 8px;
}

.thanks:focus { outline: none; }
.thanks p { margin: 0 0 0.75rem; }

.thanks-title { color: var(--gold); font: 400 2.5rem/1.2 var(--script); }

.thanks::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -60%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(246, 231, 190, 0.45), transparent);
  transform: skewX(-18deg);
  animation: shimmer 1.8s ease-in-out 0.2s forwards;
  pointer-events: none;
}

@keyframes shimmer { to { left: 120%; } }

.link {
  padding: 0.5rem;
  border: 0;
  background: none;
  color: var(--gold);
  font: 400 1.0625rem/1.5 var(--serif);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .ribbon path { animation: none; stroke-dashoffset: 0; }

  .name {
    animation: none;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .view, .medallion, .occasion, .event, .dress-line, .countdown, .actions { animation: none; }

  .thanks::after { display: none; }
}
