/* =========================================================================
   Die Pretoriusfamilie — public site styling
   Palette derived from the original site (warm browns, cream/parchment,
   orange citation accent, cadet-blue for rules) with a colour-theory cleanup
   and a modern, responsive, GIF-free layout. Design tokens live in :root so a
   future restyle is a one-file edit.
   ========================================================================= */

:root {
  /* Core palette (60-30-10: cream dominant, brown secondary, orange accent) */
  --cream:      #faf6ef;   /* page background (dominant) */
  --parchment:  #f2ead9;   /* raised panels */
  --brown-900:  #3b2a1e;
  --brown-700:  #5c4033;   /* primary brown */
  --brown-500:  #8b6b4f;
  --brown-300:  #c9b49b;
  --accent:     #d2691e;   /* citation numbers, active links (10%) */
  --accent-dark:#a24e12;
  --blue:       #5f9ea0;   /* cadet-blue complementary rules */
  --ink:        #2b2018;   /* body text */
  --muted:      #8a7d6d;
  --line:       #e3d9c9;
  --white:      #ffffff;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", ui-serif, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
  --shadow: 0 1px 3px rgba(59, 42, 30, 0.08), 0 6px 18px rgba(59, 42, 30, 0.05);
  --wrap: 960px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  font-size: 17px;
}

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1.2rem; }

a { color: var(--brown-700); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; }

h1, h2, h3 { font-family: var(--serif); color: var(--brown-900); line-height: 1.2; font-weight: 700; }

.muted { color: var(--muted); }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--brown-900); color: #fff; padding: 0.5rem 1rem; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---- Header / nav -------------------------------------------------------- */
.site-header {
  background: linear-gradient(180deg, var(--brown-700), var(--brown-900));
  color: var(--cream);
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 62px; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--cream); font-family: var(--serif); font-size: 1.3rem; font-weight: 700; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark { color: var(--accent); font-size: 1.5rem; }

.site-nav { display: flex; align-items: center; gap: 1.4rem; }
.site-nav a { color: #efe4d5; font-size: 0.98rem; }
.site-nav a:hover { color: #fff; text-decoration: none; border-bottom: 2px solid var(--accent); }
.lang-toggle {
  border: 1px solid #ffffff55; border-radius: 999px; padding: 0.2rem 0.8rem !important;
  font-size: 0.85rem !important;
}
.lang-toggle:hover { background: var(--accent); border-color: var(--accent); }

.nav-toggle { display: none; background: none; border: 0; color: var(--cream); font-size: 1.6rem; cursor: pointer; }

/* ---- Main / footer ------------------------------------------------------- */
.site-main { padding: 2rem 1.2rem 3rem; min-height: 60vh; }

.site-footer {
  background: var(--brown-900); color: #d8cbba; margin-top: 2rem;
  padding: 1.6rem 0; font-size: 0.9rem; text-align: center;
}
.site-footer p { margin: 0.2rem 0; }
.footer-note { color: #b6a690; }

.btn {
  display: inline-block; background: var(--accent); color: #fff !important;
  border-radius: 6px; padding: 0.6rem 1.1rem; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn.secondary { background: var(--brown-500); }

/* ---- Ancestor chart ------------------------------------------------------ */
.ancestors { margin: 0 auto 1.5rem; max-width: 820px; }
.anc-row { display: grid; gap: 0.8rem; margin-bottom: 0.8rem; }
.anc-grandparents { grid-template-columns: repeat(4, 1fr); }
.anc-parents { grid-template-columns: repeat(2, 1fr); max-width: 70%; margin-inline: auto; }
.anc-connector { display: flex; justify-content: center; }
.anc-connector span { width: 2px; height: 18px; background: var(--brown-300); }

.pcard {
  background: var(--parchment); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.7rem 0.8rem; text-align: center; display: flex; flex-direction: column; gap: 0.15rem;
  min-height: 64px; justify-content: center;
}
.pcard-empty { background: transparent; border-style: dashed; }
.pcard-role { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.pcard-name { font-weight: 600; font-size: 0.95rem; }
.pcard-years { font-size: 0.82rem; color: var(--muted); }

/* ---- Person block -------------------------------------------------------- */
.person {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem; max-width: 780px; margin: 0 auto;
}
.person-head { text-align: center; border-bottom: 2px solid var(--blue); padding-bottom: 1rem; margin-bottom: 1.2rem; }
.person-name { font-size: 2rem; margin: 0; }
.person-span { color: var(--muted); font-size: 1.05rem; margin: 0.3rem 0 0; }

.person-events { text-align: center; margin-bottom: 1.5rem; }
.event { margin: 0.15rem 0; }
.ev-label { color: var(--brown-500); font-variant: small-caps; letter-spacing: 0.03em; margin-right: 0.35rem; font-weight: 600; }
.ev-date { font-weight: 500; }
.ev-place { color: var(--muted); }
.event-occu .ev-detail { font-style: italic; color: var(--brown-700); }
.privacy-note { text-align: center; font-style: italic; color: var(--muted); padding: 1.5rem 0; }

/* ---- Citations ----------------------------------------------------------- */
sup.cites { margin-left: 2px; }
a.cit {
  color: var(--accent); font-weight: 700; text-decoration: none; font-size: 0.7em;
  padding: 0 1px; vertical-align: super;
}
a.cit:hover { text-decoration: underline; }
a.cit + a.cit { margin-left: 2px; }

.cite-tip {
  position: absolute; z-index: 80; max-width: 320px;
  background: var(--brown-900); color: #f6ecdf; padding: 0.7rem 0.9rem;
  border-radius: 8px; font-size: 0.85rem; line-height: 1.4; box-shadow: var(--shadow);
  border-left: 3px solid var(--accent);
}

/* ---- Marriages ----------------------------------------------------------- */
.marriage { border-top: 1px solid var(--line); padding-top: 1.2rem; margin-top: 1.2rem; }
.marriage-head { text-align: center; margin-bottom: 0.8rem; }
.marriage-badge {
  display: inline-block; background: var(--blue); color: #fff; border-radius: 999px;
  padding: 0.15rem 0.75rem; font-size: 0.8rem; font-weight: 600; margin-right: 0.4rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.marriage-when { font-weight: 500; }
.marriage-div { color: var(--muted); font-style: italic; margin-left: 0.4rem; }
.marriage-spouse { max-width: 320px; margin: 0 auto 1rem; }

.children-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.6rem; margin-top: 0.6rem;
}
.child-tile {
  background: var(--cream); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.55rem 0.6rem; text-align: center; display: flex; flex-direction: column; gap: 0.15rem;
}
.child-name { font-size: 0.9rem; font-weight: 600; }
.child-years { font-size: 0.78rem; color: var(--muted); }

/* ---- Detailed children --------------------------------------------------- */
.children-detail { border-top: 2px solid var(--blue); margin-top: 2rem; padding-top: 1rem; }
.children-detail > h2 { font-size: 1.2rem; }
.child-detail { border-bottom: 1px solid var(--line); padding: 0.8rem 0; }
.child-detail:last-child { border-bottom: 0; }
.child-detail h3 { font-size: 1.05rem; margin: 0 0 0.3rem; }
.child-detail-years, .child-spouse-when { color: var(--muted); font-weight: 400; font-size: 0.9rem; margin-left: 0.4rem; }
.child-events .event { margin: 0.1rem 0; font-size: 0.95rem; }
.child-spouse { margin: 0.3rem 0 0; font-size: 0.95rem; }

/* ---- Sources / notes ----------------------------------------------------- */
.sources, .notes { border-top: 2px solid var(--blue); margin-top: 2rem; padding-top: 1rem; }
.sources h2, .notes h2 { font-size: 1.15rem; }
.source-list { padding-left: 1.4rem; }
.source-item { font-size: 0.88rem; color: var(--brown-700); margin: 0.35rem 0; }
.source-item:target { background: #fff3e2; border-radius: 4px; }
.note { margin: 0.5rem 0; }

/* ---- Home ---------------------------------------------------------------- */
.hero { text-align: center; padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.4rem; margin: 0 0 0.4rem; }
.hero p.lead { font-size: 1.1rem; color: var(--brown-700); max-width: 640px; margin: 0 auto 1.5rem; }
.home-search { max-width: 520px; margin: 0 auto; display: flex; gap: 0.5rem; }
.home-search input {
  flex: 1; padding: 0.7rem 1rem; border: 1px solid var(--brown-300); border-radius: 8px; font: inherit;
}
.home-links { display: flex; gap: 1rem; justify-content: center; margin-top: 1.4rem; flex-wrap: wrap; }

/* ---- Search & lists ------------------------------------------------------ */
.page-title { text-align: center; margin-bottom: 1.2rem; }
.search-form {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.3rem; max-width: 720px; margin: 0 auto 1.5rem;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem 1rem;
}
.search-form label { display: flex; flex-direction: column; font-size: 0.85rem; font-weight: 600; color: var(--brown-700); gap: 0.25rem; }
.search-form input { padding: 0.5rem 0.65rem; border: 1px solid var(--brown-300); border-radius: 6px; font: inherit; font-weight: 400; }
.search-form .full { grid-column: 1 / -1; }
.search-form button { grid-column: 1 / -1; justify-self: center; }

.results-count { text-align: center; color: var(--muted); margin-bottom: 1rem; }
table.people {
  width: 100%; border-collapse: collapse; background: var(--white);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
table.people th, table.people td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--line); }
table.people th { background: var(--parchment); font-family: var(--serif); }
table.people tr:hover td { background: #fbf7f0; }

/* Surname index */
.surname-jump { text-align: center; margin-bottom: 1.2rem; line-height: 2; }
.surname-jump a { display: inline-block; padding: 0 0.35rem; font-weight: 700; }
.surname-group { margin-bottom: 1.5rem; }
.surname-group h2 { border-bottom: 1px solid var(--blue); padding-bottom: 0.2rem; }
.surname-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.3rem 1rem; list-style: none; padding: 0; }
.surname-list .count { color: var(--muted); font-size: 0.85rem; }

.pager { display: flex; justify-content: center; gap: 1rem; margin: 1.5rem 0; align-items: center; }

.notfound { text-align: center; padding: 3rem 0; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .nav-toggle { display: block; }
  .site-nav {
    display: none; position: absolute; top: 62px; right: 0; left: 0;
    background: var(--brown-900); flex-direction: column; align-items: stretch;
    gap: 0; padding: 0.5rem 1.2rem 1rem;
  }
  body.nav-open .site-nav { display: flex; }
  .site-nav a { padding: 0.6rem 0; border-bottom: 1px solid #ffffff1a; }
  .site-nav a:hover { border-bottom: 1px solid #ffffff1a; }
  .lang-toggle { align-self: flex-start; margin-top: 0.5rem; }

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

  /* Ancestor chart collapses to a simple vertical list. */
  .anc-grandparents, .anc-parents { grid-template-columns: 1fr 1fr; max-width: none; }
  .anc-connector { display: none; }

  .search-form { grid-template-columns: 1fr; }
  table.people { display: block; overflow-x: auto; }
}

@media (max-width: 460px) {
  .anc-grandparents { grid-template-columns: 1fr; }
  .anc-parents { grid-template-columns: 1fr; }
}
