:root {
  color-scheme: light;
  --bg: #f8f8f6;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #262927;
  --muted: #6f766f;
  --subtle: #9aa19a;
  --line: rgba(38, 41, 39, 0.1);
  --line-strong: rgba(38, 41, 39, 0.16);
  --accent: #4d7f73;
  --accent-strong: #315d54;
  --accent-soft: #edf5f2;
  --berry: #9c6d7a;
  --blue: #6d8ea0;
  --shadow: 0 10px 26px rgba(32, 38, 34, 0.06), 0 1px 4px rgba(32, 38, 34, 0.04);
  --shadow-soft: 0 1px 3px rgba(32, 38, 34, 0.05);
  --radius: 8px;
  --radius-sm: 5px;
  --max: 1160px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.55;
}

a {
  color: var(--accent);
  font-weight: 650;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.72rem, 2.25vw, 2.35rem);
}

h2 {
  font-size: 1.18rem;
}

h3 {
  font-size: 1.05rem;
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding-left: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  background: var(--surface-strong);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px var(--line);
}

th,
td {
  padding: 0.78rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

tr:last-child th,
tr:last-child td {
  border-bottom: 0;
}

th,
td:first-child {
  width: 13rem;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

embed {
  width: 100%;
  min-height: 72vh;
  border: 0;
  border-radius: var(--radius);
  background: #f2eee6;
  box-shadow: inset 0 0 0 1px var(--line);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 248, 246, 0.92);
  backdrop-filter: blur(10px);
}

.site-nav {
  width: min(var(--max), calc(100% - 2rem));
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 0.62rem;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-family: Georgia, serif;
  font-size: 1.12rem;
  box-shadow: inset 0 0 0 1px rgba(77, 127, 115, 0.12);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  font-size: 1.08rem;
  font-weight: 650;
}

.brand small {
  margin-top: 0.05rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 620;
}

.nav-links,
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links {
  margin-left: auto;
  padding: 0.25rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav-links a,
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition-property: background-color, color, box-shadow, transform;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.nav-links a {
  padding: 0.44rem 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.nav-actions {
  margin-left: 0.25rem;
}

.button {
  gap: 0.45rem;
  padding: 0.52rem 0.82rem;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  white-space: nowrap;
}

.button:active {
  transform: scale(0.96);
}

.button.primary {
  color: #fff;
  background: var(--accent);
  box-shadow: var(--shadow-soft);
}

.button.primary:hover {
  color: #fff;
  background: var(--accent-strong);
}

.button.secondary {
  color: var(--accent-strong);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(77, 127, 115, 0.1);
}

.button.quiet {
  color: var(--muted);
  background: transparent;
}

.button.quiet:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.68);
}

.page-shell {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.4rem 0 4rem;
}

.page-header {
  margin-bottom: 1.45rem;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
}

.page-header-row > .button,
.page-header-row > .action-row {
  flex-shrink: 0;
  margin-top: 2rem;
}

.page-header p:not(.eyebrow) {
  max-width: 680px;
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 1rem;
}

.eyebrow {
  margin-bottom: 0.45rem;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

.hero-panel,
.panel,
.card,
.empty-state,
.login-panel {
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px var(--line);
}

.hero-panel {
  min-height: 250px;
  padding: clamp(1.2rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(237, 245, 242, 0.88), rgba(255, 255, 255, 0.98)),
    var(--surface);
  color: var(--text);
}

.hero-panel h1,
.hero-panel p,
.hero-panel a {
  color: inherit;
}

.hero-panel h1 {
  max-width: 760px;
  font-size: clamp(1.85rem, 3.2vw, 2.8rem);
}

.hero-panel p {
  max-width: 620px;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 1rem;
}

.hero-panel .button {
  align-self: flex-start;
  margin-top: 2rem;
  color: #fff;
  background: var(--accent);
}

.stats-grid,
.summary-grid,
.card-grid {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 1rem;
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stat-card,
.panel,
.card,
.empty-state,
.login-panel {
  padding: 1rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100px;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px var(--line);
}

.stat-card strong {
  font-size: 1.7rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card span,
.meta,
.muted {
  color: var(--muted);
}

.section-stack {
  display: grid;
  gap: 1rem;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1rem;
  align-items: start;
}

.panel {
  display: grid;
  gap: 1rem;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.panel-header p {
  margin-top: 0.35rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.list-clean {
  display: grid;
  gap: 0.65rem;
  padding: 0;
  list-style: none;
}

.link-card,
.record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line);
  text-decoration: none;
  transition-property: box-shadow, transform, background-color;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

.link-card:hover,
.record-row:hover {
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-soft);
  transform: translateY(-1px);
}

.record-row strong,
.link-card strong {
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  font-size: 1.03rem;
  font-weight: 600;
  line-height: 1.22;
}

.record-row span,
.link-card span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 550;
}

.card {
  display: grid;
  gap: 0.7rem;
}

.card h3 a {
  color: var(--text);
}

.marriage-card {
  gap: 0.8rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.marriage-card h3 {
  font-size: 1.05rem;
}

.marriage-card h3 a {
  text-decoration: none;
}

.marriage-card h3 a:hover {
  text-decoration: underline;
}

.marriage-card + .marriage-card {
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.marriage-meta {
  display: grid;
  gap: 0.18rem;
}

.marriage-meta p {
  color: var(--muted);
  font-size: 0.94rem;
}

.children-list {
  display: grid;
  gap: 0.25rem;
  padding: 0;
  list-style: none;
}

.children-list a,
.children-list span {
  display: flex;
  min-height: 38px;
  align-items: center;
  padding: 0.45rem 0;
  border-top: 1px solid var(--line);
  color: var(--accent-strong);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  text-decoration: none;
}

.children-list a:hover {
  text-decoration: underline;
}

.children-list span {
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
}

.report-stack {
  display: grid;
  gap: 1rem;
}

.report-generation {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft), inset 0 0 0 1px var(--line);
}

.report-generation-header {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.report-generation-header p {
  margin-top: 0.25rem;
  color: var(--muted);
}

.report-person {
  display: grid;
  gap: 0.9rem;
  padding: 0.75rem 0 1rem;
  border-bottom: 1px solid var(--line);
}

.report-person:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.report-person-header {
  display: grid;
  gap: 0.25rem;
}

.report-person-header h3 {
  font-size: 1.18rem;
}

.report-person-header h3 a,
.report-marriage h5 a,
.report-link-list a,
.report-marriage a {
  color: var(--accent-strong);
}

.report-person-header p {
  color: var(--muted);
}

.report-facts {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line);
}

.report-facts div {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}

.report-facts dt {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 650;
}

.report-facts dd {
  margin: 0;
}

.report-subsection {
  display: grid;
  gap: 0.45rem;
}

.report-subsection h4 {
  font-size: 0.98rem;
}

.report-notes {
  color: var(--muted);
  white-space: pre-line;
}

.report-link-list {
  display: grid;
  gap: 0.35rem;
  padding: 0;
  list-style: none;
}

.report-link-list li {
  display: grid;
  gap: 0.1rem;
}

.report-link-list span {
  color: var(--muted);
  font-size: 0.9rem;
}

.report-marriages {
  display: grid;
  gap: 0.75rem;
}

.report-marriage {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
}

.report-marriage h5 {
  font-size: 0.98rem;
}

.report-marriage p {
  color: var(--text);
}

.report-related-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: baseline;
}

.report-related-row strong,
.report-marriage strong {
  margin-right: 0.35rem;
  color: var(--muted);
  font-weight: 650;
}

.report-related-row span {
  min-width: 0;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.88rem;
  font-weight: 700;
}

.fact-list {
  display: grid;
  gap: 0.7rem;
  padding: 0;
  list-style: none;
}

.fact-list li {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}

.fact-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.fact-list span:first-child {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.notes-box {
  padding: 1rem;
  border-radius: var(--radius);
  background: #f8fbf7;
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: pre-line;
}

.document-frame {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: 1rem;
  align-items: start;
}

.family-chart-wrap {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-strong);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-soft);
}

.family-tree-panel {
  margin-top: 0.5rem;
}

.empty-state {
  color: var(--muted);
}

.login-panel {
  max-width: 460px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-field {
  display: grid;
  gap: 0.35rem;
}

.form-field label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--text);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: 3px solid rgba(39, 100, 92, 0.18);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.alert {
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius);
  color: #6b2419;
  background: #fde6df;
}

@media (max-width: 860px) {
  .site-nav,
  .page-header-row,
  .hero,
  .split-layout,
  .document-frame {
    grid-template-columns: 1fr;
  }

  .site-nav {
    display: grid;
    padding: 0.75rem 0;
  }

  .nav-links {
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
  }

  .nav-actions {
    margin-left: 0;
  }

  .page-header-row {
    display: grid;
  }

  .stats-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .page-shell,
  .site-nav {
    width: min(100% - 1rem, var(--max));
  }

  .page-shell {
    padding-top: 1.8rem;
  }

  .nav-links a,
  .button {
    white-space: nowrap;
  }

  th,
  td {
    display: block;
    width: 100%;
  }

  th,
  td:first-child {
    padding-bottom: 0.25rem;
  }

  td + td {
    padding-top: 0;
  }

  .fact-list li {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
}
