@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;1,300&family=Inter:wght@400;500&display=swap');

:root {
  --paper: #ffffff;
  /* the wreath illustration's own canvas */
  --cream: #f4ede2;
  /* warm base for the content below */
  --ink: #1a1715;
  --taupe: #6b5d50;
  --line: #d4c8b8;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* --- Scroll Animations --- */
.fade-up {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
  transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.fade-up.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Mobile Form Safety & Touch Targets */
input[type="text"],
textarea {
  font-size: 16px !important;
}

.submit-btn,
.gallery__nav {
  min-height: 48px;
  min-width: 48px;
}

.radio-group label {
  min-height: 48px;
  display: flex;
  align-items: center;
}

/* --- Visual Chapters Layout --- */
.layout-container {
  width: 100%;
}

.chapter-section {
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 8vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  isolation: isolate;
}

/* ------------------------------- */

/* ---------- Hero / wreath section ---------- */
/* Sits on --paper (white) so there's no visible seam against the
   illustration's own white background. */

.hero {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px max(1.5rem, env(safe-area-inset-left));
  background: linear-gradient(to bottom, var(--cream) 0%, var(--paper) 10%, var(--paper) 90%, var(--cream) 100%);
}

.logo {
  position: relative;
  width: 100%;
  max-width: 37.5em;
  aspect-ratio: 1 / 1;
  background: url('https://s.cdpn.io/7635/averyson-logo.gif') no-repeat center / contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.logo-names {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.28em;
}

.groom,
.bride,
.ampersand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(34px, 6.5vw, 54px);
  color: var(--ink);
  line-height: 1;
  padding-top: 20px;
}

/* Staggered arch, echoing the original L / & / J placement:
   groom sits highest, ampersand dips in the middle, bride sits lowest. */
.groom {
  transform: translateY(-0.14em);
}

.ampersand {
  font-style: italic;
  font-size: clamp(24px, 4.5vw, 44px);
  color: var(--taupe);
  padding: 0 0.02em;
}

.bride {
  transform: translateY(0.22em);
}

date {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--taupe);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 0;
  margin-top: 2px;
}

/* ---------- Countdown / save-the-date section ---------- */

.page {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  padding: 0 max(1.5rem, env(safe-area-inset-left)) 120px;
}

.card {
  padding: 24px 0 56px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--taupe);
  margin-bottom: 32px;
}

.names {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(48px, 8vw, 82px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--ink);
}

.date {
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--ink);
  margin-bottom: 64px;
}

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 40px);
  flex-wrap: nowrap;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.number {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(40px, 7vw, 88px);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--taupe);
}

.divider {
  width: 1px;
  height: clamp(40px, 6vw, 72px);
  background: var(--line);
  flex-shrink: 0;
}

.message {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 300;
  margin-top: 32px;
  color: var(--ink);
}

/* ---------- Venue highlight ---------- */

.venue {
  margin-top: 12px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 36px;
  border: 1px solid var(--line);
  background: rgba(107, 93, 80, 0.05);
}

.venue-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--taupe);
}

.venue-link {
  text-decoration: none;
  color: var(--ink);
}

.venue-name {
  display: block;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(22px, 3.2vw, 30px);
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: border-color 0.3s ease;
}

.venue-link:hover .venue-name {
  border-bottom-color: var(--ink);
}

.venue-address {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--taupe);
  margin-top: 6px;
}

/* ---------- RSVP Section ---------- */

.rsvp-container {
  margin-top: 80px;
  display: flex;
  justify-content: center;
  padding: 0 16px;
}

.rsvp-card {
  width: 100%;
  max-width: 480px;
  /* Blend the cream background over the floral image for an elegant overlay */
  background: linear-gradient(rgba(244, 237, 226, 0.92), rgba(244, 237, 226, 0.92)), url('assets/images/floral_background.jpg') center/cover no-repeat;
  border: 1px solid var(--line);
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(107, 93, 80, 0.05);
}

.rsvp-greeting {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(32px, 5vw, 42px);
  color: var(--ink);
  margin-bottom: 12px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.1;
}

.rsvp-message {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  letter-spacing: 0.03em;
  color: var(--taupe);
  margin-bottom: 32px;
  line-height: 1.6;
}

.rsvp-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  text-align: left;
}

.input-container {
  position: relative;
  width: 100%;
  margin-top: 8px;
}

.input-container input[type="text"],
.input-container textarea {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  background-color: transparent;
  outline: none;
  color: var(--ink);
}

.input-container textarea {
  resize: vertical;
}

.input-container .label {
  position: absolute;
  top: 8px;
  left: 0;
  color: var(--taupe);
  transition: all 0.3s ease;
  pointer-events: none;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

.input-container input[type="text"]:focus~.label,
.input-container input[type="text"]:not(:placeholder-shown)~.label,
.input-container textarea:focus~.label,
.input-container textarea:not(:placeholder-shown)~.label {
  top: -20px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--taupe);
}

.input-container .underline {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1px;
  width: 100%;
  background-color: var(--ink);
  transform: scaleX(0);
  transition: all 0.3s ease;
  transform-origin: center;
}

.input-container input[type="text"]:focus~.underline,
.input-container input[type="text"]:not(:placeholder-shown)~.underline,
.input-container textarea:focus~.underline,
.input-container textarea:not(:placeholder-shown)~.underline {
  transform: scaleX(1);
}

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

.radio-group-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--taupe);
  margin-left: 2px;
}

.radio-group {
  display: flex;
  gap: 32px;
  margin-top: 4px;
}

.radio-group label {
  text-transform: none;
  letter-spacing: normal;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--ink);
  margin-left: 0;
}

/* Customizing the radio input for a cleaner look */
.radio-group input[type="radio"] {
  accent-color: var(--taupe);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.submit-btn {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 0;
  font-family: 'Inter', sans-serif;
  overflow: hidden;
  cursor: pointer;
  border: none;
  margin-top: 16px;
  width: 100%;
  background-color: rgba(245, 221, 182, 0.5);
}

.submit-btn::after {
  content: "";
  width: 0%;
  height: 100%;
  background: var(--taupe);
  position: absolute;
  transition: all 0.4s ease-in-out;
  right: 0;
}

.submit-btn:hover::after {
  right: auto;
  left: 0;
  width: 100%;
}

.submit-btn span {
  text-align: center;
  text-decoration: none;
  width: 100%;
  padding: 16px 25px;
  color: var(--ink);
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  z-index: 20;
  transition: all 0.3s ease-in-out;
}

.submit-btn:hover span {
  color: var(--paper);
  animation: scaleUp 0.3s ease-in-out;
}

@keyframes scaleUp {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.95);
  }

  100% {
    transform: scale(1);
  }
}

.hidden {
  display: none !important;
}

.rsvp-success {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(28px, 4vw, 36px);
  color: var(--ink);
  padding: 64px 0;
  text-align: center;
}

/* ---------- Gallery Section ---------- */

.gallery {
  --tile-gap: 24px;
  --carousel-height: 400px;

  width: 100%;
  background: transparent;
  padding: 0;
}

.gallery__intro {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 40px;
  padding: 0 max(1.5rem, env(safe-area-inset-left));
}

.gallery__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(30px, 4.5vw, 48px);
  color: var(--ink);
  letter-spacing: -0.01em;
}

.gallery__carousel-wrapper {
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.gallery__nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  border: none;
  transition: opacity 0.3s ease, background 0.3s ease;
}

.gallery__nav svg {
  width: 36px;
  height: 36px;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  filter: drop-shadow(0 0 6px rgba(244, 237, 226, 0.8));
}

.gallery__nav:hover {
  opacity: 1;
  background: rgba(244, 237, 226, 0.85);
  /* Smooth cream overlay on the edge */
}

.gallery__nav:hover svg {
  transform: scale(1.1);
}

.gallery__nav--prev {
  left: 0;
}

.gallery__nav--next {
  right: 0;
}

.gallery__row {
  overflow-x: auto;
  overflow-y: hidden;
  width: 100%;
  padding: 0 max(1.5rem, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar */
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.gallery__row::-webkit-scrollbar {
  display: none;
}

.gallery__row.is-dragging {
  cursor: grabbing;
  scroll-behavior: auto !important;
}

.gallery__row:not(.is-dragging) {
  cursor: grab;
  scroll-behavior: smooth;
}

.gallery__track {
  display: inline-flex;
  height: var(--carousel-height);
  align-items: center;
  margin: 0 auto;
  padding: 12px 0;
}

.gallery__tile {
  position: relative;
  height: 100%;
  flex: 0 0 auto;
  margin-right: var(--tile-gap);
  user-select: none;
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), z-index 0s 0.4s;
  will-change: transform;
}

.gallery__tile:last-child {
  margin-right: 0;
}

.gallery__tile:hover {
  transform: scale(1.08);
  /* Netflix-style smooth zoom-in */
  z-index: 2;
  transition-delay: 0.1s;
  /* Slight delay to avoid triggering during fast swipes */
  transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), z-index 0s 0s;
}

.gallery__media {
  height: 100%;
  width: auto;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(26, 23, 21, 0.08);
}

.gallery__img {
  height: 100%;
  width: auto;
  display: block;
  pointer-events: none;
  /* Prevents image dragging ghost */
}

@media (max-width: 768px) {
  .gallery {
    --carousel-height: 280px;
  }

  .gallery__nav {
    display: none;
  }

  .names {
    font-size: clamp(36px, 7vw, 64px);
  }

  .message {
    font-size: clamp(26px, 4.5vw, 44px);
  }

  .number {
    font-size: clamp(36px, 6vw, 72px);
  }

  .rsvp-greeting {
    font-size: clamp(28px, 4.5vw, 38px);
  }

  .rsvp-card {
    padding: 40px 28px;
  }
}

@media (max-width: 540px) {
  .countdown {
    gap: 12px;
  }

  .divider {
    display: none;
  }

  /* --- Mobile Gallery: vertical 2-column staggered grid --- */

  /* Release the 100svh constraint so the gallery flows naturally */
  .chapter-section:has(.gallery) {
    min-height: auto;
    padding-block: 6vh 4vh;
  }

  .gallery {
    padding: 0;
    --carousel-height: auto;
  }

  .gallery__intro {
    margin-bottom: 24px;
  }

  /* Disable horizontal scroll, let content flow vertically */
  .gallery__row {
    overflow-x: visible;
    overflow-y: visible;
    cursor: auto !important;
    padding: 0 max(1rem, env(safe-area-inset-left));
  }

  .gallery__row.is-dragging {
    cursor: auto !important;
  }

  /* Convert track from horizontal flex to 2-column grid */
  .gallery__track {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    height: auto;
    padding: 0;
  }

  /* Stagger effect: push every other tile down slightly */
  .gallery__tile:nth-child(even) {
    margin-top: 24px;
  }

  .gallery__tile {
    height: auto;
    margin-right: 0;
    border-radius: 6px;
    overflow: hidden;
  }

  .gallery__tile:hover {
    transform: none;
  }

  .gallery__media {
    height: auto;
    width: 100%;
    border-radius: 6px;
  }

  .gallery__img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 6px;
  }

  /* --- End mobile gallery --- */

  /* Fluid typography for narrow screens */
  .names {
    font-size: clamp(32px, 6.5vw, 48px);
  }

  .message {
    font-size: clamp(22px, 4vw, 36px);
  }

  .number {
    font-size: clamp(32px, 5.5vw, 56px);
  }

  .rsvp-greeting {
    font-size: clamp(24px, 4vw, 32px);
  }

  /* Form breathing room */
  .rsvp-card {
    padding: 32px 20px;
  }

  .rsvp-container {
    margin-top: 48px;
    padding: 0 8px;
  }

  /* Stack radio buttons vertically for thumb-friendly tapping */
  .radio-group {
    flex-direction: column;
    gap: 16px;
  }

  /* Increased vertical padding on text inputs for touch comfort */
  .input-container input[type="text"],
  .input-container textarea {
    padding: 10px 0;
  }

  .card {
    padding: 16px 0 40px;
  }

  .eyebrow {
    margin-bottom: 20px;
  }
}