:root {
  --ivory: #FBF3EE;
  --plum: #3A1F2C;
  --rose: #C98A93;
  --gold: #B08D57;
  --rose-soft: #F1DCD8;
  --line: rgba(58, 31, 44, 0.14);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ivory);
  color: var(--plum);
  font-family: 'Jost', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

@media (prefers-reduced-motion: no-preference) {
  .grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.035;
    z-index: 999;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 5rem 1.5rem 3rem;
  max-width: 640px;
  margin: 0 auto;
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1.1rem;
  font-weight: 500;
}

.names {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4.4rem);
  margin: 0;
  letter-spacing: 0.01em;
}

.rule {
  margin: 1.4rem auto;
  width: 100%;
  max-width: 220px;
  border-top: 1px solid var(--line);
  position: relative;
}
.rule span {
  position: absolute;
  top: -0.75rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ivory);
  padding: 0 0.8rem;
  color: var(--gold);
  font-size: 0.9rem;
}

.date {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  color: var(--rose);
  margin: 0 0 1.3rem;
}

.intro {
  font-size: 0.98rem;
  color: rgba(58, 31, 44, 0.75);
  max-width: 460px;
  margin: 0 auto;
}

.hashtag {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.02em;
}

/* ---------- Upload card ---------- */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.upload-card {
  background: #fff;
  border-radius: 6px;
  padding: 2rem;
  box-shadow: 0 20px 60px -25px rgba(58, 31, 44, 0.35);
  border: 1px solid var(--line);
}

/* ---------- Split layout: photo | voice ---------- */
.split {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.6rem;
  align-items: start;
}

.panel-title {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 1.35rem;
  margin: 0 0 1.1rem;
  text-align: center;
}

.divider {
  display: flex;
  justify-content: center;
  align-self: stretch;
  position: relative;
}
.divider span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  color: var(--gold);
  font-size: 1rem;
  padding: 0.4rem 0;
}
.divider::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 1px solid var(--line);
}

@media (max-width: 640px) {
  .split {
    grid-template-columns: 1fr;
  }
  .divider {
    height: 1px;
    margin: 0.6rem 0 1.4rem;
  }
  .divider::before {
    left: 0;
    right: 0;
    top: 50%;
    bottom: auto;
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .divider span { background: #fff; }
}

/* ---------- Voice panel ---------- */
.voice-sub {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(58, 31, 44, 0.6);
  margin: 0 0 1.4rem;
}

.voice-recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0 0.2rem;
}

.mic-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--rose);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 24px -10px rgba(201, 138, 147, 0.7);
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.mic-btn.recording {
  background: #a8433a;
  animation: pulse 1.4s ease-in-out infinite;
}
.mic-icon { line-height: 1; }
.mic-btn.recording .mic-icon { font-size: 1.2rem; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168, 67, 58, 0.45); }
  50% { box-shadow: 0 0 0 14px rgba(168, 67, 58, 0); }
}

.voice-timer {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: rgba(58, 31, 44, 0.6);
  min-height: 1.2em;
}

#voice-playback {
  width: 100%;
  margin-top: 0.8rem;
  max-width: 260px;
}

.voice-actions {
  display: flex;
  gap: 0.7rem;
  margin-top: 1rem;
  width: 100%;
  max-width: 260px;
}
.voice-btn {
  flex: 1;
  padding: 0.65rem;
  border-radius: 4px;
  font-family: 'Jost', sans-serif;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: background 0.2s ease, opacity 0.2s ease;
}
.voice-btn.ghost { background: transparent; color: var(--plum); }
.voice-btn.ghost:hover { background: rgba(58, 31, 44, 0.05); }
.voice-btn.primary { background: var(--plum); color: var(--ivory); border-color: var(--plum); }
.voice-btn.primary:hover { background: #2a1620; }
.voice-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(58, 31, 44, 0.6);
  margin-bottom: 0.5rem;
}
.field-label span { text-transform: none; letter-spacing: 0; font-size: 0.75rem; }

#from {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-family: 'Jost', sans-serif;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--ivory);
  color: var(--plum);
  margin-bottom: 1.3rem;
}
#from:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.dropzone {
  border: 1.5px dashed rgba(176, 141, 87, 0.5);
  border-radius: 8px;
  padding: 2.4rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background 0.25s ease, transform 0.15s ease;
  background: linear-gradient(180deg, rgba(241, 220, 216, 0.25), transparent);
}
.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--gold);
  background: rgba(241, 220, 216, 0.45);
}
.dropzone:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.seal {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.8rem;
  border-radius: 50%;
  background: var(--gold);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: transform 0.25s ease;
}
.dropzone:hover .seal { transform: scale(1.08) rotate(8deg); }

.dz-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
}
.dz-sub {
  font-size: 0.85rem;
  color: rgba(58, 31, 44, 0.55);
  margin: 0;
}

#preview-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}
#preview-strip img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
}

.submit-btn {
  width: 100%;
  margin-top: 1.4rem;
  padding: 0.9rem;
  background: var(--plum);
  color: var(--ivory);
  border: none;
  border-radius: 4px;
  font-family: 'Jost', sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}
.submit-btn:hover { background: #2a1620; }
.submit-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.form-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  text-align: center;
  margin: 0.8rem 0 0;
  color: var(--gold);
}
.form-status.error { color: #a8433a; }

.progress-bar {
  position: relative;
  width: 100%;
  height: 22px;
  margin-top: 0.9rem;
  background: var(--rose-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  transition: width 0.15s ease;
  border-radius: 999px;
}
.progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--plum);
  letter-spacing: 0.02em;
}

/* ---------- Wall ---------- */
.wall-section { margin-top: 3.5rem; }

.wall-heading {
  text-align: center;
  margin-bottom: 1.8rem;
}
.wall-heading h2 {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 600;
  font-size: 2rem;
  margin: 0 0 0.3rem;
}
.wall-count {
  font-size: 0.85rem;
  color: rgba(58, 31, 44, 0.55);
  margin: 0;
}

.wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.4rem;
}

.wall-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: rgba(58, 31, 44, 0.55);
  padding: 2rem 0;
}

/* photo-corner "mount" look, evoking a physical scrapbook */
.photo-mount {
  position: relative;
  margin: 0;
  background: #fff;
  padding: 0.5rem 0.5rem 1.6rem;
  box-shadow: 0 12px 28px -16px rgba(58, 31, 44, 0.4);
  transform: rotate(var(--tilt, 0deg));
  animation: settle 0.5s ease both;
}
.photo-mount:nth-child(4n+1) { --tilt: -2.2deg; }
.photo-mount:nth-child(4n+2) { --tilt: 1.6deg; }
.photo-mount:nth-child(4n+3) { --tilt: -1deg; }
.photo-mount:nth-child(4n+4) { --tilt: 2deg; }

.photo-mount img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.photo-mount::before,
.photo-mount::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background:
    linear-gradient(135deg, transparent 50%, var(--rose-soft) 50%);
  opacity: 0.9;
}
.photo-mount::before { top: -2px; left: -2px; }
.photo-mount::after { bottom: 14px; right: -2px; transform: rotate(180deg); }

.photo-mount figcaption {
  position: absolute;
  bottom: 0.35rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(58, 31, 44, 0.65);
}

@keyframes settle {
  from { opacity: 0; transform: translateY(14px) rotate(var(--tilt, 0deg)) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) rotate(var(--tilt, 0deg)) scale(1); }
}

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

footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: rgba(58, 31, 44, 0.6);
}

@media (max-width: 480px) {
  .hero { padding: 3.5rem 1.2rem 2rem; }
  .upload-card { padding: 1.4rem; }
}
