/* mansagers.com — one stylesheet for the whole site.
   Fonts and Leaflet are self-hosted: the server's Content-Security-Policy is
   default-src 'self', so nothing may be loaded from another origin except the
   map tiles. No inline styles anywhere; everything lives here. */

/* ---------- Typefaces (SIL Open Font License; see THIRD_PARTY_NOTICES.md) ---------- */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/cormorant-garamond-500.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/cormorant-garamond-600.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url("fonts/cormorant-garamond-500-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/source-serif-4-400.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/source-serif-4-600.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/source-serif-4-400-italic.woff2") format("woff2"); }

/* ---------- Tokens ---------- */
:root {
  --paper: #f5efe3;
  --paper-2: #ece4d3;
  --paper-3: #e2d8c2;
  --ink: #1d2733;
  --ink-2: #44505c;
  --ink-3: #6b7681;
  --red: #a2362a;
  --red-2: #7f2a20;
  --ochre: #b8862b;
  --ochre-2: #8f6719;
  --line: #cdc2a9;
  --shadow: 0 1px 2px rgba(29, 39, 51, .08), 0 8px 24px rgba(29, 39, 51, .08);
  --head: "Cormorant Garamond", "Georgia", serif;
  --body: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --measure: 68ch;
  --radius: 4px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #161a1f; --paper-2: #1e242b; --paper-3: #2a323b;
    --ink: #ebe4d6; --ink-2: #c9c0ae; --ink-3: #9a9384;
    --red: #d8674f; --red-2: #e88a74; --ochre: #d6a645; --ochre-2: #e6bd63;
    --line: #3a434e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #161a1f; --paper-2: #1e242b; --paper-3: #2a323b;
  --ink: #ebe4d6; --ink-2: #c9c0ae; --ink-3: #9a9384;
  --red: #d8674f; --red-2: #e88a74; --ochre: #d6a645; --ochre-2: #e6bd63;
  --line: #3a434e;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
  font-feature-settings: "onum" 1, "pnum" 1;
  overflow-x: hidden;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { color: var(--red-2); }
:focus-visible { outline: 3px solid var(--ochre); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--head); font-weight: 600; line-height: 1.12; margin: 0 0 .5em; color: var(--ink); letter-spacing: .005em; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 1.3rem + 3.2vw, 3.6rem); }
h2 { font-size: clamp(1.6rem, 1.1rem + 1.8vw, 2.4rem); margin-top: 1.6em; }
h3 { font-size: clamp(1.3rem, 1rem + 1vw, 1.7rem); margin-top: 1.4em; }
h4 { font-size: 1.15rem; margin-top: 1.2em; }
p, ul, ol, dl, blockquote, figure, table { margin: 0 0 1.1em; }
.prose { max-width: var(--measure); }
.prose > * + h2, .prose > * + h3 { margin-top: 1.6em; }
small, .small { font-size: .9rem; }
.muted { color: var(--ink-3); }
.lede { font-size: 1.22rem; line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.lede p { margin-bottom: .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }
.rule { display: block; width: 3rem; height: 2px; background: var(--ochre); border: 0; margin: 1.2rem 0 1.6rem; }
abbr[title] { text-decoration: none; border-bottom: 1px dotted var(--ink-3); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em; }
.wrap { width: min(100% - 2rem, 72rem); margin-inline: auto; }
.narrow { width: min(100% - 2rem, 48rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 1rem; top: -3rem; background: var(--ink); color: var(--paper); padding: .5rem .8rem; border-radius: var(--radius); z-index: 100; }
.skip:focus { top: 1rem; }

/* ---------- Header / nav ---------- */
.site-head { border-bottom: 1px solid var(--line); background: var(--paper); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem 1.4rem; padding: 1rem 0 .8rem; }
.brand { font-family: var(--head); font-weight: 600; font-size: 1.55rem; color: var(--ink); text-decoration: none; letter-spacing: .01em; margin-right: auto; }
.brand span { color: var(--red); }
.nav { display: flex; flex-wrap: wrap; gap: .1rem .4rem; margin: 0; padding: 0; list-style: none; }
.nav a { display: inline-block; padding: .3rem .55rem; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent; font-size: .98rem; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--red); }
.theme { border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); font: inherit; font-size: .88rem; padding: .3rem .7rem; border-radius: 999px; cursor: pointer; }
.theme:hover { color: var(--ink); border-color: var(--ink-3); }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; padding: clamp(2.5rem, 6vw, 5.5rem) 0 clamp(2rem, 5vw, 4rem); border-bottom: 1px solid var(--line); overflow: clip; background: var(--paper-2); }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url("img/nitun-farm-plan.png") no-repeat right -2rem center / auto 130%; opacity: .06; filter: grayscale(1); pointer-events: none; }
@media (max-width: 52em) { .hero::before { display: none; } }
:root[data-theme="dark"] .hero::before { filter: grayscale(1) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero::before { filter: grayscale(1) invert(1); } }
.hero .kicker { font-family: var(--head); font-style: italic; font-size: 1.25rem; color: var(--red); margin: 0 0 .4rem; }
.hero h1 { margin-bottom: .4em; max-width: 16ch; }
.hero .lede { margin-top: 1rem; }

/* ---------- Sections and cards ---------- */
section { padding-block: clamp(1.5rem, 4vw, 3rem); }
.section-title { display: flex; align-items: baseline; gap: 1rem; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.cards { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); padding: 0; margin: 1.4rem 0 0; list-style: none; }
.card { border: 1px solid var(--line); background: var(--paper-2); border-radius: var(--radius); padding: 1.1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: .4rem; }
.card h3 { margin: 0; font-size: 1.45rem; }
.card p { margin: 0; color: var(--ink-2); font-size: .98rem; flex: 1; }
.card a { font-weight: 600; text-decoration: none; }
.card a::after { content: " →"; }

/* ---------- Figures / documents ---------- */
figure.doc { margin: 1.6rem 0 2rem; }
figure.doc img { border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
figure.doc figcaption { border-top: 2px solid var(--ochre); margin-top: .7rem; padding-top: .55rem; font-size: .92rem; color: var(--ink-2); max-width: 60ch; }
figure.doc figcaption b { color: var(--ink); font-weight: 600; }
.doc-split { display: grid; gap: 1.5rem 2.2rem; align-items: start; }
@media (min-width: 52em) { .doc-split { grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); } .doc-split figure.doc { margin-top: 0; } }
.transcript { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem 1.1rem; font-size: 1rem; }
.transcript h3 { margin-top: 0; font-size: 1.55rem; }
.transcript .sub { font-family: var(--head); font-weight: 600; font-size: 1.15rem; line-height: 1.25; color: var(--ink-2); margin-bottom: 1rem; }
.transcript .xhead { font-weight: 600; text-align: center; margin: 1em 0 .6em; font-variant-caps: small-caps; letter-spacing: .04em; }
.transcript p { text-indent: 1.2em; margin-bottom: .55em; }
.transcript p.sub, .transcript p.xhead, .transcript p.first { text-indent: 0; }
.transcript .note { text-indent: 0; margin-top: 1rem; padding-top: .7rem; border-top: 1px dashed var(--line); font-size: .9rem; color: var(--ink-3); }

/* ---------- Quotations and letters ---------- */
blockquote { margin: 1.4rem 0; padding: .2rem 0 .2rem 1.2rem; border-left: 3px solid var(--ochre); color: var(--ink-2); font-style: italic; }
blockquote p { margin-bottom: .6em; }
blockquote cite { display: block; font-style: normal; font-size: .9rem; color: var(--ink-3); margin-top: .4em; }
blockquote em, blockquote i { font-style: normal; }
.letter { background: var(--paper-2); border: 1px solid var(--line); border-left: 3px solid var(--ochre); border-radius: var(--radius); padding: 1.2rem 1.4rem; font-style: normal; color: var(--ink); }
.letter .dateline { text-align: right; color: var(--ink-3); font-size: .95rem; margin-bottom: 1rem; font-style: italic; }
.letter .sig { text-align: right; font-family: var(--head); font-style: italic; font-size: 1.2rem; margin-top: 1rem; }
.poem { font-style: normal; border-left: 0; padding-left: 0; }
.poem p { white-space: pre-line; margin-bottom: 1.2em; }
.poem .refrain { font-style: italic; color: var(--red); }
.poem cite { text-align: right; }

/* ---------- Story layout with sticky contents ---------- */
.story { display: grid; gap: 2rem 3rem; }
@media (min-width: 60em) { .story { grid-template-columns: 14rem minmax(0, 1fr); } .story .toc { position: sticky; top: 1.2rem; align-self: start; } }
.toc { border: 1px solid var(--line); background: var(--paper-2); border-radius: var(--radius); padding: .9rem 1.1rem; font-size: .93rem; }
.toc h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
.toc ol { margin: 0; padding-left: 1.2rem; }
.toc li { margin: .2rem 0; }
.toc a { color: var(--ink-2); text-decoration: none; }
.toc a:hover { color: var(--red); text-decoration: underline; }
.chapter { padding-top: .5rem; scroll-margin-top: 1rem; }
.chapter + .chapter { margin-top: 2.5rem; border-top: 1px solid var(--line); padding-top: 1.5rem; }
.chapter h2 { margin-top: 0; }
.chapter .num { display: block; font-family: var(--head); font-style: italic; font-weight: 500; font-size: 1.1rem; color: var(--ochre-2); margin-bottom: .2rem; }
.aside { border: 1px solid var(--line); background: var(--paper-2); border-radius: var(--radius); padding: .9rem 1.1rem; font-size: .95rem; margin: 1.4rem 0; }
.aside h3, .aside h4 { margin-top: 0; }
.conflict { color: var(--red); font-weight: 600; }
.mark { display: inline-block; font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: .1rem .45rem; border-radius: 999px; border: 1px solid currentColor; vertical-align: middle; line-height: 1.5; }
.mark.unverified { color: var(--ochre-2); }
.mark.conflict { color: var(--red); font-weight: 600; }

/* ---------- Tree ---------- */
.pedigree { list-style: none; margin: 1.5rem 0 0; padding: 0; position: relative; }
.pedigree::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--line); transform: translateX(-50%); }
.gen { position: relative; margin: 0 auto 1.6rem; max-width: 46rem; }
.gen-label { position: relative; text-align: center; font-family: var(--head); font-style: italic; font-size: 1.05rem; color: var(--ochre-2); margin-bottom: .4rem; }
.gen-label span { background: var(--paper); padding: 0 .6rem; }
.couple { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.couple::before { content: ""; position: absolute; left: 25%; right: 25%; top: 50%; height: 2px; background: var(--line); z-index: 0; }
.person { position: relative; z-index: 1; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); border-radius: var(--radius); padding: .75rem .9rem; font: inherit; cursor: pointer; box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease; }
.person:hover { border-color: var(--ochre); transform: translateY(-1px); }
.person .pn { font-family: var(--head); font-weight: 600; font-size: 1.25rem; line-height: 1.15; display: block; }
.person .pd { display: block; font-size: .88rem; color: var(--ink-3); margin-top: .25rem; }
.person.ancestor { border-left: 3px solid var(--red); }
.person.ancestor .pn { color: var(--ink); }
.gen.unverified .person { border-style: dashed; }
.sibs { position: relative; z-index: 1; margin: .6rem auto 0; max-width: 40rem; font-size: .93rem; }
.sibs summary { cursor: pointer; color: var(--ink-2); background: var(--paper); display: inline-block; padding: .1rem .5rem; margin-left: calc(50% - 7rem); }
.sibs summary:hover { color: var(--red); }
.sibs ul { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); margin: .5rem 0 0; padding: .6rem .9rem .6rem 1.8rem; }
.sibs li { margin: .15rem 0; }
.sibs .person-link { background: none; border: 0; padding: 0; font: inherit; color: var(--red); cursor: pointer; text-decoration: underline; text-underline-offset: .15em; }
.sibs p { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); margin: .5rem 0 0; padding: .6rem .9rem; }
.end-note { position: relative; text-align: center; margin: 0 auto; max-width: 30rem; }
.end-note span { display: inline-block; background: var(--paper); padding: .6rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-style: italic; }
.branches { margin: 0 0 2rem; }
.branches details { border: 1px dashed var(--line); border-radius: var(--radius); background: var(--paper-2); padding: .5rem .9rem; margin-bottom: .6rem; }
.branches summary { cursor: pointer; font-family: var(--head); font-weight: 600; font-size: 1.15rem; }
.branches ol, .branches ul { margin: .5rem 0 .4rem; }
.branches p { margin: .3rem 0 .3rem; font-size: .93rem; color: var(--ink-2); }
@media (max-width: 36em) {
  .pedigree::before { left: 1rem; }
  .couple { grid-template-columns: 1fr; margin-left: 2.2rem; }
  .couple::before { left: -1.2rem; right: auto; width: 1.2rem; top: 1.6rem; height: 2px; }
  .gen-label { text-align: left; margin-left: 2.2rem; }
  .sibs summary { margin-left: 2.2rem; }
  .sibs ul, .sibs p { margin-left: 2.2rem; }
  .end-note { text-align: left; margin-left: 2.2rem; }
}

/* Detail dialog */
dialog.detail { border: 1px solid var(--line); border-top: 4px solid var(--red); border-radius: var(--radius); background: var(--paper); color: var(--ink); padding: 0; width: min(100% - 2rem, 38rem); max-height: min(85vh, 44rem); box-shadow: var(--shadow); }
dialog.detail::backdrop { background: rgba(29, 39, 51, .45); }
.detail-inner { padding: 1.3rem 1.5rem 1.4rem; overflow: auto; max-height: inherit; }
.detail-inner h2 { margin: 0 2.4rem .3rem 0; font-size: 1.8rem; }
.detail-inner dl { display: grid; grid-template-columns: max-content 1fr; gap: .25rem .9rem; margin: .8rem 0 1rem; font-size: .95rem; }
.detail-inner dt { color: var(--ink-3); }
.detail-inner dd { margin: 0; }
.detail-inner .bio { margin-bottom: .9rem; }
.detail-inner .srcs { font-size: .88rem; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: .6rem; }
.detail-inner .srcs ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.close { position: absolute; top: .6rem; right: .7rem; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink-2); border-radius: 999px; width: 2rem; height: 2rem; font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.close:hover { color: var(--red); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 1.5rem 0 0; padding: 0 0 0 1.2rem; border-left: 2px solid var(--line); max-width: 46rem; }
.timeline li { position: relative; padding: 0 0 1.3rem 1rem; }
.timeline li::before { content: ""; position: absolute; left: calc(-1.2rem - 6px); top: .55rem; width: 10px; height: 10px; border-radius: 50%; background: var(--ochre); border: 2px solid var(--paper); }
.timeline li.conflict::before { background: var(--red); }
.timeline li.unverified::before { background: var(--paper); border-color: var(--ochre); }
.timeline .year { font-family: var(--head); font-weight: 600; font-size: 1.3rem; color: var(--red); display: inline-block; min-width: 4.5rem; }
.timeline .title { font-weight: 600; }
.timeline p { margin: .15rem 0 0; color: var(--ink-2); font-size: .97rem; }
.timeline .src { font-size: .82rem; color: var(--ink-3); }

/* ---------- Map ---------- */
.map { height: min(70vh, 34rem); min-height: 18rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-2); margin: 1.2rem 0; isolation: isolate; }
.map.off { display: none; }
.map-note { font-size: .92rem; color: var(--ink-3); }
.map-note.hidden { display: none; }
.places { columns: 2; column-gap: 2rem; padding-left: 1.2rem; font-size: .96rem; }
@media (max-width: 40em) { .places { columns: 1; } }
.places li { break-inside: avoid; margin-bottom: .45rem; }
.places .kind { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ochre-2); margin-left: .3rem; }
.leaflet-container { font: inherit; }
.leaflet-container a { color: var(--red); }
.leaflet-popup-content { font: 400 .95rem/1.45 var(--body); color: var(--ink); }
.leaflet-popup-content b { font-family: var(--head); font-size: 1.15rem; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--paper); color: var(--ink); }
.leaflet-control-attribution { background: rgba(245, 239, 227, .85) !important; color: #333 !important; }
.leaflet-control-attribution a { color: #a2362a !important; }
.pin-route { background: var(--red); border: 2px solid #fff; border-radius: 50%; width: 14px; height: 14px; box-shadow: 0 0 0 2px var(--red); }
.pin-origin { background: var(--ochre); border: 2px solid #fff; border-radius: 50%; width: 12px; height: 12px; }
.pin-later { background: var(--ink-3); border: 2px solid #fff; border-radius: 50%; width: 10px; height: 10px; opacity: .85; }

/* ---------- Sources ---------- */
.srclist dt { font-weight: 600; margin-top: 1rem; scroll-margin-top: 1rem; }
.srclist dd { margin: .15rem 0 0; color: var(--ink-2); }
.notes li { margin-bottom: .8rem; }
.notes li::marker { color: var(--red); }
.spellings { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .4rem 1.4rem; padding: 0; list-style: none; }
.spellings li { border-bottom: 1px dotted var(--line); padding: .25rem 0; }

/* ---------- Footer ---------- */
.site-foot { border-top: 1px solid var(--line); margin-top: clamp(2rem, 6vw, 4rem); padding: 1.6rem 0 2.2rem; font-size: .92rem; color: var(--ink-3); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; }
.site-foot p { margin: 0; }
.site-foot a { color: var(--ink-2); }

/* ---------- 404 ---------- */
.lost { min-height: 60vh; display: grid; place-items: center; text-align: center; }

@media print {
  .site-head, .site-foot, .theme, .toc, .skip { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; text-decoration: none; }
  .person { box-shadow: none; }
}
