@import url("https://fonts.googleapis.com/css?family=Indie+Flower");
@import url("https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&family=Playwrite+HU:wght@100..400&display=swap");

::-webkit-scrollbar {
  width: 0;
}

* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

body {
  font-family: "Playwrite HU", "Noto Color Emoji", sans-serif;
  background-image: url("../img/BG.jpeg");
  background-repeat: repeat;
  background-size: cover;
  /* animation: scrollBg 60s linear infinite; */
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

@keyframes scrollBg {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 0 1000px;
  }
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
}

#card-front {
  color: #ffdfdf;
  z-index: 10;
}

#card,
#card-front,
#card-inside {
  height: 80vh;
  min-height: 400px;
  max-height: a;
  border-radius: 10px;
}

.wrap {
  padding: 1.5em 2em;
  height: 100%;
  overflow-y: auto;
}

#card-front,
#card-inside {
  width: 50%;
  -webkit-box-shadow:
    2px 2px 30px rgba(0, 0, 0, 0.25),
    0 0 1px rgba(0, 0, 0, 0.5);
  box-shadow:
    2px 2px 30px rgba(0, 0, 0, 0.25),
    0 0 1px rgba(0, 0, 0, 0.5);
  position: absolute;
  left: 50%;
}

#card-inside .wrap {
  background: #ffefef;
  -webkit-box-shadow: inset 2px 0 1px rgba(0, 0, 0, 0.05);
  box-shadow: inset 2px 0 1px rgba(0, 0, 0, 0.05);
}

#card {
  width: 100%;
  max-width: 960px;
  margin: auto;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-perspective: 5000px;
  perspective: 5000px;
  -webkit-transform: translateX(-25%);
  transform: translateX(-25%);
  -webkit-transition: -webkit-transform 1s ease-in-out;
  transition: -webkit-transform 1s ease-in-out;
  transition: transform 1s ease-in-out;
  transition:
    transform 1s ease-in-out,
    -webkit-transform 1s ease-in-out;
  position: relative;
  overflow: hidden;
  padding: 10px;
  border-radius: 10px;
}

#card h1 {
  text-align: center;
  font-family: "Playwrite HU", cursive;
  font-style: italic;
  font-size: clamp(1.5rem, 5vw, 2.5em);
  text-shadow:
    4px 4px 0px rgba(0, 0, 0, 0.15),
    1px 1px 0 #ffc8c8,
    2px 2px 0 #ff9696,
    3px 3px 0 #ff7d7d;
  color: #fff;
  line-height: 1.4;
  margin: 1em 0;
}

#card-inside {
  line-height: 1.4;
  font-family: "Indie Flower";
  font-weight: 500;
  color: #331717;
  font-style: italic;
}

p {
  font-size: clamp(1rem, 3vw, 1.15em);
  margin-top: 1em;
  text-align: justify;
}

p:first-child {
  margin-top: 0;
  text-align: center;
  font-size: clamp(1.1rem, 3.5vw, 1.3em);
  font-weight: bold;
}

p.signed {
  margin-top: 1.5em;
  text-align: center;
  font-family: "Indie Flower", cursive;
  font-size: clamp(1.2rem, 4vw, 1.5em);
}

#card-front {
  background-color: #ee9ca7;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#ff5555), to(#ff7777));
  background-image: linear-gradient(top, #ff5555 0%, #ff7777 100%);
  -webkit-transform-origin: left;
  transform-origin: left;
  -webkit-transition: -webkit-transform 1s linear;
  transition: -webkit-transform 1s linear;
  transition: transform 1s linear;
  transition:
    transform 1s linear,
    -webkit-transform 1s linear;
  position: relative;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-perspective: 5000px;
  perspective: 5000px;
}

#card-front:before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: block;
  background-color: #444;
  -webkit-transform: translateZ(-1px);
  transform: translateZ(-1px);
}

#card-front .wrap {
  -webkit-transition: background 1s linear;
  transition: background 1s linear;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

#card-front button {
  position: absolute;
  bottom: 1em;
  right: -12px;
  background: #f44;
  color: #fff;
  font-family: "Indie Flower", cursive;
  font-style: italic;
  font-weight: bold;
  font-size: clamp(1.2rem, 4vw, 1.5em);
  padding: 0.8em 1em;
  border: none;
  cursor: pointer;
  -webkit-box-shadow:
    2px 2px 3px rgba(0, 0, 0, 0.25),
    0 0 1px rgba(0, 0, 0, 0.4);
  box-shadow:
    2px 2px 3px rgba(0, 0, 0, 0.25),
    0 0 1px rgba(0, 0, 0, 0.4);
  border-radius: 5px;
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
}

#card-front button:hover,
#card-front button:focus {
  background: #f22;
  transform: scale(1.05);
}

#close {
  display: none;
}

#card.open-fully {
  -webkit-transform: translateX(0%);
  transform: translateX(0%);
}

#card.open-fully #close,
#card-open-half #close {
  display: inline;
}

#card.open-fully #open {
  display: none;
}

#card.open-half #card-front,
#card.close-half #card-front {
  -webkit-transform: rotateY(-90deg);
  transform: rotateY(-90deg);
}

#card.open-half .shadow {
  background-color: rgba(0, 0, 0, 0.5);
}

#card.open-fully #card-front,
#card.close-half #card-front {
  background: #ffefef;
}

#card.open-fully #card-front {
  -webkit-transform: rotateY(-180deg);
  transform: rotateY(-180deg);
}

#card.open-fully .shadow {
  background-color: rgba(0, 0, 0, 0);
}

.card-front_inside {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70%;
  width: 80%;
  margin: auto;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(-1px) rotateY(180deg);
  transform: translateZ(-1px) rotateY(180deg);
  background-color: #ffefef;
}

.shadow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(-2px) rotateY(180deg);
  transform: translateZ(-2px) rotateY(180deg);
  pointer-events: none;
  -webkit-transition: background 1s linear;
  transition: background 1s linear;
}

.polaroid {
  width: min(240px, 80%);
  height: min(300px, 60%);
  position: absolute;
  background: #1e1c18;
  border: 7px solid #f5f5f5;
  border-bottom: 30px solid #f5f5f5;
  -webkit-box-shadow: 0 0 6px -1px #000;
  box-shadow: 0 0 6px -1px #000;
  overflow: hidden;
  left: 0;
  right: 0;
  margin: auto;
  -webkit-transform: rotate(-5deg);
  transform: rotate(-5deg);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.polaroid img,
.polaroid .img {
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  background-position: center;
  background-size: cover;
  -webkit-animation: fade-in 20s ease-in;
  animation: fade-in 20s ease-in;
  -webkit-animation-iteration-count: 1;
  animation-iteration-count: 1;
}

@-webkit-keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Button styles */
#toggle-card,
#download-button {
  margin: 20px auto;
  background-color: #ff6f61;
  color: white;
  font-family: "Indie Flower", cursive;
  font-size: clamp(1rem, 3vw, 1.2em);
  padding: 15px 25px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  max-width: 250px;
  width: auto;
  min-height: 44px;
  touch-action: manipulation;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-sizing: border-box;
}

#toggle-card:hover,
#download-button:hover {
  background-color: #ff4c3b;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 100, 100, 0.3);
}

#toggle-card:focus,
#download-button:focus {
  outline: 2px solid #ff6f61;
  outline-offset: 2px;
}

#download-button {
  display: none;
}

/* Star symbol */
.star-symbol {
  font-size: clamp(4rem, 15vw, 10em);
  color: #ffffff;
  margin-top: 10px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Mobile optimizations */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  #card {
    -webkit-transform: translateX(-20%);
    transform: translateX(-20%);
  }

  .wrap {
    padding: 1em 1.5em;
  }

  #card,
  #card-front,
  #card-inside {
    height: 60vh;
    min-height: 350px;
  }

  .polaroid {
    width: min(200px, 90%);
    height: min(250px, 50%);
    border-bottom: 20px solid #f5f5f5;
  }
}

@media (max-width: 480px) {
  #card {
    -webkit-transform: translateX(-15%);
    transform: translateX(-15%);
  }

  #card,
  #card-front,
  #card-inside {
    height: 55vh;
    min-height: 300px;
  }

  .wrap {
    padding: 0.8em 1.2em;
  }

  .polaroid {
    width: min(160px, 85%);
    height: min(200px, 45%);
  }

  #card-front button {
    right: -8px;
    padding: 0.6em 0.8em;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  #card,
  #card-front,
  #card-inside {
    height: 80vh;
    min-height: 250px;
  }

  body {
    padding: 5px;
  }
}
