/* style.css */
:root {
  --bg: #14110d;
  --card: #1e1a15;
  --text: #f0e8da;
  --mut: #9b8f7c;
  --acc: #e8a15f;
  --line: #3a3329;
  --soft: #2a241c;
  --m: #7fb0d3;
  --f: #e58aa3;
  --shadow: 0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.5);
  --radius: 16px;
  --radius-sm: 10px;
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f5f2;
  --card: #fff;
  --text: #24251f;
  --mut: #66675f;
  --acc: #964824;
  --line: #d8d7d0;
  --soft: #ecece6;
  --m: #3d6b8c;
  --f: #b4506b;
  --shadow: 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 28px rgba(0,0,0,.14);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font-sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
}

header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
  flex-wrap: wrap;
  z-index: 20;
  box-shadow: var(--shadow);
}

header h1 {
  font-size: 20px;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

header h1 span {
  color: var(--acc);
}

nav {
  display: flex;
  gap: 4px;
  background: var(--soft);
  border-radius: 30px;
  padding: 3px;
}

.tab, .btn {
  border: 0;
  background: transparent;
  color: var(--mut);
  font: 500 13px var(--font-sans);
  padding: 7px 16px;
  border-radius: 30px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab:hover, .btn:hover {
  color: var(--text);
}

.tab.on {
  background: var(--acc);
  color: var(--card);
}

.btn {
  border: 1px solid var(--line);
  background: var(--card);
}

.btn.on {
  border-color: var(--acc);
  color: var(--acc);
}

.sw {
  position: relative;
  margin-left: auto;
}

#q {
  width: 210px;
  max-width: 46vw;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 30px;
  padding: 7px 16px;
  font: inherit;
  outline: 0;
  transition: border-color 0.2s;
}

#q:focus {
  border-color: var(--acc);
}

#sr {
  position: absolute;
  top: 110%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  z-index: 50;
  display: none;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

#sr div {
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

#sr div:hover {
  background: var(--soft);
}

main {
  flex: 1;
  position: relative;
  min-height: 0;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  overflow: auto;
}

.view.on {
  display: block;
}

#tree {
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: radial-gradient(circle, var(--line) 1px, transparent 1px) 0 0 / 32px 32px;
}

#tree.grabbing,
#tree.grabbing .n {
  cursor: grabbing;
}

#world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

#world.tw {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

svg#ed {
  position: absolute;
  left: 0;
  top: 0;
  overflow: visible;
  pointer-events: none;
}

.e {
  fill: none;
  stroke: #6b5d4a;
  stroke-width: 2;
  transition: stroke 0.25s, stroke-width 0.25s, opacity 0.25s;
  stroke-linecap: round;
}

[data-theme="light"] .e {
  stroke: #c4b8a3;
}

.e.sp {
  stroke: var(--acc);
  stroke-width: 2;
  stroke-dasharray: 6 7;
  opacity: 0.75;
}

.e.hl {
  stroke: var(--acc);
  stroke-width: 3.5;
  opacity: 1;
}

.e.dim {
  opacity: 0.1;
}

.e.sp.alt {
  opacity: 0.4;
}

.e.sp.hl {
  opacity: 1;
}

.n {
  position: absolute;
  width: 190px;
  height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.2s;
  animation: in 0.5s both;
  box-shadow: var(--shadow);
  user-select: none;
}

@keyframes in {
  from { opacity: 0; transform: scale(0.88); }
}

.n:hover {
  transform: translateY(-3px);
  border-color: var(--acc);
  box-shadow: var(--shadow-lg);
  z-index: 2;
}

.n.sel {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc), var(--shadow-lg);
  z-index: 3;
}

.n.dim {
  opacity: 0.2;
}

.n.hl {
  border-color: var(--acc);
  box-shadow: 0 0 0 2px var(--acc), var(--shadow-lg);
  z-index: 2;
}

.n.found {
  border-color: var(--acc);
  box-shadow: 0 0 0 3px var(--acc), var(--shadow-lg);
}

/* was: border-radius: 50%; */

.av {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 8px;          /* small radius = rounded square */
  display: grid;
  place-items: center;
  font: 600 15px var(--font-sans);
  color: #fff;
  background: var(--mut);
  font-style: normal;
  overflow: hidden;
  position: relative;
  border: 2px solid var(--card);
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}

.av.Male { background: var(--m); }
.av.Female { background: var(--f); }

/* was: border-radius: 50%; */

.av img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;   /* bias up so heads aren't cropped */
  border-radius: 8px;
}

.n .info {
  min-width: 0;
  flex: 1;
}

.n b {
  display: block;
  font-size: 13.5px;
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.n small {
  display: block;
  font-size: 11px;
  color: var(--mut);
  line-height: 1.3;
  margin-top: 3px;
}

.n .badge {
  position: absolute;
  top: -7px;
  right: -7px;
  background: var(--acc);
  color: var(--card);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tb {
  position: absolute;
  left: 16px;
  top: 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  z-index: 5;
  max-width: calc(100% - 32px);
}

.zc {
  position: absolute;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 5;
}

.zc .btn {
  width: 40px;
  padding: 10px 0;
  text-align: center;
  font-size: 17px;
}

.lg {
  position: absolute;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  font-size: 11px;
  color: var(--mut);
  z-index: 5;
  display: flex;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 16px;
  box-shadow: var(--shadow);
}

.lg .ln {
  width: 18px;
  height: 0;
  border-radius: 0;
  border-top: 2px solid var(--mut);
  vertical-align: middle;
  margin-right: 6px;
}

.lg .ln.dash {
  border-top: 2px dashed var(--acc);
}

.lg i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

.pg {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.pg h2 {
  font-size: 28px;
  margin-bottom: 4px;
}

.pg > p {
  color: var(--mut);
  margin-bottom: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.st {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: left;
  cursor: default;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow);
}

button.st {
  cursor: pointer;
}

button.st:hover {
  border-color: var(--acc);
}

.st b {
  display: block;
  font: 600 32px var(--font-serif);
  color: var(--acc);
}

.st span {
  font-size: 12px;
  color: var(--mut);
}

.bars {
  display: grid;
  gap: 6px;
  margin-bottom: 28px;
}

.bar {
  position: relative;
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--soft) var(--w), var(--card) var(--w));
  border-radius: 9px;
  padding: 8px 14px;
  font: inherit;
  color: var(--text);
  text-align: left;
}

button.bar {
  cursor: pointer;
}

button.bar:hover {
  border-color: var(--acc);
}

h3 {
  font-size: 18px;
  margin: 6px 0 10px;
}

.two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0 28px;
}

.tl {
  position: relative;
}

.ax {
  display: grid;
  grid-template-columns: 180px 1fr;
  color: var(--mut);
  font-size: 11px;
  margin-bottom: 6px;
}

.axt {
  position: relative;
  height: 16px;
}

.axt span {
  position: absolute;
  transform: translateX(-50%);
}

.tr {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  height: 28px;
  cursor: pointer;
  border-radius: 6px;
}

.tr:hover {
  background: var(--soft);
}

.tr > span {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 10px;
}

.trk {
  position: relative;
  height: 100%;
}

.bk {
  position: absolute;
  top: 8px;
  height: 12px;
  border-radius: 6px;
  background: var(--m);
  min-width: 6px;
}

.bk.Female {
  background: var(--f);
}

.bk.live {
  -webkit-mask: linear-gradient(90deg, #000 70%, transparent);
  mask: linear-gradient(90deg, #000 70%, transparent);
}

select {
  width: 100%;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  outline: 0;
}

select:focus {
  border-color: var(--acc);
}

.cn {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
}

.cn label {
  font-size: 11px;
  color: var(--mut);
  display: block;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.res {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.res h3 {
  font-size: 22px;
  margin: 0 0 4px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0 7px 16px;
  border-left: 2px solid var(--acc);
  margin-left: 10px;
}

.step em {
  font-style: normal;
  color: var(--mut);
  font-size: 12px;
  min-width: 56px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 5px 13px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--soft);
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  color: inherit;
  transition: all 0.2s;
}

.chip:hover {
  border-color: var(--acc);
  color: var(--acc);
}

#pn {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100%;
  background: var(--card);
  border-left: 1px solid var(--line);
  z-index: 30;
  padding: 24px 24px 40px;
  overflow: auto;
  transform: translateX(105%);
  transition: transform 0.4s cubic-bezier(0.3, 1, 0.4, 1);
  box-shadow: var(--shadow-lg);
}

#pn.on {
  transform: none;
}

#pn h2 {
  font-size: 28px;
  line-height: 1.1;
  margin: 8px 0 4px;
}

.lb {
  display: block;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mut);
  margin: 16px 0 6px;
}

.x {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 2;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.profile-header .av {
  width: 72px;
  height: 72px;
  font-size: 24px;
  border-width: 3px;
  border-radius: 14px;         /* add this line */
}

.profile-header .info {
  min-width: 0;
}

.profile-header h2 {
  font-size: 24px;
  line-height: 1.15;
  margin: 0;
  overflow-wrap: anywhere;
}

.profile-header .meta {
  color: var(--mut);
  font-size: 12px;
  margin-top: 3px;
}

.profile-copy {
  color: var(--mut);
  line-height: 1.7;
  margin: 6px 0 10px;
  white-space: pre-wrap;
}

.photo-section {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

/* was: grid-template-columns: repeat(3, 1fr); gap: 8px; */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

/* was a square flex box with object-fit: cover */

/* was: flex box, aspect-ratio: 1, border-radius: 10px */

.photo-item {
  aspect-ratio: 1 / 1;
  padding: 0;
  border-radius: 6px;          /* small radius, not pill-soft */
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: block;
  position: relative;
}

.photo-item:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.photo-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;           /* crop to fill, keeps faces centred */
  object-position: center 35%; /* bias upward so heads aren't cut */
}

.photo-item .empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  color: var(--mut);
  padding: 8px;
  text-align: center;
}

.photo-hint {
  font-size: 11px;
  color: var(--mut);
  margin-top: 8px;
}

.photo-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.photo-viewer.on {
  display: flex;
}

.photo-viewer img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}

.photo-viewer .close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  background: none;
  border: 0;
  line-height: 1;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: var(--text);
  color: var(--bg);
  padding: 8px 18px;
  border-radius: 30px;
  font-size: 12px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 99;
}

#toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 700px) {
  .sw {
    margin-left: 0;
    width: 100%;
  }
  #q {
    width: 100%;
    max-width: none;
  }
  .ax, .tr {
    grid-template-columns: 110px 1fr;
  }
  .cn {
    grid-template-columns: 1fr;
  }
  #pn {
    width: 100%;
  }
  .photo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .profile-header .av {
    width: 56px;
    height: 56px;
    font-size: 20px;
  }

  .profile-header .av img {
    border-radius: 14px;
  }

  .cards {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}

/* ---- profile panel ---- */
.aka { color: var(--mut); font-size: 12px; margin: 2px 0 0; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 4px; }
.acts .btn { padding: 6px 13px; font-size: 12px; }
.profile-copy.empty { font-style: italic; opacity: .8; }
.profile-copy.story { border-left: 2px solid var(--acc); padding-left: 12px; font-style: italic; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px 12px; font-size: 13px; }
.kv > span { color: var(--mut); font-size: 12px; padding-top: 1px; }
.sub, .mut { color: var(--mut); font-size: 12px; }
.fam h3, .photo-section h3 { font-size: 17px; margin: 22px 0 2px; }
.fam .lb { margin-top: 12px; }
.fam { border-top: 1px solid var(--line); margin-top: 20px; }
.chip.Male { border-left: 3px solid var(--m); }
.chip.Female { border-left: 3px solid var(--f); }
.tag { padding: 4px 12px; border-radius: 20px; background: var(--soft); font-size: 12px; }
.evs { display: grid; gap: 6px; }
.ev { display: grid; grid-template-columns: 56px 1fr; gap: 10px; font-size: 13px; }
.ev em { font-style: normal; color: var(--acc); font-weight: 600; font-size: 12px; }
.facts { margin: 4px 0 0 18px; font-size: 13px; line-height: 1.6; }
#sr .sub { margin-left: 4px; }
#sr .none { color: var(--mut); cursor: default; }
#sr .none:hover { background: none; }
.bar b { font-weight: 600; }
.trk i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); opacity: .5; }
.res .acts { margin-top: 16px; }

/* ---- photo viewer ---- */
.photo-viewer figure { max-width: 100%; max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.photo-viewer figure img { max-height: calc(100vh - 110px); object-fit: contain; }
.photo-viewer figcaption { color: #e8e2d6; font-size: 13px; text-align: center; min-height: 1em; }
.pv-nav { display: none; position: absolute; top: 50%; transform: translateY(-50%); background: rgba(0,0,0,.45); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 28px; line-height: 1; cursor: pointer; }
.pv-nav.prev { left: 16px; } .pv-nav.next { right: 16px; }
.photo-viewer.multi .pv-nav { display: block; }

@media (prefers-reduced-motion: reduce) {
  .n { animation: none; }
  #world.tw, #pn { transition: none; }
}

/* ===================================================================
   The family archive — a reading-room palette.
   =================================================================== */
:root {
  --bg: #191b18;
  --card: #222521;
  --text: #e8e2d4;
  --mut: #aaa18f;
  --acc: #d5ad73;
  --line: #414239;
  --soft: #2c2e28;
  --m: #82a6a2;
  --f: #c58e7e;
  --shadow: 0 3px 12px rgba(0,0,0,.22);
  --shadow-lg: 0 14px 42px rgba(0,0,0,.34);
  --font-serif: 'Fraunces', Georgia, serif;
  --font-sans: 'DM Sans', system-ui, sans-serif;
}

[data-theme="light"] {
  --bg: #eeece4;
  --card: #f7f5ed;
  --text: #34372f;
  --mut: #73766b;
  --acc: #8a6940;
  --line: #d5d0c2;
  --soft: #e7e4da;
  --m: #527a78;
  --f: #a7645a;
  --shadow: 0 3px 12px rgba(54,48,35,.07);
  --shadow-lg: 0 14px 42px rgba(54,48,35,.15);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
  opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
}

header {
  min-height: 68px;
  gap: 10px 18px;
  padding: 11px clamp(14px, 2.5vw, 34px);
  background: color-mix(in srgb, var(--card) 96%, var(--acc));
}
header h1 { font-size: 22px; letter-spacing: -.035em; }
header h1 span { font-style: italic; }
nav { gap: 2px; border-radius: 9px; padding: 4px; }
.tab, .btn { transition: background-color .18s, color .18s, border-color .18s, transform .18s; }
.tab { border-radius: 6px; padding: 7px 12px; }
.tab.on { background: var(--acc); color: #25251f; }
.btn { border-radius: 8px; }
.btn:active, .tab:active { transform: translateY(1px); }
#q { border-radius: 8px; }
.view { scrollbar-color: var(--line) transparent; }

.editorial-view {
  background:
    radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--acc) 7%, transparent), transparent 52%),
    var(--bg);
}
.editorial-view .pg { max-width: 1000px; padding: clamp(34px, 7vw, 88px) 26px 100px; }

.eyebrow {
  color: var(--acc);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* ---------------- History ---------------- */
.reading-page { max-width: 830px !important; }
.reading-page h2, .archive-page > h2 {
  font-size: clamp(38px, 6vw, 68px);
  letter-spacing: -.055em;
  line-height: 1;
  margin: 0 0 22px;
}
.history-source {
  max-width: 650px;
  color: var(--mut);
  font-size: 13px;
  padding: 14px 0 17px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 35px;
}
.history-copy {
  max-width: 680px;
  font-family: var(--font-serif);
  font-size: clamp(18px, 2vw, 21px);
  line-height: 1.85;
  color: color-mix(in srgb, var(--text) 92%, var(--acc));
}
.history-copy p { margin: 0 0 1.55em; }
.history-copy p:first-child::first-letter {
  float: left;
  color: var(--acc);
  font-size: 3.7em;
  line-height: .8;
  padding: .12em .12em 0 0;
}
.provenance-note {
  max-width: 680px;
  margin-top: 44px;
  padding: 20px 23px;
  border-left: 2px solid var(--acc);
  background: color-mix(in srgb, var(--soft) 76%, transparent);
}
.provenance-mark {
  display: block;
  color: var(--acc);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 7px;
}
.provenance-note p { color: var(--mut); max-width: 590px; line-height: 1.65; font-size: 13px; }
.editorial-empty { color: var(--mut); font-style: italic; }

/* ---------------- Archives ---------------- */
.archive-page { max-width: 1180px !important; }
.archive-page > h2 { margin-bottom: 12px; }
.archive-intro { color: var(--mut); max-width: 640px; margin-bottom: 35px !important; }

/* Index nav */
.archive-index {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 1000px;
  margin: 48px 0 8px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.archive-index-link {
  display: grid;
  gap: 3px;
  min-width: 170px;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s;
}
.archive-index-link:hover { border-color: var(--acc); transform: translateY(-2px); }
.archive-index-link b { font: 600 15px var(--font-serif); }
.archive-index-link small { color: var(--mut); font-size: 11px; }
.archive-index-count { color: var(--acc); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }

/* Group */
.archive-group { max-width: 1000px; margin-top: 68px; scroll-margin-top: 24px; }
.archive-group-head { border-top: 1px solid var(--line); padding-top: 20px; margin-bottom: 26px; }
.archive-group-head h3 {
  font-size: clamp(26px, 3.4vw, 40px);
  letter-spacing: -.035em;
  margin: 0 0 4px;
}
.archive-group-role { color: var(--acc); font-size: 12px; letter-spacing: .04em; }
.archive-group-blurb { color: var(--mut); font-size: 13px; margin-top: 10px; max-width: 620px; line-height: 1.7; }

/* Document */
.archive-doc {
  border-top: 1px solid var(--line);
  padding: 32px 0 42px;
}
.archive-doc:first-child { border-top: 0; padding-top: 4px; }
.archive-doc-head { margin-bottom: 24px; }
.archive-doc-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.archive-doc-year {
  font: 600 13px var(--font-sans);
  color: var(--acc);
  letter-spacing: .14em;
}
.archive-doc-source { color: var(--mut); font-size: 12px; }
.archive-doc-title {
  font: 600 clamp(22px, 2.4vw, 28px)/1.2 var(--font-serif);
  letter-spacing: -.025em;
  margin: 0 0 6px;
}
.archive-doc-people { color: var(--acc); font-size: 12px; letter-spacing: .04em; }

.archive-doc-body {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(220px, 0.85fr);
  gap: 40px;
  align-items: start;
}

/* Transcription */
.archive-doc-text { min-width: 0; font-family: var(--font-serif); font-size: 16px; line-height: 1.75; color: color-mix(in srgb, var(--text) 94%, var(--acc)); }
.arc-h {
  font: 600 13px var(--font-sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--acc);
  margin: 26px 0 10px;
}
.arc-h:first-child { margin-top: 0; }
.arc-p { margin: 0 0 1.15em; }
.arc-note { color: var(--mut); font-style: italic; font-size: 14px; margin: 0 0 1.15em; }
.arc-quote {
  border-left: 2px solid var(--acc);
  padding: 4px 0 4px 18px;
  margin: 0 0 1.3em;
  color: color-mix(in srgb, var(--text) 88%, var(--acc));
  font-style: italic;
}
.arc-list { margin: 0 0 1.3em 20px; font-size: 15px; line-height: 1.7; }
.arc-list li { margin-bottom: 4px; }

.arc-vocab {
  list-style: none;
  margin: 0 0 1.4em;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 2px 22px;
  font-family: var(--font-sans);
  font-size: 13px;
}
.arc-vocab li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--line);
}
.arc-vocab b { font-weight: 600; color: var(--acc); word-break: break-word; }
.arc-vocab span { color: var(--mut); }

.arc-table-wrap { overflow-x: auto; margin: 0 0 1.4em; }
.arc-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans);
  font-size: 13px;
}
.arc-table th, .arc-table td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.arc-table th {
  font: 600 10px var(--font-sans);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--acc);
  background: color-mix(in srgb, var(--soft) 60%, transparent);
}
.arc-table td { color: color-mix(in srgb, var(--text) 92%, var(--mut)); }

/* Scans */
.archive-doc-scans {
  display: grid;
  gap: 14px;
  align-self: start;
  position: sticky;
  top: 20px;
}
.archive-scan {
  display: block;
  width: 100%;
  padding: 8px;
  background: #f4f0e6;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: zoom-in;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  font: inherit;
  color: inherit;
  text-align: left;
}
.archive-scan:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.archive-scan img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}
.archive-scan-label {
  display: block;
  padding: 8px 4px 2px;
  font-family: var(--font-sans);
  font-size: 11px;
  color: #5a5343;
  letter-spacing: .02em;
}
.archive-empty { margin-top: 20px; color: var(--mut); font-size: 13px; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
}

@media (max-width: 900px) {
  .archive-doc-body { grid-template-columns: 1fr; gap: 26px; }
  .archive-doc-scans { position: static; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 700px) {
  header { gap: 8px 10px; }
  header h1 { flex: 1; }
  nav { order: 4; width: 100%; overflow-x: auto; }
  .tab { flex: 1; padding: 7px 8px; }
  .archive-index { gap: 8px; }
  .archive-index-link { flex: 1 1 100%; }
  .arc-vocab { grid-template-columns: 1fr; }
  .arc-vocab li { grid-template-columns: 110px 1fr; }
}

/* ---------------- Photograph gallery ---------------- */
.gallery-page { max-width: 1180px !important; }
.gallery-page > h2 { margin-bottom: 12px; }
.gallery-intro { color: var(--mut); max-width: 620px; margin-bottom: 28px !important; }

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.gallery-filters .chip {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--mut);
  font-size: 12px;
  cursor: pointer;
  transition: all .18s;
}
.gallery-filters .chip:hover { border-color: var(--acc); color: var(--text); }
.gallery-filters .chip.on {
  background: var(--acc);
  border-color: var(--acc);
  color: var(--card);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 26px 22px;
}

.gallery-card {
  display: grid;
  gap: 12px;
  margin: 0;
  animation: galleryIn .45s both;
}
@keyframes galleryIn { from { opacity: 0; transform: translateY(6px); } }

.gallery-thumb {
  display: block;
  width: 100%;
  padding: 0;
  background: #0e0e0c;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: zoom-in;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  aspect-ratio: 4 / 3;
  position: relative;
}
.gallery-thumb:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .2s, transform .35s;
}
.gallery-thumb:hover img { transform: scale(1.02); }
.gallery-thumb.missing {
  display: grid;
  place-items: center;
  background: var(--soft);
  cursor: default;
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}
.gallery-thumb .empty { color: var(--mut); font-size: 12px; }

.gallery-card figcaption { display: grid; gap: 5px; }
.gallery-caption {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.35;
  color: var(--text);
  margin: 0;
}
.gallery-date {
  color: var(--acc);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0;
}
.gallery-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.gallery-person.chip {
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--mut);
  font-size: 11px;
  cursor: pointer;
  transition: all .18s;
}
.gallery-person.chip.Male   { border-left: 3px solid var(--m); }
.gallery-person.chip.Female { border-left: 3px solid var(--f); }
.gallery-person.chip:hover { color: var(--acc); border-color: var(--acc); }

.gallery-empty {
  margin-top: 24px;
  color: var(--mut);
  font-size: 13px;
}
.gallery-empty code {
  font-family: var(--font-sans);
  font-size: 12px;
  background: var(--soft);
  padding: 1px 6px;
  border-radius: 4px;
}

@media (max-width: 700px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px 16px; }
  .gallery-caption { font-size: 14px; }
}

/* ---- Profile photo grid — final override ---- */
#pn .photo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}

#pn .photo-item {
  aspect-ratio: 1 / 1;
  width: 100%;
  padding: 0;
  margin: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--line);
  cursor: pointer;
  display: block;
  position: relative;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

#pn .photo-item:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

#pn .photo-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  border-radius: 0;
}

#pn .photo-item .empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 8px;
  font-size: 11px;
  color: var(--mut);
  text-align: center;
}

/* header avatar — keep it uniform too */
#pn .profile-header .av {
  border-radius: 8px;
}

/* ---------- Access gate ---------- */
#gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}
#gate.off { display: none; }
#gate form {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 34px 28px 30px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}
#gate h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  letter-spacing: -.03em;
  margin: 0 0 10px;
}
#gate h2 em { color: var(--acc); font-style: italic; }
#gate p { color: var(--mut); font-size: 13px; margin: 0 0 18px; line-height: 1.5; }
#gate input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 11px 14px;
  font: inherit;
  outline: 0;
  margin-bottom: 10px;
  transition: border-color .2s;
}
#gate input:focus { border-color: var(--acc); }
#gate button {
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  background: var(--acc);
  color: #25251f;
  border: 0;
  font: 600 14px var(--font-sans);
  cursor: pointer;
  transition: opacity .2s;
}
#gate button:hover { opacity: .9; }
#gate-err { color: #e07a7a; font-size: 12px; margin: 12px 0 0 !important; }

/* ---------- Image deterrents (NOT security) ---------- */
img {
  -webkit-user-drag: none;
  user-drag: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  pointer-events: none;
}
/* If an image ever needs to be clickable itself, re-enable here: */
.photo-viewer img,
#gate img { pointer-events: auto; }