/* Norman Family History - site styles */
:root {
  --paper: #f7f1e6;
  --paper-2: #efe5d3;
  --card: #fffaf1;
  --ink: #2b2620;
  --ink-soft: #5c5347;
  --muted: #7a6f60;
  --rule: #d9ccb4;
  --accent: #7b2d26;      /* oxblood */
  --accent-2: #2f4b5e;    /* slate blue */
  --gold: #b0852f;
  --warn-bg: #fbe9d0;
  --warn-ink: #7a4a07;
  --soft-bg: #e9eef1;
  --link: #7b2d26;
  --header-bg: #2f4b5e;
  --header-ink: #f7f1e6;
  --serif-display: "Cormorant Garamond", "Garamond", "Georgia", serif;
  --serif: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --measure: 70ch;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1d1b18; --paper-2: #26231f; --card: #2a2622; --ink: #eee6d8;
    --ink-soft: #cfc4b2; --muted: #a79b89; --rule: #463f36; --accent: #e0a08f;
    --accent-2: #a9c3d4; --gold: #d8b068; --warn-bg: #3f2f18; --warn-ink: #f2cf94;
    --soft-bg: #28323a; --link: #eab09f; --header-bg: #16222b; --header-ink: #eee6d8;
  }
}
:root[data-theme="dark"] {
  --paper: #1d1b18; --paper-2: #26231f; --card: #2a2622; --ink: #eee6d8;
  --ink-soft: #cfc4b2; --muted: #a79b89; --rule: #463f36; --accent: #e0a08f;
  --accent-2: #a9c3d4; --gold: #d8b068; --warn-bg: #3f2f18; --warn-ink: #f2cf94;
  --soft-bg: #28323a; --link: #eab09f; --header-bg: #16222b; --header-ink: #eee6d8;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.075rem; line-height: 1.65;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--serif-display); line-height: 1.15; color: var(--ink); }
h1 { font-size: clamp(2.1rem, 5vw, 3.1rem); margin: 1.2rem 0 .4rem; font-weight: 700; }
h2 { font-size: clamp(1.55rem, 3.4vw, 2rem); margin: 2.2rem 0 .6rem; font-weight: 600;
     border-bottom: 1px solid var(--rule); padding-bottom: .25rem; }
h3 { font-size: 1.4rem; margin: 1.6rem 0 .4rem; font-weight: 600; }
p, li { max-width: var(--measure); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--card); padding: .4rem .8rem; z-index: 10; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.lede { font-size: 1.2rem; color: var(--ink-soft); }

/* header */
.site-header { background: var(--header-bg); color: var(--header-ink);
  border-bottom: 4px solid var(--gold); position: sticky; top: 0; z-index: 50;
  transition: box-shadow .25s ease; }
html { scroll-padding-top: 5.5rem; }
/* compact floating header once the reader scrolls down (class set by site.js) */
.site-header.is-compact { box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.site-header .header-inner, .site-header .brand-mark, .site-header .brand-text { transition: all .25s ease; }
.site-header.is-compact .header-inner { padding-top: .35rem; padding-bottom: .35rem; }
.site-header.is-compact .brand-mark { width: 2.2rem; height: 2.2rem; }
.site-header.is-compact .brand-text { font-size: 1.2rem; }
.site-header.is-compact .brand-text small { display: none; }
@media (min-width: 761px) {
  /* on wide screens the compact bar is one row: logo plus menu */
  .site-header.is-compact .brand-text { display: none; }
  .site-header.is-compact .header-inner { flex-wrap: nowrap; }
}
@media (prefers-reduced-motion: reduce) {
  .site-header, .site-header .header-inner, .site-header .brand-mark, .site-header .brand-text { transition: none; }
}
.header-inner { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--header-ink); text-decoration: none; margin-right: auto; }
.brand-mark { width: 3rem; height: 3rem; flex: none; display: block; border-radius: 50%; }
.brand-text { font-family: var(--serif-display); font-size: 1.45rem; font-weight: 700; line-height: 1.05; }
.brand-text small { display: block; font-family: var(--serif); font-size: .72rem; font-weight: 400;
  letter-spacing: .08em; text-transform: uppercase; opacity: .8; margin-top: .2rem; }
.site-nav { display: flex; flex-wrap: wrap; gap: .15rem .9rem; }
.site-nav a { color: var(--header-ink); text-decoration: none; font-size: .95rem; padding: .2rem 0;
  border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a.active { border-bottom-color: var(--gold); }
.nav-toggle { display: none; background: none; color: var(--header-ink); border: 1px solid var(--gold);
  border-radius: 4px; padding: .3rem .7rem; font: inherit; font-size: .9rem; }
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; width: 100%; flex-direction: column; padding-bottom: .5rem; }
  .site-nav.open { display: flex; max-height: calc(100vh - 5rem); overflow-y: auto; }
}

main { padding-bottom: 3rem; min-height: 60vh; }

/* hero */
.hero { margin: 1.5rem 0 1rem; padding: 2rem 1.5rem; background:
  radial-gradient(ellipse at 20% 0%, rgba(176,133,47,.18), transparent 60%),
  radial-gradient(ellipse at 90% 100%, rgba(47,75,94,.18), transparent 60%), var(--paper-2);
  border: 1px solid var(--rule); border-radius: 6px; }
.hero h1 { margin-top: 0; }
.hero p { font-size: 1.15rem; color: var(--ink-soft); }
.kicker { font-size: .8rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 .3rem; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.card { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: 1.1rem 1.2rem;
  border-top: 4px solid var(--accent-2); }
.card h3 { margin-top: 0; }
.card p { font-size: .98rem; }
.card.accent { border-top-color: var(--accent); }
.card.gold { border-top-color: var(--gold); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin: 1rem 0; }
.stats div { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: .8rem 1rem; }
.stats b { display: block; font-family: var(--serif-display); font-size: 2.2rem; color: var(--accent); line-height: 1; }
.stats span { font-size: .9rem; color: var(--muted); }

/* callouts */
.flag { background: var(--warn-bg); color: var(--warn-ink); border-left: 4px solid var(--gold);
  padding: .7rem 1rem; margin: .8rem 0; border-radius: 0 4px 4px 0; max-width: var(--measure); }
.flag.soft, .callout { background: var(--soft-bg); color: var(--ink); border-left-color: var(--accent-2); }
.callout { border-left: 4px solid var(--accent-2); padding: .8rem 1rem; margin: 1rem 0; border-radius: 0 4px 4px 0; max-width: var(--measure); }
.callout p:last-child, .flag p:last-child { margin-bottom: 0; }
.tag { display: inline-block; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .05rem .4rem; border-radius: 3px; vertical-align: middle; margin-left: .3rem; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--gold); }
.tag.unproven { background: var(--soft-bg); color: var(--accent-2); border: 1px solid var(--accent-2); }
.tag.ok { background: var(--soft-bg); color: var(--accent-2); border: 1px solid var(--accent-2); font-weight: 600; }

/* descent chain */
.chain { list-style: none; padding: 0; margin: 1rem 0; counter-reset: gen; max-width: 760px; }
.chain li { position: relative; padding-left: 2.4rem; margin: 0; max-width: none; }
.chain li::before { counter-increment: gen; content: counter(gen); position: absolute; left: 0; top: .8rem;
  width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--accent-2); color: var(--paper);
  font-size: .8rem; display: grid; place-items: center; }
.chain li::after { content: ""; position: absolute; left: .82rem; top: 2.6rem; bottom: -.9rem; width: 2px; background: var(--rule); }
.chain li:last-child::after { display: none; }
.chain-card { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: .6rem .9rem; margin-bottom: .7rem; }
.chain-card > span { display: block; }
.chain-rel { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.chain-name { font-family: var(--serif-display); font-size: 1.35rem; font-weight: 600; }
.chain-where { font-size: .92rem; color: var(--ink-soft); }
.yrs { color: var(--muted); font-size: .9em; white-space: nowrap; }

/* migration route */
.route { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; margin: 1rem 0; padding: 0; list-style: none; }
.route li { flex: 1 1 150px; background: var(--card); border: 1px solid var(--rule); border-radius: 6px;
  padding: .6rem .8rem; position: relative; max-width: none; }
.route li b { display: block; font-family: var(--serif-display); font-size: 1.2rem; }
.route li span { font-size: .88rem; color: var(--ink-soft); }

/* person pages */
.crumbs { font-size: .9rem; margin: 1rem 0 0; }
.person-head h1 { margin-bottom: 0; }
.lifespan { font-size: 1.3rem; color: var(--ink-soft); margin: .2rem 0; }
.rel-badge { display: inline-block; background: var(--soft-bg); border-radius: 4px; padding: .15rem .6rem; font-size: .95rem; }
table { border-collapse: collapse; width: 100%; }
.facts th, .facts td { text-align: left; vertical-align: top; padding: .45rem .6rem; border-bottom: 1px solid var(--rule); }
.facts th { width: 11rem; font-weight: 600; }
.path { padding-left: 1.4rem; }
.fam { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: .5rem 1rem; margin: .6rem 0; max-width: var(--measure); }
.note { margin: .8rem 0; padding: .6rem 1rem; border-left: 3px solid var(--gold); background: var(--card); max-width: var(--measure); }
.sources li { font-size: .95rem; }

/* index */
.filters { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: end; margin: 1rem 0 .4rem;
  padding: .8rem 1rem; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 6px; }
.filters label { display: flex; flex-direction: column; font-size: .88rem; color: var(--ink-soft); gap: .2rem; }
.filters label.check { flex-direction: row; align-items: center; gap: .4rem; }
.filters input[type=search], .filters select { font: inherit; font-size: 1rem; padding: .35rem .5rem;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--card); color: var(--ink); min-width: 14rem; max-width: 100%; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.index th, .index td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.index th { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.index td { font-size: .96rem; }
.index tr[hidden] { display: none; }
@media (max-width: 640px) {
  .index thead { display: none; }
  .index tr { display: block; padding: .5rem 0; border-bottom: 1px solid var(--rule); }
  .index td { display: block; border: 0; padding: .05rem 0; }
  .index td:first-child { font-size: 1.05rem; font-weight: 600; }
  .filters input[type=search], .filters select { min-width: 0; width: 100%; }
  .filters label { width: 100%; }
  .facts tr { display: block; padding: .45rem 0; border-bottom: 1px solid var(--rule); }
  .facts th, .facts td { display: block; width: auto; border: 0; padding: 0; }
}

/* timeline */
.timeline { list-style: none; padding: 0; margin: 1rem 0; border-left: 2px solid var(--rule); max-width: 820px; }
.timeline li { position: relative; padding: .35rem 0 .35rem 1.2rem; display: flex; gap: .9rem; max-width: none; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: .85rem; width: 10px; height: 10px;
  border-radius: 50%; background: var(--accent-2); }
.timeline .tl-history::before { background: var(--gold); border-radius: 2px; }
.timeline .tl-history .tl-text { font-style: italic; color: var(--ink-soft); }
.tl-year { font-family: var(--serif-display); font-weight: 700; font-size: 1.15rem; min-width: 3.2rem; color: var(--accent); }
.legend { font-size: .9rem; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; margin: 0 .35rem 0 .8rem; background: var(--accent-2); border-radius: 50%; }
.legend span.h::before { background: var(--gold); border-radius: 2px; }

.button { display: inline-block; background: var(--accent); color: var(--paper); padding: .5rem 1rem;
  border-radius: 4px; text-decoration: none; }

.site-footer { border-top: 1px solid var(--rule); background: var(--paper-2); padding: 1.2rem 0; font-size: .9rem; color: var(--ink-soft); }
main > .card, main article.card { margin: 1rem 0; }
.photo { margin: 1rem 0; max-width: 420px; background: var(--card); border: 1px solid var(--rule); padding: .6rem; border-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.photo img { display: block; width: 100%; height: auto; border-radius: 2px; }
.photo figcaption { font-size: .88rem; color: var(--ink-soft); margin-top: .45rem; }
.photo.right { float: right; clear: right; margin: .3rem 0 1rem 1.5rem; max-width: 300px; }
@media (max-width: 640px) { .photo.right { float: none; margin: 1rem 0; max-width: 100%; } }
.clear { clear: both; }
.photo-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; max-width: 760px; margin: 1rem 0; align-items: start; }
.photo-row .photo { margin: 0; max-width: none; }
blockquote { margin: 1rem 0; padding: .6rem 1rem; border-left: 3px solid var(--gold); background: var(--paper-2); font-style: italic; }
blockquote p { margin: .4rem 0; }
blockquote .muted { font-style: normal; }

/* Morebath household tree */
.mb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .8rem; margin: .6rem 0 1.4rem; }
.mb-card { background: var(--card); border: 1px solid var(--rule); border-radius: 6px; padding: .7rem .9rem; font-size: .92rem; }
.mb-card ul { margin: .2rem 0 0; padding-left: 1.1rem; }
.mb-head { font-size: 1rem; margin-bottom: .2rem; }
.mb-meta, .mb-wife, .mb-kids { margin: .2rem 0; }
.mb-note { color: var(--ink-soft); font-size: .86rem; margin: .4rem 0 0; }
.mb-line { max-width: 36rem; margin: .6rem auto 1.4rem; }
.mb-candidate { border: 2px dashed var(--accent-2); }
.mb-proven { border: 2px solid var(--accent); }
.mb-link { position: relative; height: 3.2rem; margin-left: 2rem; }
.mb-link::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 3px solid var(--accent); }
.mb-link.probable::before { border-left: 3px dashed var(--accent-2); }
.mb-link span { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.mb-link.probable span { color: var(--accent-2); font-weight: 600; }
.mb-linknote { margin: 0 0 .6rem 2rem; }

/* Home page banner */
.hero-banner { margin: -2rem -1.5rem 1.5rem; }
.hero-banner img { display: block; width: 100%; height: auto; border-radius: 6px 6px 0 0; }

/* Historical illustrations (same treatment as the home banner) */
.illustration { margin: 1.2rem 0 1.6rem; }
.illustration img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 6px; }
.illustration figcaption { margin-top: .4rem; font-size: .8rem; color: var(--muted); font-style: italic; }
.card-art { display: block; margin: -1.1rem -1.2rem .9rem; }
.card-art img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px 6px 0 0; }

/* ---- Finishing touches ---- */

/* Paper texture: a faint grain over the page colour (both themes) */
body {
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .16 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Section ornament: a small printer's flourish above each section heading */
main h2 { position: relative; clear: both; }
main h2 + *, main h2 { scroll-margin-top: 5.5rem; }
main > h2:not(:first-of-type)::before,
main section h2:not(:first-child)::before {
  content: ""; display: block; width: 7.5rem; height: 12px; margin: 0 auto 1.6rem;
  background: var(--gold); opacity: .55;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M0 6h48M72 6h48' stroke='black' stroke-width='1'/%3E%3Cpath d='M60 1l5 5-5 5-5-5z' fill='black'/%3E%3Ccircle cx='51' cy='6' r='1.4'/%3E%3Ccircle cx='69' cy='6' r='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12'%3E%3Cpath d='M0 6h48M72 6h48' stroke='black' stroke-width='1'/%3E%3Cpath d='M60 1l5 5-5 5-5-5z' fill='black'/%3E%3Ccircle cx='51' cy='6' r='1.4'/%3E%3Ccircle cx='69' cy='6' r='1.4'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Card polish: a gentle lift on hover, and the illustration settles in slightly */
.card { transition: transform .25s ease, box-shadow .25s ease; }
.card-art { overflow: hidden; }
.card-art img { transition: transform .6s ease; }
@media (hover: hover) {
  .cards .card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(43,38,32,.12); }
  .cards .card:hover .card-art img { transform: scale(1.03); }
}

/* Fade-in on scroll (only when JavaScript is running and motion is allowed) */
.js-reveal main h2, .js-reveal main .card, .js-reveal main figure, .js-reveal main .callout,
.js-reveal main .flag, .js-reveal main .chain, .js-reveal main .mb-grid, .js-reveal main .mb-line,
.js-reveal main .timeline {
  opacity: 0; transform: translateY(12px); transition: opacity .7s ease, transform .7s ease;
}
.js-reveal main .is-in { opacity: 1; transform: none; }
.js-reveal main .card.is-in { transition: opacity .7s ease, transform .25s ease, box-shadow .25s ease; }
@media (prefers-reduced-motion: reduce) {
  .card, .card-art img { transition: none; }
  .cards .card:hover { transform: none; }
}
