@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&display=swap");

/* Color Palette:
 * --------------
 * Warm Sandstone | #B99977 | Background accents, borders, soft tones
 * Classic Ivory | #F9F6F1 | Backgrounds, card bases, clean layouts
 * Midnight Charcoal | #2F2F2F | Headings, text, contrasts elegantly
 * Rose Gold Blush | #D7A89E | Buttons, highlights, romantic accents
 * Olive Leaf Green | #8E8B6E | Decorative florals, subtle secondary color
 * Citystone Grey | #AFA8A0 | Dividers, shadows, muted backgrounds 
 * Antique Gold | #ba9559 | Text, accents, decorative elements
*/

body {
  margin: 0;
  padding: 0;
  display: flex;
  height: 100vh;
  background: #f9f6f1;
  font-family: "Playfair Display", serif;
  overflow-y: hidden;
}

body.isMobile {
  overflow-y: auto;
  min-height: 100vh;
}

.invite-container {
  width: 100%;
  position: relative;
}

.isMobile #invite-container {
  overflow-y: auto;
  min-height: 125vh;

  /* Mobile device horizontal */
  @media screen and (orientation: landscape) and (max-width: 950px) {
    min-height: 245vh;
  }

  @media screen and (orientation: landscape) and (max-width: 850px) {
    min-height: 265vh;
  }

  /* Mobile device  vertial */
  @media screen and (orientation: portrait) and (max-height: 850px) {
    min-height: 140vh;
  }

  @media screen and (orientation: portrait) and (max-height: 670px) {
    min-height: 160vh;
  }
}

.map-container {
  position: absolute;
  top: 50px;
  left: 0px;
  display: flex;
  flex-direction: column;
}

.building {
  width: 700px;
  margin-left: 100px;
  z-index: -5;
}

#couple-nigerian {
  position: absolute;
  height: 140px;
  top: 230px;
  left: 150px;
  z-index: -3;
  clip-path: inset(0 0 0 100%);
  animation: revealFromRight 0.5s ease forwards 1s;
}

@keyframes revealFromRight {
  from {
    clip-path: inset(0 0 0 100%);
    transform: rotate(0deg);
  }
  to {
    clip-path: inset(0 0 0 0);
    transform: rotate(-10deg);
  }
}

#couple-trad {
  position: absolute;
  height: 170px;
  width: 100px;
  top: 730px;
  left: 650px;
  z-index: -3;
  clip-path: inset(0 100% 0 0);
  animation: revealFromLeft 1s ease forwards 2.5s;
}

@keyframes revealFromLeft {
  from {
    clip-path: inset(0 100% 0 0);
    transform: rotate(-10deg);
  }
  to {
    clip-path: inset(0 0 0 0);
    transform: rotate(0deg);
  }
}

.intro-text {
  display: none;
}

.date-text {
  display: none;
}

.location-text {
  height: 30px;
  position: absolute;
  z-index: -5;
}

#dalmore-text {
  top: 180px;
  left: 60px;
}

#knotting-hill-text {
  top: 320px;
  right: 220px;
}

#path {
  height: 780px;
  margin-left: -40px;
  margin-top: -15px;
  clip-path: inset(0 0 100% 0);
  animation: fadeInPath 3s ease-in-out forwards;
  z-index: -10;
}

#knotting-hill {
  transform: translateY(-550px);
  margin-left: 250px;
}

@keyframes fadeInPath {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

.rsvp-panel {
  width: 0%;
  height: 100%;
  background: #EADFCD;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  opacity: 0;
  transform: translateX(30px);
  animation: slideInPanel 1s ease forwards;
  animation-delay: 10.5s;
  position: relative;
}

#rsvp-bottom-overlay {
  display: none;
}

@keyframes slideInPanel {
  from {
    opacity: 0;
    width: 0%;
    padding: 3rem;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    width: 40%;
    padding: 3rem;
    transform: translateX(0);
  }
}

.rsvp-panel h1 {
  font-size: 2.8rem;
  margin-bottom: 0;
  text-align: center;
  color: #2f2f2f;
}

.rsvp-panel p {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 2em;
  color: #2f2f2f;
}

.rsvp-button {
  display: inline-block;
  padding: 1rem 2rem;
  background: #ba9559;
  color: white;
  text-decoration: none;
  border-radius: 30px;
  transition: background 0.3s ease;
  z-index: 1;
  font-size: 1.2rem;
  font-weight: 600;
}

.rsvp-panel a:hover {
  background: #7a6238;
}

.dancing-couple {
  position: absolute;
  height: 160px;
  opacity: 0;
  bottom: 100px;
  left: 50px;
  animation: fadeInCouple 1s ease forwards;
}

@keyframes fadeInCouple {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.envelope {
  position: absolute;
  width: 600px;
  height: 418px;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -80%);
  transform-origin: bottom;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  opacity: 0;
  animation: fadeInEnvelope 1s ease forwards,
    rotateEnvelope 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    tiltEnvelope 1s ease forwards;
  animation-delay: 4s, 6.5s, 10.5s;
  transform-style: preserve-3d;

  img {
    width: 100%;
    height: 100%;
  }
}

#envelopeFrontImage {
  width: 600px;
  height: 418px;
  animation: hideFrontEnvelope 1s ease forwards;
  animation-delay: 6.5s;
}

#envelopeBackImage {
  position: absolute;
  top: 0;
  left: 0;
  width: 600px;
  height: 418px;
  opacity: 0;
  animation: showBackEnvelope 0.5s ease forwards;
  animation-delay: 7s;
  z-index: 1;
}

#envelopeTop {
  position: absolute;
  height: 240px;
  transform-origin: top;
  animation: flipEnvelopeTop 1s ease forwards;
  animation-delay: 8s;
  z-index: 2;
}

#envelopeTopFlipped {
  position: absolute;
  height: 240px;
  transform-origin: top;
  opacity: 0;
  animation: flipEnvelopeTop 1s ease forwards, showFlippedTop 0.8s ease forwards;
  animation-delay: 8s, 8.2s;
  z-index: 2;
}

#envelopeBottom {
  height: 418px;
  opacity: 1;
  animation: hideEnvelopeBottom 0.1s ease forwards;
  animation-delay: 10s;
  z-index: 1;
}

#envelopeBottomGold {
  height: 418px;
  opacity: 0;
  animation: showEnvelopeBottomGold 0.1s ease forwards;
  animation-delay: 10.5s;
  z-index: 1;
}

.card {
  position: absolute;
  width: 600px;
  height: 418px;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  transform-origin: bottom;
  animation: showCardInEnvelope 1s ease forwards,
    slideOutCard 1.5s ease forwards, tiltCard 1s ease forwards;
  animation-delay: 7.5s, 9s, 10.5s;

  img {
    width: 600px;
    height: 100%;
    object-fit: cover;
    object-position: top;
  }
}

/* Envelope entrance */
@keyframes fadeInEnvelope {
  from {
    opacity: 0;
    transform: translate(-50%, -80%);
    transform-origin: bottom right;
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
    transform-origin: bottom right;
  }
}

/* Envelope spin */
@keyframes rotateEnvelope {
  from {
    transform: translate(-50%, -50%) rotateY(0deg);
    transform-origin: bottom;
  }
  to {
    transform: translate(-50%, -50%) rotateY(180deg);
    transform-origin: bottom;
  }
}

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

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

/* Envelope flip open */
@keyframes showCardInEnvelope {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes flipEnvelopeTop {
  from {
    transform: rotateX(0deg);
  }
  to {
    transform: rotateX(-180deg);
  }
}

@keyframes showFlippedTop {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

/* Card slide out of envelope */
@keyframes slideOutCard {
  0% {
    height: 418px;
    transform: translate(-50%, -50%) rotate(0deg);
    z-index: -1;
  }
  10% {
    z-index: 3;
  }
  100% {
    height: 850px;
    transform: translate(-50%, -55%) rotate(0deg);
    z-index: 3;
  }
}

/* Replace envelope with gold lined */
@keyframes hideEnvelopeBottom {
  from {
    opacity: 1;
    display: block;
  }
  to {
    opacity: 0;
    display: none;
  }
}

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

/* Final tilt card & envelope */
@keyframes tiltCard {
  0% {
    transform: translate(-50%, -55%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -55%) rotate(3deg);
  }
}

@keyframes tiltEnvelope {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-70%, -50%) rotate(-15deg);
  }
}

@keyframes write {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes unwrite {
  from {
    clip-path: inset(0 0 0 0);
  }
  to {
    clip-path: inset(0 0 0 100%);
  }
}

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

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

@keyframes fadeInMap {
  from {
    clip-path: inset(0 0 100% 0);
    opacity: 0;
  }
  to {
    clip-path: inset(0 0 0 0);
    opacity: 1;
  }
}

/* Mobile design */

.isMobile {
  .envelope,
  .card,
  .rsvp-panel {
    display: none;
    animation: none;
  }

  #rsvp-bottom-overlay {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    box-sizing: border-box;
    background: #EADFCD ; 
    padding: 0.5rem 2.5rem 1.5rem 2.5rem;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.3s;
    z-index: 20;

    /* Mobile device horizontal */
    @media screen and (orientation: landscape) and (max-width: 950px) {
      padding: 0.5rem 2rem 2rem 2.5rem;
    }
  }

  h1 {
    font-size: 1.8rem;
  }

  #rsvp-bottom-overlay.visible {
    transform: translateY(0);
  }

  .rsvp-button {
    font-size: 1rem;
    margin-top: 0rem; /*ufu edited from 1rem

    /* Mobile device horizontal */
    @media screen and (orientation: landscape) and (max-width: 950px) {
      margin-top: 0.5rem;
    }
  }

  .intro-text {
    display: block;
    position: absolute;
    width: 80%;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    clip-path: inset(0 100% 0 0);
  }

  #intro-text-1 {
    animation: write 2s forwards, fadeOut 2s forwards;
    animation-delay: 1s, 3s;
  }

  #intro-text-2 {
    animation: write 2s forwards, fadeOut 1.5s forwards;
    animation-delay: 4.5s, 8.5s;
  }

  #intro-text-3 {
    margin-top: 60px;
    animation: write 2s forwards, fadeOut 1.5s forwards;
    animation-delay: 6.0s, 8.5s;
  }

  .map-container {
    width: 100%;
    align-items: center;
    overflow-x: clip;
    opacity: 0;
    animation: fadeIn 2s ease forwards;
    animation-delay: 9.5s;
  }

  .date-text {
    height: 24px;
    display: block;
  }

  #date-text-2 {
    height: 26px;
    margin-top: -470px;
  }

  .location-text {
    position: unset;
    margin-top: 20px;
    margin-bottom: 30px;
  }

  #dalmore-text {
    height: 24px;
  }

  #knotting-hill-text {
    height: 22px;
  }

  #path {
    height: 630px;
    width: 940px;
    margin-left: 30px;
    margin-top: -129px;
    animation-delay: 11.5s;
  }

  .building {
    width: 370px;
    position: unset;
    margin-left: unset;

    @media screen and (orientation: portrait) and (max-height: 670px) {
      width: 320px;
    }
  }

  #knotting-hill {
    position: unset;
    transform: none;
    margin-left: unset;
  }

  #couple-nigerian {
    height: 100px;
    margin-top: 20px;
    margin-left: -200px;
    position: unset;
    animation-delay: 12.5s;
  }

  #couple-trad {
    height: 120px;
    margin-top: 95px;
    margin-left: 100px;
    position: unset;
    animation-delay: 14s;
  }
}
