/* Reset & Global */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--primary-color);
  background-color: var(--background-color); /* Fallback color */
  background-image: url('../photos/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Flex Container */
.container {
  display: flex;
  flex-direction: row;
  flex: 1;
  width: 100%;
  min-height: 100vh; /* Ensure container is at least viewport height */
  height: 100%; /* Make it fill available space */
  background: transparent; /* Let the body background show through */
}

/* Panels */
.left,
.right {
  flex: 1;
}

/* Top Floral Image */
.top-floral {
  width: calc(100% + 80px); /* Reduced extension to add side padding */
  max-width: none;
  height: 300px; /* Reduced height for better aspect ratio */
  object-fit: fill; /* Stretch to fill but with controlled dimensions */
  object-position: center center; /* Center the image */
  margin-bottom: 2rem; /* Increased bottom margin for spacing */
  margin-left: -40px; /* Reduced to add left padding */
  margin-top: -40px; /* Reduced to add top padding */
  padding: 20px; /* Add padding around the image */
  box-sizing: border-box; /* Include padding in the element's total width and height */
  display: block;
}

/* Hero Image Panel */
.left {
  position: relative;
  background: url('../photos/SamandTy.webp') center/cover no-repeat;
}

/* Save‑the‑Date Overlay */
.overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: var(--overlay-background);
  color: var(--white);
  padding: var(--spacing-lg);
  font-family: var(--quintessential-font);
  font-size: var(--font-sm);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Right panel structure to ensure footer stays at bottom */
.right {
  background: transparent; /* Completely transparent to show background image */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--spacing-2xl);
  position: relative;
  flex: 1;
  min-height: 100vh; /* Ensure it's at least viewport height */
}

@media (max-width: 800px) {
  .right {
    min-height: auto; /* Override the 100vh on mobile */
    padding: var(--spacing-lg);
    padding-bottom: calc(var(--spacing-2xl) + 30px);
    justify-content: flex-start; /* Align content to top instead of space-between */
  }
}

/* Header */
.header h1 {
  font-size: var(--font-2xl);
  line-height: 1.2;
  font-family: var(--quintessential-font);
}

.header p {
  margin-top: var(--spacing-lg);
  font-size: var(--font-base);
  color: var(--primary-light);
  max-width: 480px;
  line-height: 1.6;
}

/* Content */
.content {
  margin-top: var(--spacing-xl);
  font-size: var(--font-base);
  line-height: 1.6;
  color: var(--primary-light);
}

/* Navigation */
.nav {
  list-style: none;
  margin-top: var(--spacing-xl);
}

.nav li {
  border-bottom: 1px solid var(--neutral-light);
  width: 200px;
}

.nav li a {
  display: block;
  padding: var(--spacing-sm) 0;
  text-decoration: none;
  color: var(--primary-color);
  font-size: var(--font-base);
}

/* Footer */
.footer {
  text-align: right;
  font-size: var(--font-xs);
  color: var(--primary-light);
  width: 100%;
  margin-top: auto;
  position: relative;
  bottom: 0;
  left: 0;
  right: 0;
}

/* Footer Navigation */
.footer-nav {
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  text-align: center;
  border-top: 1px solid var(--neutral-light);
  padding-top: var(--spacing-md);
  width: 100%;
  z-index: 100;
  padding-bottom: var(--spacing-sm);
  background: transparent; /* Transparent background to show background image */
}

@media (max-width: 800px) {
  .footer-nav {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-sm);
    padding-bottom: var(--spacing-sm);
  }
}

.footer-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-md);
}

.footer-nav li a {
  text-decoration: none;
  color: var(--primary-color);
  font-size: var(--font-sm);
  transition: color 0.2s;
  position: relative;
}

.footer-nav li a:hover {
  color: var(--accent-color);
}

.footer-nav li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 1px;
  bottom: -2px;
  left: 0;
  background-color: var(--accent-color);
  transition: width 0.3s;
}

.footer-nav li a:hover::after {
  width: 100%;
}

.rsvp {
    font-size: var(--font-xl);
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: var(--spacing-xs);
    color: var(--primary-color);
    font-family: var(--quintessential-font);
}

a {
    color: var(--primary-color);
}

/* RSVP Form Styles */
.rsvp-form {
  max-width: 500px;
  margin: var(--spacing-xl) 0;
}

.form-group {
  margin-bottom: var(--spacing-md);
}

.form-group label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--neutral-light);
  border-radius: 4px;
  background-color: var(--white);
  font-family: var(--body-font);
  color: #333333;
  font-size: var(--font-sm);
}

/* Form Validation States */
.form-group input.error,
.form-group select.error,
.form-group textarea.error {
  border-color: #f44336;
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.2);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(201, 159, 107, 0.2);
}

/* Enhanced placeholder styling */
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: #888888;
  font-style: italic;
}

/* Better radio button styling */
.radio-group input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-color);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  font-weight: normal;
  cursor: pointer;
}

.radio-group input {
  margin-right: 8px;
}

.submit-btn {
  margin-top: var(--spacing-md);
  padding: 12px 24px;
  background-color: var(--accent-color);
  color: var(--white);
  border: none;
  border-radius: 4px;
  font-family: var(--accent-font);
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.submit-btn:hover {
  background-color: var(--background-color);
}

.submit-btn:disabled {
  background-color: var(--neutral-light);
  cursor: not-allowed;
  opacity: 0.6;
}

.submit-btn.loading {
  position: relative;
}

.submit-btn.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid var(--white);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.response-message {
  margin-top: var(--spacing-md);
  font-weight: 500;
}

/* Apply Quintessential font to headings */
h2, h3 {
  font-family: var(--quintessential-font);
}

/* Q&A Section Styles */
.qa-section {
  margin-bottom: var(--spacing-lg);
  padding: var(--spacing-md);
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-color);
}

.qa-section .question h3 {
  font-family: var(--quintessential-font);
  font-size: var(--font-md);
  color: var(--primary-color);
  margin-bottom: var(--spacing-sm);
  font-weight: 600;
}

.qa-section .answer {
  color: var(--primary-color);
  line-height: 1.6;
}

.qa-section .answer ul {
  margin: 0;
  padding-left: var(--spacing-md);
}

.qa-section .answer li {
  margin-bottom: var(--spacing-xs);
}

.qa-section .answer ul ul {
  margin-top: var(--spacing-xs);
  padding-left: var(--spacing-md);
}

.qa-section .answer p {
  margin: 0;
}

.qa-section .answer strong {
  color: var(--accent-color);
  font-weight: 600;
}

/* Collapsible Q&A Styles */
.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s ease;
}

.collapsible-header:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: var(--spacing-xs);
  margin: calc(-1 * var(--spacing-xs));
}

.collapse-icon {
  font-size: var(--font-lg);
  font-weight: bold;
  color: var(--accent-color);
  transition: transform 0.3s ease;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
}

.collapsible.active .collapse-icon {
  transform: rotate(45deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapsible.active .collapsible-content {
  max-height: 500px; /* Adjust based on content needs */
  margin-top: var(--spacing-sm);
}

/* Responsive: stack panels */
@media (max-width: 800px) {
  body {
    min-height: auto; /* Remove viewport height constraint */
    height: auto; /* Allow body to grow with content */
    background-attachment: scroll; /* Better performance on mobile */
  }
  
  .container {
    flex-direction: column;
    min-height: auto; /* Remove viewport height constraint */
    height: auto; /* Allow container to grow with content */
  }
  
  .left {
    height: 300px;
    min-height: 300px;
    flex-shrink: 0;
  }
    .right {
    flex: none; /* Don't flex, just take natural height */
    min-height: auto; /* Remove minimum height constraint */
  }
  
  /* Content divs should not stretch on mobile */
  .right > div:first-child {
    flex: none; /* Don't stretch */
    justify-content: flex-start; /* Align content to top */
  }
  
  /* Force the background to extend */
  body::after {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background-image: url('../photos/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
  }
  .top-floral {
    width: calc(100% + 40px); /* Adjust for smaller padding on mobile */
    margin-left: -20px;
    margin-top: -20px;
    height: 180px; /* Slightly shorter on mobile */
  }

  /* Mobile footer positioning fix */
  .footer {
    margin-top: var(--spacing-xl); /* Add reasonable spacing instead of auto */
    position: static; /* Remove absolute positioning on mobile */
  }
}

/* Photo Gallery Styles */
.photo-gallery {
  margin: var(--spacing-xl) 0;
}

.gallery-section {
  margin-bottom: var(--spacing-xl);
}

.gallery-section h2 {
  font-size: var(--font-lg);
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
  font-family: var(--quintessential-font);
  border-bottom: 1px solid var(--neutral-light);
  padding-bottom: var(--spacing-xs);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-top: var(--spacing-md);
}

.photo-item {
  overflow: hidden;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}

.photo-item:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.photo-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: filter var(--transition-medium);
}

.photo-item:hover img {
  filter: brightness(1.05);
}

/* Gallery Styles */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--spacing-lg);
  margin: var(--spacing-xl) 0;
}

.gallery-tile {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.gallery-tile:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.15);
}

.gallery-tile-image {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
}

.gallery-tile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.gallery-tile:hover .gallery-tile-image img {
  transform: scale(1.05);
}

.gallery-tile-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.7));
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: var(--spacing-md);
}

.gallery-tile-count {
  background: var(--accent-color);
  color: var(--white);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  font-weight: bold;
}

.gallery-tile-content {
  padding: var(--spacing-md);
}

.gallery-tile-title {
  font-family: var(--quintessential-font);
  font-size: var(--font-lg);
  margin-bottom: var(--spacing-sm);
  color: var(--primary-color);
}

.gallery-tile-description {
  font-size: var(--font-sm);
  color: var(--primary-light);
  line-height: 1.5;
}

/* PhotoSwipe Custom Styles for v4 */
.pswp__caption__center {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    font-size: var(--font-base);
    font-family: var(--body-font);
    color: var(--white);
    text-align: center;
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-lg);
    max-width: 100%;
    line-height: 1.4;
}

/* Override PhotoSwipe button colors to match theme */
.pswp__button,
.pswp__button--arrow--left:before,
.pswp__button--arrow--right:before {
    background-color: var(--accent-color) !important;
}

.pswp__button:hover,
.pswp__button:focus {
    opacity: 0.8 !important;
}

.pswp__bg {
    background: rgba(0, 0, 0, 0.9) !important;
}

.pswp__counter {
    color: var(--white);
    font-family: var(--body-font);
}

/* Responsive photo grid */
@media (max-width: 600px) {
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Fix for longer pages like photos page */
.photo-gallery + .footer {
  margin-top: var(--spacing-xl);
}

/* Ensure images don't cause layout issues */
img {
  max-width: 100%;
}

/* Global fix for all long pages - ensure background extends */
html, body {
  min-height: 100%;
}

@media (min-width: 801px) {
  body {
    background-attachment: fixed; /* Keep background fixed when scrolling */
  }
}

/* Remove this duplicate block since it's now handled above */

.right > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

/* Footer always at bottom */
.footer {
  margin-top: auto;
  position: relative;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
}

/* Quintessential Font Class */
.quintessential-regular {
  font-family: "Quintessential", serif;
  font-weight: 400;
  font-style: normal;
}

.font-quintessential {
  font-family: var(--quintessential-font);
}

/* Dress Code Section Styles */
.dress-code-section {
  margin: 0;
}

.dress-code-section h4 {
  font-family: var(--quintessential-font);
  font-size: var(--font-sm);
  color: var(--accent-color);
  margin: var(--spacing-md) 0 var(--spacing-xs) 0;
  font-weight: 600;
}

.dress-code-section h4:first-child {
  margin-top: 0;
}

.dress-code-section ul {
  margin-bottom: var(--spacing-sm);
}

.dress-code-section ul:last-child {
  margin-bottom: 0;
}

/* Thank You Page Styles */
.thank-you-message {
  max-width: 600px;
  margin: var(--spacing-xl) 0;
  text-align: center;
}

.thank-you-message h2 {
  font-family: var(--accent-font);
  font-size: var(--font-lg);
  color: var(--accent-color);
  margin-bottom: var(--spacing-md);
}

.thank-you-message p {
  margin-bottom: var(--spacing-md);
  line-height: 1.6;
}

.thank-you-message .signature {
  font-style: italic;
  margin-top: var(--spacing-lg);
  color: var(--secondary-text);
}

.back-to-site {
  text-align: center;
  margin-top: var(--spacing-xl);
}

.back-link {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--accent-color);
  color: var(--white);
  text-decoration: none;
  border-radius: 4px;
  font-family: var(--accent-font);
  font-size: var(--font-sm);
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: background-color 0.3s, transform 0.3s;
}

.back-link:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

/* Form Enhancement Styles */
.form-success {
  background-color: rgba(76, 175, 80, 0.1);
  border: 1px solid #4CAF50;
  color: #2E7D32;
  padding: var(--spacing-md);
  border-radius: 4px;
  margin-top: var(--spacing-md);
  text-align: center;
}

.form-error {
  background-color: rgba(244, 67, 54, 0.1);
  border: 1px solid #f44336;
  color: #c62828;
  padding: var(--spacing-md);
  border-radius: 4px;
  margin-top: var(--spacing-md);
  text-align: center;
}

.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Dynamic Form Styling */
.help-text {
  font-size: var(--font-xs);
  color: var(--secondary-text);
  font-style: italic;
  margin-top: 4px;
  display: block;
}

.info-box {
  background-color: rgba(201, 159, 107, 0.1);
  border: 1px solid var(--accent-color);
  border-radius: 4px;
  padding: var(--spacing-md);
  margin-top: 8px;
}

.info-box strong {
  color: var(--accent-color);
  display: block;
  margin-bottom: var(--spacing-xs);
}

.info-box p {
  margin: 0;
  color: var(--primary-color);
  line-height: 1.5;
}

/* Form transitions for smooth show/hide */
.form-group {
  transition: opacity 0.3s ease, height 0.3s ease;
}

/* Phone number input styling */
input[type="tel"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--neutral-light);
  border-radius: 4px;
  background-color: var(--white);
  font-family: var(--body-font);
  color: #333333;
  font-size: var(--font-sm);
}

input[type="tel"]:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(201, 159, 107, 0.2);
}
