/* Gallery page styles */
.gallery-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8rem 3rem 4rem;
  position: relative;
  z-index: 2;
}

.gallery-header {
  text-align: center;
  margin-bottom: 3rem;
}

.gallery-title {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.15;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gallery-lead {
  font-family: var(--font-lyric);
  font-style: italic;
  color: var(--text-dim);
  font-size: 1.2rem;
  letter-spacing: 0.05em;
}

/* Filters */
.gallery-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.gf-btn {
  padding: 0.5rem 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
}

.gf-btn:hover { color: var(--gold); border-color: var(--gold); }
.gf-btn.active {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}

.gf-search {
  margin-left: auto;
}

.gf-search input {
  padding: 0.5rem 1rem;
  background: rgba(10, 10, 15, 0.7);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  outline: none;
  width: 180px;
  transition: border-color 0.3s;
}

.gf-search input:focus { border-color: var(--gold); }

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

.gallery-card {
  position: relative;
  background: linear-gradient(165deg, rgba(16, 16, 22, 0.95) 0%, rgba(8, 8, 12, 0.9) 100%);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.45s cubic-bezier(.2,.9,.25,1);
  aspect-ratio: 3 / 4.5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.gallery-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-color, var(--gold));
  opacity: 0.4;
  transition: opacity 0.4s;
}

.gallery-card:hover {
  border-color: var(--card-color, var(--gold));
  transform: translateY(-6px);
  box-shadow: 0 15px 50px rgba(0,0,0,0.5), 0 0 30px color-mix(in srgb, var(--card-color, var(--gold)) 18%, transparent);
}

.gallery-card:hover::before { opacity: 1; }

.gallery-card-portrait {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-card-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  filter: brightness(0.55) saturate(0.85);
  transition: filter 0.4s;
}

.gallery-card:hover .gallery-card-portrait img {
  filter: brightness(0.75) saturate(1);
}

.gallery-card-symbol {
  font-size: 3rem;
  color: var(--card-color, var(--gold));
  opacity: 0.2;
  filter: drop-shadow(0 0 20px var(--card-color, var(--gold)));
}

.gallery-card-info {
  position: relative;
  z-index: 2;
  padding: 1rem 0.8rem;
  background: linear-gradient(180deg, transparent 0%, rgba(6, 6, 10, 0.97) 35%);
}

.gallery-card-role {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: var(--card-color, var(--gold));
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--card-color, var(--gold)) 30%, transparent);
  display: inline-block;
  border-radius: 2px;
}

.gallery-card-name {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
  transition: color 0.3s;
}

.gallery-card:hover .gallery-card-name { color: var(--card-color, var(--gold)); }

.gallery-card-zh {
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--card-color, var(--gold));
  opacity: 0.8;
}

.gallery-card-element {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  margin-top: 0.3rem;
  text-transform: uppercase;
}

/* Detail Panel */
.gallery-detail {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(6, 6, 10, 0.92);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: gdFadeIn 0.4s ease;
}

@keyframes gdFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gd-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: rgba(10, 10, 15, 0.8);
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 310;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

.gd-close:hover { color: var(--gold); border-color: var(--gold); }

.gd-inner {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 3rem;
  max-width: 1100px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(165deg, rgba(14, 14, 20, 0.98) 0%, rgba(8, 8, 12, 0.96) 100%);
  border: 1px solid var(--gd-color, var(--gold));
  padding: 2.5rem;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 165, 116, 0.3) transparent;
}

.gd-inner::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gd-color, var(--gold)), transparent);
  box-shadow: 0 0 16px var(--gd-color, var(--gold));
}

.gd-portrait {
  position: relative;
  height: 450px;
  background: linear-gradient(165deg, rgba(18, 18, 26, 0.6) 0%, rgba(10, 10, 15, 0.8) 100%);
  border: 1px solid var(--line);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
}

.gd-portrait img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 15%;
  filter: brightness(0.8) saturate(1.05);
  animation: charFloat 4.5s ease-in-out infinite;
}

@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.gd-symbol {
  font-size: 5rem;
  color: var(--gd-color, var(--gold));
  opacity: 0.15;
  filter: drop-shadow(0 0 30px var(--gd-color, var(--gold)));
}

.gd-header { margin-bottom: 1.5rem; }

.gd-name {
  font-family: var(--font-title);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text);
  margin: 0 0 0.3rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.gd-fullname {
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--gd-color, var(--gold));
  margin-bottom: 0.5rem;
}

.gd-role {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 3px 10px;
  border: 1px solid var(--line);
  display: inline-block;
  border-radius: 2px;
}

.gd-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed rgba(212, 165, 116, 0.12);
}

.gd-meta-item { display: flex; flex-direction: column; gap: 0.2rem; }
.gd-meta-label { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.25em; color: var(--gold); text-transform: uppercase; }
.gd-meta-value { font-size: 0.95rem; color: var(--text); }

/* Stats bars */
.gd-stats {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px dashed rgba(212, 165, 116, 0.12);
}

.gd-stat-row {
  display: grid;
  grid-template-columns: 80px 1fr 30px;
  align-items: center;
  gap: 0.8rem;
}

.gd-stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.gd-stat-bar {
  height: 6px;
  background: rgba(212, 165, 116, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.gd-stat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gd-color, var(--gold)) 0%, var(--gold-bright) 100%);
  border-radius: 3px;
  transition: width 0.8s cubic-bezier(.2,.9,.25,1);
  box-shadow: 0 0 8px var(--gd-color, var(--gold));
}

.gd-stat-val {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gold);
  text-align: right;
}

.gd-quote {
  border-left: 3px solid var(--gd-color, var(--gold));
  padding: 0.4rem 0 0.4rem 1.2rem;
  margin: 0 0 1.5rem;
  font-family: var(--font-lyric);
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--gd-color, var(--gold));
}

.gd-section { margin-bottom: 1.5rem; }

.gd-section-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.gd-bio, .gd-lore {
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text-dim);
  white-space: pre-line;
}

.gd-relationships { display: flex; flex-direction: column; gap: 0.6rem; }

.gd-rel {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0.8rem;
  background: rgba(18, 18, 26, 0.5);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.3s;
}

.gd-rel:hover { border-color: var(--gold); }

.gd-rel-symbol { font-size: 1.2rem; }
.gd-rel-name { font-family: var(--font-title); font-size: 0.95rem; letter-spacing: 0.1em; }
.gd-rel-type { font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.2em; color: var(--gold); text-transform: uppercase; }
.gd-rel-desc { font-size: 0.85rem; color: var(--text-dim); }

.gd-tracks { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.gd-track {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  padding: 4px 12px;
  background: rgba(212, 165, 116, 0.06);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--gold);
  text-transform: uppercase;
}

/* No results */
.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
}

/* Responsive */
@media (max-width: 768px) {
  .gallery-page { padding: 6rem 1.2rem 3rem; }
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .gallery-card-name { font-size: 0.9rem; }
  .gallery-filters { gap: 0.3rem; }
  .gf-btn { padding: 0.4rem 0.7rem; font-size: 0.6rem; }
  .gf-search { width: 100%; margin-left: 0; margin-top: 0.5rem; }
  .gf-search input { width: 100%; }

  .gd-inner { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem; }
  .gd-portrait { height: 250px; position: relative; }
  .gd-name { font-size: 1.8rem; }
  .gd-meta { grid-template-columns: 1fr; }
  .gallery-detail { padding: 0.5rem; }
}
