:root {
  color-scheme: light;
  --bg-dark: #2b1f1a;
  --bg-soft: #3d2d26;
  --card: #f7f0e6;
  --gold: #d4af37;
  --gold-soft: #e6cf7a;
  --text-dark: #2e1f14;
  --muted: #6f5a4b;
  --danger: #9d1f1f;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Cinzel', serif;
  background:
    radial-gradient(circle at top, rgba(212, 175, 55, 0.14), transparent 45%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%2336241e' stroke-opacity='0.28' stroke-width='1.1'%3E%3Cpath d='M20 20h24v24H20zM76 20h24v24H76zM20 76h24v24H20zM76 76h24v24H76z'/%3E%3C/g%3E%3Cg fill='none' stroke='%2343332b' stroke-opacity='0.25' stroke-width='1'%3E%3Cpath d='M0 60h120M60 0v120'/%3E%3C/g%3E%3C/svg%3E"),
    linear-gradient(165deg, var(--bg-dark), var(--bg-soft));
  background-size: auto, 120px 120px, auto;
  color: var(--text-dark);
}

.container {
  width: min(980px, 92%);
  margin: 1.5rem auto 2.5rem;
  display: grid;
  gap: 1rem;
}

.hero,
.card {
  background: linear-gradient(180deg, #fffaf3, var(--card));
  border: 2px solid var(--gold-soft);
  border-radius: 18px;
  box-shadow: 0 10px 28px var(--shadow);
  position: relative;
}

.hero::before,
.card::before {
  content: '❦';
  position: absolute;
  top: 10px;
  left: 14px;
  color: var(--gold);
  font-size: 1.15rem;
}

.hero::after,
.card::after {
  content: '❦';
  position: absolute;
  top: 10px;
  right: 14px;
  color: var(--gold);
  font-size: 1.15rem;
  transform: scaleX(-1);
}

.hero {
  text-align: center;
  padding: 1.8rem 1.1rem;
}

.hero h1 {
  margin: 0;
  font-family: 'Great Vibes', cursive;
  font-size: clamp(2.2rem, 6.8vw, 4rem);
  color: #7a4d1f;
}

.hero .date {
  margin: 0.35rem 0 0.8rem;
  color: #8f6925;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  letter-spacing: 0.08em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.92rem, 2.8vw, 1.05rem);
  line-height: 1.55;
}

.card {
  padding: 1.2rem 1rem;
  padding-top: 2.4rem;
}

.card h2 {
  margin-top: 0;
  color: #8a611b;
  font-size: clamp(1.15rem, 4.2vw, 1.5rem);
}

.card p {
  line-height: 1.5;
}

.upload-area {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

#fileInput {
  display: none;
}

.file-picker {
  display: grid;
  gap: 0.5rem;
}

#filePickerBtn {
  width: 100%;
}

.file-picker-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

button {
  border: 1px solid #8f6925;
  border-radius: 12px;
  background: linear-gradient(180deg, #c79b3b, #9f7729);
  color: #fff9e8;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#uploadBtn.is-uploading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#uploadBtn.is-uploading::after {
  content: '';
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 249, 232, 0.45);
  border-top-color: #fff9e8;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status {
  margin-top: 1rem;
  color: var(--muted);
  min-height: 1.5rem;
}

.status.error {
  color: var(--danger);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.gallery-item {
  border: 1px solid #d5bc8f;
  border-radius: 14px;
  overflow: hidden;
  background: #fffcf6;
  cursor: pointer;
}


.delete-btn {
  width: 100%;
  border-radius: 0;
  border: 0;
  border-top: 1px solid #d5bc8f;
  background: linear-gradient(180deg, #b73d3d, #8f2020);
  color: #fff;
  font-size: 0.85rem;
  padding: 0.55rem;
}

.delete-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.close-viewer-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.35rem;
  padding: 0;
  line-height: 1;
}

.media-viewer-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-viewer-content img,
.media-viewer-content video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.hidden {
  display: none;
}

@media (min-width: 720px) {
  .container {
    margin-top: 2rem;
    gap: 1.2rem;
  }

  .card {
    padding: 1.4rem;
    padding-top: 2.5rem;  
  }

  .upload-area {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
  }

  .gallery-item img,
  .gallery-item video {
    aspect-ratio: 4 / 3;
  }
}
