/* ============================================
   PROVENCIO FAMILY GENEALOGY
   Spanish Colonial / Colonial America / Ozarks
   Heritage Theme
   ============================================ */

:root {
  /* === Heritage Color Palette === */
  /* Terracotta / Adobe (Spanish colonial) */
  --terracotta: #C2563A;
  --terracotta-dark: #9E3F27;
  --terracotta-light: #D9755A;
  
  /* Warm Gold (Colonial warmth) */
  --gold: #C9A84C;
  --gold-light: #E2C97E;
  --gold-dark: #A6872F;
  
  /* Sage / Olive (Ozarks mountains) */
  --sage: #6B7F5E;
  --sage-light: #8FA07E;
  --sage-dark: #4A5C3E;
  
  /* Earth tones */
  --earth: #8B6914;
  --earth-dark: #5C4510;
  --parchment: #F5EDDA;
  --parchment-dark: #E8DCC4;
  
  /* Dark backgrounds */
  --bg-primary: #1A1612;
  --bg-secondary: #2A2320;
  --bg-card: #2E2622;
  --bg-card-hover: #3D3430;
  --bg-warm: #231E1A;
  
  /* Text */
  --text-primary: #F0E6D4;
  --text-secondary: #B8A694;
  --text-muted: #7A6B5D;
  --text-accent: #E2C97E;
  
  /* Borders & accents */
  --border: #3D3430;
  --border-light: #4A4038;
  --border-gold: #5C4510;
  --accent: #C9A84C;
  --accent-hover: #E2C97E;
  --success: #7B9A5E;
  --warning: #C9A84C;
  --danger: #C2563A;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-gold: 0 0 20px rgba(201,168,76,0.15);
}

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

body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  background-image: 
    radial-gradient(ellipse at 20% 50%, rgba(194,86,58,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201,168,76,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(107,127,94,0.03) 0%, transparent 50%);
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); text-decoration: underline; }

/* ============================================
   DECORATIVE ELEMENTS
   ============================================ */

/* Spanish tile-inspired decorative divider */
.ornament-divider {
  text-align: center;
  margin: 24px 0;
  color: var(--gold);
  font-size: 1.2rem;
  letter-spacing: 12px;
  opacity: 0.6;
}

.ornament-divider::before {
  content: "◆ ◇ ◆ ◇ ◆";
}

/* Colonial-style ornamental section header */
.section-ornament {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.section-ornament::before,
.section-ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border-gold), transparent);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */

header {
  background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(42,35,32,0.95) 100%);
  border-bottom: 2px solid var(--border-gold);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

header::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-title::before {
  content: "🌿";
  font-size: 1.2rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  transition: color 0.2s;
}

.header-nav a:hover, .header-nav a.active {
  color: var(--gold);
}

/* ============================================
   SEARCH
   ============================================ */

.search-container {
  position: relative;
}

#header-search, #home-search, #tree-search, #sidebar-search {
  background: var(--bg-warm);
  border: 1px solid var(--border-gold);
  border-radius: 20px;
  padding: 7px 16px;
  color: var(--text-primary);
  font-size: 0.85rem;
  width: 220px;
  outline: none;
  transition: all 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#header-search:focus, #home-search:focus, #tree-search:focus, #sidebar-search:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
  width: 260px;
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  max-height: 350px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  box-shadow: var(--shadow);
}

.search-result-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.search-result-item:hover {
  background: var(--bg-card-hover);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-name {
  font-weight: 600;
  color: var(--text-primary);
}

.search-result-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ============================================
   HERO SECTION
   ============================================ */

main {
  max-width: 960px;
  margin: 0 auto;
  padding: 32px 24px;
}

main.person-page {
  max-width: 1200px;
  grid-template-columns: 260px 1fr;
  display: grid;
  gap: 24px;
  padding: 24px;
}

.hero {
  text-align: center;
  padding: 60px 0 48px;
  border-bottom: 2px solid var(--border-gold);
  margin-bottom: 48px;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--terracotta-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.15rem;
  margin-bottom: 40px;
  font-style: italic;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.stat-card {
  text-align: center;
  padding: 24px 40px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border-gold);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--terracotta), var(--gold), var(--sage));
}

.stat-number {
  display: block;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.stat-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   SURNAME GRID
   ============================================ */

.browse-section {
  margin-bottom: 48px;
}

.browse-section h2 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  color: var(--text-primary);
  position: relative;
  padding-left: 20px;
}

.browse-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: linear-gradient(to bottom, var(--terracotta), var(--gold));
  border-radius: 2px;
}

.surname-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.surname-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.surname-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold);
  color: var(--text-primary);
  text-decoration: none;
  box-shadow: var(--shadow-gold);
}

.surname-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-warm);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* ============================================
   PEOPLE TABLE
   ============================================ */

.tree-page {
  max-width: 100%;
  overflow-x: auto;
}

.people-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.people-table thead {
  background: var(--bg-warm);
}

.people-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-gold);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.people-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.people-table tr:last-child td {
  border-bottom: none;
}

.people-table tr:hover {
  background: var(--bg-card-hover);
}

.page-desc {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-style: italic;
}

/* ============================================
   INDIVIDUAL PAGE
   ============================================ */

.person-header {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 28px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  margin-bottom: 24px;
}

.person-identity {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.photo-area img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--border-gold);
  box-shadow: var(--shadow);
}

.photo-placeholder {
  width: 120px;
  height: 120px;
  border-radius: var(--radius);
  border: 2px dashed var(--border-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.person-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.sex-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sex-badge.Male { background: #1e3a5f; color: #93c5fd; }
.sex-badge.Female { background: #4a1942; color: #fda4af; }

.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  margin-left: 8px;
}

.status-badge.alive { background: #145324; color: #86efac; }
.status-badge.deceased { background: #44403c; color: #d6d3d1; }

/* ============================================
   CARDS
   ============================================ */

.vitals-card, .confidence-card, .evidence-card, .relationships-section, .notes-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
}

.vitals-card::before, .confidence-card::before, .evidence-card::before, .relationships-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
}

.vitals-card::before {
  background: linear-gradient(to right, var(--terracotta), var(--gold));
}

.confidence-card::before {
  background: linear-gradient(to right, var(--gold), var(--sage));
}

.evidence-card::before {
  background: linear-gradient(to right, var(--sage), var(--gold));
}

.relationships-section::before {
  background: linear-gradient(to right, var(--terracotta-light), var(--gold-light), var(--sage));
}

.vitals-card h2, .confidence-card h2, .evidence-card h2,
.relationships-section h2, .notes-card h2 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--text-primary);
  position: relative;
  padding-left: 16px;
}

.vitals-card h2::before, .confidence-card h2::before, .evidence-card h2::before,
.relationships-section h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 4px;
  background: var(--gold);
  border-radius: 2px;
}

/* ============================================
   VITALS GRID
   ============================================ */

.vitals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.vital-item {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.vital-item:last-child {
  border-bottom: none;
}

.vital-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.vital-value {
  color: var(--text-primary);
  font-size: 1rem;
}

/* ============================================
   CONFIDENCE METER
   ============================================ */

.confidence-meter {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.confidence-track {
  flex: 1;
  height: 10px;
  background: var(--bg-warm);
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.confidence-bar {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(to right, var(--terracotta), var(--gold));
  transition: width 0.5s ease;
}

.confidence-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 60px;
  text-align: right;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.confidence-level {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-left: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.confidence-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   EVIDENCE
   ============================================ */

.evidence-card h2 {
  display: flex;
  align-items: center;
  gap: 12px;
}

.evidence-count {
  font-size: 0.8rem;
  background: var(--gold);
  color: var(--bg-primary);
  padding: 2px 10px;
  border-radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 700;
}

.evidence-item {
  padding: 16px;
  margin-bottom: 12px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--gold);
  transition: border-color 0.2s;
}

.evidence-item:hover {
  border-left-color: var(--gold-light);
}

.evidence-item:last-child {
  margin-bottom: 0;
}

.evidence-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.evidence-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.evidence-notes {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.no-evidence {
  color: var(--text-muted);
  font-style: italic;
}

/* ============================================
   RELATIONSHIPS
   ============================================ */

.rel-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.rel-group h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  margin-bottom: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.rel-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rel-link {
  display: inline-block;
  padding: 4px 12px;
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.rel-link:hover {
  background: var(--gold);
  color: var(--bg-primary);
  border-color: var(--gold);
  text-decoration: none;
}

/* ============================================
   NOTES
   ============================================ */

.notes-card {
  background: var(--bg-warm);
  border-left: 3px solid var(--terracotta);
}

.notes-card p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-style: italic;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.sidebar h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gold);
  border-bottom: 1px solid var(--border-gold);
  padding-bottom: 8px;
  letter-spacing: 0.05em;
}

.sidebar-section {
  margin-bottom: 16px;
}

.sidebar-section h4 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-list a {
  display: block;
  padding: 5px 10px;
  color: var(--text-secondary);
  font-size: 0.83rem;
  border-radius: 6px;
  transition: all 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sidebar-list a:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  text-decoration: none;
  padding-left: 14px;
}

.sidebar-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sidebar-nav {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.sidebar-link {
  flex: 1;
  text-align: center;
  padding: 6px 8px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sidebar-link:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  text-decoration: none;
  border-color: var(--gold);
}

.sidebar-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  max-height: 250px;
  overflow-y: auto;
  display: none;
  z-index: 200;
  box-shadow: var(--shadow);
  margin-top: 4px;
}

.person-body {
  min-width: 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 900px) {
  main.person-page {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 768px) {
  main {
    padding: 20px 16px;
  }
  main.person-page {
    padding: 16px;
    gap: 16px;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero-stats {
    gap: 16px;
  }
  .stat-card {
    padding: 16px 24px;
  }
  .person-identity {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .rel-groups {
    grid-template-columns: 1fr;
  }
  #header-search, #home-search, #tree-search {
    width: 160px;
  }
  .header-nav {
    gap: 16px;
  }
}

@media (max-width: 480px) {
  main { padding: 16px 12px; }
  main.person-page { padding: 12px; }
  #header-search, #home-search, #tree-search { width: 130px; }
  .header-content { height: 56px; }
  .site-title { font-size: 1.1rem; }
  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 1.6rem; }
}
