:root {
  --ink: #182126;
  --muted: #5e6b70;
  --green: #1f6b57;
  --green-dark: #124b3d;
  --blue: #159dd8;
  --gold: #d7aa38;
  --cream: #f7f5ef;
  --line: #dfe5e3;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(18, 46, 42, .10);
  --radius: 22px;
  --max: 1180px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fff;
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
img { max-width: 100%; display: block; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(24,33,38,.08);
}
.nav-wrap {
  max-width: var(--max);
  min-height: 86px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 30px;
}
.brand { flex: 0 0 300px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-crest { width: 66px !important; height: 66px !important; object-fit: contain; flex: 0 0 66px; }
.brand-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.brand-copy strong { font-family: Georgia, "Times New Roman", serif; font-size: 21px; letter-spacing: -.02em; color: var(--green-dark); white-space: nowrap; }
.brand-copy span { margin-top: 6px; color: var(--gold); font-size: 12px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.main-nav { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.main-nav a {
  color: #334044;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active { background: #edf6f2; color: var(--green-dark); }
.main-nav .language { margin-left: 6px; border: 1px solid var(--line); }
.main-nav .language img { width: 20px; display: inline-block; vertical-align: -2px; margin-right: 5px; }
.menu-toggle { display: none; }
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 88% 22%, rgba(21,157,216,.19), transparent 27%),
    radial-gradient(circle at 78% 90%, rgba(215,170,56,.16), transparent 30%),
    linear-gradient(135deg, #f4faf8 0%, #fff 58%, #f8f4e9 100%);
  border-bottom: 1px solid #e6ece9;
}
.hero::after {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  right: -210px;
  top: -250px;
  border: 1px solid rgba(31,107,87,.10);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(31,107,87,.035), 0 0 0 140px rgba(31,107,87,.025);
}
.hero-inner {
  max-width: var(--max);
  min-height: 565px;
  margin: 0 auto;
  padding: 84px 24px 78px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(270px, .75fr);
  gap: 70px;
  align-items: center;
  position: relative;
  z-index: 2;
}
.eyebrow {
  margin: 0 0 9px;
  color: var(--green);
  font-size: 13px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
h1, h2, h3 { line-height: 1.12; letter-spacing: -.025em; }
h1 { max-width: 780px; margin: 0; font-size: clamp(44px, 6vw, 75px); font-weight: 780; }
.lead { max-width: 720px; margin: 25px 0 0; font-size: clamp(19px, 2.1vw, 24px); color: #49575c; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }
.button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 12px 21px; border-radius: 999px; font-weight: 750; text-decoration: none; }
.button.primary { background: var(--green); color: #fff; box-shadow: 0 10px 30px rgba(31,107,87,.22); }
.button.primary:hover { background: var(--green-dark); color: #fff; }
.button.secondary { border: 1px solid #bfcac6; background: rgba(255,255,255,.72); color: var(--ink); }
.hero-crest { justify-self: center; width: min(310px, 90%); aspect-ratio: 1; border-radius: 50%; background: rgba(255,255,255,.8); border: 1px solid rgba(31,107,87,.15); box-shadow: var(--shadow); display: grid; place-items: center; }
.hero-crest img { max-width: 55%; max-height: 65%; image-rendering: auto; }
.section { max-width: var(--max); margin: 0 auto; padding: 82px 24px; }
.section-heading { max-width: 700px; margin-bottom: 34px; }
.section-heading h2, .two-col h2, .news-section h2 { margin: 0; font-size: clamp(32px, 4vw, 48px); }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.feature-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 8px 30px rgba(23,54,48,.055); }
.feature-image { height: 220px; background: #eef2ef; overflow: hidden; display: grid; place-items: center; }
.feature-image.white { background: #fff; }
.feature-image img { width: 100%; height: 100%; object-fit: cover; }
.feature-image.white img { object-fit: contain; padding: 25px; }
.feature-body { padding: 26px 26px 28px; }
.feature-body h3 { margin: 0 0 12px; font-size: 24px; }
.feature-body p { margin: 0 0 22px; color: var(--muted); }
.feature-body a { font-weight: 750; text-decoration: none; }
.story-band { background: var(--cream); border-top: 1px solid #ede8dd; border-bottom: 1px solid #ede8dd; }
.two-col { display: grid; grid-template-columns: 1.05fr .95fr; gap: 65px; align-items: center; }
.two-col p { color: #48565b; }
.proposal-card { padding: clamp(28px, 5vw, 48px); border-radius: var(--radius); background: #183c34; color: #fff; box-shadow: var(--shadow); }
.proposal-card .eyebrow { color: #98d7c2; }
.proposal-card h3 { margin: 0 0 15px; font-size: clamp(28px, 3vw, 40px); }
.proposal-card p { color: #e4efeb; }
.proposal-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.proposal-links a { padding: 8px 13px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: #fff; text-decoration: none; font-size: 14px; font-weight: 700; }
.stats-section { padding-top: 66px; padding-bottom: 40px; }
.stats-card { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 35px rgba(23,54,48,.06); }
.stat { padding: 32px; text-align: center; background: #fff; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat strong { display: block; color: var(--green-dark); font-size: clamp(36px, 5vw, 56px); line-height: 1; }
.stat span { display: block; margin-top: 9px; color: var(--muted); font-weight: 650; }
.news-section { padding-top: 52px; }
.news-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.news-item { padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.news-item time { color: var(--green); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.news-item h3 { margin: 9px 0 10px; font-size: 23px; }
.news-item p { margin: 0; color: var(--muted); }
.site-footer { margin-top: 20px; background: #102d27; color: #e2ece8; }
.footer-inner { max-width: var(--max); margin: 0 auto; padding: 44px 24px; display: flex; justify-content: space-between; gap: 30px; align-items: center; }
.footer-inner strong { color: #fff; font-size: 19px; }
.footer-inner p { margin: 5px 0 0; color: #b9cbc4; }
.footer-inner nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-inner a { color: #e8f4ef; text-decoration: none; font-weight: 650; }
@media (max-width: 980px) {
  .nav-wrap { min-height: 74px; }
  .brand { flex-basis: 260px; }
  .brand-crest { width: 58px !important; height: 58px !important; flex-basis: 58px; }
  .brand-copy strong { font-size: 18px; }
  .menu-toggle {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    padding: 10px 14px;
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    font-weight: 750;
  }
  .menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 17px; height: 2px; background: currentColor; border-radius: 2px; content: ""; }
  .menu-icon { position: relative; }
  .menu-icon::before { position: absolute; top: -5px; }
  .menu-icon::after { position: absolute; top: 5px; }
  .main-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 12px;
    right: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0,0,0,.14);
    flex-direction: column;
    align-items: stretch;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 14px; }
  .main-nav .language { margin-left: 0; }
  .hero-inner { min-height: auto; grid-template-columns: 1fr; gap: 35px; padding-top: 62px; }
  .hero-crest { width: 230px; justify-self: start; }
  .card-grid { grid-template-columns: 1fr; }
  .feature-card { display: grid; grid-template-columns: 240px 1fr; }
  .feature-image { height: 100%; min-height: 225px; }
  .two-col { grid-template-columns: 1fr; gap: 35px; }
}
@media (max-width: 650px) {
  body { font-size: 16px; }
  .nav-wrap { padding: 8px 16px; }
  .brand { flex-basis: auto; gap: 9px; }
  .brand-crest { width: 50px !important; height: 50px !important; flex-basis: 50px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy span { margin-top: 4px; font-size: 9px; letter-spacing: .12em; }
  .menu-toggle span:last-child { display: none; }
  .hero-inner { padding: 50px 18px 56px; }
  .hero-actions { flex-direction: column; align-items: stretch; }
  .button { width: 100%; }
  .hero-crest { display: none; }
  .section { padding: 62px 18px; }
  .feature-card { display: block; }
  .feature-image { height: 210px; min-height: 0; }
  .stats-card { grid-template-columns: 1fr; }
  .stat + .stat { border-left: 0; border-top: 1px solid var(--line); }
  .news-grid { grid-template-columns: 1fr; }
  .footer-inner { padding: 38px 18px; flex-direction: column; align-items: flex-start; }
  .footer-inner nav { gap: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* ===== Modernisation of legacy pages ===== */
body.legacy-page {
  background: #f7f8f6 !important;
  color: var(--ink) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 16px !important;
  line-height: 1.65 !important;
  text-align: left !important;
}
body.legacy-page #wrapper {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  position: static !important;
}
body.legacy-page #header,
body.legacy-page #nav { display: none !important; }
body.legacy-page #hold {
  position: static !important;
  width: auto !important;
  max-width: 1180px !important;
  margin: 0 auto !important;
  padding: 46px 24px 70px !important;
}
body.legacy-page #content {
  width: 100% !important;
  min-height: 0 !important;
  height: auto !important;
  overflow: visible !important;
  padding: clamp(26px, 4vw, 48px) !important;
  margin: 0 !important;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: 22px !important;
  box-shadow: 0 14px 45px rgba(23,54,48,.07) !important;
  box-sizing: border-box !important;
}
body.legacy-page #subheader {
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 0 30px !important;
  padding: 0 0 18px !important;
  background: transparent !important;
  border-bottom: 1px solid var(--line) !important;
  color: var(--green-dark) !important;
  font-size: clamp(28px, 4vw, 44px) !important;
  line-height: 1.12 !important;
  font-weight: 780 !important;
}
body.legacy-page #subheader h1,
body.legacy-page #subheader h2,
body.legacy-page #subheader h3 {
  margin: 0 !important;
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
}
body.legacy-page #leftcolumn,
body.legacy-page #rightcolumn,
body.legacy-page #fullpage,
body.legacy-page .leftcolumn,
body.legacy-page .rightcolumn {
  float: none !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.legacy-page p,
body.legacy-page li,
body.legacy-page td,
body.legacy-page th,
body.legacy-page span {
  font-size: inherit;
  line-height: 1.65;
}
body.legacy-page p { margin: 0 0 1em; }
body.legacy-page h1,
body.legacy-page h2,
body.legacy-page h3 {
  color: var(--green-dark) !important;
  font-family: inherit !important;
}
body.legacy-page h2 { font-size: clamp(25px, 3vw, 34px) !important; }
body.legacy-page h3 { font-size: clamp(20px, 2.4vw, 27px) !important; }
body.legacy-page a { color: var(--green) !important; }
body.legacy-page a:hover { color: var(--green-dark) !important; }
body.legacy-page img {
  max-width: 100% !important;
  height: auto !important;
}
body.legacy-page table {
  width: 100% !important;
  max-width: 100% !important;
  border-collapse: collapse !important;
  margin: 18px 0 30px !important;
  background: #fff !important;
}
body.legacy-page td,
body.legacy-page th {
  padding: 10px 12px !important;
  border-bottom: 1px solid #e7ecea !important;
  vertical-align: top !important;
}
body.legacy-page tr:nth-child(even) td { background: #fafbf9 !important; }
body.legacy-page .portitem {
  float: none !important;
  display: inline-block !important;
  vertical-align: top !important;
  width: min(280px, 100%) !important;
  height: auto !important;
  margin: 10px !important;
  padding: 10px !important;
  background: #fff !important;
  border: 1px solid var(--line) !important;
  border-radius: 16px !important;
  box-shadow: 0 8px 25px rgba(23,54,48,.06) !important;
}
body.legacy-page .portitem img { width: 100% !important; height: auto !important; border-radius: 10px !important; }
body.legacy-page #footer,
body.legacy-page #copyright { display: none !important; }

/* Genealogy pages generated by Ancestral Quest */
body.genealogy-page {
  padding: 0 !important;
  background-image: none !important;
}
body.genealogy-page > h1,
body.genealogy-page > h2,
body.genealogy-page > h3,
body.genealogy-page > hr,
body.genealogy-page > p,
body.genealogy-page > ul,
body.genealogy-page > blockquote,
body.genealogy-page > table {
  max-width: 1050px;
  margin-left: auto !important;
  margin-right: auto !important;
}
body.genealogy-page > h1,
body.genealogy-page > h2,
body.genealogy-page > h3 { padding-left: 22px; padding-right: 22px; text-align: left !important; }
body.genealogy-page > p,
body.genealogy-page > ul,
body.genealogy-page > blockquote { padding-left: 22px; padding-right: 22px; }
body.genealogy-page > h1:first-of-type,
body.genealogy-page > h3:first-of-type { margin-top: 48px !important; }
body.genealogy-page blockquote { margin-top: 18px !important; margin-bottom: 28px !important; }
body.genealogy-page blockquote table { margin: 0 !important; }

/* Give the historic Kindelan banner real presence */
.site-header .nav-wrap { min-height: 112px; }
.site-header .brand { flex: 0 0 390px; }
.site-header .brand img { width: 390px; max-height: 108px; object-fit: contain; }

@media (max-width: 1120px) {
  .site-header .brand { flex-basis: 320px; }
  .site-header .brand img { width: 320px; }
  .main-nav a { padding-left: 8px; padding-right: 8px; font-size: 13px; }
}
@media (max-width: 980px) {
  .site-header .nav-wrap { min-height: 88px; }
  .site-header .brand { flex-basis: 280px; }
  .site-header .brand img { width: 280px; max-height: 82px; }
}
@media (max-width: 700px) {
  body.legacy-page #hold { padding: 24px 14px 46px !important; }
  body.legacy-page #content { padding: 24px 18px !important; border-radius: 16px !important; }
  body.legacy-page table { display: block !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
  body.legacy-page td, body.legacy-page th { min-width: 85px; }
  body.genealogy-page > h1:first-of-type,
  body.genealogy-page > h3:first-of-type { margin-top: 30px !important; }
  .site-header .brand { flex-basis: 235px; }
  .site-header .brand img { width: 235px; max-height: 72px; }
}
@media (max-width: 420px) {
  .site-header .brand { flex-basis: 205px; }
  .site-header .brand img { width: 205px; }
}

/* ===== v4: genealogy mobile layout and encoding-safe presentation ===== */
body.genealogy-page table {
  max-width: 100% !important;
}
body.genealogy-page td,
body.genealogy-page th {
  min-width: 0 !important;
  overflow-wrap: anywhere;
  word-break: normal;
}

@media (max-width: 700px) {
  /* Genealogy must fit the viewport: no horizontal table scrolling. */
  body.genealogy-page table {
    display: table !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    table-layout: auto !important;
  }
  body.genealogy-page > blockquote {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  body.genealogy-page blockquote table {
    display: block !important;
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }
  body.genealogy-page blockquote tbody {
    display: block !important;
    width: 100% !important;
  }
  body.genealogy-page blockquote tr {
    display: grid !important;
    grid-template-columns: 18px 26px 20px 28px minmax(0, 1fr);
    column-gap: 3px;
    align-items: start;
    width: 100% !important;
    padding: 9px 0 !important;
    border-bottom: 1px solid #e7ecea;
  }
  body.genealogy-page blockquote td {
    display: block !important;
    width: auto !important;
    min-width: 0 !important;
    padding: 1px 2px !important;
    border: 0 !important;
    background: transparent !important;
    overflow-wrap: anywhere;
  }
  body.genealogy-page blockquote td:nth-child(2),
  body.genealogy-page blockquote td:nth-child(3),
  body.genealogy-page blockquote td:nth-child(4) {
    text-align: center !important;
  }
  body.genealogy-page blockquote td:nth-child(5) {
    padding-left: 5px !important;
  }
  body.genealogy-page > p,
  body.genealogy-page > ul,
  body.genealogy-page > h1,
  body.genealogy-page > h2,
  body.genealogy-page > h3 {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

@media (max-width: 420px) {
  body.genealogy-page blockquote tr {
    grid-template-columns: 14px 22px 18px 24px minmax(0, 1fr);
    column-gap: 2px;
  }
  body.genealogy-page blockquote td {
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
}


/* v6: use the official 2028 event banner as the visible site header */
.site-header .brand.event-banner {
  flex: 0 1 430px;
  display: block;
}
.site-header .brand.event-banner img {
  display: block;
  width: 100% !important;
  max-width: 430px;
  height: auto !important;
  max-height: none !important;
  object-fit: contain;
}
@media (max-width: 1120px) {
  .site-header .brand.event-banner { flex-basis: 360px; }
  .site-header .brand.event-banner img { max-width: 360px; }
}
@media (max-width: 980px) {
  .site-header .brand.event-banner { flex-basis: 300px; }
  .site-header .brand.event-banner img { max-width: 300px; }
}
@media (max-width: 700px) {
  .site-header .brand.event-banner { flex-basis: min(74vw, 290px); }
  .site-header .brand.event-banner img { max-width: min(74vw, 290px); }
}
@media (max-width: 420px) {
  .site-header .brand.event-banner { flex-basis: min(72vw, 245px); }
  .site-header .brand.event-banner img { max-width: min(72vw, 245px); }
}
