/* ==========================================================================
   Base Styles & Variables
   ========================================================================== */
@font-face {
  font-family: 'New Spirit Condensed';
  src: url('assets/new-spirit-condensed.otf') format('opentype');
  font-display: block;
  font-weight: normal;
  font-style: normal;
}

/* ==========================================================================
   Reset & Base Elements
   ========================================================================== */
body {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #ee0908;
  color: #2a2a2a;
  margin: 0;
  padding: 0;
}

a {
  color: #d40807;
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: #b30706;
}

p {
  line-height: 1.8;
  color: #3a3a3a;
  margin: 0.5rem 0;
  font-size: 1.1rem;
}

ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

li {
  margin: 1.5rem 0 0;
  line-height: 1.6;
}

/* ==========================================================================
   Loading States
   ========================================================================== */
body.loading {
  opacity: 1;
}

body.loading .content {
  opacity: 0;
  transform: translateY(20px);
}

.content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.loading-heart {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  color: white;
  opacity: 0.8;
  z-index: 1;
}

.loading-heart.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-out;
}

/* ==========================================================================
   Header & Hero Section
   ========================================================================== */
header .hero {
  text-align: center;
  padding: 2rem 1rem;
  gap: 3rem;
  background: #ee0908;
  font-family: 'New Spirit Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  color: white;
  height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

header .hero .hero-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 15vh;
}

header .hero .hero-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

header .hero h1 {
  font-size: 11.089rem;
  margin: 0;
  line-height: .95;
  letter-spacing: -0.01em;
  max-width: 6em;
}

header .hero p {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  margin: 1rem 0;
  line-height: 1.6;
}

header .hero img.monogram {
  width: 9rem;
  margin-top: 2rem;
  filter: brightness(0) invert(1);
}

.hero-date {
  font-family: 'Great Vibes', cursive !important;
  font-size: 1.8rem !important;
  color: #fdf7f7;
  font-weight: 400;
  margin: 0;
  text-align: center;
  letter-spacing: 0.02em;
}

header .hero nav {
  display: flex;
  gap: 2rem;
  justify-content: center;
  width: 100%;
}

header .hero nav a {
  color: white;
  text-decoration: none;
  font-weight: regular;
  font-size: 1rem;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
}

/* ==========================================================================
   Main Content & Sections
   ========================================================================== */
main {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

section {
  margin: 0;
  padding: 2.5rem;
  background: #ffffff;
  border-radius: 12px;
  transition: transform 0.3s ease;
}

/* Section Headers */
h2 {
  font-size: 2.5rem;
  margin: 0 0 1.5rem 0;
  color: #ee0908;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-family: 'New Spirit Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

h3 {
  font-size: 1.4rem;
  margin: 1.5rem 0 0.5rem;
  color: #2a2a2a;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.heart {
  color: #ee0908;
  font-size: 1.6rem;
  display: inline-block;
  transform: rotate(-8deg);
  opacity: 0.9;
  position: relative;
  top: -2px;
}

/* ==========================================================================
   Specific Sections
   ========================================================================== */
#plan {
  margin-top: 1rem;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0rem 2rem;
  padding: 2.5rem;
  background: #ffffff;
}

#plan h2 {
  grid-column: 1 / -1;
  font-size: 2.5rem;
  margin: 0 0 1.5rem 0;
}

#friday, #saturday {
  padding: 0;
  background: none;
  box-shadow: none;
  border: none;
  backdrop-filter: none;
}

#plan h3 {
  font-size: 1.4rem;
  margin: 0 0 1rem 0;
  color: #ee0908;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

#plan p {
  margin: 0.3rem 0;
}

#hotels, #registry, #rsvp {
  grid-column: 1 / -1;
}

.date-location {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 1.2rem;
  line-height: 1.8;
  margin: 2rem auto 4rem;
  color: #3a3a3a;
  font-style: italic;
  max-width: 600px;
  padding: 0 1rem;
}

.section-divider {
  display: none;
}

/* ==========================================================================
   Forms & Inputs
   ========================================================================== */
form label {
  display: block;
  margin-bottom: 1.2rem;
  color: #444;
}

input, select {
  width: 100%;
  font-size: 1rem;
  padding: 0.8rem;
  margin-top: 0.4rem;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.8);
  transition: all 0.2s ease;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

input:focus, select:focus {
  outline: none;
  border-color: #ee0908;
  box-shadow: 0 0 0 4px rgba(238, 9, 8, 0.1);
}

button {
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: bold;
  background: #ee0908;
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(211, 8, 7, 0.2);
}

button:hover {
  background: #b30706;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(211, 8, 7, 0.2);
}

button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(238, 9, 8, 0.2);
}

/* ==========================================================================
   RSVP Form
   ========================================================================== */
#rsvpForm {
  width: 100%;
  margin: 0 auto;
  padding-top: 0rem;
}

#rsvpForm label {
  display: block;
  margin-bottom: 1.2rem;
  color: #444;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

#rsvpForm input,
#rsvpForm select {
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem;
  padding: 0.8rem;
  margin-top: 0.4rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.9);
  transition: all 0.2s ease;
}

#rsvpForm select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 1em;
  padding-right: 2.5rem;
  color: #2a2a2a;
}

#rsvpForm select option {
  color: #2a2a2a;
}

#rsvpForm select option:first-child {
  color: #757575;
}

#rsvpForm select option:not(:first-child) {
  color: #2a2a2a;
}

#rsvpForm button {
  width: 100%;
  margin-top: 1rem;
}

/* ==========================================================================
   Password Protection
   ========================================================================== */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.password-container {
  background-color: white;
  padding: 2rem;
  border-radius: 8px;
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.password-container h2 {
  display: block;
  margin-bottom: 0rem;
  font-family: 'New Spirit Condensed';
}

.password-container input {
  width: -webkit-fill-available;
  margin: 1rem 0;
  border-radius: 4px;
}

.password-container button {
  width: 100%;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(211, 8, 7, 0.2);
}

.password-container button:hover {
  background: #b30706;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(211, 8, 7, 0.2);
}

.password-container button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(238, 9, 8, 0.2);
}

.error-message {
  color: #ff0000;
  margin-top: 1rem;
  display: none;
}

/* ==========================================================================
   Thank You Section
   ========================================================================== */
.thank-you {
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.8;
  margin: 4rem auto;
  color: white !important;
  font-style: italic;
  max-width: 600px;
  padding: 0 1rem;
}

.thank-you p {
  color: white !important;
}

.thank-you a {
  color: white !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.thank-you a:hover {
  color: #fdf7f7 !important;
}

/* ==========================================================================
   Address Styles
   ========================================================================== */
.address {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding-top: .8rem;
  color: #696969;
  text-decoration-skip-ink: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.address::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ee0908'%3E%3Cpath d='M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ==========================================================================
   Polaroid Animation
   ========================================================================== */
.jerica {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.hover-images {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2rem;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  justify-content: center;
  width: 100%;
}

.hover-images.animation-started {
  opacity: 1;
}

.hover-images.exit {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease-out;
}

.hover-images.exit img {
  animation: none !important;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s ease-out;
  pointer-events: none;
  will-change: opacity, transform;
}

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

.hover-images img {
  width: 220px;
  height: 270px;
  object-fit: cover;
  background: white;
  padding: 15px;
  padding-bottom: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  filter: sepia(0.2);
  transform: translateY(-120vh);
  opacity: 0;
}

.animation-started img:nth-child(1) { animation: fallDown1 4.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 0.2s; }
.animation-started img:nth-child(2) { animation: fallDown2 5.2s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 0.8s; }
.animation-started img:nth-child(3) { animation: fallDown3 4.8s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 1.4s; }
.animation-started img:nth-child(4) { animation: fallDown4 5s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 2s; }
.animation-started img:nth-child(5) { animation: fallDown5 4.7s cubic-bezier(0.4, 0, 0.2, 1) forwards; animation-delay: 2.6s; }

@keyframes fallDown1 {
  0% { transform: translateY(-120vh) translateX(-20px) rotate(-5deg) scale(0.9); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translateY(0vh) translateX(40px) rotate(15deg) scale(1.1); opacity: 1; }
  60% { transform: translateY(0vh) translateX(40px) rotate(15deg) scale(1.1); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(120vh) translateX(60px) rotate(35deg) scale(0.95); opacity: 0; }
}

@keyframes fallDown2 {
  0% { transform: translateY(-120vh) translateX(30px) rotate(8deg) scale(1.1); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translateY(0vh) translateX(-50px) rotate(-25deg) scale(0.9); opacity: 1; }
  60% { transform: translateY(0vh) translateX(-50px) rotate(-25deg) scale(0.9); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(120vh) translateX(-80px) rotate(-50deg) scale(1.05); opacity: 0; }
}

@keyframes fallDown3 {
  0% { transform: translateY(-120vh) translateX(-40px) rotate(-12deg) scale(0.95); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translateY(0vh) translateX(30px) rotate(20deg) scale(1.15); opacity: 1; }
  60% { transform: translateY(0vh) translateX(30px) rotate(20deg) scale(1.15); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(120vh) translateX(40px) rotate(25deg) scale(0.9); opacity: 0; }
}

@keyframes fallDown4 {
  0% { transform: translateY(-120vh) translateX(20px) rotate(10deg) scale(1.05); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translateY(0vh) translateX(-30px) rotate(-15deg) scale(0.95); opacity: 1; }
  60% { transform: translateY(0vh) translateX(-30px) rotate(-15deg) scale(0.95); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(120vh) translateX(-60px) rotate(-30deg) scale(1.1); opacity: 0; }
}

@keyframes fallDown5 {
  0% { transform: translateY(-120vh) translateX(-30px) rotate(-8deg) scale(0.9); opacity: 0; }
  10% { opacity: 1; }
  40% { transform: translateY(0vh) translateX(50px) rotate(18deg) scale(1.1); opacity: 1; }
  60% { transform: translateY(0vh) translateX(50px) rotate(18deg) scale(1.1); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(120vh) translateX(70px) rotate(40deg) scale(0.95); opacity: 0; }
}

/* ==========================================================================
   Media Queries
   ========================================================================== */

@media (max-width: 1024px) {
  header .hero h1 {
    font-size: 9rem;
  }

  header .hero img.monogram {
    width: 9rem;
  }
}

@media (max-width: 768px) {
  main {
    grid-template-columns: 1fr;
    margin: 0rem;
    gap: 1rem;
  }
  
  #plan {
    margin-top: 0rem;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
  }

  #plan h2 {
    margin: 0rem;
  }
  
  section {
    padding: 2rem;
  }
  
  h2 {
    font-size: 2rem;
  }

  header .hero h1 {
    font-size: 6rem;
  }

  header .hero img.monogram {
    width: 6rem;
  }

  header .hero {
    min-height: 40rem;
    height: auto;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  header .hero .hero-content {
    margin-top: 6rem;
  }

  header .hero img.monogram {
    width: 6rem;
  }

  section {
    border-radius: 16px;
  }

  .hero-date {
    font-size: 1.6rem !important;
  }

  header .hero nav {
    gap: 1rem;
  }

  .password-container {
    width: 75%;
  }

  #rsvpForm {
    padding-top: 1rem;
  }

  .hover-images {
    position: fixed;
    left: 50vw;
    top: 50vh;
    transform: translate(-50%, -50%);
    width: 220px;
    height: 270px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
  }
  
  .hover-images img {
    width: 220px;
    height: 270px;
    object-fit: cover;
    background: white;
    padding: 15px 15px 40px 15px;
    transform: scale(0);
    opacity: 0;
    position: absolute;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    filter: sepia(0.2);
  }
  
  .animation-started {
    opacity: 1;
  }
  
  .animation-started img:nth-child(1) {
    animation: mobileStack1 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    animation-delay: .2s;
  }
  .animation-started img:nth-child(2) {
    animation: mobileStack2 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    animation-delay: 1s;
  }
  .animation-started img:nth-child(3) {
    animation: mobileStack3 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    animation-delay: 1.8s;
  }
  .animation-started img:nth-child(4) {
    animation: mobileStack4 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    animation-delay: 2.6s;
  }
  .animation-started img:nth-child(5) {
    animation: mobileStack5 1s cubic-bezier(0.65, 0, 0.35, 1) forwards;
    animation-delay: 3.4s;
  }
  
  @keyframes mobileStack1 {
    0% { transform: scale(0) rotate(-5deg); opacity: 0; }
    30% { transform: scale(1) rotate(-3deg); opacity: 1; }
    70% { transform: scale(1) rotate(-3deg); opacity: 1; }
    100% { transform: scale(0.4) rotate(-3deg); opacity: 0; }
  }
  @keyframes mobileStack2 {
    0% { transform: scale(0.4) rotate(8deg); opacity: 0; }
    30% { transform: scale(1) rotate(5deg); opacity: 1; }
    70% { transform: scale(1) rotate(5deg); opacity: 1; }
    100% { transform: scale(0.4) rotate(5deg); opacity: 0; }
  }
  @keyframes mobileStack3 {
    0% { transform: scale(0.4) rotate(-12deg); opacity: 0; }
    30% { transform: scale(1) rotate(-8deg); opacity: 1; }
    70% { transform: scale(1) rotate(-8deg); opacity: 1; }
    100% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
  }
  @keyframes mobileStack4 {
    0% { transform: scale(0.4) rotate(10deg); opacity: 0; }
    30% { transform: scale(1) rotate(7deg); opacity: 1; }
    70% { transform: scale(1) rotate(7deg); opacity: 1; }
    100% { transform: scale(0.4) rotate(7deg); opacity: 0; }
  }
  @keyframes mobileStack5 {
    0% { transform: scale(0.4) rotate(-8deg); opacity: 0; }
    30% { transform: scale(1) rotate(-5deg); opacity: 1; }
    70% { transform: scale(1) rotate(-5deg); opacity: 1; }
    100% { transform: scale(0) rotate(-5deg); opacity: 0; }
  }

  .hover-images.exit {
    pointer-events: none;
  }

  .hover-images.exit img {
    animation: none !important;
  }
}

/* iPad and large iOS devices */
@media only screen 
  and (min-device-width: 768px) 
  and (max-device-width: 1024px) 
  and (-webkit-min-device-pixel-ratio: 2) {
  header .hero h1 {
    font-size: 10rem;
  }

  header .hero {
    height: 75vh;
  }

  header .hero .hero-content {
    margin-top: 20vh;
  }

  main {
    margin-top: 0rem;
    padding: 0 2rem;
  }

  section {
    padding: 2.5rem;
  }
}

/* iOS-specific optimizations */
@supports (-webkit-touch-callout: none) {
  /* Prevent elastic scrolling on iOS */
  body {
    -webkit-overflow-scrolling: touch;
  }

  /* Improve tap target sizes */
  header .hero nav a,
  button,
  input,
  select {
    min-height: 44px;
  }

  /* Prevent zoom on input focus */
  input[type="text"],
  input[type="password"],
  select {
    font-size: 16px;
  }

  /* Improve scrolling performance */
  .content {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }
}