:root {
  color-scheme: light;
  --bg: #fff7ee;
  --bg-soft: #fffcf8;
  --text: #2c2320;
  --text-muted: #6f5e58;
  --card: rgba(255, 255, 255, 0.86);
  --card-border: rgba(173, 131, 98, 0.22);
  --accent: #b85d4d;
  --accent-dark: #924537;
  --button-text: #fff9f6;
  --shadow: 0 14px 34px rgba(99, 61, 48, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Nunito Sans', 'Segoe UI', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, #ffe6d1 0, transparent 42%),
    radial-gradient(circle at 92% 84%, #fddcc6 0, transparent 38%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  min-height: 100vh;
  position: relative;
}

.bg-orb {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.45;
  pointer-events: none;
}

.orb-1 {
  width: 360px;
  height: 360px;
  top: -120px;
  right: -120px;
  background: radial-gradient(circle, #ffd7b7 0%, #ffe9d7 58%, transparent 72%);
}

.orb-2 {
  width: 340px;
  height: 340px;
  bottom: -140px;
  left: -100px;
  background: radial-gradient(circle, #f2d7be 0%, #ffeedf 64%, transparent 74%);
}

.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 2.2rem 0 4rem;
}

.hero {
  margin-bottom: 1.5rem;
  padding: 1.3rem 1.35rem;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.82), rgba(255, 244, 235, 0.88));
  box-shadow: var(--shadow);
  animation: fade-slide 650ms ease-out both;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.76rem;
}

h1 {
  margin: 0.4rem 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 700;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.02;
}

.subtext {
  margin: 0;
  color: var(--text-muted);
  max-width: 60ch;
}

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 1.15rem;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  margin-bottom: 1.9rem;
  backdrop-filter: blur(4px);
  animation: fade-slide 720ms ease-out both;
}

h2 {
  margin-top: 0.1rem;
  margin-bottom: 0.95rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.4rem, 3.8vw, 2rem);
}

h3 {
  margin: 0 0 0.65rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.2rem;
}

.upload-form {
  display: grid;
  gap: 1rem;
}

.upload-preview,
.upload-progress {
  display: grid;
  gap: 0.55rem;
}

.upload-preview {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
}

.preview-item {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  background: #fffaf6;
}

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

.preview-item figcaption {
  padding: 0.3rem 0.42rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-row {
  border-radius: 11px;
  border: 1px solid var(--card-border);
  padding: 0.45rem 0.55rem;
  background: #fffdfb;
}

.progress-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.progress-track {
  margin-top: 0.35rem;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #f4e6db;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d77a68 0%, #b85d4d 100%);
  transition: width 130ms linear;
}

.progress-row.error .progress-fill {
  background: linear-gradient(90deg, #bc5f58 0%, #8e3833 100%);
}

.progress-row.done .progress-fill {
  background: linear-gradient(90deg, #75a36a 0%, #5f8555 100%);
}

label {
  display: grid;
  gap: 0.42rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

input[type='text'],
input[type='password'],
input[type='file'] {
  border: 1px solid #ddc3ab;
  border-radius: 12px;
  padding: 0.66rem 0.74rem;
  font-size: 0.98rem;
  background: #fffdfb;
  color: var(--text);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input[type='text']:focus,
input[type='password']:focus,
input[type='file']:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 93, 77, 0.14);
}

button {
  appearance: none;
  border: 0;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: var(--button-text);
  font-weight: 600;
  padding: 0.76rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, filter 150ms ease;
  box-shadow: 0 8px 18px rgba(146, 69, 55, 0.28);
}

button:hover {
  transform: translateY(-1px);
  filter: saturate(1.06);
}

button[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.secondary-button {
  background: #efe4da;
  color: #4d3b34;
  box-shadow: none;
}

.secondary-button:hover {
  filter: none;
  background: #e6d8cd;
}

#undoHideButton {
  justify-self: start;
}

.status {
  margin: 0;
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--accent-dark);
}

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

.gallery-controls {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.count {
  color: var(--text-muted);
}

.gallery {
  columns: 1;
  column-gap: 1.1rem;
}

.gallery .empty {
  column-span: all;
}

.admin-panel {
  display: grid;
  gap: 0.9rem;
}

.admin-actions {
  display: grid;
  gap: 0.6rem;
  grid-template-columns: 1fr;
}

.admin-columns {
  display: grid;
  gap: 0.85rem;
}

.admin-list {
  display: grid;
  gap: 0.55rem;
}

.admin-item {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 0.55rem 0.62rem;
  background: #fffdfb;
}

.admin-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.admin-item .admin-title {
  margin-bottom: 0.28rem;
  color: var(--text);
  font-weight: 700;
  font-size: 0.92rem;
}

.admin-item button {
  margin-top: 0.48rem;
  width: auto;
  box-shadow: none;
}

.photo-card {
  break-inside: avoid;
  margin: 0 0 1.1rem;
  background: rgba(255, 255, 255, 0.93);
  border-radius: 16px;
  border: 1px solid var(--card-border);
  overflow: hidden;
  box-shadow: 0 12px 24px rgba(99, 61, 48, 0.14);
  opacity: 0;
  transform: translateY(14px);
  animation: card-in 500ms ease forwards;
  animation-delay: calc(var(--stagger, 0) * 38ms);
}

.photo-card img {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: cover;
}

.meta {
  padding: 0.82rem;
}

.caption {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.details {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.admin-delete {
  margin-top: 0.65rem;
  background: #5f4b42;
  color: #ffffff;
  width: 100%;
  box-shadow: none;
}

.favorite-toggle {
  margin-top: 0.65rem;
  width: 100%;
  background: #f7e2ce;
  color: #6d4635;
  box-shadow: none;
}

.favorite-toggle.active {
  background: #d56f5d;
  color: #fffaf6;
}

.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(48px, 80px) 1fr minmax(48px, 80px);
  align-items: center;
  padding: 1rem;
  background: rgba(28, 18, 14, 0.88);
  backdrop-filter: blur(2px);
}

.lightbox-figure {
  margin: 0;
  display: grid;
  gap: 0.6rem;
  justify-items: center;
}

.lightbox-figure img {
  max-width: min(1040px, 86vw);
  max-height: 80vh;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.42);
}

.lightbox-figure figcaption {
  color: #f9ece2;
  text-align: center;
  font-size: 0.95rem;
}

.lightbox-close {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: auto;
  padding: 0.5rem 0.8rem;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

.lightbox-nav {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  box-shadow: none;
  justify-self: center;
  text-indent: -9999px;
  overflow: hidden;
  position: relative;
}

.lightbox-nav::after {
  text-indent: 0;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
}

.lightbox-nav.prev::after {
  content: '\2039';
}

.lightbox-nav.next::after {
  content: '\203A';
}

.empty {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 1rem;
  color: var(--text-muted);
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 640px) {
  .gallery {
    columns: 2;
  }

  .upload-form {
    grid-template-columns: 1fr 1fr;
  }

  .upload-form label:last-of-type,
  .upload-form .upload-preview,
  .upload-form .upload-progress,
  .upload-form .form-actions,
  .upload-form .status,
  .upload-form #undoHideButton {
    grid-column: span 2;
  }

  .form-actions {
    grid-template-columns: 1fr 1fr;
  }

  .admin-actions {
    grid-template-columns: 1fr 1fr;
  }

  .admin-columns {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 980px) {
  .gallery {
    columns: 3;
  }
}

@media (max-width: 580px) {
  .container {
    padding-top: 1.4rem;
  }

  .hero,
  .card {
    border-radius: 16px;
    padding: 1rem;
  }

  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .lightbox {
    grid-template-columns: 42px 1fr 42px;
    padding: 0.65rem;
  }
}
