/* ==========================================================================
   DESIGN SYSTEM & CSS VARIABLES - ZMFAMILY SILSILAH & GALERI
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  /* Color Palette - Deep Heritage Emerald & Warm Gold */
  --bg-dark: #07130e;
  --bg-card: rgba(18, 43, 33, 0.7);
  --bg-card-hover: rgba(28, 64, 49, 0.85);
  --bg-surface: #0d2218;
  --border-color: rgba(212, 175, 55, 0.2);
  --border-glow: rgba(212, 175, 55, 0.5);
  
  --primary-gold: #d4af37;
  --primary-gold-light: #f7e089;
  --primary-gold-dark: #aa8513;
  --accent-emerald: #2d6a4f;
  --accent-emerald-light: #40916c;
  --accent-mint: #74c69d;
  
  --text-main: #f0f7f4;
  --text-muted: #a3c2b5;
  --text-gold: #f3c623;

  /* Glassmorphism & Shadows */
  --glass-bg: rgba(13, 34, 24, 0.65);
  --glass-border: 1px solid rgba(212, 175, 55, 0.25);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --gold-glow: 0 0 20px rgba(212, 175, 55, 0.25);
  
  /* Fonts & Radius */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --transition-fast: 0.2s ease;
  --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(45, 106, 79, 0.25) 0%, transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(212, 175, 55, 0.15) 0%, transparent 40%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: #ffffff;
  font-weight: 700;
  line-height: 1.25;
}

.text-gold {
  color: var(--primary-gold);
  background: linear-gradient(135deg, #ffe8a3 0%, #d4af37 50%, #997406 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Container */
.container {
  width: 92%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 19, 14, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: var(--glass-border);
  transition: var(--transition-normal);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 76px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-icon {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

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

.brand-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #fff;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--primary-gold-light);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  border-radius: var(--radius-full);
  transition: var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-gold);
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

/* ==========================================================================
   HERO SECTION
   ========================================================================== */
.hero-section {
  position: relative;
  padding: 80px 0 60px;
  text-align: center;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--primary-gold-light);
  font-weight: 600;
  margin-bottom: 24px;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  margin-bottom: 18px;
  letter-spacing: -0.5px;
}

.hero-description {
  max-width: 780px;
  margin: 0 auto 36px;
  font-size: 1.15rem;
  color: var(--text-muted);
  font-weight: 400;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 980px;
  margin: 40px auto 0;
}

.stat-card {
  background: var(--bg-card);
  border: var(--glass-border);
  backdrop-filter: blur(12px);
  padding: 24px 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  transition: var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-5px);
  border-color: var(--border-glow);
  box-shadow: var(--gold-glow);
}

.stat-number {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-gold);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ==========================================================================
   TAB SECTION LAYOUT & CARDS
   ========================================================================== */
.section {
  padding: 70px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.section-header {
  text-align: center;
  margin-bottom: 48px;
}

.section-tag {
  color: var(--primary-gold);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
  display: block;
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  margin-bottom: 12px;
}

.section-desc {
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
  font-size: 1.05rem;
}

/* ==========================================================================
   FAMILY TREE (SILSILAH) VISUALIZER & PDF DOCUMENTS
   ========================================================================== */
.silsilah-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
  margin-top: 32px;
}

.pdf-card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.pdf-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(to bottom, var(--primary-gold), var(--accent-emerald));
}

.pdf-card:hover {
  transform: translateY(-6px);
  background: var(--bg-card-hover);
  border-color: var(--border-glow);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.pdf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pdf-badge {
  background: rgba(212, 175, 55, 0.15);
  color: var(--primary-gold-light);
  border: 1px solid rgba(212, 175, 55, 0.3);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.pdf-icon {
  font-size: 2.2rem;
}

.pdf-title {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.pdf-desc {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  flex-grow: 1;
}

.pdf-actions {
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition-fast);
  border: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-gold), var(--primary-gold-dark));
  color: #07130e;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-gold-light), var(--primary-gold));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--primary-gold);
  color: var(--primary-gold);
}

/* Tree Lineage Overview Chart */
.tree-overview-card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-top: 40px;
}

.lineage-nodes {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}

.lineage-node {
  background: rgba(13, 34, 24, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition-fast);
}

.lineage-node:hover {
  border-color: var(--primary-gold);
  background: rgba(27, 67, 50, 0.6);
}

.node-info h4 {
  font-size: 1.15rem;
  color: var(--primary-gold-light);
  margin-bottom: 4px;
}

.node-info p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ==========================================================================
   GALLERY SECTION & FILTER TABS
   ========================================================================== */
.gallery-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 36px;
}

.search-box {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 50px;
  background: rgba(13, 34, 24, 0.8);
  border: var(--glass-border);
  border-radius: var(--radius-full);
  color: #fff;
  font-size: 1rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-input:focus {
  border-color: var(--primary-gold);
  box-shadow: var(--gold-glow);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.2rem;
}

.branch-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tab-btn {
  padding: 10px 20px;
  background: rgba(13, 34, 24, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover, .tab-btn.active {
  background: linear-gradient(135deg, var(--accent-emerald), var(--bg-surface));
  color: var(--text-gold);
  border-color: var(--primary-gold);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.tab-count {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
}

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

.gallery-card {
  position: relative;
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  cursor: pointer;
  transition: var(--transition-normal);
}

.gallery-card:hover {
  transform: scale(1.03);
  border-color: var(--primary-gold);
  box-shadow: var(--gold-glow);
  z-index: 2;
}

.gallery-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition-normal);
}

.gallery-card:hover .gallery-thumb {
  transform: scale(1.08);
}

.media-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7, 19, 14, 0.9) 0%, transparent 60%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px;
  opacity: 0;
  transition: var(--transition-fast);
}

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

.gallery-caption {
  font-size: 0.88rem;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-sub {
  font-size: 0.75rem;
  color: var(--primary-gold-light);
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
}

.page-btn {
  padding: 8px 16px;
  background: var(--bg-card);
  border: var(--glass-border);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary-gold);
  color: var(--primary-gold);
}

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

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

/* ==========================================================================
   FAMILY HISTORY & LEGACY SECTION
   ========================================================================== */
.history-timeline {
  position: relative;
  max-width: 800px;
  margin: 40px auto 0;
  padding-left: 30px;
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--primary-gold), var(--accent-emerald-light));
}

.timeline-item {
  position: relative;
  margin-bottom: 36px;
}

.timeline-dot {
  position: absolute;
  left: -37px;
  top: 4px;
  width: 17px;
  height: 17px;
  background: var(--primary-gold);
  border: 3px solid var(--bg-dark);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary-gold);
}

.timeline-card {
  background: var(--bg-card);
  border: var(--glass-border);
  padding: 24px;
  border-radius: var(--radius-md);
}

.timeline-title {
  color: var(--primary-gold);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.timeline-text {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ==========================================================================
   MODAL WINDOWS (LIGHTBOX & PDF VIEWER)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition-normal);
}

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

.modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  transition: var(--transition-fast);
  z-index: 1010;
}

.modal-close:hover {
  background: rgba(212, 175, 55, 0.3);
  color: var(--primary-gold);
}

/* Lightbox Modal */
.lightbox-container {
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-media {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
}

.lightbox-caption {
  margin-top: 16px;
  color: var(--primary-gold-light);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
}

/* PDF Viewer Modal */
.pdf-modal-container {
  width: 92vw;
  height: 90vh;
  background: var(--bg-surface);
  border: var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pdf-modal-header {
  padding: 16px 24px;
  background: rgba(7, 19, 14, 0.9);
  border-bottom: var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pdf-modal-title {
  color: var(--primary-gold-light);
  font-size: 1.2rem;
}

.pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  background: rgba(5, 14, 10, 0.95);
  border-top: var(--glass-border);
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-gold {
  color: var(--primary-gold);
  font-weight: 600;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 76px;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: var(--glass-border);
    flex-direction: column;
    padding: 20px;
    gap: 10px;
    display: none;
  }
  .nav-links.mobile-open {
    display: flex;
  }
  .mobile-toggle {
    display: block;
  }
  .silsilah-grid {
    grid-template-columns: 1fr;
  }
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
