/* ===========================
   Variables
   =========================== */
:root {
  --bg: #fdf8f5;
  --surface: #ffffff;
  --text: #2d1f17;
  --text-light: #8a7060;
  --accent: #b8916a;
  --accent-dark: #9a7655;
  --accent-light: #f0e0d0;
  --border: #e8d5c5;
  --error: #c44b4b;
  --success: #5a8a5a;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Jost', system-ui, sans-serif;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(45, 31, 23, 0.08);
}

/* ===========================
   Reset & Base
   =========================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.6;
  min-height: 100vh;
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===========================
   Header / Nav
   =========================== */
.site-header {
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(253, 248, 245, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header nav {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-link {
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--accent);
}

.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* ===========================
   Footer
   =========================== */
.site-footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: auto;
  border-top: 1px solid var(--border);
}

/* ===========================
   Hero
   =========================== */
.hero,
.gallery-hero {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
}

.hero-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 300;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.hero-title em {
  font-style: italic;
  color: var(--accent);
}

.hero-subtitle {
  font-size: 1rem;
  color: var(--text-light);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.7;
}

.photo-count {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

/* ===========================
   Upload Page
   =========================== */
.upload-main {
  flex: 1;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.upload-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

.drop-zone {
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drop-zone-icon {
  color: var(--accent);
  margin-bottom: 1rem;
}

.drop-zone-text {
  font-size: 0.9375rem;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.drop-zone-hint {
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.drop-zone-limit {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 1rem;
}

.file-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 1rem;
}

.badge {
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
}

/* File list */
.file-list {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0.875rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: 0.875rem;
}

.file-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.file-size {
  color: var(--text-light);
  font-size: 0.8125rem;
  flex-shrink: 0;
}

/* Captcha */
.captcha-row {
  margin: 1.5rem 0;
  display: flex;
  justify-content: center;
}

/* Progress */
.progress-section {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.progress-item {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.3rem 0.75rem;
  font-size: 0.875rem;
}

.progress-name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-status {
  color: var(--text-light);
  text-align: right;
  font-size: 0.8125rem;
}

.progress-status.done { color: var(--success); }
.progress-status.error { color: var(--error); }

.progress-bar-wrap {
  grid-column: 1 / -1;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.15s;
}

/* Success */
.success-message {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #f2f8f2;
  border: 1px solid #c0ddc0;
  border-radius: 8px;
  text-align: center;
  color: var(--success);
}

.success-message p {
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

/* ===========================
   Buttons
   =========================== */
.btn-primary {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.9rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

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

.btn-outline {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  transition: background 0.2s, color 0.2s;
}

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

.btn-refresh {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-light);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-refresh:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===========================
   Gallery Page
   =========================== */
.gallery-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

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

@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  aspect-ratio: 1;
  background: linear-gradient(90deg, #ede3db 25%, #f7f0eb 50%, #ede3db 75%);
  background-size: 600px 100%;
  animation: shimmer 1.6s infinite linear;
  transition: transform 0.2s, box-shadow 0.2s;
}

.gallery-item.loaded {
  animation: none;
  background: var(--border);
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(45, 31, 23, 0.15);
}

.gallery-item:hover .zoom-hint {
  opacity: 1;
}

.gallery-thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.gallery-thumb.loaded {
  opacity: 1;
}

.zoom-hint {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  border-radius: 4px;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.25);
  transition: background 0.2s;
}

.gallery-item:hover .play-overlay {
  background: rgba(0, 0, 0, 0.4);
}

.empty-state {
  text-align: center;
  padding: 5rem 1.5rem;
  color: var(--text-light);
}

.empty-state p {
  margin-bottom: 1.5rem;
  font-size: 1.0625rem;
}

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

.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-media {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 101;
  line-height: 1;
  transition: color 0.2s;
}

.lightbox-close:hover { color: white; }

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  font-size: 2.5rem;
  width: 3rem;
  height: 5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
  z-index: 101;
}

.lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lightbox-nav.prev { left: 1rem; }
.lightbox-nav.next { right: 1rem; }

.lightbox-delete {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(180, 60, 60, 0.7);
  border: none;
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.2s;
  z-index: 101;
  white-space: nowrap;
}
.lightbox-delete:hover { background: rgba(180, 60, 60, 1); }

.gallery-delete-btn {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s, background 0.2s;
  z-index: 2;
  line-height: 1;
  padding: 0;
}
.gallery-item:hover .gallery-delete-btn { opacity: 1; }
.gallery-delete-btn:hover { background: rgba(180, 60, 60, 0.85); }

/* ===========================
   Utilities
   =========================== */
.hidden { display: none !important; }

/* ===========================
   Responsive
   =========================== */
@media (max-width: 600px) {
  .site-header { padding: 1rem; }
  .upload-card { padding: 1.5rem; }
  .hero, .gallery-hero { padding: 2.5rem 1rem 2rem; }
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 0.375rem; }
  .lightbox-nav { display: none; }
  .refresh-indicator span { display: none; }
  .gallery-delete-btn { opacity: 1; width: 1.375rem; height: 1.375rem; font-size: 0.65rem; }
}
