/* ===== Sage & Blush Theme ===== */
:root {
  --sage: #8ba888;
  --sage-light: #c8dcc4;
  --sage-dark: #52704f;
  --blush: #e8a4b8;
  --blush-light: #f6d3de;
  --blush-pale: #fdeff0;
  --cream: #f7f5ef;
  --white: #ffffff;
  --text-dark: #2d3b2d;
  --text-muted: #6b7d6b;
  --danger: #c0564a;
  --font-script: 'Great Vibes', cursive;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-serif);
  background: linear-gradient(160deg, #f0f5f0 0%, var(--cream) 40%, var(--blush-pale) 100%);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== Floating Petals ===== */
.petals {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.petal {
  position: absolute;
  border-radius: 50% 0 50% 50%;
  opacity: 0;
  animation: fall linear infinite;
}

@keyframes fall {
  0% { transform: translateY(-10vh) rotate(0deg) translateX(0); opacity: 0; }
  10% { opacity: 0.55; }
  90% { opacity: 0.55; }
  100% { transform: translateY(110vh) rotate(720deg) translateX(40px); opacity: 0; }
}

/* ===== Hero ===== */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3.5rem 1.5rem 2.5rem;
  max-width: 640px;
  margin: 0 auto;
}

.hero-kicker {
  font-size: clamp(0.75rem, 2vw, 0.9rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sage);
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.hero-names {
  font-family: var(--font-script);
  font-size: clamp(2.75rem, 9vw, 4.25rem);
  color: var(--sage-dark);
  font-weight: 400;
  margin-bottom: 1rem;
}

.hero-message {
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.6;
}

.hero-note {
  margin-top: 1.1rem;
  font-size: clamp(0.8rem, 2.2vw, 0.92rem);
  color: var(--sage-dark);
  background: var(--blush-pale);
  border: 1px solid var(--blush-light);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  line-height: 1.6;
}

/* ===== Layout ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  color: var(--sage-dark);
  letter-spacing: 0.08em;
  text-align: center;
  font-weight: 600;
}

/* ===== Upload Card ===== */
.upload-card {
  background: var(--white);
  border: 2px solid var(--sage-light);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  box-shadow: 0 4px 30px rgba(139, 168, 136, 0.18);
  margin-bottom: 3rem;
}

.upload-card .section-title {
  margin-bottom: 1.25rem;
}

.share-lock-note {
  margin-bottom: 1.25rem;
}

.upload-card.is-locked #submit-btn,
.upload-card.is-locked #message-submit-btn {
  opacity: 0.55;
  cursor: not-allowed;
}

.hero-note-locked {
  color: var(--sage-dark);
  background: var(--blush-pale);
  border-color: var(--blush-light);
}

/* ===== Mode Tabs ===== */
.mode-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.mode-tab {
  font-family: var(--font-serif);
  font-size: 0.85rem;
  padding: 0.55rem 1rem;
  border-radius: 20px;
  border: none;
  box-shadow: inset 0 0 0 1px var(--sage-light);
  background: var(--cream);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.mode-tab.is-active {
  background: var(--sage);
  box-shadow: inset 0 0 0 1px var(--sage);
  color: var(--white);
}

.field textarea {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--sage-light);
  border-radius: 8px;
  background: var(--cream);
  color: var(--text-dark);
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: var(--sage);
}

#upload-form,
#message-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 480px;
  margin: 0 auto;
}

/* [hidden] must win over the rules above, otherwise the tab that should be
   closed stays visible (higher specificity of the ID selector beats the
   browser's default `[hidden] { display: none }` UA rule). */
#upload-form[hidden],
#message-form[hidden] {
  display: none;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 2px dashed var(--sage-light);
  border-radius: 14px;
  padding: 2.25rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s;
  color: var(--sage-dark);
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--sage);
  background: var(--blush-pale);
}

.dropzone-icon {
  width: 34px;
  height: 34px;
  color: var(--sage);
}

.dropzone-text {
  font-size: 1.05rem;
  font-weight: 500;
}

.video-warning {
  text-align: center;
  font-size: 0.8rem;
  color: #9a6b1f;
  background: #fdf3e0;
  border: 1px solid #f0dcae;
  border-radius: 10px;
  padding: 0.5rem 0.8rem;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.field-optional {
  font-style: italic;
  opacity: 0.75;
}

.field input[type="text"] {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--sage-light);
  border-radius: 8px;
  background: var(--cream);
  color: var(--text-dark);
}

.field input[type="text"]:focus {
  outline: none;
  border-color: var(--sage);
}

/* ===== Upload queue ===== */
.queue {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: var(--cream);
  border: 1px solid var(--sage-light);
  font-size: 0.85rem;
}

.queue-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dark);
}

.queue-item-status {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.queue-item.is-pending .queue-item-status { color: var(--text-muted); }
.queue-item.is-uploading .queue-item-status { color: var(--sage); }
.queue-item.is-done .queue-item-status { color: var(--sage-dark); font-weight: 600; }
.queue-item.is-error .queue-item-status { color: var(--danger); font-weight: 600; }

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-serif);
  font-size: 1rem;
  letter-spacing: 0.04em;
  padding: 0.85rem 2rem;
  border-radius: 30px;
  cursor: pointer;
  border: none;
  box-shadow: inset 0 0 0 1px var(--sage);
  transition: background 0.3s, color 0.3s, box-shadow 0.3s, opacity 0.2s;
  font-weight: 500;
}

.btn-primary {
  background: var(--sage);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: var(--sage-dark);
  box-shadow: inset 0 0 0 1px var(--sage-dark), 0 4px 15px rgba(139, 168, 136, 0.35);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-outline {
  background: var(--white);
  color: var(--sage-dark);
  display: block;
  margin: 2rem auto 0;
}

.btn-outline:hover {
  background: var(--sage);
  color: var(--white);
}

.form-note {
  text-align: center;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.form-note.is-error { color: var(--danger); }
.form-note.is-success { color: var(--sage-dark); }

/* ===== Gallery ===== */
.gallery-heading {
  text-align: center;
  margin-bottom: 1.75rem;
}

.gallery-count {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

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

.gallery-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--blush-pale);
  border: 1px solid var(--sage-light);
  cursor: pointer;
}

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

.gallery-item .media-broken {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.gallery-item .video-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(45, 59, 45, 0.75);
  color: var(--white);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
}

.gallery-item .uploader-tag {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--sage-dark);
  font-size: 0.65rem;
  padding: 0.2rem 0.5rem;
  border-radius: 20px;
  max-width: 70%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Message Card */
.gallery-item.is-message {
  background: var(--blush-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  cursor: pointer;
}

.gallery-item.is-message .message-quote {
  font-size: 1.6rem;
  color: var(--blush);
  line-height: 1;
  margin-bottom: 0.4rem;
  display: block;
  text-align: center;
}

.gallery-item.is-message .message-text {
  font-size: 0.8rem;
  color: var(--text-dark);
  text-align: center;
  font-style: italic;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Like button (shared between gallery grid cells and the lightbox) */
.like-btn {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 20px;
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
  color: var(--danger);
  cursor: pointer;
}

.like-btn.is-liked {
  background: var(--blush);
  color: var(--white);
}

.gallery-item .like-btn {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
}

.gallery-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 2rem 0;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 20, 0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.lightbox[hidden] { display: none; }

.lightbox-content {
  position: relative;
  max-width: min(92vw, 700px);
  max-height: 88vh;
}

.lightbox-like-btn {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  font-size: 1rem;
  padding: 0.35rem 0.8rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.lightbox-message .lightbox-like-btn {
  position: static;
  display: inline-flex;
  margin-top: 0.5rem;
  box-shadow: none;
}

.lightbox-content img,
.lightbox-content video {
  width: 100%;
  height: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
}

.lightbox-message {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 480px;
}

.lightbox-message .message-quote {
  font-size: 2.5rem;
  color: var(--blush);
  display: block;
  margin-bottom: 1rem;
}

.lightbox-message .message-text {
  font-size: 1.15rem;
  color: var(--text-dark);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.lightbox-message .message-author {
  font-family: var(--font-script);
  font-size: 1.5rem;
  color: var(--sage-dark);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
}

/* ===== Admin Bar ===== */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--sage-dark);
  color: var(--white);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  padding: 0.55rem 1rem;
  text-align: center;
}

.admin-bar[hidden] { display: none; }

.admin-bar button,
.admin-bar a {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: var(--white);
  font-family: var(--font-serif);
  font-size: 0.78rem;
  padding: 0.25rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  text-decoration: none;
}

.admin-bar button:hover,
.admin-bar a:hover {
  background: rgba(255, 255, 255, 0.3);
}


/* ===== Admin Link (footer) ===== */
.admin-link {
  margin-top: 1.25rem;
  background: none;
  border: none;
  color: var(--text-muted);
  opacity: 0.45;
  font-family: var(--font-serif);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
}

.admin-link:hover {
  opacity: 0.85;
}

/* ===== Admin Login Modal ===== */
.admin-modal {
  position: fixed;
  inset: 0;
  background: rgba(20, 28, 20, 0.7);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.admin-modal[hidden] { display: none; }

.admin-modal-box {
  position: relative;
  background: var(--white);
  border-radius: 16px;
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.admin-modal-box h3 {
  font-family: var(--font-serif);
  color: var(--sage-dark);
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  font-weight: 600;
}

.admin-modal-box form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.admin-modal-box input[type="password"] {
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--sage-light);
  border-radius: 8px;
  background: var(--cream);
  text-align: center;
}

.admin-modal-box input[type="password"]:focus {
  outline: none;
  border-color: var(--sage);
}

.admin-modal-box .btn {
  width: 100%;
}

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

.admin-login-note {
  font-size: 0.82rem;
  min-height: 1.1em;
}

.admin-login-note.is-error { color: var(--danger); }
.admin-login-note.is-success { color: var(--sage-dark); }

/* ===== Gallery Delete Button (admin mode) ===== */
.gallery-item .delete-btn {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(192, 86, 74, 0.9);
  color: var(--white);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

body.admin-mode .gallery-item .delete-btn {
  display: flex;
}

.gallery-item .delete-btn:hover {
  background: var(--danger);
}

/* ===== Footer ===== */
.site-footer {
  text-align: center;
  padding: 2.5rem 1rem 3rem;
  position: relative;
  z-index: 1;
}

.footer-names {
  font-family: var(--font-script);
  font-size: 1.9rem;
  color: var(--sage-dark);
  margin-bottom: 0.4rem;
}

.footer-note {
  font-size: 0.9rem;
  color: var(--sage);
  font-style: italic;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .upload-card { padding: 1.5rem 1.1rem; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; }
}

@media (max-width: 380px) {
  .hero { padding: 2.5rem 1rem 2rem; }
}

/* Safety net: several component classes above (.btn-outline, #upload-form,
   #message-form...) set their own unconditional `display`, which otherwise
   wins over the browser's default `[hidden] { display: none }` rule —
   author styles always beat the user-agent stylesheet regardless of
   specificity. This guarantees `hidden` always actually hides the element,
   no matter what other CSS targets it. */
[hidden] {
  display: none !important;
}
