/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Serif headings */
h1, h2, h3 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  letter-spacing: 0.01em;
}

/* === Invitation envelope animation === */

.env-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  /* warm glow behind the envelope, fading to darker linen at the edges */
  background: radial-gradient(ellipse 80% 60% at 50% 44%, #f7f2e9 0%, #ece6db 52%, #ddd5c6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.env-overlay.env-fading {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.env-scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.env-envelope {
  position: relative;
  width: min(85vw, 420px);
  aspect-ratio: 8 / 5;
  perspective: 1200px;
  animation: env-float 4.5s ease-in-out infinite;
}

/* gentle idle float to invite interaction */
@keyframes env-float {
  0%, 100% { transform: translateY(0) rotate(-0.4deg); }
  50%      { transform: translateY(-9px) rotate(0.4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .env-envelope { animation: none; }
}

/* inside/back of the envelope — also carries the "resting on a surface" shadow */
.env-liner {
  position: absolute;
  inset: 0;
  background: #24311a;
  border-radius: 6px;
  box-shadow:
    0 26px 50px -14px rgba(30, 25, 15, 0.45),
    0 8px 18px rgba(30, 25, 15, 0.18);
}

/* the card tucked inside */
.env-card {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 7%;
  bottom: 12%;
  background: #fdf9f4; /* cream */
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.5rem;
  color: #172c4f;
  transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
  z-index: 2;
}

.env-card.env-card-out {
  transform: translateY(-78%);
}

/* front pocket — V-shaped opening at the top */
.env-front {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #3c5230 0%, #314323 100%);
  border-radius: 6px;
  clip-path: polygon(0 0, 50% 45%, 100% 0, 100% 100%, 0 100%);
  z-index: 3;
  box-shadow: inset 0 -2px 8px rgba(0, 0, 0, 0.15);
}

/* flap — closed triangle pointing down; opens by rotating up and back */
.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 56%;
  background: linear-gradient(180deg, #3a4e2b 0%, #314323 55%, #283619 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 6px 6px 0 0;
  transform-origin: top center;
  transition: transform 0.6s cubic-bezier(0.45, 0, 0.55, 1);
  /* the flap's point casts a soft shadow onto the pocket below */
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.28));
  z-index: 4;
}

.env-flap.env-flap-open {
  transform: rotateX(180deg);
}

.env-flap.env-flap-behind {
  z-index: 1;
}

/* wax seal — cream with evergreen monogram, sits at the flap tip */
.env-seal {
  position: absolute;
  left: 50%;
  top: 56%;
  transform: translate(-50%, -50%);
  width: 76px;
  height: 76px;
  border-radius: 9999px;
  /* domed cream wax: bright highlight top-left, shading to the edges */
  background: radial-gradient(circle at 38% 32%, #ffffff 0%, #f4ead9 42%, #e6dac3 100%);
  box-shadow:
    0 7px 16px rgba(0, 0, 0, 0.38),                 /* drop shadow */
    inset 0 2px 3px rgba(255, 255, 255, 0.75),      /* domed top highlight */
    inset 0 -4px 6px rgba(120, 100, 68, 0.35),      /* domed bottom shade */
    inset 0 0 0 5px rgba(49, 67, 35, 0.13);         /* pressed rim */
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.4rem;
  color: #314323;
  /* monogram pressed into the wax */
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5), 0 -1px 1px rgba(40, 30, 15, 0.2);
  z-index: 5;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.env-seal:hover {
  transform: translate(-50%, -50%) scale(1.05);
}

.env-seal.env-seal-broken {
  transform: translate(-50%, -50%) scale(1.2) rotate(10deg);
  opacity: 0;
  pointer-events: none;
}

.env-hint {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #8c8c73;
  transition: opacity 0.3s ease;
}

.env-skip {
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #a3a38f;
  background: none;
  border: none;
  cursor: pointer;
}

.env-skip:hover {
  color: #545445;
}

/* Pawprint trail around the invitation text — one lights at a time, looping */
.paw-trail {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.paw-trail span {
  position: absolute;
  font-size: 1.35rem;
  line-height: 1;
  opacity: 0;
  transform-origin: center;
  animation: paw-walk 24s ease-in-out infinite;
}

@keyframes paw-walk {
  0%, 100% { opacity: 0; }
  5%       { opacity: 0.32; }
  16%      { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .paw-trail span { animation: none; opacity: 0.16; }
}

/* Peeking cat — pops up from the bottom edge to peek, then ducks back down */
.cat-peek {
  position: absolute;
  bottom: 0;
  right: 7%;
  font-size: 2rem;
  line-height: 1;
  transform: translateY(62%);
  transform-origin: bottom center;
  animation: cat-peek 9s ease-in-out infinite;
  z-index: 3;
}

@keyframes cat-peek {
  0%, 64%, 100% { transform: translateY(62%); }              /* hidden — only ears show */
  72%           { transform: translateY(2%) rotate(-4deg); } /* pops up to peek */
  84%           { transform: translateY(2%) rotate(4deg); }  /* looks the other way */
  92%           { transform: translateY(62%); }              /* ducks back down */
}

@media (prefers-reduced-motion: reduce) {
  .cat-peek { animation: none; transform: translateY(48%); }
}

/* invitation reveal */
.env-inv-hidden {
  display: none;
}

@keyframes env-inv-reveal {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.env-inv-reveal {
  animation: env-inv-reveal 0.5s ease both;
}

/* Grain texture overlay — covers full viewport, non-interactive */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}
