/* Pastel Blue Birthday Invitation
   Files: index.html + style.css
   Asset: assets/Birthday-card.png
*/

:root{
  --bg1: #5DCFE3;
  --bg2: #c048c0;
  --ink: #41174a;
  --ink-soft: rgba(23, 50, 74, 0.78);
  --blue: #87590C;
  --blue-2: #cfe8ff;
  --white: #ffffff;
  --shadow: rgba(0, 35, 70, 0.18);
  --shadow2: rgba(0, 35, 70, 0.10);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(159,205,245,0.35), transparent 55%),
    radial-gradient(900px 600px at 85% 15%, rgba(207,232,255,0.55), transparent 55%),
    linear-gradient(180deg, var(--bg1), var(--bg2));
  overflow-x: hidden;
}

.page{
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 18px;
}

/* -----------------------------------------
   Envelope overlay
------------------------------------------ */
.overlay{
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(124, 241, 241, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
  transition: opacity .35s ease, visibility .35s ease;
}

.overlay.hidden{
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.envelope-wrap{
  display: grid;
  place-items: center;
  gap: 12px;
  user-select: none;
  cursor: pointer;
  padding: 18px 18px 8px;
  border-radius: 22px;
  transition: transform .2s ease;
  outline: none;
}

.envelope-wrap:focus-visible{
  box-shadow: 0 0 0 4px rgba(135,89,12);
}

.envelope-wrap.ready{
  animation: floaty 2.8s ease-in-out infinite;
}

@keyframes floaty{
  0%,100%{ transform: translateY(0); }
  50%{ transform: translateY(-7px); }
}

.tap-hint{
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  letter-spacing: .02em;
}

/* Envelope build */
.envelope{
  position: relative;
  width: min(320px, 82vw);
  aspect-ratio: 16 / 11;
  transform: translateZ(0);
  filter: drop-shadow(0 18px 28px var(--shadow));
}

.env-back{
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #ffffff, #f3fbff);
  border: 2px solid rgba(159,205,245,0.7);
  border-radius: 16px;
}

.env-front{
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background:
    linear-gradient(135deg, transparent 49%, rgba(159,205,245,0.22) 50%, transparent 51%),
    linear-gradient(225deg, transparent 49%, rgba(159,205,245,0.22) 50%, transparent 51%),
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.0));
  pointer-events: none;
}

.env-paper{
  position: absolute;
  left: 50%;
  top: 10%;
  width: 86%;
  height: 78%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #ffffff, #f7fcff);
  border-radius: 12px;
  border: 1px solid rgba(159,205,245,0.45);
  box-shadow: 0 12px 18px var(--shadow2);
  display: grid;
  place-items: center;
  gap: 10px;
  padding: 16px;
  transition: transform .65s cubic-bezier(.2,.85,.2,1), opacity .55s ease;
}

.paper-line{
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(159,205,245,0.20);
}
.paper-line.short{ width: 70%; }

.seal{
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 25%, #ffffff, #e9f6ff 60%, #d7efff);
  border: 2px solid rgba(159,205,245,0.7);
  box-shadow: 0 8px 16px rgba(0,35,70,0.12);
  font-size: 22px;
}

/* Flap */
.env-flap{
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 55%;
  border-radius: 16px 16px 12px 12px;
  transform-origin: top center;
  background:
    linear-gradient(180deg, #ffffff, #f0f9ff);
  border: 2px solid rgba(159,205,245,0.7);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transition: transform .65s cubic-bezier(.2,.85,.2,1);
}

/* Open animation */
.envelope-wrap.opened .env-flap{
  transform: rotateX(155deg);
}

.envelope-wrap.opened .env-paper{
  transform: translateX(-50%) translateY(-22%) scale(1.02);
  opacity: 0;
}

/* -----------------------------------------
   Invitation card
------------------------------------------ */
.invite{
  width: 100%;
  display: grid;
  place-items: center;
  gap: 14px;
}

.invite.hidden{
  display: none;
}

.invite.shown{
  animation: pop .55s ease both;
}

@keyframes pop{
  from{ opacity: 0; transform: translateY(10px) scale(.98); }
  to{ opacity: 1; transform: translateY(0) scale(1); }
}

.card{
  position: relative;
  width: min(560px, 92vw);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: 0 22px 40px var(--shadow);
  transform: translateZ(0);
  transition: transform .25s ease;
  cursor: zoom-in;
}

.card.zoom{
  transform: scale(1.06);
  cursor: zoom-out;
}

.card-img{
  width: 100%;
  height: auto;
  display: block;
}

.card-text{
  position: absolute;
  left: 2%;
  right: 2%;
  top: 10%;
  bottom: 10%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;

  /* Subtle readability helper */
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(159,205,245,0.30);
  border-radius: 18px;
  padding: 16px 16px 14px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.kicker{
  margin: 0 0 6px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .02em;
}

.title{
  margin: 0;
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.05;
}

.sub{
  margin: 8px 0 0;
  font-weight: 700;
  color: rgba(23, 50, 74, 0.74);
}

.names{
  margin: 8px 0 0;
  font-size: clamp(18px, 2.6vw, 22px);
  font-weight: 800;
}

.divider{
  width: 56%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(159,205,245,0.85), transparent);
  margin: 12px 0 10px;
}

.detail{
  margin: 5px 0;
  color: rgba(23, 50, 74, 0.85);
  font-weight: 600;
}

.dress{
  margin-top: 8px;
}

.note{
  margin: 12px 0 0;
  font-weight: 700;
  color: rgba(23, 50, 74, 0.72);
}

/* Reopen button */
.reopen{
  appearance: none;
  border: 1px solid rgba(159,205,245,0.65);
  background: rgba(255,255,255,0.70);
  color: rgba(23, 50, 74, 0.88);
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 999px;
  box-shadow: 0 10px 18px rgba(0,35,70,0.08);
  cursor: pointer;
}

.reopen:hover{
  transform: translateY(-1px);
}

.reopen:active{
  transform: translateY(0px);
}

/* Registry button */
.registry-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 900;
  letter-spacing: .01em;
  color: rgba(23, 50, 74, 0.92);
  background: linear-gradient(180deg, rgba(207,232,255,0.95), rgba(159,205,245,0.85));
  border: 1px solid rgba(159,205,245,0.75);
  box-shadow: 0 12px 18px rgba(0,35,70,0.10);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.registry-btn:hover{
  transform: translateY(-1px);
  filter: brightness(1.02);
  box-shadow: 0 16px 24px rgba(0,35,70,0.12);
}
.registry-btn:active{
  transform: translateY(0px);
  box-shadow: 0 10px 16px rgba(0,35,70,0.10);
}
.registry-btn:focus-visible{
  outline: none;
  box-shadow: 0 0 0 4px rgba(159,205,245,0.55), 0 12px 18px rgba(0,35,70,0.10);
}

.card-text a.registry-btn{
  text-decoration: none !important;
  color: rgba(23, 50, 74, 0.92) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin-top: 12px !important;
  padding: 12px 16px !important;
  border-radius: 999px !important;
  font-weight: 900 !important;
  background: linear-gradient(180deg, rgba(207,232,255,0.95), rgba(159,205,245,0.85)) !important;
  border: 1px solid rgba(159,205,245,0.75) !important;
}

/* Tablet/mobile tuning */
@media (max-width: 768px){
  .page{
    padding: 14px;
  }

  .card{
    width: min(560px, 96vw);
  }

  .card-text{
    left: 3.5%;
    right: 3.5%;
    top: 12%;
    bottom: 10%;
    padding: 14px 14px 12px;
    justify-content: flex-start;
  }

  .title{
    font-size: clamp(22px, 5vw, 30px);
    line-height: 1.08;
  }

  .sub{
    margin-top: 7px;
    font-size: clamp(13px, 2.3vw, 18px);
    line-height: 1.28;
  }

  .names{
    font-size: clamp(16px, 3.3vw, 22px);
    line-height: 1.34;
  }

  .detail,
  .note{
    font-size: clamp(14px, 2.25vw, 18px);
    line-height: 1.32;
  }

  .divider{
    margin: 10px 0 9px;
  }

  .registry-btn,
  .card-text a.registry-btn{
    margin-top: 10px !important;
    padding: 11px 18px !important;
    font-size: 15px;
  }
}

/* Small screens: make the artwork fit without text spilling */
@media (max-width: 480px){
  .page{
    padding: 12px 10px 18px;
  }

  .invite{
    gap: 12px;
  }

  .card{
    width: 100%;
    max-width: 400px;
    border-radius: 24px;
  }

  .card-text{
    left: 2.5%;
    right: 2.5%;
    top: 11.5%;
    bottom: 11%;
    padding: 12px 10px 10px;
    border-radius: 16px;
  }

  .title{
    font-size: clamp(18px, 5.9vw, 24px);
    line-height: 1.06;
  }

  .sub{
    margin-top: 6px;
    font-size: clamp(12px, 3.2vw, 14px);
    line-height: 1.24;
  }

  .names{
    margin-top: 6px;
    font-size: clamp(13px, 3.8vw, 18px);
    line-height: 1.3;
  }

  .detail{
    margin: 4px 0;
    font-size: clamp(12px, 3.55vw, 15px);
    line-height: 1.24;
  }

  .dress{
    margin-top: 6px;
  }

  .note{
    margin-top: 9px;
    font-size: clamp(11px, 3.1vw, 13px);
    line-height: 1.22;
  }

  .divider{
    width: 68%;
    margin: 9px 0 8px;
  }

  .registry-btn,
  .card-text a.registry-btn{
    margin-top: 9px !important;
    padding: 10px 16px !important;
    font-size: 14px;
  }

  .reopen{
    padding: 10px 16px;
    font-size: 15px;
  }
}

/* Very small phones */
@media (max-width: 380px){
  .card-text{
    top: 11%;
    bottom: 10.5%;
    padding: 11px 9px 9px;
  }

  .title{
    font-size: 17px;
  }

  .sub{
    font-size: 11.5px;
  }

  .names{
    font-size: 12.5px;
  }

  .detail{
    font-size: 11.8px;
  }

  .note{
    font-size: 10.8px;
  }

  .registry-btn,
  .card-text a.registry-btn{
    padding: 9px 15px !important;
    font-size: 13.5px;
  }
}

/* Touch devices: avoid accidental zoom jump */
@media (hover: none) and (pointer: coarse){
  .card{
    cursor: default;
  }

  .card.zoom{
    transform: none;
  }
}
