/* Heritage OS + Legacy Vault — cinematic premium layer */

.heritage-shell {
  max-width: 1120px;
}

.heritage-hero {
  text-align: center;
  margin-bottom: 32px;
  padding: 28px 16px 8px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(201, 168, 76, 0.14), transparent 55%),
    linear-gradient(180deg, #121218 0%, transparent 100%);
  border-radius: 20px;
}

.heritage-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 5vw, 40px);
  color: var(--ivory, #f7f4ec);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  margin-bottom: 10px;
}

.heritage-sub,
.text-readable {
  color: var(--soft-white, #efece4);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
  line-height: 1.6;
}

.heritage-section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  color: var(--gold, #c9a84c);
  margin: 0 0 14px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.heritage-stat-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}

.heritage-stat-chip {
  border: 1px solid rgba(201, 168, 76, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ivory, #f7f4ec);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  min-height: 36px;
}

.heritage-module-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  justify-content: center;
}

.heritage-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--soft-white, #efece4);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  min-height: 44px;
}

.heritage-tab.active {
  border-color: var(--gold, #c9a84c);
  color: var(--gold, #c9a84c);
  background: rgba(201, 168, 76, 0.12);
}

.heritage-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.heritage-module-card {
  background: linear-gradient(165deg, #17171f 0%, #0c0c10 100%);
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 16px;
  padding: 20px;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  color: var(--ivory, #f7f4ec);
}

.heritage-module-card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}

.heritage-module-card h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  margin: 8px 0 8px;
  color: var(--ivory, #f7f4ec);
}

.heritage-module-card p {
  color: var(--soft-white, #efece4);
  font-size: 13px;
  line-height: 1.55;
  margin-bottom: 12px;
  opacity: 0.92;
}

.heritage-module-icon {
  font-size: 28px;
  filter: drop-shadow(0 2px 6px rgba(201, 168, 76, 0.25));
}

.heritage-module-meta {
  font-size: 12px;
  color: var(--gold-light, #e8c97a);
  margin-bottom: 12px;
}

.heritage-surface {
  background: #121218 !important;
  color: var(--ivory, #f7f4ec);
}

.heritage-surface h3 {
  color: var(--ivory, #f7f4ec);
}

.heritage-timeline .card,
.heritage-shell .card {
  background: #14141c;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--ivory, #f7f4ec);
}

.heritage-tree-board {
  min-height: 280px;
  padding: 16px;
  border-radius: 16px;
  border: 1px dashed rgba(201, 168, 76, 0.3);
  background:
    radial-gradient(circle at 20% 20%, rgba(201, 168, 76, 0.08), transparent 40%),
    #0d0d12;
  position: relative;
  overflow: auto;
}

.heritage-tree-node {
  position: absolute;
  width: 132px;
  padding: 12px 10px;
  border-radius: 12px;
  background: #1a1a24;
  border: 1px solid rgba(201, 168, 76, 0.35);
  text-align: center;
  cursor: grab;
  color: var(--ivory, #f7f4ec);
  touch-action: none;
  user-select: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.heritage-tree-node:active {
  cursor: grabbing;
  border-color: var(--gold, #c9a84c);
  box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.4), 0 12px 28px rgba(0, 0, 0, 0.45);
}

.heritage-tree-node .avatar {
  font-size: 26px;
  margin-bottom: 4px;
}

.heritage-tree-edges {
  margin-top: 12px;
  font-size: 12px;
  color: var(--soft-white, #efece4);
}

.heritage-constellation,
.heritage-genome {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 14px;
  min-height: 36px;
}

.heritage-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.heritage-gene-bar {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex: 1;
  min-width: 80px;
}

.heritage-gene-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim, #7a6530), var(--gold, #c9a84c));
}

.heritage-storylines .story-card {
  border-left: 3px solid var(--gold, #c9a84c);
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 12px 12px 0;
}

.memorial-candle-row {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-top: 24px;
}

.memorial-candle {
  width: 10px;
  height: 28px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, #ffe6a0, #c9a84c 40%, #3a2a10);
  position: relative;
  animation: candle-flicker 2.4s ease-in-out infinite;
}

.memorial-candle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 12px;
  border-radius: 50% 50% 20% 20%;
  background: radial-gradient(circle, #fff6c8 0%, #ffb347 55%, transparent 70%);
  animation: candle-flame 1.6s ease-in-out infinite;
}

@keyframes candle-flicker {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

@keyframes candle-flame {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); }
}

.nav-center {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 6px;
  margin: 0 8px;
}

/* Dynamic contrast helpers */
.surface-dark,
.heritage-shell,
.legacy-shell,
#view-dashboard .card,
#view-archive,
.vault-card {
  color: var(--ivory, #f7f4ec);
}

.surface-light {
  background: #f4f1ea;
  color: #1a1a1f;
}

.surface-light .text-muted,
.surface-light .text-readable {
  color: #3a3a44 !important;
  text-shadow: none;
}

#view-dashboard .stat-card,
#view-dashboard .card {
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}

#view-dashboard .stat-label,
#view-dashboard .text-muted {
  color: var(--muted, #b4b0a6) !important;
}

@media (max-width: 768px) {
  .heritage-module-grid {
    grid-template-columns: 1fr;
  }
  .heritage-title {
    font-size: 28px;
  }
  .nav-center {
    display: none;
  }
  .heritage-tree-node {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100%;
    margin-bottom: 8px;
  }
}
