/* Durham History Archive.
   Built for comfortable reading and unhurried use: large type, strong
   contrast, big buttons, one thing at a time. */

:root {
  --paper: #faf6ec;
  --card: #ffffff;
  --ink: #1d2426;
  --soft: #4d5a5d;
  --line: #d9d0bd;
  --green: #24584a;
  --green-dark: #173d33;
  --green-tint: #e4efe9;
  --rust: #9a4a22;
  --gold: #f4e4b0;
  --warn-bg: #fff3d6;
  --warn-line: #d9a514;
  --bad: #a3271b;
  --bad-bg: #fde9e6;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(40, 30, 10, .12), 0 6px 18px rgba(40, 30, 10, .06);
}

* { box-sizing: border-box; }
html { font-size: 19px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
}
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--green); text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
img { max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 4px solid #e2a100; outline-offset: 2px; border-radius: 4px; }
/* Headings are focused by script after a step change, for screen readers. */
h1[tabindex="-1"]:focus { outline: none; }

/* ---- header ---- */
.site-header { background: var(--green-dark); color: #fff; }
.site-header .inner {
  max-width: 1200px; margin: 0 auto; padding: .6rem 1.2rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem 1.4rem;
}
.site-header .brand { font-family: Georgia, serif; font-size: 1.3rem; color: #fff; text-decoration: none; margin-right: auto; }
.site-header nav { display: flex; flex-wrap: wrap; gap: .2rem; }
.site-header nav a {
  color: #fff; text-decoration: none; padding: .45rem .8rem; border-radius: 8px; font-weight: 600;
}
.site-header nav a:hover, .site-header nav a[aria-current="page"] { background: rgba(255, 255, 255, .18); }
.site-header .who { font-size: .9rem; opacity: .95; display: flex; align-items: center; gap: .6rem; }
.site-header .who button {
  background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .6);
  border-radius: 8px; padding: .25rem .7rem; font: inherit; cursor: pointer;
}
.site-header .who button:hover { background: rgba(255, 255, 255, .18); }

main { max-width: 1200px; margin: 0 auto; padding: 1.6rem 1.2rem 4rem; }
main.narrow { max-width: 820px; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 56px; padding: .6rem 1.5rem;
  font: inherit; font-size: 1.05rem; font-weight: 700; text-decoration: none; text-align: center;
  color: #fff; background: var(--green); border: 2px solid var(--green);
  border-radius: var(--radius); cursor: pointer;
}
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn.secondary { background: #fff; color: var(--green-dark); }
.btn.secondary:hover { background: var(--green-tint); color: var(--green-dark); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--green-dark); text-decoration: underline; padding-inline: .6rem; }
.btn.quiet:hover { background: var(--green-tint); }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { min-height: 44px; padding: .3rem .9rem; font-size: .95rem; }
.btn.huge { min-height: 120px; font-size: 1.35rem; flex-direction: column; padding: 1.2rem; }
.btn.huge small { font-weight: 400; font-size: .95rem; opacity: .95; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: 1rem; }

/* ---- forms ---- */
label, .label { display: block; font-weight: 700; margin-bottom: .3rem; font-size: 1.05rem; }
.hint { color: var(--soft); font-size: .95rem; margin: 0 0 .5rem; font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], select, textarea {
  width: 100%; font: inherit; font-size: 1.05rem; color: var(--ink);
  padding: .7rem .8rem; border: 2px solid #8b8672; border-radius: 8px; background: #fff;
}
textarea { min-height: 8rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
.field { margin-bottom: 1.4rem; }
.field.short input, .field.short select { max-width: 14rem; }
.choice {
  display: flex; align-items: flex-start; gap: .8rem; padding: .8rem 1rem; margin-bottom: .5rem;
  border: 2px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; font-weight: 600;
}
.choice:hover { border-color: var(--green); }
.choice input { width: 1.5rem; height: 1.5rem; margin: .15rem 0 0; accent-color: var(--green); flex: none; }
.choice.on { border-color: var(--green); background: var(--green-tint); }
.choice .extra { font-weight: 400; margin-top: .6rem; }
.choice .extra .row { gap: .6rem; }
.choice .extra input, .choice .extra select { width: auto; min-width: 7rem; }

/* ---- cards and notes ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.4rem; }
.note { border-left: 6px solid var(--green); background: var(--green-tint); padding: .9rem 1.1rem; border-radius: 0 var(--radius) var(--radius) 0; }
.note.warn { border-color: var(--warn-line); background: var(--warn-bg); }
.note.bad { border-color: var(--bad); background: var(--bad-bg); }
.note > :last-child { margin-bottom: 0; }
.muted { color: var(--soft); }
.badge { display: inline-block; padding: .1rem .6rem; border-radius: 99px; background: var(--gold); font-size: .85rem; font-weight: 700; }
.badge.id { background: var(--green-tint); font-family: ui-monospace, Menlo, Consolas, monospace; }

#toast {
  position: fixed; left: 50%; top: 1rem; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: #fff; padding: .8rem 1.4rem; border-radius: var(--radius);
  box-shadow: var(--shadow); max-width: 90vw; font-weight: 600;
}
#toast.bad { background: var(--bad); }

/* ---- home ---- */
.big-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.2rem 0 2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.tile {
  display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--green); color: var(--ink); }
.tile .pic { aspect-ratio: 4 / 3; background: #ece5d3; display: flex; align-items: center; justify-content: center; }
.tile .pic img { width: 100%; height: 100%; object-fit: contain; }
.tile .pic span { color: var(--soft); font-size: .9rem; }
.tile .txt { padding: .6rem .8rem .8rem; }
.tile .txt strong { display: block; line-height: 1.25; }
.tile .txt small { color: var(--soft); }

/* ---- wizard ---- */
.steps { margin: 0 0 1.2rem; }
.steps .count { font-weight: 700; color: var(--green-dark); }
.steps .bar { height: 12px; background: #e6dec9; border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.steps .bar div { height: 100%; background: var(--green); border-radius: 99px; transition: width .2s; }
.wizard-nav { margin-top: 2rem; padding-top: 1.2rem; border-top: 2px solid var(--line); }
.how { background: #fff; border: 2px dashed var(--line); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: 1.4rem; }
.how ol, .how ul { margin: .3rem 0 0; padding-left: 1.4rem; }
.how li { margin-bottom: .3rem; }

.drop {
  border: 3px dashed #8b8672; border-radius: var(--radius); background: #fff;
  padding: 2rem 1rem; text-align: center;
}
.drop.over { border-color: var(--green); background: var(--green-tint); }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-top: 1rem; }
.page-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; text-align: center; }
.page-card img { max-height: 220px; display: block; margin: 0 auto .5rem; border: 1px solid var(--line); }
.page-card.big img { max-height: 60vh; }
.progress { height: 14px; background: #e6dec9; border-radius: 99px; overflow: hidden; margin: .5rem 0; }
.progress div { height: 100%; background: var(--green); width: 0; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: .3rem .9rem;
  border: 2px solid var(--line); border-radius: 99px; background: #fff; font: inherit; font-weight: 600;
  color: var(--ink); cursor: pointer; text-decoration: none;
}
.chip:hover { border-color: var(--green); }
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.chip.fixed { cursor: default; background: var(--green-tint); border-color: var(--green-tint); }
.chip .x { font-size: 1.2rem; line-height: 1; border: 0; background: none; cursor: pointer; color: inherit; padding: 0 .1rem; }

/* suggestions under a text box */
.picker { position: relative; }
.picker-list {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px;
  background: #fff; border: 2px solid var(--green); border-radius: var(--radius); box-shadow: var(--shadow);
  max-height: 22rem; overflow: auto;
}
.picker-list button {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left; font: inherit;
  padding: .6rem .8rem; border: 0; border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; min-height: 52px;
}
.picker-list button:last-child { border-bottom: 0; }
.picker-list button:hover, .picker-list button.active { background: var(--green-tint); }
.picker-list .new { font-weight: 700; color: var(--green-dark); }
.picker-list small { color: var(--soft); display: block; }
.avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #e6dec9; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--soft); }
.avatar.large { width: 120px; height: 120px; font-size: 2.2rem; }

/* ---- face boxes ---- */
.who-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: 1.4rem; align-items: start; }
.who-side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
@media (max-width: 900px) { .who-layout { grid-template-columns: 1fr; } .who-side { position: static; max-height: none; } }
.fb-stage { position: relative; display: inline-block; line-height: 0; max-width: 100%; user-select: none; }
.fb-stage img { display: block; max-width: 100%; max-height: 78vh; border: 1px solid var(--line); -webkit-user-drag: none; }
.fb-layer { position: absolute; inset: 0; touch-action: none; cursor: crosshair; }
.fb-layer.readonly { cursor: default; touch-action: auto; }
.fb-box {
  position: absolute; border: 3px solid #fff; outline: 2px solid rgba(0, 0, 0, .75); border-radius: 4px;
  cursor: move; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0);
}
.fb-layer.readonly .fb-box { cursor: pointer; border-color: rgba(255, 255, 255, .0); outline-color: transparent; }
.fb-layer.readonly:hover .fb-box, .fb-layer.readonly .fb-box.sel { border-color: #fff; outline-color: rgba(0, 0, 0, .75); }
.fb-box.sel { border-color: #ffcf33; outline-color: #000; z-index: 3; }
.fb-box.unknown { border-style: dashed; }
.fb-box .num {
  position: absolute; left: -3px; top: -3px; transform: translateY(-100%); line-height: 1.2;
  background: #000; color: #fff; font-size: .8rem; font-weight: 700; padding: .05rem .45rem; border-radius: 4px 4px 0 0; white-space: nowrap;
}
.fb-box.sel .num { background: #ffcf33; color: #000; }
.fb-layer.readonly .fb-box .num { display: none; }
.fb-layer.readonly .fb-box:hover .num, .fb-layer.readonly .fb-box.sel .num { display: block; }
.fb-box .grip {
  position: absolute; right: -12px; bottom: -12px; width: 24px; height: 24px; border-radius: 50%;
  background: #ffcf33; border: 2px solid #000; cursor: nwse-resize; display: none;
}
.fb-box.sel .grip { display: block; }
.fb-ghost { position: absolute; border: 2px dashed #ffcf33; background: rgba(255, 207, 51, .15); pointer-events: none; }

.face-list { list-style: none; margin: 0; padding: 0; }
.face-list li { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: .5rem; }
.face-list li.sel { border-color: #c79a00; background: #fff8dc; }
.face-list .n { width: 2rem; height: 2rem; border-radius: 50%; background: #000; color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.face-list .name { flex: 1; font-weight: 700; min-width: 0; }
.face-list .name small { display: block; font-weight: 400; color: var(--soft); }
.ask { border: 3px solid #c79a00; background: #fff8dc; border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }

/* ---- review and item view ---- */
.summary { width: 100%; border-collapse: collapse; }
.summary th, .summary td { text-align: left; vertical-align: top; padding: .7rem .5rem; border-bottom: 1px solid var(--line); }
.summary th { width: 11rem; color: var(--soft); font-weight: 600; }
.summary td.change { width: 7rem; text-align: right; }
.empty { color: var(--soft); font-style: italic; }
.item-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 1.6rem; align-items: start; }
@media (max-width: 900px) { .item-layout { grid-template-columns: 1fr; } }
.thumb-strip { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.thumb-strip button { border: 3px solid transparent; padding: 0; background: none; cursor: pointer; border-radius: 6px; }
.thumb-strip button.on { border-color: var(--green); }
.thumb-strip img { height: 80px; display: block; border-radius: 3px; }
.pre { white-space: pre-wrap; }
dl.facts { margin: 0; }
dl.facts dt { font-weight: 700; color: var(--soft); font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; margin-top: 1rem; }
dl.facts dd { margin: .2rem 0 0; }

.searchbar { display: flex; gap: .6rem; }
.searchbar input { flex: 1; font-size: 1.2rem; padding: .8rem 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: end; margin: 1rem 0 1.4rem; }
.filters .field { margin: 0; }
.filters input[type="number"] { width: 7rem; }
.person-row { display: flex; align-items: center; gap: .9rem; padding: .7rem .9rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.person-row:hover { border-color: var(--green); }
.person-row small { color: var(--soft); display: block; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: .7rem; }
table.plain { width: 100%; border-collapse: collapse; background: #fff; }
table.plain th, table.plain td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--line); }

.login-wrap { max-width: 520px; margin: 8vh auto; padding: 0 1.2rem; }
.done-mark { font-size: 3rem; line-height: 1; color: var(--green); }
.id-big { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 2rem; font-weight: 700; background: var(--green-tint); padding: .3rem 1rem; border-radius: var(--radius); display: inline-block; }

@media print {
  .site-header, .btn, .wizard-nav { display: none !important; }
  body { background: #fff; }
}
