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

:root {
  --gold: #c9a227;
  --gold-light: #e8d48b;
  --gold-dark: #8b6914;
  --cream: #faf6f0;
  --blush: #f5e6e0;
  --text: #2c2416;
  --text-muted: #6b5d4d;
  --shadow: 0 8px 32px rgba(44, 36, 22, 0.1);
  --radius: 16px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Outfit', sans-serif;
  font-weight: 300;
  background: linear-gradient(165deg, var(--cream) 0%, var(--blush) 45%, #ede4f0 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(201, 162, 39, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 90% 80%, rgba(201, 162, 39, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(232, 212, 139, 0.08) 0%, transparent 60%);
}

.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 4rem 1.5rem 3rem;
}

.hero-sub {
  font-size: 0.95rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
}

.hero h1 span {
  color: var(--gold);
  font-style: italic;
}

.hero-thanks {
  margin-top: 1.5rem;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 400;
  color: var(--text);
  max-width: 32rem;
  margin-left: auto;
  margin-right: auto;
}

.hero-wish {
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 1rem;
}

main {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

section {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 2rem;
  border: 1px solid rgba(201, 162, 39, 0.15);
}

h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dropzone {
  display: block;
  border: 2px dashed rgba(201, 162, 39, 0.45);
  border-radius: 12px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
  min-height: 160px;
}

.dropzone.has-files {
  padding: 1rem;
  cursor: default;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.06);
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.dropzone-icon {
  font-size: 2.5rem;
}

.dropzone-text {
  font-weight: 400;
  color: var(--text);
}

.dropzone-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 0.6rem;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(44, 36, 22, 0.06);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  border-radius: 50%;
  background: rgba(20, 16, 10, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-remove:hover {
  background: rgba(155, 34, 38, 0.9);
}

.hidden {
  display: none !important;
}

.btn-upload {
  align-self: center;
  padding: 0.85rem 2.5rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 16px rgba(201, 162, 39, 0.35);
}

.btn-upload:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(201, 162, 39, 0.45);
}

.btn-upload:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.status {
  text-align: center;
  font-size: 0.95rem;
  min-height: 1.4em;
}

.status.success {
  color: #2d6a4f;
}

.status.error {
  color: #9b2226;
}

.undo-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(45, 106, 79, 0.1);
  border: 1px solid rgba(45, 106, 79, 0.25);
  border-radius: 10px;
  font-size: 0.95rem;
}

.btn-undo {
  padding: 0.45rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  color: #9b2226;
  background: #fff;
  border: 1px solid rgba(155, 34, 38, 0.35);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-undo:hover {
  background: rgba(155, 34, 38, 0.06);
}

.gallery-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.gallery-header h2 {
  margin-bottom: 0;
}

.gallery-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-admin {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-admin:hover,
.btn-admin.active {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: rgba(201, 162, 39, 0.1);
}

.photo-count {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

.gallery-item {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(44, 36, 22, 0.08);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.gallery-item:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 20px rgba(44, 36, 22, 0.15);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.35rem;
  padding: 0.5rem;
  background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.45));
  opacity: 0;
  transition: opacity 0.2s;
}

.gallery-item:hover .gallery-item-overlay,
.gallery-item:focus-within .gallery-item-overlay {
  opacity: 1;
}

.gallery-btn {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}

.gallery-btn:hover {
  transform: scale(1.08);
}

.gallery-delete {
  color: #9b2226;
}

footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 16, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.lightbox-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(96vw, 1100px);
  width: 100%;
}

.lightbox img {
  max-width: 100%;
  max-height: calc(90vh - 4rem);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  user-select: none;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 100%;
  padding: 0 0.5rem;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.95rem;
  min-width: 4rem;
}

.lightbox-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-lightbox {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-lightbox:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-lightbox.btn-danger {
  color: #ffb4b4;
  border-color: rgba(255, 120, 120, 0.4);
}

.btn-lightbox.btn-danger:hover {
  background: rgba(155, 34, 38, 0.35);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, opacity 0.15s;
  z-index: 2;
}

.lightbox-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.lightbox-prev {
  left: 1rem;
}

.lightbox-next {
  right: 1rem;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
  z-index: 3;
}

.lightbox-close:hover {
  opacity: 1;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(20, 16, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
}

.modal-content h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.modal-content form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-content input {
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 8px;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.btn-text {
  margin-top: 0.75rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width: 480px) {
  section {
    padding: 1.5rem;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .gallery-item-overlay {
    opacity: 1;
  }

  .lightbox-nav {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 2rem;
  }

  .lightbox-prev {
    left: 0.25rem;
  }

  .lightbox-next {
    right: 0.25rem;
  }
}
