@import url("base-v10.css");
@import url("common-v09.css");
@import url("midnight-v09.css");
@import url("mobile-v09.css");
@import url("prominent-nav-v09.css");
@import url("rebuild-v10.css");

/*
 * 1859 palette layer. The layout, spacing, typography, navigation model,
 * cards, panels, and responsive rules are the v22.5 1858 production system.
 */
:root {
  --ink: #031014;
  --ink2: #06191e;
  --paper: #041116;
  --panel: #0a2026;
  --panel2: #0f2b32;
  --rule: #31535c;
  --line: #31535c;
  --line2: #64858d;
  --gold: #65d9d3;
  --gold2: #c9fffb;
  --text: #fffaf0;
  --muted: #b9cdd1;
  --shadow: 0 28px 80px rgba(0, 0, 0, .52);
  --brown: #a3702f;
  --red: #c23b34;
  --blue: #2f7fa8;
  --mauve: #a8477a;
  --green: #326849;
  --black: #3a3632;
}

html { background: #020b0e; }

body.design-midnight {
  background:
    radial-gradient(circle at 75% -10%, rgba(70, 177, 181, .22), transparent 33rem),
    radial-gradient(circle at 10% 24%, rgba(101, 217, 211, .08), transparent 30rem),
    #020b0e;
  color: var(--text);
}

.design-midnight .app {
  background:
    linear-gradient(90deg, transparent 0, rgba(255,255,255,.018) 50%, transparent 100%),
    #041116;
}

.site-header-bar {
  background: rgba(3, 16, 20, .97);
  border-bottom-color: rgba(101, 217, 211, .42);
}

.site-header-mark { border-color: rgba(101, 217, 211, .72); }
.site-header-brand small { color: #9fc6c9; }

.design-midnight .hero {
  background:
    linear-gradient(90deg, rgba(2,11,14,.99) 0%, rgba(4,17,22,.94) 48%, rgba(4,22,28,.64) 100%),
    radial-gradient(circle at 78% 45%, rgba(101,217,211,.2), transparent 26rem),
    #031014;
  border-bottom-color: rgba(201,255,251,.28);
}

.design-midnight .hero::before {
  background:
    linear-gradient(90deg, transparent 0 74px, rgba(201,255,251,.16) 75px, transparent 76px),
    linear-gradient(180deg, transparent 0 74px, rgba(201,255,251,.08) 75px, transparent 76px);
}

.design-midnight .hero::after { content: "ARCHIVE / 1859"; color: rgba(201,255,251,.5); }
.design-midnight .hero-deck { color: #d5e3e5; }
.full-historical-title { color: var(--gold2); border-left-color: var(--gold); }

.design-midnight .hero-stage.hero-single { min-height: 590px; }
.design-midnight .hero-stage.hero-single .hero-book {
  position: relative;
  inset: auto;
  width: min(410px, 88%);
  max-height: 545px;
  transform: none !important;
  z-index: 3;
}
.design-midnight .hero-stage.hero-single .hero-book img {
  width: 100%;
  height: 100%;
  max-height: 545px;
  object-fit: contain;
  background: #020b0e;
}

.design-midnight .stats { background: #041217; border-bottom-color: #27444c; }
.design-midnight .stat { border-right-color: #27444c; }

.design-midnight .menu-toggle-btn {
  color: #bed3d6;
  background: rgba(255,255,255,.045);
  border-color: rgba(201,255,251,.38);
}
.design-midnight .nav-drawer { background: rgba(3,15,19,.99); border-color: rgba(201,255,251,.38); }
.design-midnight .nav-drawer label,
.design-midnight .nav-drawer a.edition-nav-link { color: #bed3d6; border-bottom-color: rgba(201,255,251,.16); }
.design-midnight .nav-drawer a.edition-nav-link { justify-content: space-between; color: var(--gold2); }
.design-midnight .nav-drawer a.edition-nav-link:hover,
.design-midnight .nav-drawer a.edition-nav-link:focus-visible { color: #fff; background: rgba(101,217,211,.09); }

.design-midnight .overview-map { border-color: #2c515a; background: #06191e; }
.design-midnight .overview-map a { border-right-color: #2c515a; }
.design-midnight .overview-map a:hover { background: rgba(101,217,211,.09); }
.design-midnight .overview-section + .overview-section { border-color: #27464e; }

.design-midnight .story-step,
.design-midnight .data-card,
.design-midnight .callout,
.design-midnight .network-card,
.design-midnight .person,
.design-midnight .person-profile {
  border-color: #31535c;
  background: linear-gradient(145deg, #0c252c, #06171c);
}

.design-midnight .copy-card {
  border-color: #31535c;
  background: linear-gradient(150deg, #0c252c, #05161b);
}
.design-midnight .copy-card:hover { border-color: #5f8790; }
.design-midnight .copy-card[open] { border-color: rgba(101,217,211,.7); }
.design-midnight .copy-body { border-color: #31535c; background: #06191e; }
.design-midnight .fact-grid > div,
.design-midnight .record-block { border-color: #31535c; background: #0b242a; }
.design-midnight .fact-grid.compact-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
.design-midnight .card-thumb { border-color: #476b74; background: #020b0e; }
.card-thumb>img { width: 100%; height: 100%; object-fit: contain; }
.design-midnight .card-thumb.placeholder {
  border-color: #476b74;
  background: #071b20;
  color: #b9cdd1;
}
.card-thumb.photo-unavailable {
  display: grid;
  place-items: center;
  padding: 5px;
  border: 1px dashed rgba(101,217,211,.45);
  background: rgba(101,217,211,.06);
  color: var(--gold2);
  text-align: center;
  font-family: Inter, Avenir, "Segoe UI", Helvetica, Arial, sans-serif !important;
  font-size: .62rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  letter-spacing: .02em !important;
}

.catalog-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: var(--gold2);
  font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-transform: uppercase;
}
.catalog-link:hover,
.catalog-link:focus-visible { color: #fff; }
.catalog-pending {
  display: block;
  margin-top: 7px;
  color: #a9bec2;
}

.filters button {
  padding: 11px 16px;
  border: 1px solid #466670;
  border-radius: 3px;
  background: #071b20;
  color: #c3d4d7;
  font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .09em;
  text-transform: uppercase;
  cursor: pointer;
}
.filters button:hover,
.filters button:focus-visible { color: #fff; border-color: #91b5bc; }
.filters button.active { background: var(--gold); border-color: var(--gold2); color: #031014; }

.master-status { border-color: #31535c !important; background: #071b20 !important; color: #c6d8da !important; }
.master-status strong { color: #fffaf0 !important; }

.binding-showcase.textual .binding-card {
  min-height: 235px;
  display: grid;
  grid-template-rows: 125px minmax(0,1fr);
  align-content: stretch;
}
.binding-showcase.textual .binding-image {
  aspect-ratio: auto;
  min-height: 125px;
  height: 125px;
  padding: 28px;
}
.binding-swatch { width: 74px; height: 74px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; box-shadow: inset 0 0 0 7px rgba(0,0,0,.14); }
.binding-swatch.brown { background: var(--brown); }
.binding-swatch.red { background: var(--red); }
.binding-swatch.blue { background: var(--blue); }
.binding-swatch.mauve { background: var(--mauve); }
.binding-swatch.green { background: var(--green); }
.binding-swatch.black { background: var(--black); }
.binding-swatch.later { background: #8f765e; }
.binding-swatch.unphotographed {
  background: repeating-linear-gradient(135deg, #72878b 0 8px, #3f555a 8px 16px);
}

.gallery-open { width: 100%; padding: 0; border: 0; background: #020b0e; cursor: zoom-in; }
.gallery-open>img { width: 100%; height: 270px; object-fit: contain; }

.comparison-diagnostic {
  margin: 34px 0 0;
  padding: 20px 24px;
  border: 1px solid var(--gold);
  background: rgba(101,217,211,.09);
  color: #dbeaec;
  font-size: 17px;
  line-height: 1.6;
}
.comparison-diagnostic b,
.comparison-diagnostic strong { color: var(--gold2); }
.comparison-chapter { margin-top: 50px; padding-top: 34px; border-top: 1px solid var(--line); }
.comparison-chapter-heading { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 24px; }
.comparison-chapter-heading > span {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--gold);
  color: var(--gold2);
  font: 700 12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;
}
.comparison-chapter-heading h3 { margin: 5px 0 0; color: var(--text); font: 400 clamp(30px,4vw,48px)/1.05 Georgia,serif; }
.comparison-pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; align-items: stretch; }
.comparison-side { min-width: 0; overflow: hidden; border: 1px solid var(--line); background: linear-gradient(160deg,#0b252c,#07191e 72%); }
.comparison-edition { padding: 16px 18px; border-bottom: 1px solid var(--line); background: #0c2c33; color: var(--gold2); font: 400 27px/1 Georgia,serif; }
.comparison-edition small { display: block; margin-top: 6px; color: #98bdc1; font: 700 10px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing: .09em; text-transform: uppercase; }
.comparison-side figure { margin: 0; border-bottom: 1px solid var(--line); background: #020b0e; }
.comparison-side figure .gallery-open > img { height: 420px; object-fit: contain; }
.comparison-side figcaption { display: flex; flex-direction: column; gap: 4px; padding: 11px 15px; }
.comparison-side figcaption b { color: var(--gold2); }
.comparison-side figcaption small { color: #9fc6c9; }
.comparison-copy { padding: 20px; color: #c5d5d8; line-height: 1.7; }
.comparison-copy p { margin: 0 0 15px; }
.comparison-copy p:last-child { margin-bottom: 0; }
.comparison-copy h4 { margin: 0 0 12px; color: var(--gold2); font: 400 28px/1.1 Georgia,serif; }
.binding-variant-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; padding: 20px; border-bottom: 1px solid var(--line); }
.binding-variant-list > div { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid #294c54; background: #06191e; color: #d5e5e7; }
.compare-swatch { flex: 0 0 auto; width: 28px; height: 28px; border: 1px solid rgba(255,255,255,.48); border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(0,0,0,.11); }
.compare-swatch.brown-1859 { background: var(--brown); }
.compare-swatch.red-1859 { background: var(--red); }
.compare-swatch.blue-1859 { background: var(--blue); }
.compare-swatch.mauve-1859 { background: var(--mauve); }
.compare-swatch.black-1859 { background: var(--black); }
.compare-swatch.green-1859 { background: var(--green); }
.comparison-mini-gallery { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.comparison-mini-gallery figure { border: 0; border-right: 1px solid var(--line); }
.comparison-mini-gallery figure:last-child { border-right: 0; }
.comparison-mini-gallery figure .gallery-open > img { height: 300px; }
.comparison-absence { min-height: 300px; display: grid; place-items: center; border-bottom: 1px solid var(--line); background: radial-gradient(circle,rgba(101,217,211,.12),transparent 58%),#020b0e; color: #5f858b; font: 400 100px/1 Georgia,serif; }
.comparison-numbering { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 34px; }
.comparison-numbering span { padding: 16px 18px; border: 1px solid var(--line); background: #071b20; color: #b9cdd1; }
.comparison-numbering b { color: var(--gold2); }

.people-section-block { margin-top: 48px; padding-top: 34px; border-top: 1px solid var(--line); }
.people-group-heading { margin-bottom: 22px; }
.people-group-heading h3 { margin: 6px 0 0; color: var(--text); font: 400 clamp(30px,4vw,48px)/1.05 Georgia, serif; }
.people-directory-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.people-makers-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
.people-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(160deg,#0b252c,#07191e 70%);
}
.people-card figure { margin: 0; border-bottom: 1px solid var(--line); background: #020b0e; }
.people-card figure img { width: 100%; height: 300px; object-fit: contain; display: block; }
.people-evidence-grid .people-card figure img { height: 240px; }
.people-card figcaption { display: block; padding: 9px 14px; color: #9fc6c9; font: 700 10px/1.35 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing: .08em; text-transform: uppercase; }
.people-card-body { flex: 1; display: flex; flex-direction: column; padding: 20px; }
.person-role { color: var(--gold); font: 700 10px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace; letter-spacing: .1em; text-transform: uppercase; }
.people-card h4 { margin: 8px 0 12px; color: var(--gold2); font: 400 clamp(26px,2.6vw,36px)/1.08 Georgia,serif; }
.people-card p { margin: 0 0 20px; color: #c5d5d8; line-height: 1.65; }
.people-card .button { align-self: flex-start; margin-top: auto; }

.lightbox-inner { position: relative; width: min(1120px,94vw); height: min(88vh,900px); }
.lightbox-image-stage { position: relative; min-height: 0; background: #02090c; }
.lightbox-image-stage > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 64px;
  transform: translateY(-50%);
  border: 1px solid rgba(201,255,251,.44);
  background: rgba(3,16,20,.78);
  color: var(--gold2);
  font-size: 32px;
  cursor: pointer;
}
.lightbox-nav.previous { left: 12px; }
.lightbox-nav.next { right: 12px; }
.lightbox-caption { display: flex; justify-content: space-between; gap: 18px; }
.lightbox-close {
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 24px rgba(0,0,0,.8);
}
.lightbox-caption-close {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 8px 13px;
  border: 1px solid rgba(201,255,251,.5);
  border-radius: 4px;
  background: #10272d;
  color: var(--gold2);
  font: 700 12px/1.1 ui-sans-serif, system-ui, sans-serif;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.copy-report-dialog { color: var(--text); background: #041116; }
.copy-report-dialog::backdrop { background: rgba(2,8,10,.84); backdrop-filter: blur(8px); }

footer {
  display: block;
  text-align: center;
  padding: 19px 20px 29px;
  color: #7f969a;
  font: 9px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .09em;
}
footer > * + * { margin-top: 9px; }
.footer-links { display: flex; justify-content: center; gap: 12px; }
.footer-edition-link {
  color: var(--gold2);
  text-decoration: none;
  text-transform: uppercase;
}
.footer-edition-link:hover,
.footer-edition-link:focus-visible { text-decoration: underline; text-underline-offset: 4px; }

.back-to-top {
  right: max(18px,env(safe-area-inset-right));
  bottom: max(18px,env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border: 2px solid var(--gold);
  background: rgba(5,25,30,.96);
  color: var(--gold2);
  font-size: 28px;
  font-weight: 700;
  z-index: 90;
  box-shadow: 0 8px 28px rgba(0,0,0,.62);
}
.back-to-top span { transform: translateY(-1px); }

@media (max-width: 800px) {
  .design-midnight .hero-stage.hero-single { min-height: 360px !important; }
  .design-midnight .hero-stage.hero-single .hero-book { width: min(300px,82%) !important; transform: none !important; }
  .people-directory-grid,
  .people-makers-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .comparison-side figure .gallery-open > img { height: 350px; }
  .binding-variant-list { grid-template-columns: 1fr; }
  .lightbox { padding: 0 !important; }
  .lightbox-inner { width: 100vw !important; max-width: 100vw !important; height: 100dvh !important; max-height: 100dvh !important; border: 0 !important; }
  .lightbox-close {
    top: max(12px, env(safe-area-inset-top)) !important;
    right: max(12px, env(safe-area-inset-right)) !important;
    width: 52px !important;
    height: 52px !important;
    border-width: 2px !important;
    background: #10272d !important;
    font-size: 34px !important;
  }
  .lightbox-nav { width: 44px; height: 58px; }
  .lightbox-caption { padding-right: 12px; flex-direction: column; gap: 8px; }
  .lightbox-caption-close { width: 100%; margin: 4px 0 0; padding: 11px 13px; }
  .back-to-top {
    right: max(14px,env(safe-area-inset-right));
    bottom: max(18px,env(safe-area-inset-bottom));
    width: 50px;
    height: 50px;
    font-size: 27px;
  }
}

@media (max-width: 560px) {
  .comparison-pair,
  .comparison-numbering { grid-template-columns: 1fr; }
  .comparison-chapter { margin-top: 38px; padding-top: 28px; }
  .comparison-chapter-heading { gap: 12px; }
  .comparison-side figure .gallery-open > img { height: min(110vw,480px); }
  .comparison-mini-gallery { grid-template-columns: 1fr; }
  .comparison-mini-gallery figure { border-right: 0; border-bottom: 1px solid var(--line); }
  .comparison-mini-gallery figure:last-child { border-bottom: 0; }
  .comparison-mini-gallery figure .gallery-open > img { height: min(95vw,420px); }
  .comparison-absence { min-height: 210px; }
  .people-directory-grid,
  .people-makers-grid { grid-template-columns: 1fr; }
  .people-card figure img { height: min(88vw,420px); }
  .people-evidence-grid .people-card figure img { height: min(78vw,340px); }
}

/* 1858 census structural parity: the 1859 edition keeps its own palette,
   while reusing the established hero fan and People-directory grammar. */
.people-directory-intro {
  max-width: 900px;
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}
.people-portrait-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 30px 0 42px;
  padding: 24px 26px;
  border: 1px solid var(--rule);
  background: linear-gradient(135deg, rgba(101,217,211,.1), transparent 52%), var(--panel);
}
.people-portrait-entry span,
.people-portrait-gallery-head span {
  color: var(--gold);
  font: 700 .62rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.people-portrait-entry h3,
.people-portrait-gallery-head h3 {
  margin: 7px 0 5px;
  color: var(--text);
  font-size: 1.7rem;
}
.people-portrait-entry p,
.people-portrait-gallery-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
#portrait-gallery-toggle {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  background: rgba(101,217,211,.08);
  color: var(--gold2);
  cursor: pointer;
  font: 700 .62rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
#portrait-gallery-toggle:hover,
#portrait-gallery-toggle:focus-visible {
  background: var(--gold);
  color: var(--ink);
}
.people-portrait-gallery {
  margin: 0 0 56px;
  padding: 30px;
  border: 1px solid var(--rule);
  background: #020b0e;
}
.people-portrait-gallery[hidden] { display: none; }
.people-portrait-gallery-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.people-portrait-gallery-head p {
  font: 700 .62rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.people-portrait-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  align-items: stretch;
  gap: 16px;
}
.people-portrait-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: transform .2s ease, border-color .2s ease;
}
.people-portrait-card:hover { border-color: var(--gold); transform: translateY(-3px); }
.people-portrait-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.people-portrait-card img {
  width: 100%;
  aspect-ratio: .78;
  display: block;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: center 20%;
  background: #02090c;
  filter: sepia(.08) saturate(.9);
}
.people-portrait-card > div {
  padding: 14px 13px 16px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.people-portrait-card small {
  display: block;
  color: var(--gold);
  font: 700 .52rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.people-portrait-card strong {
  display: block;
  margin-top: 7px;
  font-size: 1.12rem;
  line-height: 1.08;
}
.people-portrait-card .portrait-card-dates {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: .78rem;
}
.people-portrait-card .portrait-card-credit {
  display: block;
  margin-top: 9px;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.3;
}
.people-group { margin: 30px 0 14px; }
.people-group h3 { margin: 0 0 6px; color: var(--text); font-size: 25px; }
.people-group > p { margin: 0 0 14px; color: var(--muted); }
.design-midnight .people-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 13px;
}
.design-midnight .person-profile {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel2);
  color: var(--text);
  box-shadow: none;
}
.person-mini-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}
.design-midnight .person-profile h4 { margin: 0; color: var(--gold2); font-size: 22px; }
.person-dates { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-style: italic; }
.evidence-chip {
  flex: 0 0 auto;
  border: 1px solid rgba(101,217,211,.34);
  border-radius: 999px;
  padding: 4px 7px;
  color: var(--gold2);
  background: rgba(101,217,211,.08);
  font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.evidence-chip.unresolved {
  color: #c6d2d4;
  border-color: rgba(198,210,212,.35);
  background: rgba(198,210,212,.06);
}
.design-midnight .person-profile .profile-role {
  margin: 7px 0 9px;
  color: #a9e4df !important;
  font: 600 11px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: .055em;
}
.design-midnight .person-profile p { margin: 0 0 12px; color: #d3dfe1; font-size: 15px; line-height: 1.55; }
.profile-links { display: flex; flex-wrap: wrap; gap: 6px; }
.profile-links button,
.profile-links a {
  position: static;
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 0;
  padding: 6px 9px;
  border: 1px solid rgba(101,217,211,.35);
  border-radius: 999px;
  background: rgba(101,217,211,.07);
  color: var(--gold2);
  text-decoration: none;
  font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .05em;
  cursor: pointer;
}
.profile-links button:hover,
.profile-links a:hover { background: rgba(101,217,211,.15); }
.person-profile.profile-target { outline: 2px solid var(--gold); outline-offset: 4px; }

@media (max-width: 800px) {
  .people-portrait-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
}
@media (max-width: 760px) {
  .people-portrait-entry,
  .people-portrait-gallery-head { align-items: flex-start; flex-direction: column; }
  #portrait-gallery-toggle { width: 100%; }
  .people-portrait-gallery { padding: 18px 12px 24px; }
  .design-midnight .people-profile-grid { grid-template-columns: 1fr; }
  .person-mini-head { display: block; }
  .evidence-chip { display: inline-block; margin-top: 7px; }
}

/* Verified portrait records — matched to the 1858 census interaction. */
.portrait-record-modal {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, .88);
  backdrop-filter: blur(8px);
}
.portrait-record-modal.open { display: grid; }
.portrait-record-dialog {
  position: relative;
  width: min(980px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(380px, 1.1fr);
  overflow: auto;
  border: 1px solid var(--gold);
  background: #020b0e;
  box-shadow: 0 34px 100px #000;
}
.portrait-record-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: rgba(2, 11, 14, .94);
  color: var(--gold2);
  cursor: pointer;
  font-size: 1.6rem;
}
.portrait-record-image {
  min-height: 610px;
  display: grid;
  place-items: center;
  background: #010608;
}
.portrait-record-image img {
  width: 100%;
  height: 100%;
  max-height: 740px;
  display: block;
  object-fit: contain;
  object-position: center;
  filter: sepia(.05) saturate(.92);
}
.portrait-record-copy { padding: 56px 48px 42px; }
.portrait-record-copy .portrait-record-group {
  margin: 0;
  color: var(--gold);
  font: 700 .62rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.portrait-record-copy h2 {
  margin: 12px 0 4px;
  color: var(--text);
  font-size: clamp(2.5rem, 5vw, 4.4rem);
  line-height: .98;
  letter-spacing: -.045em;
}
.portrait-record-dates { margin: 0; color: var(--gold2); font-size: 1.15rem; }
.portrait-record-role { margin: 28px 0 12px; color: #d3dfe1; font-size: 1.02rem; }
.portrait-record-connection { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.7; }
.portrait-record-copy-links { margin-top: 18px; }
.portrait-record-credit {
  margin-top: 28px;
  padding: 17px;
  border: 1px solid var(--rule);
  background: var(--panel);
}
.portrait-record-credit span {
  color: var(--gold);
  font: 700 .55rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.portrait-record-credit p { margin: 8px 0 5px; color: #d3dfe1; }
.portrait-record-credit b {
  color: #a9e4df;
  font: 700 .58rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.portrait-record-source {
  display: inline-flex;
  margin-top: 18px;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  color: var(--gold2);
  text-decoration: none;
  font: 700 .58rem ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
@media (max-width: 720px) {
  .portrait-record-modal { padding: 12px; }
  .portrait-record-dialog { grid-template-columns: 1fr; max-height: calc(100vh - 24px); }
  .portrait-record-image { min-height: 360px; max-height: 52vh; }
  .portrait-record-copy { padding: 36px 24px 32px; }
}

/* Shelfmark text remains uniform; the arrow identifies a catalog link. */
.fact-grid .shelfmark-link { color: inherit; text-decoration: none; }
.fact-grid .shelfmark-link:hover, .fact-grid .shelfmark-link:focus-visible { color: var(--gold2); text-decoration: underline; text-underline-offset: .15em; }
