:root {
  color-scheme: light;
  --ink: #173e50;
  --quiet: #345364;
  --accent: #315866;
  --glass: rgb(255 252 241 / 87%);
  --selected: #214d60;
  --selected-ink: #fffaf0;
  --line: rgb(33 77 96 / 25%);
  --veil: rgb(252 249 236 / 80%);
  --focus: #9a591c;
  --color-fade: 500ms ease;
  --day-image: url("assets/costa-dia.webp");
  --night-image: url("assets/costa-noche.webp");
}

:root[data-theme="night"] {
  color-scheme: dark;
  --ink: #fff2d8;
  --quiet: #e0e6f3;
  --accent: #e5c98e;
  --glass: rgb(12 27 55 / 88%);
  --selected: #f4e4bf;
  --selected-ink: #172940;
  --line: rgb(219 226 246 / 33%);
  --veil: rgb(11 23 49 / 79%);
  --focus: #ffdb91;
}

*, *::before, *::after { box-sizing: border-box; }
body, h1, p, fieldset { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100svh;
  background: #d7e6ed;
  color: var(--ink);
  font-family: system-ui, sans-serif;
  transition: color var(--color-fade), background-color var(--color-fade);
}

[data-theme="night"] body { background: #101b36; }

button, input { font: inherit; }
a, button, label { -webkit-tap-highlight-color: transparent; }
:focus-visible, input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.visually-hidden, .theme-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.postcard {
  isolation: isolate;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(100%, 39rem);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
}

.scenery, .scene, .scene-video, .stars, .birds {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scenery { z-index: -1; overflow: hidden; border-radius: inherit; }

.scene {
  opacity: 0;
  background-position: center;
  background-size: cover;
  transition: opacity 800ms ease;
}

.scene--day {
  opacity: 1;
  background-image: var(--day-image), linear-gradient(#badce9, #f4ebd6 62%, #7babb4);
}

.scene--night {
  background-image: var(--night-image), linear-gradient(#111936, #273658 65%, #172641);
}

[data-theme="night"] .scene--night { opacity: 1; }

.scene-video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 380ms ease;
}

.scene-video.is-playing { opacity: 1; }

.toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .45rem;
  padding: max(1rem, env(safe-area-inset-top)) clamp(.7rem, 4vw, 1.6rem) 0;
}

.theme-picker, .sound-button {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: var(--ink);
  font-size: .74rem;
  font-weight: 650;
  transition: background-color var(--color-fade), border-color var(--color-fade);
}

.theme-picker label, .sound-button { cursor: pointer; }
.theme-picker label span {
  display: grid;
  min-height: 36px;
  place-items: center;
  padding-inline: clamp(.48rem, 2.45vw, .78rem);
  border-radius: 999px;
}

.theme-picker input:checked + span {
  background: var(--selected);
  color: var(--selected-ink);
}

.sound { position: relative; }
.sound-button {
  justify-content: center;
  gap: .32rem;
  padding-inline: clamp(.52rem, 2.2vw, .8rem);
  white-space: nowrap;
}

.sound-button svg { width: 1rem; height: 1rem; flex: none; }
.sound-status:empty { display: none; }
.sound-status {
  position: absolute;
  top: calc(100% + .45rem);
  right: 0;
  width: max-content;
  max-width: min(12rem, 80vw);
  padding: .5rem .65rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--glass);
  color: var(--quiet);
  font-size: .75rem;
}

.invitation {
  position: relative;
  align-self: center;
  width: min(100%, 32rem);
  margin: clamp(1.9rem, 9svh, 5rem) auto max(2.2rem, env(safe-area-inset-bottom));
  padding: clamp(1.2rem, 3svh, 1.85rem) 1rem;
  text-align: center;
}

.invitation::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -.7rem 0;
  background: radial-gradient(ellipse at center, var(--veil) 26%, transparent 74%);
}

.eyebrow {
  color: var(--quiet);
  font-size: clamp(.63rem, 2.3vw, .75rem);
  font-weight: 670;
  letter-spacing: .19em;
  line-height: 1.65;
  text-transform: uppercase;
}

h1 {
  margin-top: .27rem;
  font-family: "Baskerville", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(4.7rem, 23vw, 8.7rem);
  font-weight: 400;
  line-height: .99;
  letter-spacing: -.065em;
}

h1 span {
  display: block;
  margin-top: .16em;
  font-size: .27em;
  font-style: italic;
  letter-spacing: .008em;
}

.waves {
  display: block;
  width: 3rem;
  height: .72rem;
  margin: clamp(.85rem, 2.6svh, 1.38rem) auto .8rem;
  color: var(--accent);
}

.family {
  color: var(--quiet);
  font-size: clamp(.79rem, 3.15vw, .96rem);
  line-height: 1.55;
}

.family strong { font-weight: 680; white-space: nowrap; }

.event {
  width: fit-content;
  margin: clamp(1.3rem, 4svh, 2.25rem) auto .85rem;
  padding: .78rem clamp(1rem, 6vw, 1.8rem);
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--glass);
  transition: background-color var(--color-fade), border-color var(--color-fade);
}

.event-when { font-size: clamp(.86rem, 3.6vw, 1.03rem); font-weight: 720; }
.event-when span { padding-inline: .22em; }
.event-time { margin-top: .2rem; color: var(--quiet); font-size: .8rem; }

.rsvp {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .53rem;
  min-height: 48px;
  padding: .65rem clamp(.9rem, 4.5vw, 1.38rem);
  border-radius: 999px;
  background: var(--selected);
  color: var(--selected-ink);
  font-size: .82rem;
  font-weight: 720;
  text-decoration: none;
  transition: background-color var(--color-fade), color var(--color-fade), transform 180ms ease;
}

.rsvp svg { width: 1.15rem; height: 1.15rem; flex: none; }
.rsvp span { margin-inline-start: .12rem; }

@media (hover: hover) {
  .rsvp:hover { transform: translateY(-2px); }
  .theme-picker label:hover span, .sound-button:hover { box-shadow: inset 0 0 0 1px var(--line); }
}

.stars i {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff0c9;
  box-shadow: 0 0 7px 1px rgb(251 231 178 / 60%);
  opacity: .65;
}

[data-theme="night"] .stars i { animation: twinkle var(--duration) ease-in-out var(--delay) infinite; }
@keyframes twinkle {
  0%, 100% { opacity: .28; transform: scale(.8); }
  48% { opacity: .98; transform: scale(1.22); }
}

.bird {
  position: absolute;
  top: var(--height);
  left: -1.5rem;
  width: var(--size);
  color: #375c6f;
  animation: fly var(--flight) linear var(--start) both;
}

.bird svg { display: block; width: 100%; animation: glide 1.5s ease-in-out infinite alternate; }
@keyframes fly {
  from { transform: translateX(0); opacity: 0; }
  9%, 86% { opacity: .8; }
  to { transform: translateX(calc(var(--postcard-width, 100vw) + 2.25rem)) translateY(-1.4rem); opacity: 0; }
}
@keyframes glide {
  from { transform: scaleY(.6) rotate(-5deg); }
  to { transform: scaleY(1) rotate(4deg); }
}

@media (min-width: 42rem) {
  body {
    display: grid;
    place-items: center;
    padding: 1.2rem 1.5rem;
    background-image: radial-gradient(ellipse at 50% 35%, rgb(255 249 226 / 18%), transparent 68%);
  }

  .postcard {
    --postcard-width: clamp(25rem, 61svh, 34rem);
    width: var(--postcard-width);
    min-height: max(37rem, calc(100svh - 2.4rem));
    border-radius: .8rem;
    box-shadow: 0 1.2rem 4.3rem rgb(9 30 52 / 26%), 0 0 0 1px rgb(255 255 255 / 31%);
  }

  h1 { font-size: clamp(6.5rem, 15svh, 8rem); }
  .invitation { margin-top: clamp(1.6rem, 9svh, 5rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .birds, .scene-video { display: none; }
  .rsvp:hover { transform: none; }
}
