:root {
  color-scheme: light;
  --ink: #0f304f;
  --ink-deep: #09243e;
  --ink-soft: #4f6476;
  --nav: #0c304f;
  --nav-2: #143f60;
  --paper: #fbf8f1;
  --paper-2: #f5efe4;
  --card: rgba(255, 253, 247, 0.92);
  --line: #ddd4c5;
  --line-strong: #c5b7a5;
  --gold: #b18a50;
  --green: #5d8b59;
  --blue: #0f4a78;
  --shadow: 0 18px 42px rgba(34, 26, 14, 0.12);
  --soft-shadow: 0 8px 22px rgba(16, 36, 58, 0.1);
  --radius: 8px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Inter", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background: #fbf8f1;
}

body {
  margin: 0;
  color: var(--ink-deep);
  background:
    radial-gradient(circle at 42% 16%, rgba(177, 138, 80, 0.12), transparent 28rem),
    linear-gradient(90deg, #f7f1e7, #fffdf8 38%, #f6f0e8);
  font-family: var(--serif);
  line-height: 1.45;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.17;
  background-image:
    linear-gradient(rgba(15, 48, 79, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 48, 79, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mix-blend-mode: multiply;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.archive-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  color: #f8f4eb;
  background:
    linear-gradient(180deg, rgba(7, 32, 54, 0.94), rgba(10, 47, 77, 0.95)),
    radial-gradient(circle at 35% 15%, rgba(128, 174, 203, 0.22), transparent 19rem);
  box-shadow: 12px 0 30px rgba(9, 27, 45, 0.18);
  padding: 28px 12px 0;
  display: flex;
  flex-direction: column;
}

.crest {
  color: #fffaf1;
  text-decoration: none;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0 10px 24px;
}

.crest__logo {
  width: 104px;
  aspect-ratio: 1;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.22));
}

.crest__title {
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crest__subtitle {
  font: 0.95rem var(--sans);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 6px;
  color: #f8f4eb;
  text-decoration: none;
  font-size: 1.03rem;
  transition: background 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(143, 184, 213, 0.28);
}

.nav-icon {
  font-family: var(--sans);
  font-size: 1.25rem;
  opacity: 0.92;
}

.sidebar-photo {
  position: relative;
  margin: auto -12px 0;
  height: 310px;
  overflow: hidden;
  background: #0b2d49;
}

.sidebar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 52%;
  filter: sepia(0.08) saturate(0.92) brightness(0.82);
  transform: scale(1.01);
}

.sidebar-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12, 48, 79, 0.2), rgba(12, 48, 79, 0.92));
}

.sidebar-photo figcaption {
  position: absolute;
  z-index: 1;
  left: 18px;
  bottom: 16px;
  font: 0.78rem var(--sans);
  color: rgba(255, 255, 255, 0.76);
}

.main-panel {
  min-width: 0;
}

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 36px;
  border-bottom: 1px solid rgba(197, 183, 165, 0.44);
  background: rgba(255, 253, 247, 0.68);
  backdrop-filter: blur(12px);
}

.family-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  color: var(--ink);
  font-size: 1.08rem;
}

.brand-logo {
  width: 30px;
  aspect-ratio: 1;
  display: block;
  object-fit: contain;
}

.topbar p {
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid var(--line-strong);
  color: #5a4b40;
  font-style: italic;
}

.page-header {
  width: 100%;
  max-width: 100%;
  padding: 44px 36px 22px;
  border-bottom: 1px solid rgba(197, 183, 165, 0.44);
}

.page-header h1 {
  max-width: 850px;
}

.page-header p {
  max-width: min(58ch, 100%);
  margin: 16px 0 0;
  color: #625d55;
  font: 1.02rem/1.55 var(--sans);
  overflow-wrap: break-word;
}

.hero {
  position: relative;
  min-height: 330px;
  padding: 42px 36px 24px;
  display: grid;
  grid-template-columns: minmax(310px, 0.95fr) minmax(320px, 1fr);
  gap: 24px;
  overflow: hidden;
}

.hero--home {
  min-height: clamp(520px, 56vw, 680px);
  align-items: center;
  isolation: isolate;
  background: #132f47;
  border-bottom: 1px solid rgba(197, 183, 165, 0.42);
}

.hero--home::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: url("./assets/media/brand/hero-background.png");
  background-position: center right;
  background-size: cover;
  opacity: 0.95;
  filter: saturate(0.96) contrast(1.04) brightness(1.02);
}

.hero--home::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(251, 248, 241, 0.92) 0%, rgba(251, 248, 241, 0.76) 28%, rgba(251, 248, 241, 0.26) 52%, rgba(251, 248, 241, 0.06) 74%, rgba(8, 30, 52, 0.08) 100%),
    linear-gradient(180deg, rgba(255, 253, 247, 0.3) 0%, rgba(255, 253, 247, 0.02) 42%, rgba(9, 32, 54, 0.28) 100%),
    radial-gradient(ellipse at 84% 88%, rgba(8, 28, 49, 0.34), transparent 55%);
  pointer-events: none;
}

.hero__copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  max-width: 760px;
  padding: 18px 0 26px;
  text-shadow: 0 1px 0 rgba(255, 253, 247, 0.72);
}

.welcome {
  margin: 0 0 2px;
  color: #6e665e;
  font-size: clamp(1.25rem, 1.8vw, 1.8rem);
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(2.55rem, 4.4vw, 4.25rem);
  line-height: 0.96;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

.hero__lede,
.hero__note {
  max-width: 52ch;
  color: #625d55;
  font-size: 1.08rem;
}

.hero__note {
  font-size: 0.95rem;
  color: #766e64;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 4px;
  border: 1px solid var(--blue);
  text-decoration: none;
  font: 700 0.92rem var(--sans);
}

.button--primary {
  color: #fffaf1;
  background: var(--blue);
}

.button--ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.hero__collage {
  position: relative;
  min-height: 270px;
}

.tree-sketch {
  position: absolute;
  inset: 0 22% 0 0;
  opacity: 0.18;
  background:
    radial-gradient(ellipse at 45% 28%, transparent 25%, #736453 26%, transparent 27%),
    repeating-radial-gradient(ellipse at 45% 28%, transparent 0 18px, rgba(67, 57, 47, 0.45) 19px 20px, transparent 21px 38px);
  mask-image: radial-gradient(circle at 45% 38%, #000 0 58%, transparent 72%);
}

.photo-stack {
  position: absolute;
  margin: 0;
  overflow: hidden;
  border: 8px solid #fbf8f1;
  border-bottom-width: 18px;
  border-radius: 7px;
  box-shadow: 0 16px 28px rgba(30, 24, 18, 0.22);
  background: #f6efe4;
}

.photo-stack img {
  display: block;
  width: 200%;
  height: 200%;
  object-fit: cover;
}

.photo-stack figcaption {
  position: absolute;
  left: 8px;
  bottom: 2px;
  font: 0.65rem var(--sans);
  color: #71675c;
}

.photo-stack--fjord {
  width: min(360px, 62%);
  aspect-ratio: 1.55;
  right: 88px;
  top: 14px;
  transform: rotate(-7deg);
  z-index: 2;
}

.photo-stack--fjord img {
  object-position: 100% 100%;
  transform: translate(-50%, -50%);
}

.photo-stack--family {
  width: min(190px, 34%);
  aspect-ratio: 0.78;
  right: 18px;
  top: 56px;
  transform: rotate(5deg);
  z-index: 1;
}

.photo-stack--family img {
  object-position: 0 0;
}

.paper-note {
  position: absolute;
  width: 300px;
  height: 180px;
  right: 8px;
  bottom: 0;
  background:
    linear-gradient(120deg, rgba(177, 138, 80, 0.08), transparent),
    repeating-linear-gradient(8deg, rgba(86, 63, 39, 0.12) 0 1px, transparent 1px 18px),
    #efe2cc;
  transform: rotate(2deg);
  box-shadow: var(--soft-shadow);
}

.stats-strip {
  position: relative;
  z-index: 2;
  margin: -34px 24px 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--soft-shadow);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.stat {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 10px;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
}

.stat__icon {
  font: 1.35rem var(--sans);
  color: #70899b;
}

.stat strong {
  display: block;
  font-size: 1.2rem;
}

.stat span:last-child {
  display: block;
  color: #5d625f;
  font: 0.76rem/1.25 var(--sans);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(310px, 0.85fr);
  padding: 0 24px 24px;
}

.archive-section {
  background: rgba(255, 253, 247, 0.74);
  border: 1px solid var(--line);
  border-top: 0;
  padding: 18px;
  min-width: 0;
}

.archive-section--wide {
  grid-column: span 1;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.18rem;
}

.section-heading a,
.section-heading span,
.timeline-header a {
  color: #456681;
  text-decoration: none;
  font: 0.76rem var(--sans);
}

.photo-grid,
.document-grid,
.artifact-grid,
.place-grid,
.story-grid {
  display: grid;
  gap: 12px;
}

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

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

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

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

.page-section {
  margin: 24px;
  border-top: 1px solid var(--line);
  border-radius: var(--radius);
}

.page-grid {
  min-height: 220px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 24px;
}

.home-link {
  min-height: 150px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-deep);
  background: rgba(255, 253, 247, 0.74);
  box-shadow: var(--soft-shadow);
  text-decoration: none;
}

.home-link span {
  color: var(--ink);
  font-size: 1.18rem;
}

.home-link strong {
  color: #5f5d57;
  font: 0.86rem/1.45 var(--sans);
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 38px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  color: #5f5d57;
  background: rgba(255, 255, 255, 0.48);
  font: 0.95rem/1.5 var(--sans);
  text-align: center;
}

.card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(197, 183, 165, 0.68);
  border-radius: 7px;
  box-shadow: 0 8px 18px rgba(31, 35, 38, 0.06);
}

.card__image {
  height: 132px;
  overflow: hidden;
  background: #e9dfd0;
}

.document-grid .card__image {
  height: 112px;
}

.artifact-grid .card__image {
  height: 150px;
}

.card__image img,
.roots-card img {
  width: 200%;
  height: 200%;
  object-fit: cover;
}

[data-crop="family"] img {
  object-position: 0 0;
}

[data-crop="ship"] img {
  object-position: 100% 0;
  transform: translateX(-50%);
}

[data-crop="homestead"] img {
  object-position: 0 100%;
  transform: translateY(-50%);
}

[data-crop="fjord"] img {
  object-position: 100% 100%;
  transform: translate(-50%, -50%);
}

[data-crop="paper"] img {
  object-position: 50% 50%;
  filter: sepia(0.35) saturate(0.5) brightness(1.12);
}

.card__body {
  padding: 10px 11px 12px;
}

.card h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.18;
}

.card p {
  margin: 0;
  color: #5f5d57;
  font: 0.76rem/1.35 var(--sans);
}

.meta-line {
  display: block;
  color: #71685f;
  font: 0.7rem/1.4 var(--sans);
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  color: #5b5146;
  background: rgba(151, 135, 111, 0.17);
  font: 0.68rem var(--sans);
}

.citation {
  margin-top: 9px;
  color: #544a3e;
  font: 0.68rem/1.35 var(--sans);
}

.citation summary {
  cursor: pointer;
  color: var(--blue);
}

.citation p {
  margin: 6px 0 0;
}

.roots-card {
  min-height: 260px;
}

.roots-figure {
  height: 160px;
  margin: 0 -2px 12px;
  overflow: hidden;
  border-radius: 7px;
}

.roots-card h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.18rem;
}

.roots-card p {
  margin: 0 0 10px;
  color: #5f5d57;
  font: 0.82rem/1.45 var(--sans);
}

.detail-sections {
  display: grid;
  grid-template-columns: 1fr;
  padding: 0 24px 42px;
}

.detail-sections .archive-section {
  border-top: 1px solid var(--line);
}

.tree-panel {
  display: grid;
  gap: 14px;
}

.tree-workspace {
  margin: 24px;
  border-top: 1px solid var(--line);
  padding: 0;
  overflow: hidden;
}

.tree-controls {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(220px, 300px) minmax(220px, 300px) minmax(0, 1fr);
  grid-template-areas: "mode subject search filters";
  gap: 12px 16px;
  align-items: end;
  padding: 16px 20px;
  background: rgba(248, 244, 235, 0.68);
  border-bottom: 1px solid rgba(197, 183, 165, 0.62);
}

.tree-controls p {
  grid-column: 1 / -1;
  margin: 0;
  color: #625d55;
  font: 0.78rem/1.45 var(--sans);
}

.tree-search {
  display: grid;
  grid-area: search;
  gap: 6px;
  color: #3f5870;
  font: 700 0.72rem var(--sans);
  text-transform: uppercase;
}

.tree-subject {
  grid-area: subject;
}

.tree-mode-toggle {
  display: grid;
  grid-area: mode;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.mode-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font: 700 0.78rem var(--sans);
  cursor: pointer;
}

.mode-button.is-active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.tree-search input,
.tree-search select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 0 12px;
  color: var(--ink-deep);
  background: rgba(255, 255, 255, 0.88);
  font: 0.92rem var(--sans);
  text-transform: none;
}

.tree-search select {
  appearance: none;
}

.tree-filter-list {
  display: flex;
  grid-area: filters;
  flex-wrap: wrap;
  gap: 7px;
}

.family-controls {
  grid-template-columns: minmax(260px, 360px) minmax(160px, 220px) minmax(0, 1fr);
  grid-template-areas: "search sort .";
}

.family-sort {
  grid-area: sort;
}

.tree-browser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  min-height: 620px;
}

.family-browser {
  min-height: 620px;
}

.family-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(15, 48, 79, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(15, 48, 79, 0.04) 1px, transparent 1px),
    rgba(255, 253, 247, 0.66);
  background-size: 28px 28px;
}

.tree-canvas {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(245px, 285px);
  gap: 18px;
  overflow: auto;
  padding: 22px 22px 26px;
  background:
    linear-gradient(90deg, rgba(15, 48, 79, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(15, 48, 79, 0.04) 1px, transparent 1px),
    rgba(255, 253, 247, 0.66);
  background-size: 28px 28px;
}

.tree-generation {
  min-width: 0;
}

.tree-generation h3 {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(197, 183, 165, 0.7);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(255, 253, 247, 0.94);
  font: 700 0.78rem var(--sans);
  text-transform: uppercase;
}

.tree-generation__cards {
  display: grid;
  gap: 10px;
}

.tree-couple {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid rgba(15, 74, 120, 0.28);
  border-radius: 8px;
  background: rgba(240, 246, 248, 0.62);
}

.marriage-link {
  justify-self: center;
  margin: -2px 0;
  padding: 2px 8px;
  border-radius: 999px;
  color: #315875;
  background: rgba(255, 253, 247, 0.94);
  font: 700 0.62rem var(--sans);
  text-transform: uppercase;
}

.tree-card {
  position: relative;
  width: 100%;
  min-height: 146px;
  display: grid;
  gap: 5px;
  text-align: left;
  border: 1px solid rgba(141, 125, 101, 0.42);
  border-radius: 7px;
  padding: 12px 36px 12px 12px;
  color: var(--ink-deep);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 20px rgba(16, 36, 58, 0.07);
  cursor: pointer;
}

.birth-flag {
  position: absolute;
  top: 10px;
  right: 10px;
  color: var(--ink-deep) !important;
  font: 1.2rem/1 var(--sans) !important;
}

.tree-card:hover,
.tree-card:focus-visible,
.tree-card.is-selected {
  border-color: var(--blue);
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 74, 120, 0.14), 0 12px 24px rgba(16, 36, 58, 0.1);
}

.tree-card strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.14;
}

.tree-card span,
.tree-card small {
  color: #5f625f;
  font: 0.76rem/1.3 var(--sans);
}

.tree-card__generation {
  width: fit-content;
  color: #6e5938 !important;
  font: 700 0.66rem var(--sans) !important;
  text-transform: uppercase;
}

.person-inspector {
  border-left: 1px solid rgba(197, 183, 165, 0.7);
  padding: 22px;
  background: rgba(250, 247, 240, 0.92);
  overflow: auto;
}

.person-inspector h3 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.08;
}

.person-inspector p {
  margin: 0 0 10px;
  color: #565b5b;
  font: 0.84rem/1.45 var(--sans);
}

.person-source-name {
  color: #71665c !important;
  font-style: italic !important;
}

.uncertain-note {
  display: block;
  margin-top: 3px;
  color: #8a5b24;
  font-size: 0.72rem;
}

.tree-node {
  padding: 14px;
  border: 1px solid rgba(197, 183, 165, 0.7);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.54);
}

.tree-node h3,
.story-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 1rem;
}

.tree-node p,
.story-card p {
  margin: 0;
  color: #5f5d57;
  font: 0.82rem/1.45 var(--sans);
}

.story-card {
  padding: 14px;
  border: 1px solid rgba(197, 183, 165, 0.7);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.54);
}

.timeline-panel {
  height: auto;
  overflow: visible;
  margin: 0;
  padding: 42px 36px 52px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.timeline-toolbar {
  position: sticky;
  top: 0;
  z-index: 6;
  margin: -42px -36px 28px;
  padding: 42px 36px 1px;
  border-bottom: 1px solid rgba(197, 183, 165, 0.58);
  background:
    linear-gradient(180deg, rgba(251, 248, 241, 0.98), rgba(251, 248, 241, 0.92)),
    radial-gradient(circle at 48% 30%, rgba(177, 138, 80, 0.08), transparent 28rem);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 26px rgba(16, 36, 58, 0);
}

.timeline-toolbar:is(:hover, :focus-within) {
  box-shadow: 0 12px 26px rgba(16, 36, 58, 0.06);
}

.timeline-scrubber {
  position: relative;
  margin: 8px 18px 46px 48px;
  min-height: 62px;
}

.timeline-scrubber__rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 20px;
  height: 2px;
  background: rgba(197, 183, 165, 0.72);
}

.timeline-scrubber__progress {
  position: absolute;
  left: 0;
  top: 0;
  height: 2px;
  background: #0f6696;
}

.timeline-scrubber__marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 2px rgba(251, 248, 241, 0.95);
  transform: translate(-50%, -50%);
}

.timeline-scrubber__input {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  top: 8px;
  width: 100%;
  height: 26px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: grab;
}

.timeline-scrubber__input:active {
  cursor: grabbing;
}

.timeline-scrubber__input:focus-visible {
  outline: 2px solid rgba(15, 74, 120, 0.32);
  outline-offset: 12px;
}

.timeline-scrubber__input::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent var(--timeline-progress), transparent var(--timeline-progress));
}

.timeline-scrubber__input::-webkit-slider-thumb {
  appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -14px;
  border: 3px solid #fffdf7;
  border-radius: 999px;
  background: #0a5d8d;
  box-shadow: 0 0 0 2px rgba(197, 183, 165, 0.72), 0 9px 20px rgba(16, 36, 58, 0.17);
}

.timeline-scrubber__input::-moz-range-track {
  height: 2px;
  background: transparent;
}

.timeline-scrubber__input::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 3px solid #fffdf7;
  border-radius: 999px;
  background: #0a5d8d;
  box-shadow: 0 0 0 2px rgba(197, 183, 165, 0.72), 0 9px 20px rgba(16, 36, 58, 0.17);
}

.timeline-scrubber__ticks {
  position: absolute;
  left: 0;
  right: 0;
  top: 38px;
  color: #5f625f;
  font: 0.92rem/1 var(--sans);
}

.timeline-scrubber__ticks span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-scrubber__ticks span::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -35px;
  width: 1px;
  height: 18px;
  background: rgba(197, 183, 165, 0.82);
}

.timeline-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 18px 28px;
}

.filter-button {
  border: 1px solid rgba(197, 183, 165, 0.95);
  border-radius: 999px;
  min-height: 42px;
  padding: 0 24px;
  color: #284d6f;
  background: rgba(255, 255, 255, 0.62);
  font: 0.92rem var(--sans);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(16, 36, 58, 0.03);
}

.filter-button:hover,
.filter-button:focus-visible {
  border-color: rgba(15, 74, 120, 0.42);
  outline: none;
}

.filter-button.is-active {
  color: #fff;
  border-color: #0a5d8d;
  background: linear-gradient(180deg, #0f6f9f, #075b88);
  box-shadow: 0 8px 18px rgba(15, 74, 120, 0.18);
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 18px;
  padding-left: 218px;
}

.timeline-list::before {
  content: "";
  position: absolute;
  left: 154px;
  top: 24px;
  bottom: 24px;
  width: 3px;
  background: linear-gradient(180deg, #0e6a9d, #075b88);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  scroll-margin-block: 34vh;
}

.timeline-item::before,
.timeline-item::after {
  content: "";
  position: absolute;
  z-index: 2;
  border-radius: 50%;
  transform: translateX(-50%);
}

.timeline-item::before {
  left: -64px;
  top: 30px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(177, 138, 80, 0.78);
  background:
    radial-gradient(circle at center, #0f6f9f 0 34%, transparent 36%),
    linear-gradient(180deg, #fffdf7, #efe3cf);
  box-shadow: 0 6px 14px rgba(38, 31, 22, 0.14);
}

.timeline-item::after {
  left: -64px;
  top: 38px;
  width: 18px;
  height: 18px;
  background: #0f6f9f;
  box-shadow: inset 0 0 0 1px rgba(5, 28, 47, 0.34);
}

.timeline-year {
  position: absolute;
  left: -182px;
  top: 31px;
  width: 78px;
  color: #0f4a78;
  font-size: 1.45rem;
  line-height: 1;
  text-align: right;
}

.timeline-card {
  position: relative;
  min-height: 154px;
  padding: 24px 28px 22px;
  border: 1px solid rgba(197, 183, 165, 0.72);
  border-left: 6px solid var(--blue);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(16, 36, 58, 0.05);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.timeline-item.is-current .timeline-card {
  border-color: rgba(15, 74, 120, 0.54);
  box-shadow: 0 0 0 4px rgba(15, 74, 120, 0.1), 0 14px 30px rgba(16, 36, 58, 0.08);
  transform: translateY(-1px);
}

.timeline-card--birth {
  border-left-color: #5d8b59;
}

.timeline-card--death {
  border-left-color: #6a86a0;
}

.timeline-card--marriage {
  border-left-color: #b18a50;
}

.timeline-card--migration {
  border-left-color: #0f4a78;
}

.timeline-card--record {
  border-left-color: #7a6040;
}

.related-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.related-links a,
.related-links span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 8px;
  border: 1px solid rgba(112, 137, 155, 0.34);
  border-radius: 999px;
  color: #315874;
  background: rgba(240, 246, 248, 0.72);
  font: 0.68rem/1.2 var(--sans);
  text-decoration: none;
}

.related-links a:hover,
.related-links a:focus-visible {
  border-color: var(--blue);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  outline: none;
}

.timeline-card h3 {
  margin: 6px 0 5px;
  color: var(--ink);
  font-size: 1.35rem;
  line-height: 1.08;
}

.timeline-card p {
  margin: 0;
  color: #5f5d57;
  font: 1rem/1.42 var(--sans);
}

.timeline-type {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--gold);
  font: 800 0.78rem var(--sans);
  text-transform: uppercase;
}

.timeline-flag {
  color: var(--ink-deep);
  font: 0.95rem/1 var(--sans);
}

@media (max-width: 1280px) {
  .archive-app {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .sidebar {
    padding-left: 10px;
    padding-right: 10px;
  }

  .crest__title {
    font-size: 1.55rem;
  }

  .crest__subtitle {
    font-size: 0.82rem;
  }

  .nav-item {
    grid-template-columns: 28px 1fr;
    padding: 0 12px;
    font-size: 0.95rem;
  }

  .hero {
    grid-template-columns: minmax(330px, 0.95fr) minmax(240px, 0.72fr);
    gap: 14px;
  }

  .hero--home {
    min-height: clamp(460px, 58vw, 580px);
  }

  .hero--home::after {
    background:
      linear-gradient(90deg, rgba(251, 248, 241, 0.94) 0%, rgba(251, 248, 241, 0.8) 40%, rgba(251, 248, 241, 0.26) 66%, rgba(9, 36, 62, 0.08) 100%),
      linear-gradient(180deg, rgba(255, 253, 247, 0.26) 0%, rgba(255, 253, 247, 0.02) 50%, rgba(9, 36, 62, 0.26) 100%);
  }

  h1 {
    font-size: clamp(2.45rem, 4.2vw, 3.4rem);
  }

  .hero__lede,
  .hero__note {
    font-size: 0.98rem;
  }

  .hero__collage {
    min-height: 230px;
  }

  .photo-stack--fjord {
    width: min(270px, 68%);
    right: 50px;
  }

  .photo-stack--family {
    width: min(145px, 38%);
    right: 4px;
  }

  .paper-note {
    width: 220px;
    height: 140px;
  }

  .document-grid,
  .artifact-grid,
  .place-grid,
  .home-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .stat {
    grid-template-columns: 24px 1fr;
    gap: 7px;
    padding: 14px 12px;
  }

  .stat strong {
    font-size: 1.05rem;
  }

  .stat span:last-child {
    font-size: 0.68rem;
  }

  .timeline-panel {
    padding: 38px 24px 48px;
  }

  .timeline-toolbar {
    margin: -38px -24px 28px;
    padding: 38px 24px 1px;
  }

  .timeline-scrubber {
    margin-left: 30px;
    margin-right: 12px;
  }

  .timeline-list {
    padding-left: 174px;
  }

  .timeline-list::before {
    left: 118px;
  }

  .timeline-item::before {
    left: -56px;
    width: 30px;
    height: 30px;
  }

  .timeline-item::after {
    left: -56px;
    top: 37px;
    width: 16px;
    height: 16px;
  }

  .timeline-year {
    left: -148px;
    font-size: 1.2rem;
    word-break: normal;
  }
}

@media (max-width: 980px) {
  .archive-app {
    display: block;
    width: 100vw;
    max-width: 100vw;
    overflow-x: clip;
  }

  .sidebar,
  .timeline-panel {
    position: static;
    height: auto;
    width: 100vw;
    max-width: 100vw;
  }

  .main-panel {
    width: 100vw;
    max-width: 100vw;
    overflow-x: clip;
  }

  .sidebar {
    padding: 22px 14px 14px;
  }

  .crest {
    padding-bottom: 14px;
  }

  .crest__logo,
  .sidebar-photo {
    display: none;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    max-width: 100%;
    min-width: 0;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    grid-template-columns: auto 1fr;
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.9rem;
  }

  .topbar {
    display: none;
  }

  .hero {
    padding: 28px 18px 18px;
    grid-template-columns: 1fr;
    width: 100vw;
    max-width: 100vw;
  }

  .hero--home {
    min-height: 480px;
    align-items: start;
    padding-top: 54px;
  }

  .hero--home::before {
    background-position: 33% center;
    opacity: 0.9;
  }

  .hero--home::after {
    background:
      linear-gradient(180deg, rgba(251, 248, 241, 0.96) 0%, rgba(251, 248, 241, 0.86) 34%, rgba(251, 248, 241, 0.34) 62%, rgba(8, 30, 52, 0.36) 100%),
      linear-gradient(90deg, rgba(251, 248, 241, 0.9) 0%, rgba(251, 248, 241, 0.34) 58%, rgba(9, 36, 62, 0.1) 100%);
  }

  .page-header {
    padding: 28px 18px 18px;
  }

  .page-header p {
    width: min(100%, calc(100vw - 36px));
    max-width: calc(100vw - 36px);
  }

  .hero__collage {
    display: none;
  }

  .stats-strip,
  .tree-workspace,
  .page-section,
  .content-grid,
  .home-grid,
  .detail-sections,
  .timeline-panel {
    margin: 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  .stats-strip {
    margin-top: -24px;
  }

  .stats-strip,
  .content-grid,
  .detail-sections {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tree-workspace {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .tree-controls {
    grid-template-columns: 1fr;
    grid-template-areas:
      "mode"
      "subject"
      "search"
      "filters";
    padding-left: 14px;
    padding-right: 14px;
  }

  .tree-controls--all {
    grid-template-areas:
      "mode"
      "search"
      "filters";
  }

  .family-controls {
    grid-template-areas:
      "search"
      "sort";
  }

  .tree-browser {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .tree-canvas {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    overflow: visible;
    padding: 14px;
  }

  .family-card-list {
    grid-template-columns: 1fr;
    overflow: visible;
    padding: 14px;
  }

  .person-inspector {
    border-left: 0;
    border-top: 1px solid rgba(197, 183, 165, 0.7);
    padding: 18px 14px;
  }

  .stats-strip {
    gap: 0;
  }

  .stat {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat:last-child {
    border-bottom: 0;
  }

  .photo-grid,
  .document-grid,
  .artifact-grid,
  .place-grid,
  .home-grid,
  .story-grid {
    grid-template-columns: 1fr;
  }

  .archive-section {
    border-top: 0;
  }

  .timeline-panel {
    border-top: 1px solid var(--line);
    border-radius: 0;
    padding-top: 24px;
    padding-bottom: 44px;
  }

  .timeline-toolbar {
    margin: -24px -14px 24px;
    padding: 24px 14px 1px;
  }

  .timeline-scrubber {
    margin: 6px 6px 38px;
  }

  .timeline-scrubber__ticks {
    font-size: 0.78rem;
  }

  .timeline-filters {
    margin: 0 0 24px;
    gap: 8px;
  }

  .filter-button {
    min-height: 38px;
    padding: 0 16px;
    font-size: 0.82rem;
  }

  .timeline-list {
    gap: 14px;
    padding-left: 92px;
  }

  .timeline-list::before {
    left: 48px;
  }

  .timeline-item::before {
    left: -44px;
  }

  .timeline-item::after {
    left: -44px;
  }

  .timeline-year {
    left: -92px;
    width: 38px;
    font-size: 1rem;
  }

  .timeline-card {
    min-height: 0;
    padding: 18px 18px 16px;
  }

  .timeline-card h3 {
    font-size: 1.12rem;
  }

  .timeline-card p {
    font-size: 0.88rem;
  }
}

@media (max-width: 560px) {
  .crest__title {
    font-size: 1.55rem;
  }

  h1 {
    font-size: 2.35rem;
    line-height: 1.02;
    max-width: 12ch;
  }

  .welcome {
    font-size: 1.2rem;
  }

  .hero__lede,
  .hero__note {
    font-size: 0.96rem;
    max-width: 31ch;
  }

  .hero__actions {
    display: grid;
  }

  .button {
    width: 100%;
    max-width: 100%;
  }

  .timeline-scrubber__ticks span:nth-child(even) {
    display: none;
  }

  .timeline-list {
    padding-left: 74px;
  }

  .timeline-list::before {
    left: 46px;
  }

  .timeline-item::before {
    left: -28px;
    width: 28px;
    height: 28px;
  }

  .timeline-item::after {
    left: -28px;
    top: 37px;
    width: 14px;
    height: 14px;
  }

  .timeline-year {
    left: -82px;
    width: 40px;
    font-size: 0.86rem;
  }

  .timeline-card {
    padding: 16px 14px 15px;
  }
}
