:root {
  --ink-900: #1b2127;
  --ink-700: #33414f;
  --ink-500: #5c6b7a;
  --ink-300: #8b98a5;
  --paper-000: #ffffff;
  --paper-100: #f7f5f1;
  --paper-200: #ece7df;
  --paper-300: #ddd5c8;
  --accent-700: #5b4320;
  --accent-500: #8a6a34;
  --accent-200: #d8c49a;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --shadow: 0 1px 2px rgba(27, 33, 39, 0.08), 0 8px 24px rgba(27, 33, 39, 0.06);
  --maxw: 1080px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 8.5rem;
}

body {
  margin: 0;
  background: var(--paper-100);
  color: var(--ink-900);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  font-family: "Barlow Condensed", "Segoe UI Semibold", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--ink-900);
}

h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
}

h2 {
  font-size: clamp(1.5rem, 3.4vw, 2rem);
}

h3 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--accent-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--ink-900);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Layout ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink-900);
  color: var(--paper-000);
  padding: 0.6rem 1rem;
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.wrap {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

main {
  padding: 2.5rem 0 3.5rem;
}

.section {
  margin-bottom: 2.75rem;
}

/* ---------- Site header / navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper-000);
  border-bottom: 1px solid var(--paper-300);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 0.7rem 0 0.35rem;
  flex-wrap: wrap;
}

.brand a {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-900);
  text-decoration: none;
}

.brand .tagline {
  font-size: 0.85rem;
  color: var(--ink-500);
  letter-spacing: 0.04em;
}

.nav-primary ul,
.nav-secondary ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
}

.nav-primary a,
.nav-secondary a {
  display: inline-block;
  text-decoration: none;
  color: var(--ink-700);
  border-bottom: 2px solid transparent;
}

.nav-primary a {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 1.3rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0;
}

.nav-secondary {
  background: var(--paper-200);
  border-top: 1px solid var(--paper-300);
}

.nav-secondary ul {
  gap: 0.15rem 1.25rem;
}

.nav-secondary a {
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  padding: 0.4rem 0;
  color: var(--ink-500);
}

.nav-primary a:hover,
.nav-secondary a:hover {
  color: var(--accent-700);
  border-bottom-color: var(--accent-200);
}

.nav-primary a[aria-current="page"],
.nav-secondary a[aria-current="page"] {
  color: var(--accent-700);
  border-bottom-color: var(--accent-500);
  font-weight: 600;
}

/* ---------- Page intro ---------- */

.page-intro {
  background: var(--paper-000);
  border-bottom: 1px solid var(--paper-300);
  padding: 2.25rem 0 1.75rem;
}

.page-intro p {
  max-width: 62ch;
  color: var(--ink-700);
  margin-bottom: 0;
}

.eyebrow {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.85rem;
  color: var(--accent-500);
  margin: 0 0 0.35rem;
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.card,
.info-card {
  background: var(--paper-000);
  border: 1px solid var(--paper-300);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
}

.card h3 {
  margin-top: 0;
}

.card p:last-child,
.info-card p:last-child {
  margin-bottom: 0;
}

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card-link:hover {
  transform: translateY(-2px);
  border-color: var(--accent-200);
  color: inherit;
}

.card-link .more {
  display: inline-block;
  margin-top: 0.6rem;
  font-weight: 600;
  color: var(--accent-700);
}

/* ---------- Lists ---------- */

.link-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.link-list li {
  border-bottom: 1px solid var(--paper-300);
  padding: 0.7rem 0;
}

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

.meta {
  color: var(--ink-500);
  font-size: 0.9rem;
  margin: 0;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--paper-300);
  background: var(--paper-200);
  color: var(--ink-700);
  vertical-align: middle;
}

.badge-public {
  background: #e7f0e8;
  border-color: #c3dcc7;
  color: #2f5b38;
}

.badge-private {
  background: #f4e9e0;
  border-color: var(--accent-200);
  color: var(--accent-700);
}

/* ---------- Two column ---------- */

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 820px) {
  .two-col {
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
  }
}

/* ---------- Person page ---------- */

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

.person-header .lifespan {
  font-size: 1.1rem;
  color: var(--ink-500);
}

.fact-table {
  width: 100%;
  border-collapse: collapse;
}

.fact-table th,
.fact-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.75rem 0.55rem 0;
  border-bottom: 1px solid var(--paper-200);
}

.fact-table th {
  width: 9rem;
  font-weight: 600;
  color: var(--ink-500);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pedigree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pedigree ul {
  list-style: none;
  margin: 0.35rem 0 0.35rem 1rem;
  padding-left: 1rem;
  border-left: 2px solid var(--paper-300);
}

.pedigree li {
  padding: 0.2rem 0;
}

/* ---------- Surnames / cemeteries ---------- */

.tag-cloud {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.tag-cloud a {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: var(--paper-000);
  border: 1px solid var(--paper-300);
  text-decoration: none;
  color: var(--ink-700);
}

.tag-cloud a:hover {
  border-color: var(--accent-500);
  color: var(--accent-700);
}

.tag-cloud .count {
  color: var(--ink-300);
  font-size: 0.85rem;
  margin-left: 0.35rem;
}

.alpha-index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 1.5rem;
  padding: 0;
  list-style: none;
}

.alpha-index a {
  display: inline-block;
  min-width: 2rem;
  text-align: center;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--paper-300);
  border-radius: var(--radius-sm);
  background: var(--paper-000);
  text-decoration: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper-000);
  border: 1px solid var(--paper-300);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table caption {
  text-align: left;
  color: var(--ink-500);
  font-size: 0.9rem;
  padding-bottom: 0.5rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--paper-200);
}

.data-table thead th {
  background: var(--paper-200);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-700);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.table-scroll {
  overflow-x: auto;
}

/* ---------- Updates timeline ---------- */

.updates {
  list-style: none;
  margin: 0;
  padding: 0;
}

.updates li {
  padding: 0 0 1rem 1.15rem;
  border-left: 2px solid var(--paper-300);
  position: relative;
}

.updates li::before {
  content: "";
  position: absolute;
  left: -0.4rem;
  top: 0.55rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--accent-500);
}

.updates time {
  display: block;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-500);
}

/* ---------- Forms ---------- */

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

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  padding: 0.6rem 0.7rem;
  background: var(--paper-000);
  border: 1px solid var(--paper-300);
  border-radius: var(--radius-md);
}

.field textarea {
  min-height: 10rem;
  resize: vertical;
}

.hint {
  font-size: 0.85rem;
  color: var(--ink-500);
  margin: 0.3rem 0 0;
}

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--accent-700);
  background: var(--accent-700);
  color: var(--paper-000);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--ink-900);
  border-color: var(--ink-900);
  color: var(--paper-000);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-700);
}

.btn-secondary:hover {
  background: var(--accent-700);
  color: var(--paper-000);
}

@media (min-width: 820px) {
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--ink-900);
  color: var(--paper-200);
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer .footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  align-items: center;
  justify-content: space-between;
}

.site-footer .footer-name {
  font-family: "Barlow Condensed", system-ui, sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--paper-000);
}

.site-footer ul {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
}

.site-footer a {
  color: var(--paper-200);
}

.site-footer a:hover {
  color: var(--accent-200);
}

.site-footer small {
  display: block;
  width: 100%;
  color: var(--ink-300);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- Motion ---------- */

@keyframes reveal-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

main > .wrap > .section,
.page-intro .wrap {
  animation: reveal-up 0.5s ease both;
}

main > .wrap > .section:nth-child(2) {
  animation-delay: 0.08s;
}

main > .wrap > .section:nth-child(3) {
  animation-delay: 0.16s;
}

main > .wrap > .section:nth-child(4) {
  animation-delay: 0.24s;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 420px) {
  body {
    font-size: 1rem;
  }

  .wrap {
    width: calc(100% - 1.75rem);
  }

  .nav-primary ul {
    gap: 0.2rem 1rem;
  }

  .nav-primary a {
    font-size: 1.15rem;
  }

  .nav-secondary ul {
    gap: 0.1rem 0.9rem;
  }

  .nav-secondary a {
    font-size: 0.85rem;
  }

  .brand a {
    font-size: 1.35rem;
  }

  .fact-table th {
    width: 7rem;
  }
}
