@import url(https://fonts.googleapis.com/css?family=Righteous);
@import url(https://fonts.googleapis.com/css?family=Cutive+Mono);

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizelegibility;
  box-sizing: border-box;
}
html *,
html::before,
html::after {
  box-sizing: inherit;
}

body {
  overflow: hidden;
  background-color: #456ddd;
  perspective: 1000px;
  color: #fff;
  font-family: 'Cutive Mono', sans-serif;
  margin: 0;
  text-align: center;
}

.card {
  position: absolute;
  top: 100px;
  left: 50%;
  margin-left: -175px;
  width: 350px;
  height: 470px;
  transform-style: preserve-3d;
  transition: all ease-in-out 1s;
}
.card .page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}
.card .cover {
  z-index: 2;
  transform: rotateY(-20deg);
  transition: transform ease-in-out 1.4s;
  
}

.content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #dd9445;
  z-index: 3;
}

.together-forever {
  max-width: 80%;
  height: auto;
  margin: 15px 0;
  border-radius: 8px;
  
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
  opacity: 0; /* Initially hide the image by making it fully transparent */
  transition: opacity 0.8s ease-in-out; /* Optional: for a smooth fade-in */

  position:relative;

}

.card.open .together-forever {
  opacity: 1; /* Make the image fully visible when the card is open */

}


.cover::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: right bottom;
  background-color: rgba(0, 0, 0, 0.3);
  transform: skew(-8deg) rotateX(-10deg);
  z-index: -1;
  content: ""; /* Added content for pseudo-element to work */
}

 .content h2 {
  opacity: 1; 
  transition: opacity 0.8s ease-in-out; 
}

.card.open .cover .content h2 {
  opacity: 0;
}


.card.open button {
    opacity: 0;
}

.card button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  background: transparent;
  border: 3px solid #fff;
  color: #fff;
  font-size: 20px;
  padding: 0.5em 1.4em;
}
.card .cover button:focus {
  outline: none;
}

.card .inside {
  z-index: 1;
  transform: rotateY(-8deg);
}
.card .inside .content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #27292a;
  z-index: 3;
}
.card .inside::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: right bottom;
  background-color: rgba(0, 0, 0, 0.3);
  transform: skew(-8deg) rotateX(-10deg);
  z-index: -1;
  content: ""; /* Added content for pseudo-element to work */
}
.card.open {
  margin-left: 0;
}
.card.open .cover {
  transform: rotateY(-175deg);
}
.card.open .together-forever {
  opacity: 1;
  margin-top: -50px; /* Adjust this value to move it up as much as you need */
}
.t-text {
  position: absolute;
  top: 30px;
  width: 100%;
}

.b-text {
  position: absolute;
  bottom: 30px;
  width: 100%;
}

.hb {
  margin-top: 150px;
  background: radial-gradient(top, ellipse cover, rgba(248, 80, 150, 1) 0%, rgba(134, 220, 24, 1) 25%, rgba(38, 124, 240, 1) 60%, rgba(231, 56, 39, 1) 100%);
  display: inline-block;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-family: 'Righteous', sans-serif;
  font-size: 50px;
  font-weight: 700;
  position: relative;
}
.hb::after,
.hb::before {
  content: attr(data-title);
  text-shadow: 8px -8px 0px #fff;
  position: absolute;
  top: 0;
  left: 0;
  animation: depth 6s -1s cubic-bezier(0.445, 0.05, 0.55, 0.95) infinite;
}
.hb::after {
  background: radial-gradient(top, ellipse cover, rgba(248, 100, 100, 1) 0%, rgba(10, 255, 200, 1) 25%, rgba(238, 124, 250, 1) 60%, rgba(250, 166, 29, 1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transform: translate3d(0px, 16px, 0px) scale(0.9);
  z-index: -1;
}
.hb::before {
  background: linear-gradient(top, rgba(55, 93, 177, 1) 0%, rgba(253, 251, 0, 1) 30%, rgba(239, 1, 124, 1) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transform: translate3d(0px, 32px, 0px) scale(0.8);
  z-index: -2;
}

@keyframes depth {
  50% {
    transform: translate3d(0px, 0px, 0px);
  }
}
/* Mobile-specific styles using a media query */
@media (max-width: 600px) {
  body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    perspective: none;
    text-align: center;
  }
.card {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin-left: -175px;
  margin-top: -235px;
  width: 350px;
  height: 470px;
  transform-style: preserve-3d;
  transition: all ease-in-out 1s;
  transform-origin: top center;
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #dd9445; /* Match the cover color */
  z-index: 2; /* Place it above the .inside initially */
  transform-origin: bottom center;
  transform: rotateX(0deg);
  transition: transform ease-in-out 1.4s;
}

.card.open::before {
  transform: rotateX(180deg);
  z-index: 0;
}

.card .page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

.card .cover {
  z-index: 3;
  transform: rotateX(0deg);
  transition: transform ease-in-out 1.4s;
  background-color: #dd9445;
}

.card .inside {
  z-index: 1;
  transform-origin: bottom center;
  /* Keep translateY for sliding effect if desired */
  /* transform: translateY(100%); */
  transition: transform ease-in-out 1.4s;
}

.card .inside .content {
  opacity: 0; /* Initially hide the content */
  transition: opacity 0.8s ease-in-out 0.4s; /* Fade in when open */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center; /* Center content */
  position: relative; /* Needed for z-index if other elements overlap */
  z-index: 1; /* Ensure it's above the background of .inside */
}

.card.open .inside .content {
  opacity: 1; /* Make content visible when open */
}
  .card .cover,
  .card .inside {
    position: relative;
    transform: none !important;
    backface-visibility: visible !important;
  }

  .card .cover::after,
  .card .inside::after {
    display: none;
  }

  .card .cover .content,
  .card .inside .content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
  }

  .card .cover h2 {
    font-size: 2em;
    margin-bottom: 15px;
  }

  .card .cover button {
    font-size: 1.1em;
    padding: 0.8em 1.5em;
  }

  .card .inside {
    transform: translateY(100%); /* Initially hidden */
    transition: transform ease-in-out 0.8s; /* Adjust timing if needed */
  }

  .card.open .inside {
    transform: translateY(0%); /* Slide up */
  }

  .together-forever {
    max-width: 90%;
    margin: 10px 0;
    opacity: 0; /* Initially hidden */
    transition: opacity 0.8s ease-in-out 0.4s; /* Delay fade-in slightly */
    order: -1;
  }

  .card.open .together-forever {
    opacity: 1; /* Show when open */
    margin-top: 15px;
  }

  .t-text {
    font-size: 1.3em;
    margin-bottom: 8px;
    order: 1;
    width: 100%;
    text-align: center;
  }

  .hb {
    font-size: 2.5em;
    margin-top: 10px;
    order: 2;
  }

  .b-text {
    font-size: 1em;
    margin-top: 8px;
    order: 3;
  }
}