/* ============================================
   JACKSON FAMILY ARCHIVE
   Clean, Classic, Understated
   ============================================ */

:root {
    --cream: #faf9f6;
    --paper: #f5f4f0;
    --ink: #1a1a1a;
    --ink-light: #4a4a4a;
    --ink-faded: #777;
    --rule: #d4d0c8;
    --accent: #8b7355;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'EB Garamond', 'Times New Roman', serif;
    font-size: 18px;
    line-height: 1.75;
    color: var(--ink);
    background: var(--cream);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

.container.narrow {
    max-width: 800px;
}

/* ============================================
   HEADER
   ============================================ */
.site-header {
    border-bottom: 1px solid var(--rule);
    padding: 20px 0;
    position: sticky;
    top: 0;
    background: var(--cream);
    z-index: 100;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.site-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 16px;
    font-weight: 400;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.5px;
}

.site-title:hover {
    color: var(--accent);
}

.site-section {
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    color: var(--ink-faded);
    font-style: italic;
}

.main-nav {
    display: flex;
    gap: 32px;
}

.main-nav a {
    font-size: 14px;
    color: var(--ink-light);
    text-decoration: none;
    letter-spacing: 0.3px;
}

.main-nav a:hover {
    color: var(--ink);
}

/* ============================================
   TITLE SECTION
   ============================================ */
.title-section {
    padding: 80px 0 60px;
    border-bottom: 1px solid var(--rule);
}

/* Frontispiece - Centered Formal Layout */
.frontispiece {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.frontispiece-coat {
    display: block;
    width: 180px;
    height: auto;
    margin: 0 auto 32px;
}

.frontispiece-title {
    font-family: 'Libre Baskerville', serif;
    font-size: 2.5em;
    font-weight: 400;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--ink);
}

.frontispiece-title span {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 0.6em;
    color: var(--ink-light);
}

.frontispiece-location {
    font-size: 16px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--ink-light);
    margin-bottom: 4px;
}

.frontispiece-dates {
    font-size: 15px;
    color: var(--accent);
    margin-bottom: 24px;
}

.frontispiece-divider {
    font-size: 20px;
    color: var(--accent);
    margin: 24px 0;
    opacity: 0.5;
}

.frontispiece-arms {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-light);
    margin-bottom: 20px;
}

.frontispiece-arms p {
    margin-bottom: 8px;
}

.frontispiece-arms strong {
    color: var(--ink);
    font-weight: 500;
}

.frontispiece-grant {
    font-size: 12px;
    color: var(--ink-faded);
    letter-spacing: 0.5px;
}

/* Legacy support */
h1 {
    font-family: 'Libre Baskerville', serif;
    font-size: 42px;
    font-weight: 400;
    line-height: 1.3;
    margin-bottom: 20px;
}

.arms-description p {
    font-size: 16px;
    line-height: 1.6;
}

.arms-note {
    margin-top: 24px;
    font-size: 14px;
    color: var(--ink-faded);
}

/* ============================================
   SECTIONS
   ============================================ */
.section {
    padding: 80px 0;
    border-bottom: 1px solid var(--rule);
}

.section.alt {
    background: var(--paper);
}

h2 {
    font-family: 'Libre Baskerville', serif;
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 12px;
}

.section-note {
    font-size: 16px;
    font-style: italic;
    color: var(--ink-faded);
    margin-bottom: 40px;
}

/* Drop Cap */
.drop-cap::first-letter {
    float: left;
    font-family: 'Libre Baskerville', serif;
    font-size: 72px;
    line-height: 1;
    padding-right: 12px;
    margin-top: 4px;
    color: var(--ink);
}

p+p {
    margin-top: 16px;
}

/* ============================================
   LINEAGE LIST
   ============================================ */
.lineage-list {
    list-style: none;
    margin-top: 30px;
}

.lineage-list li {
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
    display: flex;
    gap: 16px;
}

.lineage-list li:last-child {
    border-bottom: none;
}

.gen-number {
    flex-shrink: 0;
    width: 40px;
    font-size: 14px;
    color: var(--ink-faded);
}

.lineage-gap {
    color: var(--ink-faded);
    font-style: italic;
}

/* ============================================
   TIMELINE
   ============================================ */
.timeline {
    margin-top: 30px;
}

.timeline-entry {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 30px;
    padding: 20px 0;
    border-bottom: 1px solid var(--rule);
}

.timeline-entry:last-child {
    border-bottom: none;
}

.timeline-year {
    font-family: 'Libre Baskerville', serif;
    font-size: 16px;
    color: var(--accent);
    text-align: right;
}

.timeline-content {
    font-size: 17px;
}

/* ============================================
   PERSONS GRID
   ============================================ */
.generation-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 20px;
}

.gen-tab {
    padding: 8px 20px;
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    background: transparent;
    border: 1px solid var(--rule);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gen-tab:hover,
.gen-tab.active {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}

.persons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.person-card {
    background: var(--paper);
    border: 1px solid var(--rule);
    padding: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.person-card:hover {
    border-color: var(--ink-light);
}

.person-name {
    font-family: 'Libre Baskerville', serif;
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 4px;
}

.person-dates {
    font-size: 15px;
    color: var(--ink-faded);
    margin-bottom: 8px;
}

.person-location {
    font-size: 14px;
    color: var(--ink-light);
    font-style: italic;
}

.person-summary {
    font-size: 15px;
    color: var(--ink-light);
    margin-top: 12px;
    line-height: 1.6;
}

.person-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.person-gen {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cream);
    background: var(--ink);
    padding: 3px 8px;
}

.person-branch {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
    padding: 3px 8px;
    border: 1px solid var(--accent);
}

.person-parent {
    font-size: 13px;
    color: var(--ink-faded);
    font-style: italic;
    margin-bottom: 8px;
}

/* ============================================
   GALLERY
   ============================================ */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.gallery-item {
    aspect-ratio: 1;
    border: 1px solid var(--rule);
    background: var(--cream);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.gallery-item:hover {
    border-color: var(--ink-light);
}

.gallery-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.gallery-placeholder span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-faded);
    margin-bottom: 8px;
}

.gallery-placeholder p {
    font-size: 14px;
    color: var(--ink-light);
}

/* ============================================
   SOURCES
   ============================================ */
.sources-list {
    margin-top: 30px;
}

.source-item {
    padding: 20px 0;
    border-bottom: 1px solid var(--rule);
}

.source-item:last-child {
    border-bottom: none;
}

.source-item h3 {
    font-family: 'Libre Baskerville', serif;
    font-size: 17px;
    font-weight: 400;
    margin-bottom: 6px;
}

.source-item p {
    font-size: 15px;
    color: var(--ink-light);
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-dialog {
    position: relative;
    background: var(--cream);
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid var(--rule);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-faded);
}

.modal-close:hover {
    color: var(--ink);
}

.modal-content {
    padding: 40px;
}

.modal-header {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.modal-name {
    font-family: 'Libre Baskerville', serif;
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 8px;
}

.modal-dates {
    font-size: 17px;
    color: var(--ink-faded);
}

.modal-location {
    font-size: 16px;
    color: var(--ink-light);
    font-style: italic;
    margin-top: 4px;
}

.modal-section {
    margin-bottom: 28px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-faded);
    margin-bottom: 12px;
}

.modal-section p {
    font-size: 16px;
    line-height: 1.7;
}

.modal-events {
    list-style: none;
}

.modal-event {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
}

.modal-event:last-child {
    border-bottom: none;
}

.modal-event-date {
    color: var(--accent);
}

.modal-family {
    list-style: none;
}

.modal-family li {
    padding: 8px 0;
    font-size: 15px;
}

/* ============================================
   COMPANY BRANDING (Index Page)
   ============================================ */
.company-branding {
    padding: 100px 0 60px;
    text-align: center;
}

.hero-title-sub {
    font-family: 'EB Garamond', serif;
    font-size: 0.5em;
    font-style: italic;
    color: var(--ink-light);
    display: block;
    margin-top: 10px;
}

.hero-location {
    font-family: 'EB Garamond', serif;
    font-size: 20px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 8px;
}

.hero-dates {
    font-family: 'Libre Baskerville', serif;
    font-size: 18px;
    color: var(--accent);
    margin-bottom: 50px;
}

.arms-display {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-bottom: 50px;
    flex-wrap: wrap;
}

.arms-block {
    max-width: 300px;
}

.arms-label {
    font-family: 'EB Garamond', serif;
    font-style: italic;
    font-size: 18px;
    color: var(--accent);
    display: block;
    margin-bottom: 12px;
}

.arms-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink-light);
}

.grant-note {
    font-size: 14px;
    color: var(--ink-faded);
    line-height: 1.6;
    border-top: 1px solid var(--rule);
    display: inline-block;
    padding-top: 24px;
    margin-top: 10px;
}

.portal-grid.single-item {
    justify-content: center;
}

.portal-grid.single-item .portal-card {
    max-width: 400px;
    margin: 0 auto;
}

.modal-family-role {
    color: var(--ink-faded);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    padding: 60px 0 40px;
    background: var(--paper);
    border-top: 1px solid var(--rule);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 40px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--rule);
}

.footer-logo {
    font-size: 20px;
    color: var(--ink);
}

.footer-nav {
    display: flex;
    gap: 24px;
}

.footer-nav a {
    text-decoration: none;
    color: var(--ink-light);
    font-size: 14px;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--ink);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--ink-faded);
}

.footer-sub {
    font-size: 13px;
    color: var(--accent);
    margin-top: 4px;
    font-style: italic;
}



.copyright {
    font-size: 13px;
    color: var(--ink-faded);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .title-section .container {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .arms-description {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--rule);
        padding-top: 30px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 0 24px;
    }

    h1 {
        font-size: 32px;
    }

    h2 {
        font-size: 24px;
    }

    .main-nav {
        display: none;
    }

    .timeline-entry {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .timeline-year {
        text-align: left;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .generation-tabs {
        flex-wrap: wrap;
    }
}

/* ============================================
   BLOCKQUOTES (Historical Documents)
   ============================================ */
blockquote {
    margin: 16px 0;
    padding: 16px 24px;
    background: var(--paper);
    border-left: 3px solid var(--accent);
    font-style: italic;
    color: var(--ink-light);
    font-size: 0.95em;
    line-height: 1.7;
}

/* ============================================
   FAMILY TREE
   ============================================ */
.tree-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 40px;
}

.tree-nav {
    background: var(--cream);
    border: 1px solid var(--rule);
    padding: 10px 20px;
    font-family: 'EB Garamond', serif;
    font-size: 15px;
    color: var(--ink-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tree-nav:hover:not(:disabled) {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}

.tree-nav:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tree-range {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--ink-faded);
}

.family-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 40px 0;
}

.tree-generation {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.tree-gen-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--ink-faded);
    margin-bottom: 8px;
}

.tree-person {
    background: var(--cream);
    border: 1px solid var(--rule);
    padding: 16px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 220px;
    position: relative;
}

.tree-person:hover {
    border-color: var(--ink);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.tree-person.active {
    background: var(--ink);
    color: var(--cream);
    border-color: var(--ink);
}

.tree-person-name {
    font-family: 'Libre Baskerville', serif;
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 4px;
}

.tree-person-dates {
    font-size: 14px;
    color: var(--ink-faded);
}

.tree-person.active .tree-person-dates {
    color: rgba(255, 255, 255, 0.7);
}

.tree-connector {
    width: 2px;
    height: 32px;
    background: var(--rule);
}

.tree-spouse {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tree-spouse-connector {
    width: 24px;
    height: 2px;
    background: var(--accent);
}

.tree-spouse-box {
    background: transparent;
    border: 1px dashed var(--rule);
    padding: 12px 20px;
    text-align: center;
    font-size: 14px;
    color: var(--ink-light);
}

.tree-spouse-name {
    font-style: italic;
}

/* ============================================
   HERALDRY
   ============================================ */
.heraldry-block {
    text-align: center;
    border: 1px solid var(--accent);
    padding: 40px;
    background: var(--cream);
    position: relative;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.coat-img {
    display: block;
    margin: 0 auto;
    width: auto;
    height: auto;
}

.heraldry-block::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid var(--rule);
    pointer-events: none;
}

.heraldry-desc {
    font-family: 'Libre Baskerville', serif;
    font-size: 1.4em;
    font-style: italic;
    color: var(--ink);
    margin: 32px 0;
    line-height: 1.4;
}

.heraldry-divider {
    color: var(--accent);
    font-size: 24px;
    margin: 16px 0;
    opacity: 0.6;
}

.heraldry-text {
    max-width: 600px;
    margin: 0 auto;
    color: var(--ink-light);
}

/* ============================================
   JOURNEY TIMELINE
   ============================================ */
.journey-timeline {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-top: 60px;
    padding: 0 20px;
}

.journey-line {
    position: absolute;
    top: 12px;
    left: 60px;
    right: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--rule), var(--rule), var(--accent));
    z-index: 0;
}

.journey-stop {
    position: relative;
    z-index: 1;
    flex: 1;
    text-align: center;
    cursor: pointer;
}

.journey-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--cream);
    border: 3px solid var(--rule);
    margin: 0 auto 20px;
    transition: all 0.3s ease;
}

.journey-stop:hover .journey-marker {
    border-color: var(--accent);
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(139, 115, 85, 0.1);
}

.journey-marker.active {
    border-color: var(--accent);
    background: var(--accent);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(139, 115, 85, 0.4);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(139, 115, 85, 0);
    }
}

.journey-content {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.journey-stop:hover .journey-content {
    opacity: 1;
}

.journey-years {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 8px;
}

.journey-content h3 {
    font-family: 'Libre Baskerville', serif;
    font-size: 18px;
    font-weight: 400;
    color: var(--ink);
    margin-bottom: 4px;
}

.journey-content p {
    font-size: 13px;
    color: var(--ink-light);
    margin-bottom: 12px;
}

.journey-tag {
    display: inline-block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 10px;
    background: var(--paper);
    border: 1px solid var(--rule);
    color: var(--ink-faded);
}

.journey-stop[data-era="present"] .journey-tag {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

@media (max-width: 800px) {
    .journey-timeline {
        flex-direction: column;
        align-items: stretch;
        gap: 40px;
        padding: 0;
    }

    .journey-line {
        top: 0;
        bottom: 0;
        left: 11px;
        right: auto;
        width: 2px;
        height: auto;
        background: linear-gradient(180deg, var(--accent), var(--rule), var(--rule), var(--accent));
    }

    .journey-stop {
        display: flex;
        align-items: flex-start;
        gap: 24px;
        text-align: left;
    }

    .journey-marker {
        margin: 0;
        flex-shrink: 0;
    }
}