/* ═══════════════════════════════════════════════════════════
   Oler Family Tree — static genealogy site
   Modern Farmhouse theme (matches Family Dashboard)
   ═══════════════════════════════════════════════════════════ */

:root {
    --bg: #f6f1ea;
    --bg-alt: #efe7db;
    --bg-card: #fffdfa;
    --bg-hover: #f3ece0;
    --border: #e3d9cb;
    --border-strong: #d3c5b1;
    --text: #3e3630;
    --text-strong: #2b241e;
    --text-dim: #8a7b6b;
    --primary: #5f6f52;
    --primary-hover: #4e5d43;
    --accent: #b4835a;
    --green: #6b8e5a;
    --red: #b14a3b;
    --yellow: #c89b3c;
    --radius: 14px;
    --shadow: 0 4px 18px rgba(96, 74, 49, 0.08);
    --shadow-hover: 0 8px 26px rgba(96, 74, 49, 0.16);
    --font-head: 'Playfair Display', Georgia, serif;
    --font-body: 'Jost', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    background-image:
        radial-gradient(rgba(148, 118, 82, 0.05) 1px, transparent 1px),
        linear-gradient(175deg, var(--bg) 0%, var(--bg-alt) 100%);
    background-size: 14px 14px, 100% 100%;
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, .brand, .section-title, .stat-value {
    font-family: var(--font-head);
    color: var(--text-strong);
    letter-spacing: -0.01em;
}

/* ─── Nav ─────────────────────────────────────────────── */
.topnav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 14px rgba(96,74,49,0.06);
}
.nav-inner {
    display: flex; align-items: center; gap: 1rem;
    padding: 0 1.75rem; min-height: 62px; max-width: 1440px; margin: 0 auto;
}
.brand { font-weight: 700; font-size: 1.25rem; color: var(--text-strong); display: flex; align-items: center; gap: .45rem; }
.nav-tabs { display: flex; gap: 0.35rem; flex: 1; flex-wrap: wrap; }
.nav-tab {
    display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem;
    border-radius: 999px; color: var(--text-dim); text-decoration: none; font-size: 0.92rem; font-weight: 500;
    transition: all 0.18s; border: 1px solid transparent; cursor: pointer;
}
.nav-tab:hover { background: var(--bg-hover); color: var(--text-strong); }
.nav-tab.active { background: var(--primary); color: #fdfbf7; box-shadow: 0 3px 10px rgba(95,111,82,0.35); }
.nav-right { display: flex; align-items: center; gap: 0.9rem; }
.count-pill {
    background: var(--primary); color: #fdfbf7; font-weight: 600; font-size: 0.85rem;
    padding: 0.3rem 0.85rem; border-radius: 999px;
}

/* ─── Content ─────────────────────────────────────────── */
.content { max-width: 1200px; margin: 0 auto; padding: 2rem 1.75rem; width: 100%; flex: 1; }

/* ─── Cards ───────────────────────────────────────────── */
.card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem 1.6rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.card h2 { font-size: 1.3rem; margin-bottom: 0.85rem; font-weight: 600; }

/* ─── Grid ────────────────────────────────────────────── */
.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(2,1fr); }
.grid-3 { grid-template-columns: repeat(3,1fr); }
.grid-4 { grid-template-columns: repeat(4,1fr); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ─── Stat cards ──────────────────────────────────────── */
.stat-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 4px solid var(--primary); border-radius: var(--radius);
    padding: 1.25rem 1.4rem; box-shadow: var(--shadow); margin-bottom: 1.25rem;
}
.stat-value { font-size: 2.1rem; font-weight: 600; color: var(--text-strong); line-height: 1.1; }
.stat-label { font-size: 0.8rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

/* ─── Search / filters ────────────────────────────────── */
input, select {
    width: 100%; padding: 0.65rem 0.85rem; background: #fffefb; border: 1px solid var(--border-strong);
    border-radius: 10px; color: var(--text-strong); font-size: 0.94rem; font-family: var(--font-body); margin-top: 0.35rem;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(95,111,82,0.15); }

/* ─── Chips / person list ─────────────────────────────── */
.chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 0.35rem 0.6rem; font-size: 0.9rem; color: var(--text);
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.chip .dot.m { background: #5aa7ff; }
.chip .dot.f { background: #f28bb8; }
.chip .dot.u { background: #9aa0ac; }
.ged { font-size: 0.7rem; color: var(--text-dim); }
.arrow { color: var(--text-dim); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.chip.surname-btn { cursor: pointer; border: 1px solid var(--border); }
.chip.surname-btn:hover { border-color: var(--primary); background: var(--bg-hover); }

.person-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.6rem; }
.person-row {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.75rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    cursor: pointer; transition: all 0.15s;
}
.person-row:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.person-row .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.person-row .pname { font-weight: 600; color: var(--text-strong); }
.person-row .pdates { color: var(--text-dim); font-size: 0.85rem; }
.person-row .pplace { color: var(--text-dim); font-size: 0.8rem; margin-left: auto; text-align: right; }

/* ─── Tables ──────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th { text-align: left; padding: 0.7rem 0.8rem; border-bottom: 2px solid var(--border-strong); color: var(--text-dim); font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.07em; }
td { padding: 0.62rem 0.8rem; border-bottom: 1px solid var(--border); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ─── Surnames view ───────────────────────────────────── */
.surname-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); gap: 0.7rem; }
.surname-item {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem;
    cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: all 0.15s;
}
.surname-item:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.surname-item .sn { font-weight: 600; color: var(--text-strong); }
.surname-item .sc { color: var(--text-dim); background: var(--bg-hover); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.78rem; font-weight: 600; }

/* ─── Modal ───────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(43,36,30,0.5); }
.modal-card {
    position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 2rem 2.2rem; box-shadow: var(--shadow-hover);
}
.modal-close { position: absolute; top: 0.8rem; right: 1rem; background: none; border: none; font-size: 1.8rem; color: var(--text-dim); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text-strong); }

.rel-grid { display: grid; grid-template-columns: 1fr; gap: 0.5rem; margin-top: 0.5rem; }
.rel-grid.rel-2 { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); }
.rel-link { background: var(--bg-hover); border: 1px solid var(--border); border-radius: 8px; padding: 0.45rem 0.7rem; cursor: pointer; font-size: 0.9rem; transition: all 0.12s; }
.rel-link:hover { border-color: var(--primary); background: var(--bg-card); }

/* ─── Section title / footer ──────────────────────────── */
.section-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 1.25rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--border); }
.text-dim { color: var(--text-dim); }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.footer {
    text-align: center; color: var(--text-dim); font-size: 0.82rem; padding: 1.5rem;
    border-top: 1px solid var(--border); background: var(--bg-card);
}

/* Origins story prose */
.story p { margin-bottom: 0.8rem; line-height: 1.7; }
.story h3 { margin: 1.2rem 0 0.4rem; font-family: var(--font-head); color: var(--text-strong); font-size: 1.1rem; }
.timeline { list-style: none; padding: 0; margin: 0.6rem 0; }
.timeline li { padding: 0.35rem 0 0.35rem 1.4rem; position: relative; }
.timeline li::before { content: "🌿"; position: absolute; left: 0; top: 0.4rem; font-size: 0.85rem; }
