:root {
  color-scheme: dark;
  --background: #0c1b1a;
  --text: #fcf1d9;
  --soft: #b8c9be;
  --gold: #f3ca85;
  font-family: system-ui, sans-serif;
  background: var(--background);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: radial-gradient(ellipse at 80% 9%, #1b3730 0, transparent 54%), var(--background);
}

.postcard {
  max-width: 70rem;
  margin-inline: auto;
  padding: max(1.5rem, env(safe-area-inset-top)) max(1.125rem, env(safe-area-inset-right))
           max(1.5rem, env(safe-area-inset-bottom)) max(1.125rem, env(safe-area-inset-left));
}

.greeting { text-align: center; margin: .15rem 0 1.1rem; }
.recipient {
  margin: 0 0 .45rem;
  color: var(--gold);
  font-size: .875rem;
  text-transform: uppercase;
  letter-spacing: .26em;
  font-weight: 650;
}

h1 {
  margin: 0;
  font-family: Georgia, 'Noto Serif', serif;
  font-size: clamp(2.65rem, 10.6vw, 4rem);
  font-weight: 600;
  letter-spacing: -.04em;
  line-height: .99;
}

.rule {
  display: inline-block;
  width: 2.15rem;
  height: 1px;
  margin-top: 1rem;
  background: var(--gold);
  opacity: .65;
}

.present { max-width: 32rem; margin-inline: auto; }

.stage {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid #f3ca8544;
  border-radius: clamp(1.1rem, 5vw, 2rem);
  background: #0d211f;
  box-shadow: 0 1.1rem 3rem #07100e80;
}

.still, .motion {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
}

.motion { opacity: 0; }
.stage[data-state='playing'] .motion { opacity: 1; }

.tap-gift, .tap-logo {
  position: absolute;
  z-index: 1;
  border: 0;
  padding: 0;
  margin: 0;
  color: inherit;
  background: transparent;
  touch-action: manipulation;
  cursor: pointer;
}

.tap-gift { inset: 0; border-radius: inherit; }
.tap-logo { inset: 9% 9% 12%; border-radius: .85rem; }
.tap-logo:hover { background: #fff5ce0a; }

.actions { text-align: center; margin: 1rem 0 0; }
.hint { color: var(--soft); margin: 0 0 .7rem; font-size: .95rem; }

.primary {
  display: inline-flex;
  min-width: min(100%, 15rem);
  min-height: 3.15rem;
  align-items: center;
  justify-content: center;
  padding: .75rem 1.25rem;
  border: 1px solid #f6d398;
  border-radius: 999px;
  background: linear-gradient(155deg, #f9db9f 0, #d7a65d 100%);
  box-shadow: 0 .35rem 1.15rem #bb854225, inset 0 1px #fff0cda8;
  color: #231b11;
  font: 700 1rem system-ui, sans-serif;
  text-decoration: none;
  touch-action: manipulation;
  cursor: pointer;
}

.primary:active { background: #e1b875; transform: translateY(1px); }
.primary:disabled { opacity: .62; cursor: wait; }
:focus-visible { outline: 2px solid #fff1c4; outline-offset: 4px; }
.tap-gift:focus-visible, .tap-logo:focus-visible { outline-offset: -5px; }

.instructions {
  max-width: 24rem;
  margin: .35rem auto 0;
  color: var(--soft);
  text-align: center;
  line-height: 1.55;
}

.instructions summary {
  min-height: 2.75rem;
  padding-block: .65rem;
  cursor: pointer;
  font-size: .9rem;
}

.instructions p { text-align: start; margin: .15rem 0 .75rem; }
.instructions a { color: var(--gold); text-underline-offset: .2em; }

@media (min-width: 48rem) {
  .postcard {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: clamp(2rem, 7vw, 6rem);
    align-items: center;
    align-content: center;
    min-height: 100svh;
    padding: 2.25rem clamp(2rem, 6vw, 5rem);
  }
  .greeting { text-align: start; align-self: center; }
  h1 { font-size: clamp(3.25rem, 6.15vw, 6rem); }
  .rule { margin-top: 1.4rem; }
  .present { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .primary:active { transform: none; }
}
