/* ===== GLOBAL VARIABLES ===== */
:root {
  --col-gap: 80px;
}

/* ===== BASE STYLES ===== */
body {
  background-color: #f5f0e6;
  background-image: url("../parchment.png");
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-position: center;
  font-family: "Georgia", serif;
  color: #4b3b2a;
  margin: 40px;
  line-height: 1.6;
}

/* ===== PAGE CONTAINER ===== */
.page {
  max-width: 1000px;
  margin: auto;
  background: #fffdf7;
  padding: 40px;
  box-shadow: 0 0 30px rgba(0,0,0,.35);
  border: 1px solid #d8c8a8;
}

/* ===== HEADINGS ===== */
h1 {
  font-size: 40px;
  border-bottom: 2px solid #8b6f47;
  padding-bottom: 10px;
  color: #4b3b2a;
}

h2 {
  color: #5b3a1a;
  margin-top: 25px;
  border-left: 5px solid #8b6f47;
  padding-left: 15px;
}

h3 {
  color: #6b5a4a;
  margin-top: 20px;
}

/* ===== NAVIGATION ===== */
.nav {
  margin-bottom: 20px;
  font-weight: bold;
  position: relative;
}

.nav a {
  color: #5b3a1a;
  text-decoration: none;
  padding: 5px 10px;
}

.nav a:hover {
  text-decoration: underline;
  background-color: rgba(139, 111, 71, 0.1);
  border-radius: 4px;
}

/* ===== PEDIGREE CHART LAYOUT ===== */
.chart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--col-gap);
  margin-top: 20px;
  min-height: 800px;
  position: relative;
}

.gen-column {
  display: grid;
  grid-template-rows: repeat(8, 1fr);
  height: 100%;
  position: relative;
  padding-top: 40px; /* space for title */
}

.gen-title {
  position: absolute;
  top: 0;
  width: 100%;
  text-align: center;
  font-weight: bold;
  color: #5b3a1a;
  font-size: 1.1em;
}

/* ===== PERSON BOX STYLING ===== */
.person-box {
  position: relative;
  border: 1px solid #8b6f47;
  background: linear-gradient(#f3ead7, #e0d2b8);
  padding: 8px;
  font-size: 13px;
  text-align: center;
  min-height: 70px;
  border-radius: 8px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all 0.2s ease;
}

.person-box:hover {
  transform: scale(1.03);
  box-shadow: 3px 3px 10px rgba(0,0,0,0.3);
  background: linear-gradient(#e8dcc5, #d5c6a8);
}

.person-box strong {
  display: block;
  font-size: 14px;
  color: #3a2c1b;
}

.person-id {
  font-size: 11px;
  color: #6b5b45;
  border-bottom: 1px dashed #8b6f47;
  margin-bottom: 3px;
  padding-bottom: 2px;
}

.person-place {
  font-size: 11px;
  color: #5f4a32;
  margin-top: 4px;
  font-style: italic;
}

.person-box.empty {
  border: 1px dashed #aaa;
  background: #f5f1e8;
  border-radius: 8px;
  color: #6b5a4a;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
}

/* ===== CONNECTOR SYSTEM ===== */
/* horizontal line */
.person-box::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--col-gap));
  transform: translateY(-50%);
  width: var(--col-gap);
  height: 2px;
  background: #8b6f47;
  pointer-events: none;
}

/* vertical connector */
.person-box::before {
  content: "";
  position: absolute;
  right: calc(-1 * var(--col-gap));
  width: 2px;
  background: #8b6f47;
  pointer-events: none;
}

/* Top person in pair (father) */
.person-box.pair-top::before {
  top: 20%;
  height: calc(70% - 1px);
}

/* Bottom person in pair (mother) */
.person-box:not(.pair-top)::before {
  bottom: 20%;
  height: calc(70% - 1px);
}

/* remove last column lines */
.gen-column:last-child .person-box::before,
.gen-column:last-child .person-box::after {
  display: none;
}

#chart {
  position: relative;
}

/* ===== PERSON PAGE STYLES ===== */
.person-detail {
  background: #fff9e6;
  border: 2px solid #8b6f47;
  border-radius: 12px;
  padding: 30px;
  max-width: 800px;
  margin: 20px auto;
  box-shadow: 5px 5px 15px rgba(0,0,0,0.2);
}

.profilePhoto {
  max-width: 220px;
  margin: 10px 0;
  border: 2px solid #8b6f47;
  padding: 4px;
  background: white;
}

#refNumber {
  font-size: 14px;
  color: #6b5b45;
  margin-bottom: 10px;
}

.info-section {
  margin: 20px 0;
  padding: 15px;
  background: rgba(245, 240, 230, 0.6);
  border-radius: 8px;
  border-left: 5px solid #8b6f47;
}

.info-section h3 {
  color: #5b3a1a;
  margin-bottom: 15px;
  border-bottom: 1px solid #8b6f47;
  padding-bottom: 5px;
}

.info-grid {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  margin: 10px 0;
}

.info-label {
  font-weight: bold;
  color: #5b3a1a;
}

/* ===== PHOTO GALLERY ===== */
.photoGallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.thumbnail {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 1px solid #8b6f47;
  padding: 3px;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.thumbnail:hover {
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border: 5px solid white;
}

/* ===== CENSUS STYLES ===== */
.censusRecord {
  border-left: 4px solid #8b6b3d;
  padding: 10px;
  margin-bottom: 18px;
  background: #efe9dd;
  border-radius: 0 8px 8px 0;
}

.censusHeader {
  font-weight: bold;
  cursor: pointer;
  color: #5a3d1e;
}

.censusToggle {
  float: right;
}

.censusBody {
  display: none;
  margin-top: 8px;
}

.censusViewBtn {
  margin-top: 10px;
  padding: 6px 10px;
  background: #8b6b3d;
  color: white;
  border: none;
  cursor: pointer;
  border-radius: 4px;
}

.censusViewBtn:hover {
  background: #6b4f2d;
}

#censusViewer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#censusViewer img {
  max-width: 90%;
  max-height: 90%;
  box-shadow: 0 0 20px #000;
}

#censusClose {
  position: absolute;
  top: 25px;
  right: 35px;
  color: white;
  font-size: 32px;
  cursor: pointer;
}

#censusNav {
  position: absolute;
  bottom: 25px;
  color: white;
  font-size: 18px;
}

#censusNav button {
  padding: 6px 10px;
  margin: 0 10px;
  background: #8b6b3d;
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 4px;
}

/* ===== SEARCH ===== */
.searchResults {
  display: none;
  list-style: none;
  padding: 5px;
  margin: 0;
  background: #fff;
  border: 1px solid #ccc;
  width: 200px;
  position: absolute;
  top: 28px;
  left: 140px;
  z-index: 1000;
}

.searchResults li {
  padding: 4px;
  cursor: pointer;
}

.searchResults li:hover {
  background: #eee;
}

mark {
  background: yellow;
  padding: 2px;
}

/* ===== DOCUMENTS ===== */
.document {
  padding: 8px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 6px;
}

#documents h3 {
  margin-top: 20px;
  border-bottom: 1px solid #8b6f47;
  padding-bottom: 4px;
}

/* ===== LEGEND ===== */
.legend {
  background: white;
  padding: 10px;
  line-height: 18px;
  color: #333;
  border-radius: 6px;
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
  font-size: 14px;
}

/* ===== UTILITY CLASSES ===== */
.directAncestor {
  background: #e6ffe6;
  padding: 2px 4px;
  border-radius: 4px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
  .chart {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  
  .gen-column {
    padding-top: 30px;
  }
  
  :root {
    --col-gap: 40px;
  }
}

@media (max-width: 768px) {
  body {
    margin: 20px;
  }
  
  .page {
    padding: 20px;
  }
  
  h1 {
    font-size: 30px;
  }
  
  .info-grid {
    grid-template-columns: 1fr;
  }
  
  .profilePhoto {
    max-width: 100%;
  }
}
/* DISABLE OLD STRAIGHT LINES - we're using SVG curved lines now */
.person-box::before, 
.person-box::after {
    display: none !important;
}

/* Style for the pedigree button on person page */
.btn-chart {
  background: #8b7a66;
  color: #f4ecd8;
  border: 1px solid #5a4a3f;
  padding: 8px 20px;
  font-size: 16px;
  font-family: "Georgia", serif;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  margin-top: 10px;
}

.btn-chart:hover {
  background: #5a4a3f;
  color: #ffd700;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-chart:active {
  transform: translateY(0px);
}
/* Family Story Section */
.family-story-section {
    margin: 40px 0;
}

.story-card {
    background: #fff9e6;
    border: 2px solid #8b6f47;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.1);
}

.story-card p {
    line-height: 1.8;
    margin-bottom: 20px;
    color: #4b3b2a;
}

.story-card blockquote {
    margin: 20px 40px;
    padding: 15px 25px;
    background: #f4ecd8;
    border-left: 4px solid #8b6f47;
    font-style: italic;
    color: #5b3a1a;
}

.signature {
    text-align: right;
    font-family: "Georgia", serif;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0d2b8;
}

@media (max-width: 768px) {
    .story-card {
        padding: 20px;
    }
    
    .story-card blockquote {
        margin: 15px 20px;
        padding: 10px 15px;
    }
}