/* ==========================================================================
   Systmp Gallery Stylesheet
   Modern, Static, Fully Responsive Gallery
   ========================================================================== */

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #161a23;
  --bg-surface: #1e2230;
  --bg-surface-hover: #262c3d;
  --border-subtle: #2a3144;
  --border-strong: #3d4660;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent: #38bdf8;
  --accent-rgb: 56, 189, 248;
  --accent-hover: #0ea5e9;
  --accent-subtle: rgba(56, 189, 248, 0.12);
  
  --card-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.4), 0 2px 6px -1px rgba(0, 0, 0, 0.3);
  --card-shadow-hover: 0 12px 28px -4px rgba(0, 0, 0, 0.6), 0 4px 12px -2px rgba(56, 189, 248, 0.2);
  
  --header-height: 70px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  
  --accent: #0284c7;
  --accent-rgb: 2, 132, 199;
  --accent-hover: #0369a1;
  --accent-subtle: rgba(2, 132, 199, 0.1);
  
  --card-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --card-shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(2, 132, 199, 0.15);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 60px);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="light"] .site-header {
  background-color: rgba(248, 250, 252, 0.88);
}

.header-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.35);
}

.brand-info {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-stats {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Header Controls */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  max-width: 600px;
  justify-content: flex-end;
}

.search-wrapper {
  position: relative;
  width: 100%;
  max-width: 340px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.5rem 2.25rem 0.5rem 2.4rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: all var(--transition-fast);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.search-clear:hover {
  color: var(--text-primary);
}

.theme-toggle, .btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.theme-toggle:hover, .btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Category Filter Bar */
.category-nav-wrapper {
  position: sticky;
  top: var(--header-height);
  z-index: 90;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal);
}

.category-nav-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.category-nav-inner::-webkit-scrollbar {
  height: 4px;
}

.category-nav-inner::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}

.category-pill {
  white-space: nowrap;
  padding: 0.35rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.category-pill:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.category-pill.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(var(--accent-rgb), 0.3);
}

.pill-count {
  font-size: 0.72rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-full);
}

.category-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Main Container */
.main-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Category Section */
.category-section {
  margin-bottom: 3.5rem;
  scroll-margin-top: calc(var(--header-height) + 70px);
}

.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.category-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.category-anchor {
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.category-title-group:hover .category-anchor {
  opacity: 1;
}

.category-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-transform: uppercase;
}

.category-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-subtle);
  color: var(--accent);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

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

/* Image Card */
.image-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--card-shadow);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-normal);
  display: flex;
  flex-direction: column;
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--card-shadow-hover);
  border-color: var(--border-strong);
}

.image-preview-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background-color: var(--bg-secondary);
  overflow: hidden;
  cursor: pointer;
}

.image-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.image-card:hover .image-preview {
  transform: scale(1.05);
}

.image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(15, 17, 23, 0.7) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-card:hover .image-overlay {
  opacity: 1;
}

.view-badge {
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Card Body */
.card-body {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-surface);
  flex: 1;
}

.card-filename-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-filename {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.btn-copy {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.btn-copy:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.btn-copy.copied {
  color: #10b981;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.meta-tags {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.meta-badge {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
}

.meta-size {
  font-family: var(--font-mono);
}

/* Empty search state */
.empty-state {
  display: none;
  text-align: center;
  padding: 4rem 1rem;
}

.empty-state.visible {
  display: block;
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  color: var(--text-muted);
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(5, 7, 12, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lightbox-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  background: rgba(15, 17, 23, 0.6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #ffffff;
  z-index: 2;
}

.lightbox-title-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.lightbox-category-tag {
  background: var(--accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  flex-shrink: 0;
}

.lightbox-filename {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.lightbox-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.lightbox-body {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow: hidden;
}

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

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  user-select: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 24, 33, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
  z-index: 10;
}

.lightbox-nav:hover {
  background: rgba(56, 189, 248, 0.9);
  color: #ffffff;
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav.prev {
  left: 1.5rem;
}

.lightbox-nav.next {
  right: 1.5rem;
}

.lightbox-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(15, 17, 23, 0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-size: 0.8125rem;
  z-index: 2;
}

.lightbox-counter {
  font-family: var(--font-mono);
}

.lightbox-hints {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lightbox-kbd {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #e2e8f0;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition-normal);
  z-index: 80;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .header-inner {
    padding: 0.6rem 1rem;
  }
  
  .brand-title {
    font-size: 1rem;
  }
  
  .main-content {
    padding: 1.25rem 1rem 3rem;
  }
  
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
  }
  
  .lightbox-hints {
    display: none;
  }
  
  .lightbox-nav.prev {
    left: 0.5rem;
  }
  
  .lightbox-nav.next {
    right: 0.5rem;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  
  .search-wrapper {
    max-width: 180px;
  }
  
  .category-title {
    font-size: 1.15rem;
  }
}
