/* ==========================================================================
   The Film Examiner - Archival Entity Enrichment Styles
   Personal Details, Wikipedia TOC Accordions, Wikimedia Commons Masonry, Lightbox
   ========================================================================== */

/* Enrichment Loading & Empty States */
.enrich-loading {
  background: #0D111A;
  border: 1px dashed #2A364F;
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 1.5rem 0;
}
.enrich-spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #2A364F;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.enrich-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
  font-style: italic;
}

/* 1. Personal Details & Genealogical Truth Card */
.personal-details-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--gold);
  border-radius: 8px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}
.details-card-title {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.15rem;
  margin-bottom: 1.25rem;
  letter-spacing: 0.5px;
}
.facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.fact-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.fact-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.fact-value {
  font-size: 0.95rem;
  color: #F1F5F9;
  font-weight: 500;
  line-height: 1.5;
}

/* 2. Wikipedia Interactive Table of Contents */
.toc-container {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}
.toc-header {
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}
.toc-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}
.toc-badge {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFF;
}
.toc-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}
.toc-tree {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.toc-item {
  border-radius: 6px;
  overflow: hidden;
}
.toc-sub {
  margin-left: 1.5rem;
}
.toc-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  background: #0E131E;
  border: 1px solid #1A2234;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.toc-row:hover {
  background: #151D2D;
  border-color: var(--gold);
}
.toc-row.active {
  background: #182236;
  border-color: var(--gold);
}
.toc-caret {
  font-size: 0.75rem;
  color: var(--gold);
  width: 14px;
  flex-shrink: 0;
}
.toc-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--gold);
  flex-shrink: 0;
}
.toc-label {
  font-size: 0.92rem;
  color: #E2E8F0;
  font-weight: 500;
}
.toc-content {
  background: #0A0D14;
  border: 1px solid #1E273A;
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 1.25rem 1.5rem;
  margin-top: -2px;
  margin-bottom: 0.5rem;
  color: #CBD5E1;
  font-size: 0.95rem;
  line-height: 1.8;
  animation: fadeIn 0.2s ease-out;
}
.toc-content p {
  margin-bottom: 1rem;
}
.toc-content p:last-child {
  margin-bottom: 0;
}
.sec-loading {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* 3. Wikimedia Commons Archival Media Masonry */
.commons-container {
  margin-bottom: 3rem;
}
.gallery-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.gallery-badge {
  font-family: 'Cinzel', serif;
  font-size: 1.3rem;
  color: var(--gold);
  border-left: 4px solid var(--gold);
  padding-left: 0.75rem;
}
.gallery-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.gallery-subtitle {
  width: 100%;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
.commons-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}
.commons-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}
.commons-card:hover {
  border-color: var(--gold);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.commons-img-wrap {
  width: 100%;
  height: 220px;
  background: #000;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.commons-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.commons-card:hover .commons-img-wrap img {
  transform: scale(1.05);
}
.commons-dims {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #E2E8F0;
  font-size: 0.68rem;
  font-family: 'JetBrains Mono', monospace;
  padding: 2px 6px;
  border-radius: 4px;
  backdrop-filter: blur(4px);
}
.commons-meta {
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}
.commons-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #FFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.commons-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.commons-card-lic {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* 4. Lightbox Modal */
.fe-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.2s ease-out;
}
.lightbox-dialog {
  background: #10141F;
  border: 1px solid var(--gold);
  border-radius: 12px;
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}
.lightbox-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--card-border);
  color: #FFF;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: all 0.2s;
}
.lightbox-close:hover {
  background: var(--gold);
  color: #000;
}
.lightbox-img-box {
  background: #000;
  max-height: 55vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.lightbox-img-box img {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}
.lightbox-details {
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.lightbox-details h3 {
  font-family: 'Cinzel', serif;
  color: #FFF;
  font-size: 1.3rem;
}
.lightbox-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.lightbox-desc {
  color: #CBD5E1;
  font-size: 0.92rem;
  line-height: 1.6;
}
.lightbox-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--card-border);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================================
   Commons Subcategory Navigation & Child Drawers
   ========================================================================= */
.commons-subcat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem 0;
  align-items: center;
}

.subcat-pill {
  border: 1px solid #2A364F;
  background: #0D111A;
  color: #94A3B8;
  border-radius: 9999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  font-family: inherit;
}

.subcat-pill:hover {
  background: #161E2D;
  border-color: rgba(212, 175, 55, 0.5);
  color: #FFF;
  transform: translateY(-1px);
}

.subcat-pill.active {
  background: rgba(212, 175, 55, 0.12);
  border-color: #D4AF37;
  color: #F59E0B;
  font-weight: 600;
  box-shadow: 0 0 12px rgba(212, 175, 55, 0.18);
}

.subcat-count-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
}

.subcat-pill.active .subcat-count-badge {
  background: rgba(212, 175, 55, 0.25);
  color: #F59E0B;
}

.commons-child-drawer {
  width: 100%;
  background: #0A0D14;
  border: 1px solid #233047;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin: -0.5rem 0 1.25rem 0;
  animation: fadeIn 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.child-drawer-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Cinzel', serif;
}

.child-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.child-pill {
  background: #111724;
  border: 1px solid #25334C;
  border-radius: 6px;
  color: #CBD5E1;
  font-size: 0.75rem;
  padding: 4px 9px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}

.child-pill:hover {
  background: #1A2436;
  border-color: var(--gold);
  color: #FFF;
}

.child-pill.active {
  background: rgba(212, 175, 55, 0.2);
  border-color: #D4AF37;
  color: #F59E0B;
  font-weight: 600;
}

/* =========================================================================
   Commons Archival Video Cards & Lightbox Player
   ========================================================================= */
.commons-card-video {
  border-color: rgba(229, 9, 20, 0.45);
}

.commons-card-video:hover {
  border-color: #E50914;
  box-shadow: 0 10px 30px rgba(229, 9, 20, 0.35);
}

.video-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease;
  pointer-events: none;
}

.commons-card:hover .video-play-overlay {
  background: rgba(0, 0, 0, 0.15);
}

.video-play-icon {
  width: 50px;
  height: 50px;
  background: rgba(229, 9, 20, 0.9);
  color: #FFF;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  padding-left: 3px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, background 0.2s ease;
}

.commons-card:hover .video-play-icon {
  transform: scale(1.15);
  background: #E50914;
}

.commons-type-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  background: #E50914;
  color: #FFF;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
  z-index: 2;
}

.lightbox-video-box {
  width: 100%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
}

.lightbox-video-box video {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
}
