/* Base styles */
html {
  width: 100%;
  min-height: 100%;
  font-size: 16px;
}

body {
  font-family: "Press Start 2P", sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  width: 100%;
  min-height: 100%;
  position: relative;
  overflow-x: hidden;
  background-color: #3ea043;
  background-attachment: scroll;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: top;
}

body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='4' height='4' viewBox='0 0 4 4'><rect width='4' height='4' fill='none'/><circle cx='1' cy='1' r='0.5' fill='%23ffffff' fill-opacity='0.06'/></svg>");
  background-repeat: repeat;
  opacity: 0.6;
  image-rendering: pixelated;
}

#app {
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

/* Typography */
h1 {
  font-family: "Press Start 2P", monospace;
  font-size: 1.5rem;
  color: rgb(214, 0, 0);
  line-height: 1.5;
  text-shadow: 0.2rem 0.2rem 0 rgba(0, 0, 0, 0.8);
}

.ceremony-date__day,
.ceremony-date__full {
  display: block;
}

h2 {
  font-family: "Press Start 2P", monospace;
  font-size: 1.5rem;
  color: #3ea043;
  text-shadow: 0.2rem 0.2rem 0 rgba(0, 0, 0, 0.8);
}

p {
  font-family: "Press Start 2P", monospace;
  font-size: 1rem;
  color: #3ea043;
  line-height: 1.5;
  text-shadow: 0.1rem 0.1rem 0 rgba(0, 0, 0, 0.8);
}

.details-value {
  color: rgb(118, 211, 100);
}

.copy-feedback {
  display: inline-block;
  margin-left: 0.5rem;
  font-family: "Press Start 2P", monospace;
  font-size: 0.8rem;
  color: rgb(214, 0, 0);
  text-shadow: 0.1rem 0.1rem 0 rgba(0, 0, 0, 0.8);
}

a {
  font-family: "Press Start 2P", monospace;
  color: rgb(46, 213, 255);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  text-shadow: 0.1rem 0.1rem 0 rgba(0, 0, 0, 0.8);
  transition:
    color 0.12s ease,
    text-decoration-color 0.12s ease;
  line-height: 2;

}

a:hover {
  color: rgb(46, 119, 255);
}

/* Header */
header {
  text-align: center;
  padding: 0;
  background: transparent;
}

.page-title-mobile {
  display: none;
  margin: 0;
  padding: 0.5rem 0.75rem 0;
  font-family: "Press Start 2P", monospace;
  line-height: 1.6;
  color: rgb(255, 221, 69);
  text-shadow: 2px 2px 0 rgba(214, 0, 0, 0.8);
  text-align: center;
  word-break: break-word;
  will-change: transform, opacity;
}

header .page-title-mobile.h2,
header h2.page-title-mobile {
  font-size: 1.5rem;
}

header .page-title-mobile.h1,
header h1.page-title-mobile {
  font-size: 2rem;
  padding-top: 0.25rem;
  padding-bottom: 1rem;
}

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

@keyframes pageTitleBlink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@media (max-width: 768px) and (orientation: portrait) {
  header h2.page-title-mobile {
    display: block;
    animation:
      pageTitleIn 3000ms cubic-bezier(0.2, 0.9, 0.2, 1) both,
      pageTitleBlink 2000ms steps(2, end) 620ms infinite;
  }

  header h1.page-title-mobile {
    display: block;
    animation:
      pageTitleIn 3000ms cubic-bezier(0.2, 0.9, 0.2, 1) both,
      pageTitleBlink 2000ms steps(2, end) 620ms infinite;
  }
}

@media (prefers-reduced-motion: reduce) {
  header h2.page-title-mobile,
  header h1.page-title-mobile {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Canvas */
.game-canvas {
  position: relative;
  z-index: 5;
}

canvas.game-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 1;
  background: linear-gradient(#7bd3ff, #c8faff);
  image-rendering: pixelated;
  margin: 0;
  border: none;
}

/* Fullscreen game mode */
body.game-fullscreen {
  overflow: hidden !important;
  height: 100vh;
}

body.game-fullscreen #app > section,
body.game-fullscreen footer {
  display: none !important;
}

body.game-fullscreen #app > header {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #3ea043;
}

/* Sections */
section {
  padding: 2rem 2.5rem;
  max-width: 840px;
  margin: 2.5rem auto;
  width: 100%;
  background: rgb(255, 255, 255);
  border: 4px solid rgb(255, 221, 69);
  box-shadow:
    0.4rem 0.4rem 0 rgba(62, 160, 67, 0.8),
    0.8rem 0.8rem 0 rgba(0, 0, 0, 0.4);
  border-radius: 0;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Reveal generico per sezioni */
.reveal {
  opacity: 0;
  transform: translateY(2rem) scale(0.98);
  filter: blur(2px);
  transition:
    opacity 0.7s ease-out,
    transform 2s ease-out,
    filter 0.7s ease-out;
  will-change: opacity, transform, filter;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  filter: blur(0);
}

.section-sep {
  border: none;
  height: 3px;
  margin: 1rem auto;
  max-width: 80%;
  color: white;
  background-color: rgb(255, 221, 69);
  border-radius: 2px;
  box-shadow: 0.2rem 0.2rem 0 rgba(0, 0, 0, 0.45);
}

.section-sep.small {
  height: 2px;
  max-width: 50%;
  background-color: rgb(255, 221, 69);
  box-shadow: 0.2rem 0.2rem 0 rgba(0, 0, 0, 0.45);
}

/* Components */
.iban {
  font-weight: bold;
  display: inline-block;
}

.copy-icon {
  width: clamp(28px, 8vw, 40px);
  height: auto;
  cursor: pointer;
  margin-left: 12px;
  vertical-align: middle;
  image-rendering: pixelated;
  transition:
    transform 0.12s ease,
    filter 0.12s ease;
  filter: drop-shadow(0.2rem 0.2rem 0 rgba(0, 0, 0, 0.45));
}

.copy-icon:hover {
  transform: scale(1.15);
}

.pixel-mini {
  width: clamp(28px, 12vw, 48px);
  image-rendering: pixelated;
}

.pixel-chiesa {
  width: clamp(40px, 18vw, 144px);
  image-rendering: pixelated;
  display: block;
  margin: 0.75rem auto;
}

.pixel-valle {
  width: clamp(80px, 36vw, 288px);
  image-rendering: pixelated;
  display: block;
  margin: 0.75rem auto;
}

.pixel-mid {
  width: clamp(40px, 15vw, 64px);
  image-rendering: pixelated;
}

.pixel-heart {
  width: 24px;
  height: auto;
  image-rendering: pixelated;
  animation: beat 1.2s infinite;
}

@keyframes beat {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

/* Footer */
footer {
  margin-top: 3rem;
  padding: 2rem 1rem 3rem;
  background: transparent;
  text-align: center;
  font-family: "Press Start 2P", monospace;
  color: #1a1440;
  position: relative;
}

.footer-content p {
  margin: 0.5rem 0;
  color: rgb(255, 255, 255);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.8);
}

.footer-small {
  color: #9c4a6d;
  font-size: 0.8rem;
  margin-top: 1rem;
}

.footer-icons {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  gap: clamp(0.75rem, 4vw, 1.5rem);
  flex-wrap: wrap;
}

/* Footer reveal: niente movimento dal basso, solo ingresso laterale degli sposi */
footer.reveal {
  opacity: 1;
  transform: none;
  filter: none;
}

footer.reveal.is-visible {
  opacity: 1;
}

@keyframes footerGroomIn {
  from {
    opacity: 1;
    transform: translateX(-100vw);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes footerBrideIn {
  from {
    opacity: 1;
    transform: translateX(100vw);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

footer .footer-icons .pixel-mini {
  opacity: 0;
  transform: translateX(0);
}

footer.reveal.is-visible .footer-icons .pixel-mini:first-child {
  animation: footerGroomIn 2s ease-out forwards;
}

footer.reveal.is-visible .footer-icons .pixel-mini:last-child {
  animation: footerBrideIn 2s ease-out forwards;
}

/* Responsive */
@media (max-width: 1024px) {
  html {
    font-size: 15px;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  #app {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    box-sizing: border-box;
  }

  #app > header {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    width: calc(100% + 2.5rem);
  }

  section {
    padding: 1.5rem 1.25rem;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  footer {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 11px;
  }

  #app {
    padding-left: 3rem;
    padding-right: 3rem;
  }

  #app > header {
    margin-left: -3rem;
    margin-right: -3rem;
    width: calc(100% + 6rem);
  }

  section {
    padding: 1rem 0.875rem;
    margin-left: 0;
    margin-right: 0;
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

}
