/* =========================
   GENEALOGY LAYOUT
========================= */

.genealogy {
    margin-top: 3rem;
}

.genealogy-section {
    max-width: 700px;
    margin: 3rem auto;
}

.genealogy-section h2 {
    margin-bottom: 0.8rem;
}

.page-genealogy .genealogy-intro {
    max-width: 720px;
    text-align: left;
    margin: 2rem auto 3rem;
}

.genealogy-search {
    margin-bottom: 2rem;
    text-align: center;
}

.genealogy-search input {
    width: 300px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    font-family: var(--font-sans);
}

.person-focus {
    margin-bottom: 3rem;
    text-align: center;
}

.person-name {
    font-size: 1.6rem;
}

.person-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
}

.tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.generation {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.person-card {
    padding: 0.6rem 1rem;
    border: 1px solid #ddd;
    background: #fff;
    font-size: 0.9rem;
    min-width: 140px;
}

.person-card.primary {
    border: 1px solid var(--color-accent);
}

.parents {
    position: relative;
}

.parents::after {
    content: "";
    position: absolute;
    bottom: -20px;
    width: 2px;
    height: 20px;
    background: #ccc;
}

.subject::before {
    content: "";
    position: absolute;
    top: -20px;
    width: 2px;
    height: 20px;
    background: #ccc;
}

.genealogy-entry {
    text-align: center;
    margin: 2rem 0;
}

.genealogy-entry-link {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--color-accent);
}

/* subtle hover */
.genealogy-entry-link:hover {
    text-decoration: underline;
}

/* =========================
   GENEALOGY STATS (LEDGER)
========================= */

.genealogy-stats {
    width: 90%;
    max-width: 900px;
    margin: 1rem auto 1.5rem auto;
    text-align: center;
}

.stats-title {
    margin-bottom: .75rem;
}

/* Ledger rows */
.stats-ledger {
    border-top: 1px solid #e5e2dc;
    border-bottom: 1px solid #e5e2dc;
    padding: 1rem 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
}

/* Each stat */
.stat {
    flex: 1;
    text-align: center;
}

/* Value */
.stat-value {
    display: block;
    font-size: 1rem;
}

/* Label */
.stat-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-top: 0.2rem;
}

/* =========================
   GENEALOGY RECORD BLOCK
========================= */

.genealogy-record {
    max-width: 600px;
    margin: 3rem auto 0;
    border-top: 1px solid #e5e2dc;
    padding-top: 1rem;
}

/* Each line */
.record-line {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
}

/* Labels */
.record-line .label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-muted);
}

/* Values */
.record-line .value {
    font-size: 0.9rem;
}

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

.page-search .site-main {
    max-width: 900px;
}

/* Header */
.search-header {
    text-align: center;
    margin-bottom: 2rem;
}

.search-meta {
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--color-muted);
}

/* Results container */
.search-results {
    max-width: 700px;
    margin: 0 auto;
}

/* Empty state */
.search-empty {
    text-align: center;
    color: var(--color-muted);
    margin-top: 2rem;
}

/* Result card */
.result-card {
    padding: 1.2rem 0;
    border-bottom: 1px solid #e5e2dc;
}

/* Name */
.result-name {
    font-size: 1.1rem;
}

/* Meta */
.result-meta {
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-top: 0.2rem;
}

/* Link */
.result-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-accent);
    text-decoration: none;
}

.result-link:hover {
    text-decoration: underline;
}

/* ==========================================
   GENEALOGY - SURNAME ARCHIVE INDEX
========================================== */

/* A–Z bar */
.archive-az {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin: 2rem 0;
}

.archive-az a {
    font-size: 0.75rem;
    letter-spacing: 1px;
    text-decoration: none;
    padding: 4px 6px;
    border: 1px solid #ddd;
    color: var(--color-muted);
}

/* Active letters */
.archive-az .az-active {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-decoration: none;

    padding: 4px 6px;
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
}

/* Hover */
.archive-az .az-active:hover {
    background: #eee;
}

/* Disabled letters */
.archive-az .az-disabled {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;

    padding: 4px 6px;
    color: #bbb;
    border: 1px solid transparent;

    cursor: default;
}

.az-count {
    font-size: 0.65rem;
    color: var(--color-muted);
    margin-left: 2px;
}

/* section highlight */
.letter-highlight {
    background: rgba(0,0,0,0.04);
    transition: background 0.6s ease;
}

/* Ledger container */
.surname-ledger {
    max-width: 900px;
    margin: 0 auto;
}

/* Each letter section */
.surname-group {
    margin-bottom: 2.5rem;
}

/* Letter heading */
.surname-letter {
    text-align: center;
    font-size: 1.4rem;
    letter-spacing: 3px;
    margin-bottom: 1rem;
    color: var(--color-muted);
}

/* List */
.surname-list {
    list-style: none;
    padding: 0;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px 20px;
}

/* Entries */
.surname-list li {
    text-align: center;
    padding: 4px 0;
}

/* Links */
.surname-list a {
    text-decoration: none;
    font-size: 0.9rem;
    color: var(--color-text);
}

.surname-list a:hover {
    color: var(--color-accent);
}

/* collapse lists */
/* collapse EVERYTHING inside the group */
.surname-group.collapsed .surname-letter,
.surname-group.collapsed .surname-list {
    display: none;
}

/* optional: subtle transition feel */
.surname-group {
    transition: background 0.3s ease;
}

/* highlight active section */
.surname-group.active {
    background: rgba(0,0,0,0.03);
}

/* ==========================================
   GENEALOGY - INDIVIDUAL INDEX (ARCHIVAL STYLE)
========================================== */

.genealogy-index {
    max-width: 700px;
    margin: 2rem auto;
}

/* List reset */
.genealogy-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Each entry */
.genealogy-links li {
    padding: 0.8rem 0;
    border-bottom: 1px solid #e5e2dc;
    text-align: center;
}

/* Link styling */
.genealogy-links a {
    text-decoration: none;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    color: var(--color-text);
}

/* Hover = subtle, editorial */
.genealogy-links a:hover {
    color: var(--color-accent);
}

.family-index {
    list-style: none;
    padding: 0;
    columns: 2;              /* clean multi-column layout */
    column-gap: 40px;
}

.family-index li {
    margin: 4px 0;
}

.family-index a {
    text-decoration: none;
}

/* =========================
   FAMILY LAYOUT FIX
========================= */

.family-header {
    display: flex;
    align-items: flex-start;  /* prevents vertical distortion */
    gap: 25px;
    margin-bottom: 25px;
}

.family-coat {
    width: auto !important;
    height: auto !important;
    max-width: 250px;
    max-height: 250px;
    object-fit: contain;

    border: 4px solid #000;
    display: block;
    flex-shrink: 0;
}

.family-meta {
    flex: 1;
}

/* =========================
   SPACING FIX
========================= */

.family-section {
    margin-top: 30px;
}

.family-section h3 {
    margin-bottom: 10px;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.family-section p {
    margin-bottom: 14px;
    line-height: 1.65;
}

.family-list {
    margin-top: 10px;
    padding-left: 20px;
}

.family-list li {
    margin-bottom: 6px;
}

/* keep consistency with archive */
.archive-meta {
    margin-bottom: 25px;
}

/* ==========================================
   NOBILITY INDEX MODULE
   (Stapleton Archival System)
========================================== */

/* Container */
.nobility-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 30px;
}

/* Title */
.nobility-title {
    font-size: 2rem;
    font-weight: normal;
    letter-spacing: 1px;
}

/* Intro */
.nobility-intro {
    font-size: 0.95rem;
    color: #444;
    margin-top: 10px;
}

/* ==========================================
   SEARCH
========================================== */
.nobility-search {
    margin: 20px 0;
}

.nobility-search input {
    width: 100%;
    padding: 8px;
    font-family: inherit;
    border: 1px solid #ccc;
}

/* ==========================================
   A-Z INDEX
========================================== */
.nobility-az {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 15px 0 25px;
}

.nobility-az a {
    text-decoration: none;
    font-size: 0.85rem;
    padding: 4px 6px;
    border: 1px solid #ccc;
    color: #333;
}

.nobility-az a:hover {
    background: #ddd;
}

/* ==========================================
   REGIONS
========================================== */
.nobility-region h2 {
    font-size: 1.3rem;
    margin-top: 40px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 5px;
    cursor: pointer;
}

.nobility-region-content {
    margin-top: 10px;
}

.nobility-region.collapsed .nobility-region-content {
    display: none;
}

/* ==========================================
   GRID
========================================== */
.nobility-grid {
    list-style: none;
    padding: 0;
    margin: 10px 0 30px;

    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 6px 20px;
}

.nobility-grid li {
    display: block;
}

.nobility-grid a {
    text-decoration: none;
    color: #2a2a2a;
    font-size: 0.95rem;
}

.nobility-grid a:hover {
    text-decoration: underline;
}

/* ==========================================
   GENEALOGY PROFILE SYSTEM
========================================== */

:root{
    --paper:#f8f4ea;
    --paper-dark:#f2eadb;
    --ink:#2d2a26;
    --muted:#6f675a;
    --gold:#b08b57;
    --burgundy:#6d1f2b;
    --border:#d6c8ae;
    --shadow:0 8px 30px rgba(0,0,0,.08);
    --radius:18px;
}

/* ==========================================
   DARK PARCHMENT MODE
========================================== */

body.dark-mode{

    --paper:#2a241d;
    --paper-dark:#342d24;

    --ink:#e8dcc6;
    --muted:#b8aa92;

    --gold:#c8a36a;
    --burgundy:#c07a86;

    --border:#4d4336;

    --shadow:
        0 10px 30px rgba(0,0,0,.45);
}

/* ==========================================
   GLOBAL DARK BACKGROUND
========================================== */

body.dark-mode{
    background:
        radial-gradient(
            circle at top,
            #3a3127,
            #1f1a15 70%
        );

    color:var(--ink);
}

/* ==========================================
   CARD SYSTEM
========================================== */

body.dark-mode .profile-card,
body.dark-mode .content-card,
body.dark-mode .family-block,
body.dark-mode .sidebar-card{

    background:
        linear-gradient(
            to bottom,
            rgba(58,49,39,.96),
            rgba(42,36,29,.98)
        );

    border-color:var(--border);

    box-shadow:
        0 14px 38px rgba(0,0,0,.45),
        inset 0 1px 0 rgba(255,255,255,.03);
}

/* ==========================================
   TEXT
========================================== */

body.dark-mode p,
body.dark-mode li,
body.dark-mode div,
body.dark-mode .timeline-detail,
body.dark-mode .note-text{
    color:var(--ink);
}

/* ==========================================
   LINKS
========================================== */

body.dark-mode a{
    color:#d8b07a;
}

body.dark-mode a:hover{
    color:#f3d2a5;
}

/* ==========================================
   TIMELINE
========================================== */

body.dark-mode .timeline::before{
    background:
        linear-gradient(
            to bottom,
            rgba(200,163,106,.5),
            rgba(200,163,106,.14)
        );
}

body.dark-mode .timeline-row::before{
    background:var(--gold);
    border-color:var(--paper-dark);
}

/* ==========================================
   FACTS / SOURCE PANELS
========================================== */

body.dark-mode .source-entry,
body.dark-mode .repository-block{
    background:#332b22;
}

body.dark-mode .citation-block{
    background:rgba(255,255,255,.03);
}

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

body.dark-mode .note-text{
    border-left-color:rgba(200,163,106,.25);
}

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

body.dark-mode .crest-card{
    background:
        radial-gradient(
            circle at top,
            rgba(90,76,60,.92),
            rgba(42,36,29,.98)
        );
}

body.dark-mode .portrait-card{
    background:#332b22;
}

/* ==========================================
   BUTTONS / COLLAPSIBLES
========================================== */

body.dark-mode .collapse-controls button{
    background:#3a3127;
    border-color:#5b4f40;
    color:var(--ink);
}

body.dark-mode .collapse-controls button:hover{
    background:#4a3f33;
}

/* ==========================================
   SUBTLE TYPOGRAPHIC REFINEMENTS
========================================== */

body.dark-mode .family-title{
    color:#d7b48a;
}

body.dark-mode .timeline span{
    color:#d2a56f;
}

body.dark-mode .lifespan,
body.dark-mode .aka,
body.dark-mode .change-record{
    color:#bda98b;
}

*{
    box-sizing:border-box;
}

body.genealogy-page{
    margin:0;
    font-family:'Source Serif 4', serif;
    color:var(--ink);
    line-height:1.8;
    background:#ece5d8;
}