/* AnCEstory lineage lab */

.anc-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: min(1480px, 100%);
}

/* History slide rule under site menu (header) */
.anc-header-with-timeline .header-inner {
  max-width: min(1480px, 100%);
}
.anc-header-sliderule {
  margin-top: 10px;
  padding: 10px 12px 8px;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.28);
  background: linear-gradient(
    180deg,
    rgba(124, 58, 237, 0.1),
    rgba(10, 11, 13, 0.55) 55%
  );
  width: 100%;
}
.anc-header-sliderule .hsr-title {
  font-size: 0.92rem;
}
.anc-header-sliderule .hsr-strip {
  height: 96px;
}
.anc-header-sliderule .hsr-iris {
  margin-top: 4px;
}
.anc-header-sliderule .hsr-iris-results {
  max-height: 8.5rem;
}
/* legacy class if used elsewhere */
.anc-history-rail {
  padding: 12px 14px 10px;
  border-color: rgba(124, 58, 237, 0.22);
}

.anc-lead p {
  margin: 0 0 8px;
  line-height: 1.5;
  color: var(--muted, #c9d1d9);
}

.anc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}

.anc-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font: 700 0.65rem/1 system-ui;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--faint, #8b949e);
}

.anc-toolbar input[type="search"],
.anc-toolbar select {
  min-width: 160px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: 500 0.9rem/1.2 system-ui;
  text-transform: none;
  letter-spacing: 0;
}

.anc-import-label input {
  font: 500 0.75rem system-ui;
  text-transform: none;
}

/* Forbes-style multi-column: names · people · lineage ABOVE world/travel */
.anc-main-cols {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.48fr)
    minmax(260px, 0.95fr)
    minmax(420px, 1.55fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 12px;
}
@media (max-width: 1200px) {
  .anc-main-cols {
    grid-template-columns: minmax(140px, 0.45fr) minmax(220px, 0.9fr) minmax(0, 1.4fr);
  }
}
@media (max-width: 1100px) {
  .anc-main-cols {
    grid-template-columns: minmax(140px, 0.5fr) 1fr;
  }
  .anc-lineage-col {
    grid-column: 1 / -1;
  }
}
@media (max-width: 700px) {
  .anc-main-cols {
    grid-template-columns: 1fr;
  }
}
.anc-names-col .anc-names-scroll,
.anc-cards-col .anc-cards-scroll {
  max-height: min(40rem, 62vh);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Lineage columns get their own taller scroll so long chains aren't cramped */
.anc-line-scroll {
  max-height: min(48rem, 68vh);
  min-height: 12rem;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 2px 2px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-gutter: stable;
}
/* Matriline | Patriline | Descendants — roomy min widths, scroll sideways if needed */
.anc-lineage-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(13.5rem, 1fr));
  gap: 12px;
  min-height: 240px;
  overflow-x: auto;
  padding-bottom: 2px;
}
@media (max-width: 900px) {
  .anc-lineage-cols {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }
}
.anc-line-col {
  border: 1px solid var(--line, #30363d);
  border-radius: 12px;
  padding: 10px 10px 8px;
  background: rgba(0, 0, 0, 0.15);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.anc-line-col h3 {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.anc-line-col > .docs-kicker {
  margin: 0 0 6px;
  flex: 0 0 auto;
}
.anc-line-col.matri {
  border-color: rgba(255, 122, 217, 0.28);
}
.anc-line-col.patri {
  border-color: rgba(110, 200, 255, 0.28);
}
.anc-line-col.tree {
  border-color: rgba(122, 235, 176, 0.22);
}
.anc-line-item {
  appearance: none;
  width: 100%;
  flex: 0 0 auto;
  text-align: left;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 3px;
  padding: 10px 12px;
  margin: 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  cursor: pointer;
  line-height: 1.35;
  min-height: 3.25rem;
  box-sizing: border-box;
}
.anc-line-item:hover,
.anc-line-item.on {
  border-color: rgba(125, 211, 252, 0.4);
  background: rgba(125, 211, 252, 0.08);
}
.anc-line-item .gen {
  font: 700 0.68rem/1.2 ui-monospace, Menlo, monospace;
  opacity: 0.7;
  grid-row: 1 / span 2;
  align-self: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.anc-line-item .nm {
  font-weight: 650;
  font-size: 0.9rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}
.anc-line-item .meta {
  font-size: 0.72rem;
  opacity: 0.72;
  grid-column: 2;
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.anc-line-item .anc-line-place {
  opacity: 0.85;
  font-size: 0.7rem;
}
.anc-line-empty {
  font-size: 0.8rem;
  opacity: 0.65;
  padding: 12px 10px;
  line-height: 1.45;
  margin: 0;
}
/* World + travel BELOW main cols */
.anc-world-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.7fr);
  gap: 12px;
  margin-bottom: 12px;
}
@media (max-width: 900px) {
  .anc-world-row {
    grid-template-columns: 1fr;
  }
}
.anc-people-row {
  display: none; /* replaced by anc-main-cols */
}
.anc-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.anc-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font: 600 0.8rem/1.2 system-ui;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink, inherit);
}
.anc-date-flag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font: 650 0.6rem/1.2 ui-monospace, Menlo, monospace;
  letter-spacing: 0.03em;
  border: 1px solid var(--line, #30363d);
}
.anc-date-flag.ok { color: #3fb950; border-color: rgba(63,185,80,0.4); }
.anc-date-flag.conflict { color: #f85149; border-color: rgba(248,81,73,0.45); }
.anc-date-flag.missing { color: #8b949e; }
.anc-date-flag.estimated { color: #d29922; border-color: rgba(210,153,34,0.45); }
.anc-date-flag.antiquity { color: #a371f7; border-color: rgba(163,113,247,0.45); }
.anc-date-flag.history { color: #58a6ff; border-color: rgba(88,166,255,0.45); }
.anc-date-flag.myth { color: #db61a2; border-color: rgba(219,97,162,0.45); }

/* Source identification tags (GED) — not modern gender chips */
.anc-sex-tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0.05rem 0.28rem;
  border-radius: 4px;
  font: 700 0.58rem/1.2 ui-monospace, Menlo, monospace;
  letter-spacing: 0.04em;
  border: 1px solid var(--line, #30363d);
  vertical-align: middle;
}
.anc-sex-tag.sex-m { color: #58a6ff; border-color: rgba(88,166,255,0.4); }
.anc-sex-tag.sex-f { color: #f472b6; border-color: rgba(244,114,182,0.4); }
.anc-sex-tag.sex-x { color: #a78bfa; border-color: rgba(167,139,250,0.45); }
.anc-sex-tag.sex-u { color: #8b949e; border-color: rgba(139,148,158,0.35); }
.anc-sex-tag.sex-other { color: #d29922; border-color: rgba(210,153,34,0.4); }

/* Inclusive identification panel */
.anc-inclusive-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.anc-inclusive-head h2 {
  margin: 0 0 2px;
  font-size: 1rem;
}
.anc-inclusive-lead {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted, #8b949e);
  max-width: 72ch;
}
.anc-id-layers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 800px) {
  .anc-id-layers { grid-template-columns: 1fr; }
}
.anc-id-layer {
  border: 1px solid var(--line, #30363d);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg, #0d1117);
}
.anc-id-layer--you {
  border-color: color-mix(in srgb, #a78bfa 35%, var(--line));
  background: color-mix(in srgb, #a78bfa 6%, var(--bg, #0d1117));
}
.anc-id-layer h3 {
  margin: 0 0 6px;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.anc-id-bullets {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted, #8b949e);
}
.anc-id-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.anc-id-form label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font: 700 0.65rem/1 system-ui;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint, #8b949e);
}
.anc-id-form input[type="text"] {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-elev, var(--panel));
  color: var(--ink);
  font: 500 0.85rem/1.2 system-ui;
  text-transform: none;
  letter-spacing: 0;
}
.anc-id-form .anc-check {
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}
.anc-local-id-host { margin-top: 8px; }
.anc-inclusive-details {
  font-size: 0.8rem;
  color: var(--muted);
}
.anc-inclusive-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--ink);
}

.anc-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(240px, 1fr);
  gap: 12px;
}

@media (max-width: 1000px) {
  .anc-grid {
    grid-template-columns: 1fr;
  }
}

.anc-col h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.anc-wide {
  grid-column: span 1;
}

@media (min-width: 1001px) {
  .anc-wide {
    grid-column: span 2;
  }
}

.anc-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 420px;
  overflow: auto;
  border-left: 2px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

.anc-row {
  appearance: none;
  width: 100%;
  text-align: left;
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 2px 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: none;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.anc-row + .anc-row {
  border-top: none;
}

.anc-row.on,
.anc-row:hover {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg));
}

.anc-row-y {
  grid-row: span 2;
  font: 700 0.78rem/1.2 ui-monospace, Menlo, monospace;
  color: var(--accent);
  align-self: center;
}

.anc-row-n {
  font-weight: 650;
  font-size: 0.85rem;
}

.anc-row-m {
  font-size: 0.7rem;
  color: var(--faint);
}

/* Tree — roomier nested list for long descendant branches */
.anc-tree.anc-line-scroll {
  gap: 0;
}
.anc-tree-root,
.anc-tree-node ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
}

.anc-tree-root {
  padding-left: 0;
  border-left: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.anc-tree-node {
  margin: 0;
  padding: 0;
}

.anc-tree-node > ul {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.anc-tree-label {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0 10px 10px 0;
  border-left: 3px solid color-mix(in srgb, var(--accent) 50%, var(--line));
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
  max-width: 100%;
  min-width: 0;
  line-height: 1.35;
  box-sizing: border-box;
}

.anc-tree-label strong {
  font-size: 0.9rem;
  font-weight: 650;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.anc-tree-label.on,
.anc-tree-label:hover {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  border-left-color: var(--accent);
}

.anc-tree-label span {
  font-size: 0.74rem;
  color: var(--faint);
  line-height: 1.4;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.anc-tree-more {
  font-size: 0.74rem;
  color: var(--faint);
  padding: 6px 0 4px 12px;
  line-height: 1.4;
}

.anc-parents {
  font-size: 0.8rem;
  color: var(--muted);
}

.anc-link {
  appearance: none;
  border: none;
  background: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}

/* Map */
.anc-map {
  width: 100%;
  height: 280px;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
  background: var(--bg);
}

.anc-map-legend {
  margin: 10px 0 0;
  padding: 0 0 0 1.1rem;
  max-height: 160px;
  overflow: auto;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Surnames */
.anc-surnames {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 360px;
  overflow: auto;
}

.anc-sur {
  appearance: none;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.anc-sur + .anc-sur {
  border-top: none;
}

.anc-sur:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}

.anc-sur-n {
  font-weight: 650;
}

.anc-sur-c {
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  font-weight: 700;
}

.anc-sur-y {
  font-size: 0.7rem;
  color: var(--faint);
}

/* Datasets */
.anc-datasets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.anc-ds {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
}

.anc-ds h3 {
  margin: 0 0 4px;
  font-size: 0.85rem;
}

.anc-ds p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--faint);
}

.anc-ds code {
  display: block;
  margin-top: 6px;
  font-size: 0.65rem;
  color: var(--muted);
  word-break: break-all;
}

/* People cards + names scroll (menu restore) */
.anc-cards-scroll,
.anc-names-scroll {
  max-height: min(28rem, 55vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 0.25rem;
}
.anc-row.anc-card {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.15rem 0.55rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  margin: 0 0 0.35rem;
  border-radius: 10px;
  border: 1px solid var(--border, #30363d);
  background: var(--card, rgba(22, 27, 34, 0.55));
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.anc-row.anc-card .anc-row-y { grid-row: 1 / span 2; font-variant-numeric: tabular-nums; opacity: 0.85; }
.anc-row.anc-card .anc-row-n { font-weight: 650; }
.anc-row.anc-card .anc-row-m { font-size: 0.78rem; opacity: 0.78; grid-column: 2; }
.anc-row.anc-card .anc-card-ack {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  opacity: 0.72;
  letter-spacing: 0.01em;
  line-height: 1.3;
  color: var(--muted, #8b949e);
}
.anc-sex-tag {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  font: 650 0.65rem/1.2 ui-monospace, Menlo, monospace;
  letter-spacing: 0.04em;
  border: 1px solid var(--line, #30363d);
  color: var(--muted, #8b949e);
  vertical-align: middle;
}
.anc-row.anc-card.on,
.anc-row.anc-card:hover {
  border-color: var(--accent, #58a6ff);
}
.anc-surnames.anc-names-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* World map — Apple World Clock clean style */
.anc-map-card {
  padding-bottom: 12px;
}
.anc-map-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.anc-map-head h2 {
  margin: 0 0 2px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.anc-map-frame {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #0a0b0d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
/* AnCEstory MapView dark shell (fornevercollective.github.io/ancestory) */
.anc-map-frame.map-shell--dark,
.map-shell--dark {
  background: #0a0b0d;
  border-color: #2a3038;
}
.anc-map,
.anc-map.map-leaflet {
  display: block;
  width: 100%;
  height: min(42vh, 420px);
  min-height: 280px;
  background: #0e0f12;
  touch-action: manipulation;
  z-index: 0;
}
.anc-map .leaflet-container,
.map-shell--dark .leaflet-container {
  width: 100%;
  height: 100%;
  background: #0e0f12 !important;
  font: inherit;
}
.map-shell--dark .leaflet-control-attribution {
  background: rgba(10, 11, 13, 0.88) !important;
  color: #8b919a !important;
  font-size: 10px;
  max-width: 100%;
}
.map-shell--dark .leaflet-control-attribution a {
  color: var(--accent, #58a6ff);
}
.map-shell--dark .leaflet-popup-content-wrapper,
.map-shell--dark .leaflet-popup-tip,
.anc-map-popup {
  background: #161b22 !important;
  color: #e6edf3 !important;
  box-shadow: none !important;
  border: 1px solid #30363d;
}
.map-shell--dark .leaflet-popup-content {
  margin: 0.5rem 0.65rem;
  font-size: 0.85rem;
  line-height: 1.35;
}
.anc-map-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  font-size: 0.8rem;
}
.anc-map-scope-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.anc-map-scope {
  font: inherit;
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line, #30363d);
  background: var(--bg, #0d1117);
  color: inherit;
  max-width: 16rem;
}
.anc-map-mode-btn {
  font-size: 0.75rem !important;
  padding: 6px 12px !important;
  border-radius: 999px !important;
}
.anc-map-legend {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.anc-map-chip {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font: 600 0.72rem/1.2 system-ui, -apple-system, sans-serif;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.anc-map-chip span {
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.anc-map-chip:hover {
  border-color: rgba(125, 211, 252, 0.35);
  background: rgba(125, 211, 252, 0.08);
}
.anc-map-chip.on {
  border-color: rgba(125, 211, 252, 0.55);
  background: rgba(125, 211, 252, 0.14);
  color: #e0f2fe;
}
/* legacy ol legend */
.anc-map-legend li {
  display: none;
}
.anc-travel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(36rem, 70vh);
  overflow: auto;
}
.anc-travel-card {
  border: 1px solid var(--line, #30363d);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--card, rgba(22, 27, 34, 0.55));
}
.anc-travel-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}
.anc-travel-card .meta {
  font-size: 0.78rem;
  opacity: 0.8;
  margin: 0 0 8px;
}
.anc-travel-card .story {
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0 0 8px;
}
.anc-travel-card img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line, #30363d);
  background: #000;
}
.anc-travel-card a {
  font-size: 0.78rem;
}
.anc-travel-empty {
  opacity: 0.7;
  font-size: 0.85rem;
}
