/* Kartoffeltysker — site styles
   Palette taken from the crest; type: IM Fell English (display) + Source Serif 4 (text). */

@font-face {
  font-family: "IM Fell English";
  src: url("/fonts/im-fell-english-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "IM Fell English";
  src: url("/fonts/im-fell-english-latin-400-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4-latin-standard-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap;
}

:root {
  --paper: #edeee9;     /* cool linen */
  --paper-2: #e2e4dc;   /* slightly darker linen for panels */
  --ink: #1c2233;       /* iron-gall blue-black */
  --ink-soft: #4a5063;
  --hessian: #22306a;   /* crest blue */
  --hessian-2: #2d3d80;
  --red: #b51f25;       /* crest red, darkened for text contrast */
  --heather: #6e5272;   /* marginalia */
  --straw: #e6c84a;     /* crest gold */
  --rule: #c9ccc1;

  --display: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --text: "Source Serif 4", "Iowan Old Style", Georgia, serif;

  --measure: 38rem;
  --margin-col: 15rem;
  --gutter: 1rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.1875rem);
  line-height: 1.62;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--straw); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, .display {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: 0;
  margin: 0;
}
h1 { font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.4rem); }
h2 { font-size: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem); margin-top: 3.2rem; margin-bottom: 0.9rem; }
h3 { font-size: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem); margin-top: 2rem; margin-bottom: 0.5rem; }
p { margin: 0 0 1.05em; }
.lede { font-size: 1.18em; line-height: 1.5; color: var(--ink); }
.muted { color: var(--ink-soft); }
.skip { position: absolute; left: -999px; top: 0; background: var(--straw); color: var(--ink); padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: 1rem; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header .inner {
  max-width: calc(var(--measure) + var(--margin-col) + 6rem);
  margin: 0 auto;
  padding: 0.7rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); }
.brand img { width: 30px; }
.brand span { font-family: var(--display); font-size: 1.45rem; line-height: 1; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1.15rem; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: 0.98rem; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--rule); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--red); }
.nav-toggle { display: none; }
/* small screens: a Menu button that opens the links as a list */
@media (max-width: 760px) {
  .js .nav-toggle {
    display: inline-flex; align-items: center; gap: 0.5rem;
    font: inherit; font-size: 0.98rem; color: var(--ink);
    background: transparent; border: 1px solid var(--rule); border-radius: 3px;
    padding: 0.35rem 0.7rem; cursor: pointer;
  }
  .nav-toggle .bars, .nav-toggle .bars::before, .nav-toggle .bars::after {
    display: block; width: 16px; height: 2px; background: var(--ink); position: relative; transition: transform 0.2s;
  }
  .nav-toggle .bars::before, .nav-toggle .bars::after { content: ""; position: absolute; left: 0; }
  .nav-toggle .bars::before { top: -5px; }
  .nav-toggle .bars::after { top: 5px; }
  .open .nav-toggle .bars { background: transparent; }
  .open .nav-toggle .bars::before { transform: translateY(5px) rotate(45deg); }
  .open .nav-toggle .bars::after { transform: translateY(-5px) rotate(-45deg); }
  .js .site-nav { display: none; flex-basis: 100%; }
  .js .site-header.open .site-nav { display: block; }
  .js .site-nav ul { flex-direction: column; gap: 0; padding: 0.3rem 0 0.4rem; }
  .js .site-nav a { display: block; padding: 0.65rem 0 0.65rem 0.8rem; border-bottom: 0; border-left: 3px solid transparent; font-size: 1.05rem; }
  .js .site-nav li + li a { border-top: 1px solid var(--rule); }
  .js .site-nav a[aria-current="page"] { border-left-color: var(--red); }
}

/* ---------- page frame with margin notes ---------- */
.page {
  max-width: calc(var(--measure) + var(--margin-col) + 6rem);
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}
.prose { max-width: var(--measure); }
.prose > h1 + .lede { margin-top: 1.2rem; }

/* margin notes: inline on small screens, in the right margin on wide screens */
.note {
  display: block;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--heather);
  border-left: 2px solid var(--heather);
  padding: 0.1rem 0 0.1rem 0.7rem;
  margin: -0.4rem 0 1.1rem;
}
.note a { color: var(--heather); }
@media (min-width: 1080px) {
  .page { padding-right: calc(var(--margin-col) + 3rem); }
  .prose { position: relative; }
  .note {
    float: right; clear: right;
    width: var(--margin-col);
    margin: 0.35rem calc(-1 * (var(--margin-col) + 2.5rem)) 0.8rem 0;
  }
}

/* ---------- home hero ---------- */
.hero {
  background: var(--hessian);
  color: var(--paper);
  overflow: hidden;
}
.hero .inner {
  max-width: calc(var(--measure) + var(--margin-col) + 6rem);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}
.hero h1 { color: #fff; max-width: 14ch; }
.hero p { max-width: 34rem; color: #dfe3f0; }
.hero .crest-wrap { justify-self: center; width: min(62vw, 300px); }
.hero .crest-wrap img { filter: drop-shadow(0 18px 30px rgba(8, 14, 40, 0.45)); }
.hero .advert {
  font-family: var(--text);
  font-style: italic;
  font-size: 1.02rem;
  color: #d4d9ec;
  border-top: 1px solid rgba(255,255,255,0.22);
  padding-top: 0.9rem;
  margin-top: 1.4rem;
}
@media (min-width: 820px) {
  .hero .inner { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .hero .crest-wrap { width: 100%; max-width: 360px; justify-self: end; }
}
@media (prefers-reduced-motion: no-preference) {
  .hero .crest-wrap img { animation: rise 1.1s cubic-bezier(.2,.7,.2,1) both; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
}

/* ---------- home pathways ---------- */
.paths { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.paths li { border-bottom: 1px solid var(--rule); }
.paths a {
  display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; gap: 0.3rem 1.5rem;
  padding: 1.1rem 0; text-decoration: none; color: var(--ink);
}
.paths a strong { font-family: var(--display); font-weight: 400; font-size: 1.55rem; line-height: 1.15; color: var(--hessian); }
.paths a span { color: var(--ink-soft); }
.paths a:hover strong { color: var(--red); }
@media (max-width: 560px) { .paths a { grid-template-columns: 1fr; } }

/* ---------- name cascade (signature element) ---------- */
.names {
  margin: 2.4rem 0 2.6rem;
  padding: 0;
  list-style: none;
  font-family: var(--display);
  line-height: 1.05;
}
.names li { display: block; margin-bottom: 0.9rem; }
.names .n { font-size: clamp(2rem, 1.4rem + 2.8vw, 3.4rem); color: var(--hessian); }
.names .n { display: block; }
.names .who { display: block; font-family: var(--text); font-size: 0.9rem; color: var(--ink-soft); line-height: 1.4; max-width: 30rem; margin-top: 0.15rem; }
.names li:nth-child(2) { padding-left: 1.2em; }
.names li:nth-child(3) { padding-left: 2.4em; }
.names li:nth-child(4) { padding-left: 3.6em; }
.names li:nth-child(5) { padding-left: 4.8em; }
.names li:nth-child(6) { padding-left: 6em; }
.names li:last-child .n { color: var(--red); }
@media (max-width: 560px) {
  .names li:nth-child(2) { padding-left: 0.6em; }
  .names li:nth-child(3) { padding-left: 1.2em; }
  .names li:nth-child(4) { padding-left: 1.8em; }
  .names li:nth-child(5) { padding-left: 2.4em; }
  .names li:nth-child(6) { padding-left: 3em; }
}

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 1.5rem 0 2rem; padding: 0; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 1.2rem 1.4rem; }
.timeline li::before {
  content: ""; position: absolute; left: -6px; top: 0.55rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink-soft);
}
.timeline time { display: block; font-family: var(--display); font-size: 1.25rem; color: var(--hessian); line-height: 1.2; }
.timeline li.family::before {
  border-radius: 0; transform: rotate(45deg); background: var(--straw); border-color: var(--ink);
  left: -7px; width: 12px; height: 12px;
}
.timeline li.family time { color: var(--red); }
.legend { font-size: 0.88rem; color: var(--ink-soft); display: flex; align-items: center; gap: 0.5rem; }
.legend i { display: inline-block; width: 11px; height: 11px; background: var(--straw); border: 2px solid var(--ink); transform: rotate(45deg); }

/* ---------- register entries (people) ---------- */
.entry { margin: 2rem 0 2.4rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); }
.entry h3 { margin: 0 0 0.25rem; color: var(--hessian); font-size: clamp(1.55rem, 1.3rem + 0.9vw, 2rem); }
.entry .rel { font-style: italic; color: var(--ink-soft); margin: 0 0 0.8rem; }
.entry dl { display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.25rem 1rem; margin: 0 0 1rem; font-size: 0.97rem; }
.entry dt { color: var(--ink-soft); }
.entry dd { margin: 0; }
@media (max-width: 480px) { .entry dl { grid-template-columns: 1fr; } .entry dd { margin-bottom: 0.4rem; } }

/* ---------- line of descent ---------- */
.descent { list-style: none; margin: 1.5rem 0 2rem; padding: 0; counter-reset: gen; }
.descent li { counter-increment: gen; display: grid; grid-template-columns: 3rem 1fr; gap: 0 0.8rem; padding: 0.55rem 0; border-bottom: 1px dotted var(--rule); }
.descent li::before { content: counter(gen); font-family: var(--display); font-size: 1.5rem; color: var(--heather); line-height: 1.2; text-align: right; }
.descent .p { font-family: var(--display); font-size: 1.22rem; line-height: 1.25; }
.descent .d { grid-column: 2; font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- panels ---------- */
.panel { background: var(--paper-2); padding: 1.2rem 1.4rem; margin: 1.8rem 0; border-left: 4px solid var(--hessian); }
.panel h3 { margin-top: 0; }
.panel.disagree { border-left-color: var(--red); }
.panel table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.panel th, .panel td { text-align: left; vertical-align: top; padding: 0.4rem 0.6rem 0.4rem 0; border-bottom: 1px solid var(--rule); }
.panel th { font-weight: 600; }

.surnames { columns: 3 9rem; column-gap: 1.5rem; list-style: none; padding: 0; margin: 1rem 0 1.5rem; font-family: var(--display); font-size: 1.35rem; line-height: 1.5; }

/* crest page */
.crest-figure { margin: 2rem 0; display: grid; gap: 1.5rem; align-items: start; }
.crest-figure img { width: min(100%, 340px); }
@media (min-width: 720px) { .crest-figure { grid-template-columns: 300px 1fr; } }
.blazon { list-style: none; padding: 0; margin: 0; }
.blazon li { padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
.blazon b { font-family: var(--display); font-weight: 400; font-size: 1.2rem; color: var(--hessian); display: block; }

/* map */
#map { height: min(70vh, 560px); margin: 1.5rem 0 0.6rem; border: 1px solid var(--rule); background: var(--paper-2); }
.leaflet-popup-content { font-family: var(--text); font-size: 0.95rem; line-height: 1.45; }
.leaflet-popup-content strong { font-family: var(--display); font-weight: 400; font-size: 1.15rem; }
.map-key { font-size: 0.88rem; color: var(--ink-soft); display: flex; gap: 1.2rem; flex-wrap: wrap; }
.map-key span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.4rem; vertical-align: 0; }
.map-key .k-origin::before { background: var(--hessian); }
.map-key .k-route::before { background: var(--heather); }
.map-key .k-colony::before { background: var(--red); }
.map-key .k-later::before { background: var(--straw); box-shadow: inset 0 0 0 1px var(--ink); }

/* sources list */
.sources { padding-left: 1.2rem; }
.sources li { margin-bottom: 0.8rem; }
.sources li:target { background: #f6eeb9; outline: 6px solid #f6eeb9; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #c8ccd8; font-size: 0.9rem; }
.site-footer .inner {
  max-width: calc(var(--measure) + var(--margin-col) + 6rem);
  margin: 0 auto; padding: 2rem var(--gutter) 2.5rem;
  display: grid; gap: 1rem;
}
.site-footer a { color: #fff; }
.site-footer p { margin: 0; max-width: 46rem; }

/* ---------- figures ---------- */
.figure { margin: 1.8rem 0 2rem; }
.figure img { width: 100%; background: var(--paper-2); }
.figure figcaption, .bleed figcaption { font-size: 0.84rem; line-height: 1.45; color: var(--ink-soft); margin-top: 0.55rem; }
.figure.portrait { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr; gap: 1rem; align-items: end; }
@media (max-width: 480px) { .figure.portrait { grid-template-columns: 7.5rem 1fr; } }

/* full-bleed picture under the home hero */
.bleed { margin: 0; background: var(--ink); }
.bleed img { display: block; width: 100%; height: clamp(16rem, 52vw, 40rem); object-fit: cover; object-position: center 40%; }
/* on wider screens show the whole painting, framed on the dark band, instead of cropping it */
@media (min-width: 760px) {
  .bleed { padding-top: 2.2rem; }
  .bleed img { width: auto; max-width: calc(100% - 2 * var(--gutter)); height: auto; max-height: min(86vh, 56rem); margin: 0 auto; object-fit: contain; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); }
  .bleed figcaption { text-align: center; padding-top: 0.9rem; padding-bottom: 1.6rem; }
}
.bleed figcaption {
  max-width: calc(var(--measure) + var(--margin-col) + 6rem);
  margin: 0 auto; padding: 0.7rem var(--gutter) 0.9rem;
  color: #b9bfd0;
}
.bleed figcaption span { font-family: var(--display); font-size: 1.3rem; color: #fff; margin-right: 0.4rem; }

/* ---------- family tree ---------- */
.tree { margin: 1.6rem 0 2.4rem; display: grid; justify-items: center; text-align: center; gap: 0; }
.tree .node {
  position: relative; background: var(--paper-2); border: 1px solid var(--rule);
  padding: 0.75rem 1rem; max-width: 27rem; width: 100%;
  font-size: 0.95rem; line-height: 1.35;
}
.tree .node b { font-family: var(--display); font-weight: 400; font-size: 1.12rem; color: var(--hessian); }
.tree .node small { display: block; margin-top: 0.3rem; color: var(--ink-soft); font-size: 0.82rem; }
.tree > .node + .node, .tree > .tree-top + .node { margin-top: 1.6rem; }
.tree > .node + .node::before {
  content: ""; position: absolute; left: 50%; top: calc(-1.6rem - 1px); height: 1.6rem;
  border-left: 2px solid var(--heather);
}
.tree .colonist { border-top: 4px solid var(--straw); }
.tree .join { border-color: var(--heather); }
.tree-top { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; width: 100%; }
.tree-top .node { max-width: none; }
/* drop lines from each colonist couple, a crossbar, and a line down to their children's marriage */
.tree-top > .node::after, .tree-top > .stack::after {
  content: ""; position: absolute; left: 50%; bottom: calc(-0.8rem - 1px); height: 0.8rem;
  border-left: 2px solid var(--heather);
}
.tree-top::after {
  content: ""; position: absolute; left: 25%; right: 25%; bottom: -0.8rem; border-top: 2px solid var(--heather);
}
.tree > .tree-top + .node::before {
  content: ""; position: absolute; left: 50%; top: calc(-0.8rem - 1px); height: 0.8rem;
  border-left: 2px solid var(--heather);
}
.tree figcaption { margin-top: 1rem; font-size: 0.84rem; color: var(--heather); }
@media (max-width: 480px) {
  .tree-top { gap: 0.6rem; }
  .tree .node { padding: 0.6rem 0.6rem; font-size: 0.88rem; }
  .tree .node b { font-size: 1rem; }
}

.hero h1 + .lede { margin-top: 1.3rem; }

.tree-top .stack { position: relative; display: grid; gap: 1rem; align-content: start; }
.tree .maybe { background: transparent; border-style: dashed; border-color: var(--heather); }
.tree .maybe small { margin: 0 0 0.25rem; }
.tree .stack .maybe::before {
  content: ""; position: absolute; left: 50%; top: calc(-1rem - 1px); height: 1rem;
  border-left: 2px dashed var(--heather);
}

blockquote { margin: 1.4rem 0 1.6rem; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 3px solid var(--straw); }
blockquote p { margin-bottom: 0.6rem; }
blockquote p[lang="da"] { font-family: var(--display); font-size: 1.12em; line-height: 1.45; color: var(--hessian); }

.tree .node .sep { display: block; height: 0.6rem; }
.tree .stack .node + .node::before {
  content: ""; position: absolute; left: 50%; top: calc(-1rem - 1px); height: 1rem;
  border-left: 2px solid var(--heather);
}
.tree .stack .node small:first-child { margin: 0 0 0.25rem; }

/* family tree v2: three colonist couples.
   Columns are c = (100% - 1.6rem) / 3 wide with 0.8rem gaps. */
.tree-grid {
  position: relative; display: grid; width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 0.8rem; row-gap: 1.6rem; padding-bottom: 0.8rem;
}
.tree-grid .node { max-width: none; }
.tree-grid .t-frank { grid-column: 1; grid-row: 1; }
.tree-grid .t-durr { grid-column: 2; grid-row: 1; }
.tree-grid .t-marcher { grid-column: 3; grid-row: 1; }
.tree .t-jj small:first-child { margin: 0 0 0.25rem; }
/* Frank line runs straight down past the Dürr–Marcher generation */
.tree-grid .t-line { grid-column: 1; grid-row: 2; position: relative; }
.tree-grid .t-line::before {
  content: ""; position: absolute; left: 50%; top: -1.6rem; bottom: -0.8rem; border-left: 2px solid var(--heather);
}
/* Dürr and Marcher drop to a bar, which drops to their children */
.tree-grid .t-durr::after, .tree-grid .t-marcher::after {
  content: ""; position: absolute; left: 50%; bottom: calc(-0.8rem - 1px); height: 0.8rem; border-left: 2px solid var(--heather);
}
.tree-grid .t-kids { grid-column: 2 / span 2; grid-row: 2; position: relative; display: grid; justify-items: center; }
.tree-grid .t-kids::before {
  content: ""; position: absolute; top: -0.8rem; left: calc((100% - 0.8rem) / 4); right: calc((100% - 0.8rem) / 4);
  border-top: 2px solid var(--heather);
}
.tree-grid .t-jj { width: min(100%, 26rem); }
.tree-grid .t-jj::before {
  content: ""; position: absolute; left: 50%; top: calc(-0.8rem - 1px); height: 0.8rem; border-left: 2px solid var(--heather);
}
.tree-grid .t-jj::after {
  content: ""; position: absolute; left: 50%; bottom: calc(-0.8rem - 1px); height: 0.8rem; border-left: 2px solid var(--heather);
}
/* bottom bar from the Frank line to the Dürr–Märcher children, centred on the marriage below */
.tree-grid::after {
  content: ""; position: absolute; bottom: 0; left: calc((100% - 1.6rem) / 6); width: calc(50% + 0.4rem);
  border-top: 2px solid var(--heather);
}
.tree > .tree-grid + .node { margin-top: 0.8rem; }
.tree > .tree-grid + .node::before {
  content: ""; position: absolute; left: 50%; top: calc(-0.8rem - 1px); height: 0.8rem; border-left: 2px solid var(--heather);
}
.tree figcaption { margin-top: 1rem; }
/* phones: Dürr and Marcher side by side over their children, the Frank line joining below */
@media (max-width: 640px) {
  .tree-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tree-grid .t-durr { grid-column: 1; grid-row: 1; }
  .tree-grid .t-marcher { grid-column: 2; grid-row: 1; }
  .tree-grid .t-kids { grid-column: 1 / span 2; grid-row: 2; }
  .tree-grid .t-frank { grid-column: 1; grid-row: 3; }
  .tree-grid .t-line { grid-column: 1 / span 2; grid-row: 3; pointer-events: none; }
  .tree-grid .t-jj { width: 100%; }
  .tree-grid .t-frank::after {
    content: ""; position: absolute; left: 50%; bottom: calc(-0.8rem - 1px); height: 0.8rem; border-left: 2px solid var(--heather);
  }
  .tree-grid::after { left: calc((100% - 0.8rem) / 4); width: calc(25% + 0.2rem); }
}
