/* Safer Family Tree - classic layout, lightly modernised */
:root {
  --bg: #f5f2ea;
  --ink: #23201b;
  --muted: #6a645a;
  --line: #a39d92;
  --card: #fffdf8;
  --edge: #ddd6c8;
  --btn: #ee9c6c;
  --btn-hover: #e58a55;
  --btn-ink: #3b1f0f;
  --link: #2f5d9e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 28px 20px 48px;
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  font-size: 13px;
  background-color: var(--bg);
  /* very faint linen texture - a nod to the original site */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .47 0 0 0 0 .38 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--link); }

/* ---------- header ---------- */
.title-box {
  display: table;
  margin: 0 auto 6px;
  padding: 10px 34px;
  background: var(--card);
  border: 1px solid var(--edge);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(40, 32, 20, .07);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.subtitle { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 20px; }

.buttons {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 0 auto 18px; max-width: 1200px;
}
.buttons.center { justify-content: center; }
.btn {
  display: inline-block;
  padding: 7px 16px;
  background: var(--btn);
  border: 1px solid rgba(0, 0, 0, .08);
  border-radius: 8px;
  color: var(--btn-ink);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s;
}
.btn:hover { background: var(--btn-hover); }
.btn.current { background: transparent; border-color: var(--btn); color: #9a4f22; }
.btn.home { background: #fff; border-color: var(--edge); color: var(--ink); }
.btn.home:hover { background: #f1ece2; }

.find {
  margin-left: auto;
  padding: 7px 12px;
  width: 210px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13.5px;
}
.find:focus { outline: 2px solid #f2b48d; border-color: #e9a072; }

.intro {
  max-width: 700px;
  margin: 18px auto 22px;
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
  color: #3d3830;
}
.intro p { margin: 0 0 10px; }
.intro .welcome { font-family: Georgia, serif; font-size: 20px; color: var(--ink); }

/* ---------- tree (left-to-right, compressed) ---------- */
.tree-wrap {
  overflow-x: auto;
  max-width: 100%;
  padding: 18px;
  background: rgba(255, 253, 248, .55);
  border: 1px solid var(--edge);
  border-radius: 14px;
}
.tree { display: inline-block; }

.node { display: flex; align-items: center; position: relative; }
.kids { display: flex; flex-direction: column; margin-left: 12px; }
.kids > .node { padding: 2px 0 2px 12px; }

/* connectors */
.kids > .node::before {             /* vertical line joining siblings */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
}
.kids > .node::after {              /* short stub into each child */
  content: ""; position: absolute; left: 0; top: 50%; width: 12px;
  border-top: 1px solid var(--line);
}
.kids > .node:first-child::before { top: 50%; }
.kids > .node:last-child::before  { bottom: 50%; }
.kids > .node:only-child::before  { display: none; }
.has-kids > .box::after {           /* line out of the parent */
  content: ""; position: absolute; right: -13px; top: 50%; width: 12px;
  border-top: 1px solid var(--line);
}

.box {
  position: relative;
  flex: none;
  width: 184px;
  padding: 3px 8px 4px;
  border: 1px solid rgba(0, 0, 0, .14);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(40, 32, 20, .06);
  line-height: 1.28;
  transition: box-shadow .15s, transform .15s, opacity .15s;
}
.box .nm   { display: block; font-weight: 600; font-size: 13px; }
.box .sp   { display: block; font-size: 12px; color: #4f4a42; }
.box .sp.unknown { font-style: italic; color: #8a8378; }
.box .note { display: block; font-size: 11px; font-style: italic; color: #8a2c2c; }
.box.missing { border-style: dashed; opacity: .8; }
.box a { color: inherit; text-decoration: underline; text-decoration-color: rgba(0,0,0,.3); text-underline-offset: 2px; }
.box:hover { box-shadow: 0 3px 10px rgba(40, 32, 20, .14); }

/* search highlight */
.searching .box { opacity: .35; }
.searching .box.hit { opacity: 1; box-shadow: 0 0 0 3px #e9a072; }

/* generation colours - same order as the original site, softened */
.g0 { background: #f8c9dc; }
.g1 { background: #dedad3; }
.g2 { background: #fbf0a8; }
.g3 { background: #d3efcf; }
.g4 { background: #fbd6b6; }
.g5 { background: #cdeef2; }
.g6 { background: #dcdcf6; }
.g7 { background: #f3d6f0; }

.footer { margin-top: 24px; text-align: center; font-size: 12.5px; color: var(--muted); }

@media print {
  body { background: #fff; padding: 0; }
  .buttons, .find { display: none; }
  .tree-wrap { border: 0; padding: 0; overflow: visible; }
  .box { box-shadow: none; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 640px) {
  body { padding: 18px 12px 36px; }
  .title-box { font-size: 21px; padding: 8px 16px; }
  .find { margin-left: 0; width: 100%; }
  .box { width: 140px; }
  .box .nm { font-size: 12px; }
  .tree-wrap { padding: 10px; }
}

/* branch groups and home-page chart titles */
.side { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 2px 0 8px; }
.chart-title { font: 400 21px Georgia, "Times New Roman", serif; text-align: center; margin: 30px 0 12px; }
@media (max-width: 640px) { .side { width: 100%; margin: 6px 0 0; } }
