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

:root {
  --bg: #fafaf9;
  --bg-alt: #f5f5f4;
  --text: #1c1917;
  --text-muted: #78716c;
  --text-light: #a8a29e;
  --border: #e7e5e4;
  --accent: #1c1917;
  --accent-hover: #44403c;
  --card-bg: #ffffff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  --radius: 4px;
  --gap: 16px;
  --header-h: 64px;
  --font-sans: "ZCOOL XiaoWei", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "ZCOOL XiaoWei", "Cormorant Garamond", "Noto Serif TC", "Songti TC", "SimSun", Georgia, serif;
  --font-display: "Ma Shan Zheng", "ZCOOL XiaoWei", "Cormorant Garamond", serif;
}

html {
  scroll-behavior: smooth;
}

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 250, 249, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--font-serif);
}

.logo-mark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 32px;
}

.nav-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: color 0.2s;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  padding: 120px 24px 110px;
  text-align: center;
  background-image:
    linear-gradient(180deg, rgba(28,25,23,0.5) 0%, rgba(28,25,23,0.3) 50%, rgba(28,25,23,0.6) 100%),
    url('../images/hero-bg.webp');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(28,25,23,0.4) 100%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.1;
  margin-bottom: 12px;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0,0,0,0.4);
}

.hero-subtitle {
  font-size: 1.25rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: #1a1a1a;
  margin-bottom: 24px;
}

.hero-desc {
  font-size: 0.75rem;
  line-height: 2;
  color: #b8b8b8;
  max-width: 480px;
  margin: 0 auto;
  letter-spacing: 0.02em;
}

/* ===== Gallery Section ===== */
.gallery-section {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ===== Category Navigation (Dropdown) ===== */
.category-nav {
  display: flex;
  justify-content: center;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.cat-select {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: #000;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 40px 10px 16px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23000' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  transition: border-color 0.2s;
  min-width: 220px;
}

.cat-select:hover {
  border-color: #999;
}

.cat-select:focus {
  outline: none;
  border-color: #000;
}

/* ===== Toolbar ===== */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.result-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.page-indicator {
  font-size: 0.8125rem;
  color: var(--text-light);
  white-space: nowrap;
  font-family: monospace;
}

.sort-select {
  padding: 6px 28px 6px 12px;
  font-size: 0.8125rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%2378716c'%3E%3Cpath d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z'/%3E%3C/svg%3E") no-repeat right 8px center;
  appearance: none;
  -webkit-appearance: none;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s;
}

.sort-select:hover {
  border-color: var(--text-light);
}

.sort-select:focus {
  outline: none;
  border-color: var(--text);
}

.layout-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.layout-btn {
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  color: var(--text-muted);
  transition: all 0.2s;
}

.layout-btn:hover {
  color: var(--text);
}

.layout-btn.active {
  background: var(--accent);
  color: #fff;
}

.layout-btn svg {
  width: 16px;
  height: 16px;
}

/* ===== Grid Container ===== */
.grid-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

@media (min-width: 640px) {
  .grid-container {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

@media (min-width: 1024px) {
  .grid-container {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1440px) {
  .grid-container {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Masonry mode */
.grid-container.masonry {
  display: block;
  column-count: 2;
  column-gap: var(--gap);
}

@media (min-width: 640px) {
  .grid-container.masonry {
    column-count: 3;
    column-gap: 20px;
  }
}

@media (min-width: 1024px) {
  .grid-container.masonry {
    column-count: 4;
    column-gap: 24px;
  }
}

@media (min-width: 1440px) {
  .grid-container.masonry {
    column-count: 5;
  }
}

/* ===== Artwork Card ===== */
.artwork-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.grid-container.masonry .artwork-card {
  break-inside: avoid;
  margin-bottom: var(--gap);
}

@media (min-width: 640px) {
  .grid-container.masonry .artwork-card {
    margin-bottom: 20px;
  }
}

@media (min-width: 1024px) {
  .grid-container.masonry .artwork-card {
    margin-bottom: 24px;
  }
}

.artwork-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.artwork-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg-alt);
}

.grid-container.masonry .artwork-image-wrap {
  aspect-ratio: auto;
}

.artwork-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.3s ease;
  opacity: 0;
}

.grid-container.masonry .artwork-image {
  height: auto;
  object-fit: contain;
}

.artwork-image.loaded {
  opacity: 1;
}

.artwork-card:hover .artwork-image {
  transform: scale(1.04);
}

/* Skeleton placeholder */
.artwork-image-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--bg-alt) 25%, #eee 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.artwork-image-wrap.loaded::before {
  display: none;
}

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

.artwork-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

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

.artwork-overlay-info {
  color: #fff;
}

.artwork-overlay-title {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.artwork-overlay-id {
  font-size: 0.75rem;
  opacity: 0.7;
}

.artwork-category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  font-size: 0.6875rem;
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(4px);
  border-radius: 999px;
  color: var(--text);
  opacity: 0;
  transition: opacity 0.3s;
}

.artwork-card:hover .artwork-category-badge {
  opacity: 1;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 48px 0 16px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  cursor: pointer;
}

.page-btn:hover:not(:disabled):not(.active) {
  color: var(--text);
  background: var(--bg-alt);
}

.page-btn.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-ellipsis {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

.page-nav-btn {
  font-size: 1rem;
  font-weight: 600;
}

.page-info {
  width: 100%;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 8px;
  letter-spacing: 0.05em;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lightbox-image {
  max-width: 90vw;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
}

.lightbox-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
}

.lightbox-title {
  font-weight: 500;
}

.lightbox-id {
  opacity: 0.5;
  font-family: monospace;
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 2rem;
  color: rgba(255,255,255,0.6);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
}

.lightbox-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5rem;
  color: rgba(255,255,255,0.5);
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
  line-height: 1;
  padding-bottom: 6px;
}

.lightbox-nav:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}

.lightbox-prev {
  left: 24px;
}

.lightbox-next {
  right: 24px;
}

/* ===== About Section ===== */
.about-section {
  padding: 80px 24px;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
}

.about-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.about-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1.2;
  margin-bottom: 8px;
  color: var(--text);
}

.about-subtitle {
  font-size: 0.8125rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 28px;
}

.about-text {
  font-size: 0.9375rem;
  line-height: 2;
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
}

.footer-brand {
  flex-shrink: 0;
}

.footer-logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.08em;
}

.footer-tagline {
  margin-top: 4px;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-light);
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-label {
  font-size: 0.6875rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-light);
}

.contact-value {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
  transition: color 0.2s;
}

a.contact-value:hover {
  color: var(--accent-hover);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.75rem;
}

/* ===== Empty State ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-light);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state-text {
  font-size: 1rem;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-light);
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
