/* Dark-first design system for photo galleries */

:root {
  --bg-primary: 18, 18, 20;
  --bg-secondary: 28, 28, 32;
  --bg-surface: 38, 38, 44;
  --bg-elevated: 48, 48, 56;
  --text-primary: 240, 240, 245;
  --text-secondary: 155, 155, 168;
  --text-muted: 100, 100, 115;
  --accent: 99, 144, 255;
  --accent-hover: 120, 160, 255;
  --border: 55, 55, 65;
  --hover: 65, 65, 78;
  --danger: 255, 90, 90;
  --success: 80, 220, 140;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --shadow-glow: 0 0 24px rgba(255, 255, 255, 0.08);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.4);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;
  --transition-color: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

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

html {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: rgb(var(--bg-primary));
  color: rgb(var(--text-primary));
  min-height: 100dvh;
  line-height: 1.5;
}

/* Typography */
.text-display    { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.02em; text-shadow: 0 0 20px rgba(255,255,255,0.15); }
.text-headline   { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.01em; text-shadow: 0 0 16px rgba(255,255,255,0.12); }
.text-title      { font-size: 1.25rem; font-weight: 600; }
.text-heading    { font-size: 1rem; font-weight: 600; }
.text-body       { font-size: 0.9375rem; font-weight: 400; color: rgb(var(--text-secondary)); }
.text-label      { font-size: 0.875rem; font-weight: 500; color: rgb(var(--text-secondary)); }
.text-small      { font-size: 0.8125rem; font-weight: 400; color: rgb(var(--text-muted)); }
.text-accent     { color: rgb(var(--accent)); }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: rgb(var(--text-muted));
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgb(var(--text-secondary)); }

/* Layout */
.container {
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Cards / Surfaces */
.surface {
  background: rgb(var(--bg-surface));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-md);
  transition: var(--transition-color);
}

.card {
  background: rgb(var(--bg-secondary));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: var(--transition-color), transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  border-color: rgb(var(--hover));
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover { transform: scale(1.01); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: rgb(var(--accent));
  color: #fff;
  box-shadow: var(--shadow-glow);
}
.btn-primary:hover { background: rgb(var(--accent-hover)); }

.btn-secondary {
  background: rgb(var(--bg-surface));
  color: rgb(var(--text-primary));
  border: 1px solid rgb(var(--border));
}
.btn-secondary:hover { background: rgb(var(--hover)); }

.btn-danger {
  background: rgb(var(--danger));
  color: #fff;
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  color: rgb(var(--text-secondary));
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}
.btn-icon:hover { color: rgb(var(--text-primary)); background: rgb(var(--hover)); }

/* Inputs */
.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  font-family: var(--font-sans);
  background: rgb(var(--bg-surface));
  color: rgb(var(--text-primary));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  border-color: rgb(var(--accent));
  box-shadow: 0 0 0 3px rgba(var(--accent), 0.2);
}

.input::placeholder { color: rgb(var(--text-muted)); }

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--thumb-size, 240px), 1fr));
  gap: 4px;
}

.photo-grid--full {}

.photo-thumb {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  cursor: pointer;
  background: rgb(var(--bg-surface));
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, filter 0.3s ease;
}

.photo-thumb:hover img {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.photo-selected {
  outline: 3px solid rgb(var(--accent));
  outline-offset: -3px;
}

.photo-selected img {
  opacity: 0.75;
}

.photo-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgb(var(--accent));
  color: #fff;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* Navigation breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
  font-size: 0.875rem;
  color: rgb(var(--text-muted));
}

.breadcrumbs a {
  color: rgb(var(--text-secondary));
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumbs a:hover { color: rgb(var(--accent)); }

.breadcrumbs .separator { color: rgb(var(--text-muted)); }
.breadcrumbs .current { color: rgb(var(--text-primary)); font-weight: 500; }

/* Event cards */
.event-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.event-card {
  padding: 1.25rem;
  cursor: pointer;
}

.event-card .event-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.event-card .event-date {
  font-size: 0.8125rem;
  color: rgb(var(--text-muted));
}

/* Gallery cards */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.gallery-card {
  overflow: hidden;
  cursor: pointer;
}

.gallery-card .gallery-cover {
  aspect-ratio: 16/9;
  background: rgb(var(--bg-surface));
  overflow: hidden;
}

.gallery-card .gallery-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-card:hover .gallery-cover img { transform: scale(1.06); }

.gallery-card .gallery-info {
  padding: 1rem 1.25rem;
}

.gallery-card .gallery-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.gallery-card .gallery-desc {
  font-size: 0.8125rem;
  color: rgb(var(--text-muted));
}

/* Login page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  text-align: center;
}

.login-card h1 {
  margin-bottom: 0.5rem;
}

.login-card .subtitle {
  color: rgb(var(--text-muted));
  margin-bottom: 2rem;
  font-size: 0.9375rem;
}

.login-card .input {
  margin-bottom: 1rem;
}

.login-card .btn {
  width: 100%;
}

.login-error {
  color: rgb(var(--danger));
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid rgb(var(--border));
  margin-bottom: 1.5rem;
}

.site-header .site-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgb(var(--text-primary));
  text-decoration: none;
  text-shadow: 0 0 16px rgba(255,255,255,0.1);
}

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

/* Upload area */
.upload-area {
  border: 2px dashed rgb(var(--border));
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  cursor: pointer;
}

.upload-area:hover,
.upload-area.dragover {
  border-color: rgb(var(--accent));
  background: rgba(var(--accent), 0.05);
}

.upload-area .upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: rgb(var(--text-muted));
}

.upload-progress {
  margin-top: 1.5rem;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgb(var(--bg-surface));
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: rgb(var(--accent));
  transition: width 0.3s ease;
  border-radius: 3px;
}

/* Fade-in animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease forwards;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg,
    rgb(var(--bg-surface)) 25%,
    rgb(var(--bg-elevated)) 50%,
    rgb(var(--bg-surface)) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

/* PhotoSwipe overrides for dark theme */
.pswp {
  --pswp-bg: rgb(var(--bg-primary));
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: rgb(var(--text-muted));
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Responsive helpers */
@media (max-width: 640px) {
  .container { padding: 0 1rem; }
  .text-display { font-size: 1.75rem; }
  .text-headline { font-size: 1.375rem; }
  .gallery-grid { grid-template-columns: 1fr; }
  .event-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.5rem; }
}
