/* ==========================================================================
   THE GENESIS TOUCH · 30 Variations of Creation
   Renaissance Fresco & Contemporary Digital Museum Styling
   ========================================================================== */

:root {
  --bg-primary: #0d0f14;
  --bg-secondary: #141721;
  --bg-card: #181c28;
  --bg-card-hover: #1f2433;
  --bg-elevated: #242a3c;
  --border-subtle: rgba(212, 175, 55, 0.18);
  --border-strong: rgba(212, 175, 55, 0.45);
  
  --gold-primary: #d4af37;
  --gold-glow: #f3e5ab;
  --gold-dark: #aa820a;
  --text-primary: #f0f3f8;
  --text-secondary: #a0aec0;
  --text-muted: #718096;
  
  --accent-cyan: #38bdf8;
  --accent-emerald: #34d399;
  --accent-rose: #f43f5e;
  
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.7), 0 0 1px 1px var(--border-subtle);
  --shadow-hover: 0 20px 40px -10px rgba(212, 175, 55, 0.15), 0 0 2px 1px var(--gold-primary);
  --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="parchment"] {
  --bg-primary: #f8f5ee;
  --bg-secondary: #ede7dc;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfbf7;
  --bg-elevated: #e6dfd1;
  --border-subtle: rgba(160, 82, 45, 0.18);
  --border-strong: rgba(160, 82, 45, 0.45);
  
  --gold-primary: #8f5b1d;
  --gold-glow: #b87333;
  --gold-dark: #5c380c;
  --text-primary: #241d15;
  --text-secondary: #5c5243;
  --text-muted: #8c7e6c;
  
  --shadow-card: 0 8px 24px -6px rgba(92, 56, 12, 0.12), 0 0 1px 1px var(--border-subtle);
  --shadow-hover: 0 16px 36px -8px rgba(143, 91, 29, 0.22), 0 0 2px 1px var(--gold-primary);
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Cinzel', 'Noto Serif SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Georgia, serif;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Background Atmosphere */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle at 50% 15%, rgba(212, 175, 55, 0.08) 0%, transparent 60%),
              radial-gradient(circle at 85% 85%, rgba(56, 189, 248, 0.04) 0%, transparent 50%);
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

/* Hero Header */
.hero-header {
  padding: 70px 0 40px;
  text-align: center;
  position: relative;
}

.fresco-crest {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  letter-spacing: 2px;
  color: var(--gold-primary);
  text-transform: uppercase;
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.15;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--gold-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle-en {
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-style: italic;
  color: var(--gold-primary);
  letter-spacing: 2px;
  margin-bottom: 18px;
  opacity: 0.9;
}

.hero-desc {
  max-width: 780px;
  margin: 0 auto 36px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* Control Bar */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 36px;
  background: var(--bg-card);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-btn:hover {
  color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.08);
}

.filter-btn.active {
  background: var(--gold-primary);
  color: #0c0d11;
  font-weight: 600;
  border-color: var(--gold-primary);
  box-shadow: 0 2px 12px rgba(212, 175, 55, 0.3);
}

.utility-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 16px 8px 36px;
  border-radius: 999px;
  font-size: 0.88rem;
  outline: none;
  width: 180px;
  transition: var(--transition-smooth);
}

.search-input:focus {
  width: 240px;
  border-color: var(--gold-primary);
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.theme-toggle-btn:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  transform: rotate(20deg);
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 32px;
  margin-bottom: 70px;
}

/* Card */
.art-card {
  content-visibility: auto;
  contain: layout paint style;
  contain-intrinsic-size: 0 460px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
  cursor: pointer;
}

.art-card:hover {
  transform: translateY(-8px);
  border-color: var(--gold-primary);
  box-shadow: var(--shadow-hover);
}

.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--bg-secondary);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  display: block;
}

.art-card:hover .card-media img {
  transform: scale(1.05);
}

.card-badge-num {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--gold-primary);
  font-family: monospace;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 2;
}

.card-category-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 2;
}

.card-touch-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 16px;
  background: linear-gradient(to top, rgba(13, 15, 20, 0.95), transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--gold-glow);
  letter-spacing: 0.5px;
}

.touch-spark {
  color: var(--gold-primary);
  animation: pulse-spark 2s infinite ease-in-out;
}

@keyframes pulse-spark {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
}

.card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title-cn {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.card-title-en {
  font-size: 0.88rem;
  color: var(--gold-primary);
  margin-bottom: 14px;
  font-style: italic;
}

.card-meaning {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.tag-pill {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Modal / Lightbox */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 8, 11, 0.88);
  backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-container {
  background: var(--bg-card);
  border: 1px solid var(--gold-primary);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 25px rgba(212, 175, 55, 0.2);
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: scale(0.96) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-smooth);
}

.modal-close-btn:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
  transform: scale(1.1);
}

.modal-nav-btn {
  position: absolute;
  top: 40%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-subtle);
  color: var(--gold-primary);
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: var(--transition-smooth);
}

.modal-nav-btn:hover {
  background: var(--gold-primary);
  color: #0c0d11;
  transform: translateY(-50%) scale(1.1);
}

.modal-nav-prev { left: 16px; }
.modal-nav-next { right: 16px; }

.modal-content-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  min-height: 520px;
}

.modal-image-col {
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.modal-image-col img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: filter 0.25s ease-out;
}

.modal-info-col {
  padding: 40px 32px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-left: 1px solid var(--border-subtle);
}

.modal-num-badge {
  color: var(--gold-primary);
  font-family: monospace;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.modal-title-cn {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.modal-title-en {
  font-size: 1.1rem;
  font-style: italic;
  color: var(--gold-primary);
  margin-bottom: 24px;
}

.modal-touch-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
}

.touch-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.touch-val {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-glow);
}

.modal-meaning-text {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.modal-quote-box {
  border-left: 3px solid var(--gold-primary);
  padding-left: 16px;
  font-style: italic;
  color: var(--gold-primary);
  margin-bottom: 28px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-actions {
  margin-top: auto;
  display: flex;
  gap: 12px;
}

.btn-action {
  flex: 1;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition-smooth);
  text-decoration: none;
}

.btn-primary {
  background: var(--gold-primary);
  color: #0c0d11;
  border: 1px solid var(--gold-primary);
}

.btn-primary:hover {
  background: var(--gold-glow);
  transform: translateY(-2px);
}

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

.btn-secondary:hover {
  border-color: var(--gold-primary);
  color: var(--gold-primary);
}

/* Footer */
.gallery-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 50px 0 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-quote {
  font-style: italic;
  color: var(--gold-primary);
  max-width: 600px;
  margin: 0 auto 16px;
}

/* Responsive */
@media (max-width: 900px) {
  .modal-content-grid {
    grid-template-columns: 1fr;
  }
  .modal-image-col {
    max-height: 380px;
  }
  .modal-info-col {
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    padding: 24px;
  }
  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .utility-actions {
    justify-content: space-between;
  }
  .search-input {
    width: 100%;
  }
  .search-input:focus {
    width: 100%;
  }
}

@media (max-width: 600px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
  .hero-header {
    padding: 40px 0 24px;
  }
}
