/* ==========================================================================
   Design "B — Архивная картотека" (card-catalog look).
   Loaded after style.css and themes.css. Colors come from variables so all
   four themes (sepia, parchment, midnight, ink) work; per-theme overrides
   are at the bottom of this file.
   ========================================================================== */

:root {
  /* category colors: tab + top edge of each index card */
  --cat-diary: #8a3b2b;
  --cat-memoirs: #2f5560;
  --cat-letters: #8c6322;
  --cat-other: #4c5a3e;
  --cat-text: #fdf6ea;

  /* index cards */
  --card-paper: #fffdf5;
  --card-rule: rgba(90, 130, 170, 0.18);
  --card-margin: rgba(196, 70, 60, 0.45);
  --card-edge: #d9ccb1;
  --card-shadow: rgba(50, 35, 20, 0.16);

  /* snapshots */
  --snap-paper: #fffdf7;
  --snap-corner: #2a221a;
  --snap-empty: #efe5d2;
  --snap-photo-bg: #cbbda3;

  /* hero band (when no picture is uploaded) */
  --hero-bg: #4a3b2c;
  --hero-ink: #fbf3e2;
  --hero-kicker: #e3c999;
}

/* ---- Page background: subtle paper grain over the theme color ---- */
body { background-image: url(/images/paper-grain.png); }

/* ---- Header ---- */
.site-header { padding: 0.9rem 0; }
.brand-logo { height: 52px; width: auto; display: block; }
.brand-logo-dark { display: none; }
html[data-theme="midnight"] .brand-logo-light { display: none; }
html[data-theme="midnight"] .brand-logo-dark { display: block; }
.main-nav { gap: 1.35rem; }
.main-nav a { font-size: 1.32rem; }
.main-nav a:hover { color: var(--color-accent); text-decoration: none; }
.nav-search input { font: inherit; padding: 0.45rem 0.7rem; background: var(--color-bg); color: var(--color-ink); }

/* ---- Section headings ---- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 3rem 0 1.75rem; }
.section-head h1, .section-head h2 { margin: 0; font-size: 2rem; }
.section-more { font-size: 0.95rem; }

/* ---- Hero band (home page) ---- */
.hero-band {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  background-color: var(--hero-bg);
  background-image: url(/images/paper-grain.png);
  overflow: hidden;
}
.hero-band.has-image { background-size: cover; background-position: center; }
.hero-band::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(36, 26, 16, 0.85) 0%, rgba(36, 26, 16, 0.6) 55%, rgba(36, 26, 16, 0.2) 100%);
}
.hero-band:not(.has-image)::before { background: radial-gradient(ellipse at 80% 30%, rgba(227, 201, 153, 0.18), transparent 60%); }
.hero-inner { position: relative; width: 100%; padding-top: 2.5rem; padding-bottom: 2.5rem; display: flex; flex-direction: column; gap: 1.1rem; }
.hero-kicker { font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--hero-kicker); }
.hero-title { margin: 0; max-width: 680px; font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.12; color: var(--hero-ink); }
.hero-search { display: flex; max-width: 560px; }
.hero-search input {
  flex: 1; min-width: 0; height: 50px; padding: 0 1.1rem;
  font: inherit; font-size: 1rem; border: none; border-radius: 4px 0 0 4px;
  background: #fbf7ee; color: #2a221a;
}
.hero-search button {
  height: 50px; padding: 0 1.5rem; font: inherit; font-size: 1rem; font-weight: 700;
  color: #2a221a; background: var(--hero-kicker); border: none; border-radius: 0 4px 4px 0; cursor: pointer;
}
.hero-search button:hover { filter: brightness(1.06); }

/* ---- Category filter buttons ---- */
.cat-filter { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-filter a {
  padding: 0.45rem 0.9rem; border-radius: 4px; border: 1px solid var(--color-border);
  color: var(--color-ink); font-size: 0.9rem; text-decoration: none; background: var(--color-card-bg);
}
.cat-filter a:hover { border-color: var(--color-accent); }
.cat-filter a.active { background: var(--color-ink); color: var(--color-bg); border-color: var(--color-ink); }

/* ---- Index cards (diaries) ---- */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 2.5rem 1.75rem;
  margin: 0 0 1rem;
}
.index-card { display: flex; flex-direction: column; color: var(--color-ink); text-decoration: none; }
.index-card:hover { text-decoration: none; }
.index-card-tab {
  align-self: flex-start;
  margin-left: calc(14px + var(--tab-step, 0) * 48px);
  padding: 0.35rem 1rem 0.3rem;
  border-radius: 6px 6px 0 0;
  background: var(--cat-color);
  color: var(--cat-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.index-card-body {
  min-height: 190px;
  padding: 1.2rem 1.35rem;
  display: flex; flex-direction: column; gap: 0.6rem;
  background-color: var(--card-paper);
  background-image:
    linear-gradient(to bottom, transparent 58px, var(--card-margin) 58px, var(--card-margin) 59px, transparent 59px),
    repeating-linear-gradient(to bottom, transparent 0, transparent 27px, var(--card-rule) 27px, var(--card-rule) 28px);
  border: 1px solid var(--card-edge);
  border-top: 4px solid var(--cat-color);
  box-shadow: 0 4px 10px var(--card-shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.index-card:hover .index-card-body, .index-card:focus-visible .index-card-body { transform: translateY(-5px); box-shadow: 0 14px 24px var(--card-shadow); }
.index-card-meta { display: flex; justify-content: space-between; gap: 0.5rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-muted); }
.index-card-lock { display: inline-flex; align-items: center; gap: 0.25rem; }
.index-card-title { margin: 0.5rem 0 0; font-family: var(--font-serif); font-size: 1.35rem; line-height: 1.25; font-weight: 700; color: var(--color-ink); }
.index-card-author { font-family: var(--font-mono); font-size: 0.85rem; color: var(--color-ink); opacity: 0.85; }

.cat-diary   { --cat-color: var(--cat-diary);   --tab-step: 0; }
.cat-memoirs { --cat-color: var(--cat-memoirs); --tab-step: 1; }
.cat-letters { --cat-color: var(--cat-letters); --tab-step: 2; }
.cat-other   { --cat-color: var(--cat-other);   --tab-step: 3; }

/* ---- Snapshots (authors) ---- */
.snap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 2.25rem 1.75rem;
  margin: 0 0 1rem;
}
.snapshot {
  position: relative;
  display: block;
  padding: 0.75rem 0.75rem 0.9rem;
  background: var(--snap-paper);
  color: var(--color-ink);
  text-decoration: none;
  box-shadow: 0 5px 12px var(--card-shadow);
  transform: rotate(var(--tilt, -1.5deg));
  transition: transform 0.2s ease;
}
.snapshot:hover, .snapshot:focus-visible { transform: rotate(0deg) scale(1.03); text-decoration: none; }
.snap-grid > :nth-child(5n+1) { --tilt: -2deg; }
.snap-grid > :nth-child(5n+2) { --tilt: 1.5deg; }
.snap-grid > :nth-child(5n+3) { --tilt: -1deg; }
.snap-grid > :nth-child(5n+4) { --tilt: 2deg; }
.snap-grid > :nth-child(5n+5) { --tilt: -2.5deg; }
.snapshot::before, .snapshot::after {
  content: ""; position: absolute; top: 4px; width: 0; height: 0; z-index: 1;
  border-top: 18px solid var(--snap-corner);
}
.snapshot::before { left: 4px; border-right: 18px solid transparent; }
.snapshot::after { right: 4px; border-left: 18px solid transparent; }
.snapshot-photo {
  height: 180px; display: flex; align-items: center; justify-content: center;
  background: var(--snap-empty); overflow: hidden;
}
.snapshot-photo img { width: 100%; height: 100%; object-fit: cover; filter: sepia(0.25); }
.snapshot-initials { font-family: var(--font-serif); font-size: 3.2rem; color: var(--cat-diary); }
.snap-grid > :nth-child(4n+2) .snapshot-initials { color: var(--cat-memoirs); }
.snap-grid > :nth-child(4n+3) .snapshot-initials { color: var(--cat-letters); }
.snap-grid > :nth-child(4n+4) .snapshot-initials { color: var(--cat-other); }
.snapshot-name { margin-top: 0.6rem; font-family: var(--font-hand); font-size: 1.55rem; line-height: 1.1; text-align: center; }
.snapshot-meta { margin-top: 0.25rem; font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-muted); text-align: center; }

/* ---- Author page: larger snapshot next to the bio ---- */
.author-snapshot { float: right; width: 220px; margin: 0 0 1.5rem 2rem; }
.author-snapshot .snapshot-photo { height: 240px; }
@media (max-width: 640px) { .author-snapshot { float: none; margin: 0 auto 1.5rem; } }

/* ---- Admin: site picture ---- */
.hero-preview { max-width: 100%; border-radius: 6px; border: 1px solid var(--color-border); }

/* ==========================================================================
   Theme overrides
   ========================================================================== */
html[data-theme="parchment"] {
  --card-paper: #fffaf0;
  --snap-paper: #fffaf0;
}

html[data-theme="midnight"] {
  --cat-diary: #a5513f;
  --cat-memoirs: #3f7482;
  --cat-letters: #a87a33;
  --cat-other: #66774f;
  --card-paper: #2a2723;
  --card-rule: rgba(150, 180, 210, 0.10);
  --card-margin: rgba(220, 110, 100, 0.35);
  --card-edge: #3a382f;
  --card-shadow: rgba(0, 0, 0, 0.45);
  --snap-paper: #2e2b26;
  --snap-corner: #0f0e0c;
  --snap-empty: #3a352d;
  --hero-bg: #2a2219;
}
html[data-theme="midnight"] .snapshot-initials { filter: brightness(1.4); }
html[data-theme="midnight"] .hero-search input { background: #f0e9dc; }

html[data-theme="ink"] {
  --card-paper: #ffffff;
  --card-rule: rgba(0, 0, 0, 0.06);
  --card-margin: rgba(0, 0, 0, 0.25);
  --card-edge: #cccccc;
  --snap-paper: #ffffff;
  --snap-corner: #111111;
  --snap-empty: #f0f0f0;
  --hero-bg: #222222;
}
html[data-theme="ink"] body { background-image: none; }
html[data-theme="ink"] .index-card, html[data-theme="ink"] .snapshot { text-decoration: none; }
html[data-theme="ink"] .snapshot { transform: none; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Small screens: let the header wrap instead of running off the edge ---- */
@media (max-width: 700px) {
  .header-row { gap: 0.8rem 1rem; }
  .main-nav { flex-wrap: wrap; flex-basis: 100%; gap: 0.4rem 1.1rem; }
  .nav-search { flex: 1 1 100%; }
  .nav-search input { width: 100%; }
  .nav-admin { flex-wrap: wrap; }
  .section-head h1, .section-head h2 { font-size: 1.6rem; }
}

/* ---- Photos page: back button + zoomed photo viewer ---- */
.photos-head { margin-top: 1.5rem; }
.back-button { white-space: nowrap; text-decoration: none; }
.back-button:hover { text-decoration: none; }
.photos-foot { margin: 2rem 0 0; }
.photo-zoom { display: block; cursor: zoom-in; }

.lightbox {
  width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
  margin: 0; padding: 0; border: none;
  background: rgba(20, 15, 10, 0.92); color: #f0e6d2;
}
.lightbox::backdrop { background: rgba(20, 15, 10, 0.6); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lb-figure {
  flex: 1; height: 100%; margin: 0; padding: 3.5rem 0 1rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.8rem;
  min-width: 0;
}
.lb-img {
  max-width: 100%; max-height: calc(100vh - 8rem); object-fit: contain;
  background: #fbf7ee; padding: 8px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.lb-caption { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; justify-content: center; align-items: baseline; text-align: center; padding: 0 1rem; }
.lb-text { font-size: 1rem; }
.lb-diary { color: #e3c999; }
.lb-counter { font-family: var(--font-mono); font-size: 0.8rem; opacity: 0.7; }
.lb-close, .lb-nav {
  background: none; border: none; color: #f0e6d2; cursor: pointer; line-height: 1;
  opacity: 0.8; transition: opacity 0.15s;
}
.lb-close:hover, .lb-nav:hover { opacity: 1; }
.lb-close { position: absolute; top: 0.6rem; right: 1rem; font-size: 2.6rem; padding: 0.2rem 0.6rem; }
.lb-nav { font-size: 4rem; padding: 1rem 1.2rem; align-self: stretch; }
.lb-nav[hidden] { visibility: hidden; display: block; }
@media (max-width: 640px) {
  .lb-nav { font-size: 2.6rem; padding: 0.5rem; }
  .lb-img { max-height: calc(100vh - 9rem); padding: 4px; }
}
.lb-close:focus:not(:focus-visible), .lb-nav:focus:not(:focus-visible) { outline: none; }
.lb-close:focus-visible, .lb-nav:focus-visible { outline: 2px solid rgba(240, 230, 210, 0.5); outline-offset: 2px; }

/* ---- Progress: background scan box (document page) + import overlay ---- */
.progress-track { position: relative; height: 8px; border-radius: 4px; background: var(--color-border); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 4px; background: var(--color-accent); transition: width 0.4s ease; }
.progress-track.indeterminate .progress-fill {
  width: 35%; position: absolute; left: -35%;
  animation: progress-slide 1.4s ease-in-out infinite;
}
@keyframes progress-slide { 0% { left: -35%; } 100% { left: 100%; } }

.scan-progress {
  margin-top: 1.5rem; padding: 1rem 1.2rem; display: flex; flex-direction: column; gap: 0.6rem;
  background: var(--card-paper); border: 1px solid var(--card-edge); border-left: 4px solid var(--color-accent); border-radius: 4px;
}
.scan-progress[hidden] { display: none; }
.scan-progress-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem; }
.scan-count { margin-left: auto; font-family: var(--font-mono); font-size: 0.85rem; color: var(--color-muted); }
.scan-note, .scan-message { margin: 0; font-size: 0.9rem; }
.scan-spinner {
  width: 16px; height: 16px; border-radius: 50%; display: none;
  border: 2px solid var(--color-border); border-top-color: var(--color-accent);
  animation: spin 0.9s linear infinite;
}
.scan-progress.is-running .scan-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.busy-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(36, 26, 16, 0.55);
}
.busy-overlay[hidden] { display: none; }
.busy-card {
  width: min(460px, 100%); padding: 1.8rem 1.8rem 1.4rem; text-align: center;
  background: var(--card-paper); color: var(--color-ink);
  border-top: 4px solid var(--color-accent); border-radius: 4px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.busy-stage { margin: 0.9rem 0 0.8rem; font-family: var(--font-serif); font-size: 1.15rem; }
.busy-elapsed { margin: 0.7rem 0 0; font-family: var(--font-mono); font-size: 0.85rem; }
.busy-note { margin: 0.4rem 0 0; font-size: 0.85rem; }
/* three ink dots "being written" */
.busy-quill { display: inline-flex; gap: 8px; }
.busy-quill span { width: 10px; height: 10px; border-radius: 50%; background: var(--color-accent); animation: ink 1.2s ease-in-out infinite; }
.busy-quill span:nth-child(2) { animation-delay: 0.2s; }
.busy-quill span:nth-child(3) { animation-delay: 0.4s; }
@keyframes ink { 0%, 80%, 100% { opacity: 0.2; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) {
  .busy-quill span, .scan-spinner, .progress-track.indeterminate .progress-fill { animation-duration: 3s; }
}

/* ---- Footnotes / endnotes in entries ---- */
.fn-ref { line-height: 0; font-size: 0.72em; vertical-align: super; }
.fn-ref a {
  display: inline-block; padding: 0.08em 0.08em; margin: 0 -0.02em 0 0.02em; line-height: 1.1;
  font-family: var(--font-mono); font-weight: 700; text-align: center; text-decoration: none;
  color: var(--color-accent); border-radius: 3px;
}
.fn-ref a:hover, .fn-ref a[aria-expanded="true"] { background: var(--color-accent); color: var(--color-bg); }
.footnotes { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--color-border); font-size: 0.92rem; }
.footnotes h2 { font-size: 1.05rem; margin: 0 0 0.75rem; font-family: var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
.footnotes ol { margin: 0; padding-left: 1.8rem; }
.footnotes li { margin: 0 0 0.5rem; padding-left: 0.2rem; }
.footnotes li::marker { font-family: var(--font-mono); color: var(--color-accent); font-weight: 700; }
.footnotes li:target { background: rgba(227, 201, 153, 0.35); border-radius: 3px; }
.footnote-back { margin-left: 0.35rem; text-decoration: none; }
.fn-pop {
  position: absolute; z-index: 900; padding: 0.75rem 0.95rem; font-size: 0.92rem; line-height: 1.45;
  background: var(--card-paper); color: var(--color-ink);
  border: 1px solid var(--card-edge); border-top: 3px solid var(--color-accent); border-radius: 4px;
  box-shadow: 0 10px 28px var(--card-shadow);
}
.fn-pop[hidden] { display: none; }
.fn-pop-num { font-family: var(--font-mono); font-weight: 700; color: var(--color-accent); }
.footnote-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin-top: -0.4rem; }
.footnote-tools .button { margin: 0; }
.footnote-tools small { flex: 1 1 260px; }

/* ---- Archives: archival boxes ---- */
:root {
  --box-board: #c8b28a;      /* cardboard */
  --box-board-dark: #b39b70;
  --box-label: #fbf6ea;
  --box-tie: #8a3b2b;
}
html[data-theme="midnight"] { --box-board: #5a4c37; --box-board-dark: #4b3f2d; --box-label: #2e2b26; --box-tie: #a5513f; }
html[data-theme="ink"] { --box-board: #e6e6e6; --box-board-dark: #d0d0d0; --box-label: #ffffff; --box-tie: #222222; }

.archives-intro { max-width: 680px; margin-top: -0.75rem; margin-bottom: 2rem; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2.25rem 1.75rem; }
.archive-card { display: flex; flex-direction: column; gap: 0.5rem; color: var(--color-ink); text-decoration: none; }
.archive-card:hover { text-decoration: none; }
.archive-card-cover {
  position: relative; height: 190px; display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-radius: 3px;
  background-color: var(--box-board);
  background-image: url(/images/paper-grain.png), linear-gradient(180deg, var(--box-board) 0%, var(--box-board-dark) 100%);
  box-shadow: 0 4px 10px var(--card-shadow), inset 0 -10px 0 rgba(0, 0, 0, 0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.archive-card:hover .archive-card-cover, .archive-card:focus-visible .archive-card-cover { transform: translateY(-5px); box-shadow: 0 14px 24px var(--card-shadow); }
.archive-card-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: sepia(0.35); }
/* cloth ties across the box when there's no picture */
.archive-card-ties::before, .archive-card-ties::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 7px; background: var(--box-tie); opacity: 0.75;
}
.archive-card-ties::before { left: 22%; }
.archive-card-ties::after { right: 22%; }
.archive-card-label {
  position: relative; z-index: 1; width: 72%; padding: 0.7rem 0.9rem 0.8rem; text-align: center;
  background: var(--box-label); border: 1px solid rgba(0, 0, 0, 0.15); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}
.archive-card-cover img ~ .archive-card-label { align-self: flex-end; margin-bottom: 14px; width: 80%; opacity: 0.96; }
.archive-card-fond { display: block; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--color-muted); }
.archive-card-name { display: block; margin-top: 0.25rem; font-family: var(--font-serif); font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.archive-card-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--color-muted); }
.archive-card-desc { font-size: 0.92rem; line-height: 1.45; }

.archive-header { display: flex; gap: 2rem; align-items: flex-start; margin-bottom: 1rem; }
.archive-header h1 { margin: 0.2rem 0 0.4rem; }
.archive-header .prose { max-width: 720px; }
.archive-header-img { width: 260px; max-width: 40%; border: 8px solid var(--snap-paper); box-shadow: 0 5px 12px var(--card-shadow); transform: rotate(-1.5deg); filter: sepia(0.25); }
.archive-admin { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.archive-admin .button { margin: 0; }
@media (max-width: 640px) { .archive-header { flex-direction: column; } .archive-header-img { max-width: 100%; } }

/* "Archives:" line on document and author pages */
.diary-archives { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.9rem 0 1.1rem; }
.diary-archives-label { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-muted); }
.archive-chip {
  display: inline-flex; align-items: center; gap: 0.15rem; padding: 0.2rem 0.65rem;
  background: var(--box-board); border-radius: 3px; font-size: 0.92rem;
}
.archive-chip a { color: var(--color-ink); }
html[data-theme="midnight"] .archive-chip a { color: #f0e6d2; }
.chip-remove { display: inline; margin: 0; }
.chip-remove button { background: none; border: none; padding: 0 0 0 0.3rem; font-size: 1rem; line-height: 1; cursor: pointer; color: var(--color-ink); opacity: 0.55; }
.chip-remove button:hover { opacity: 1; }
.archive-add-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 0 0.5rem; }
.archive-add-form .button { margin: 0; padding: 0.35rem 0.8rem; }

/* picker */
.archive-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.archive-picker select { flex: 1 1 220px; }
.archive-picker .archive-new-name { flex: 1 1 220px; }
.archive-picker [hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.9rem; }
.field-label { }
.archive-add-form select { font: inherit; padding: 0.35rem 0.5rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); color: var(--color-ink); }

/* admin form */
.archive-form-img { display: block; max-width: 220px; margin: 0.4rem 0; border-radius: 3px; }
.archive-members { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.archive-members th, .archive-members td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--color-border); text-align: left; vertical-align: middle; }
.archive-members th { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; color: var(--color-muted); }
.archive-members .order-input { width: 4.5rem; }
.archive-members td:last-child, .archive-members th:last-child { text-align: center; }

/* ---- Photos placed inside entry text ---- */
.entry-body { display: flow-root; }  /* contain floated photos */
.entry-photo { margin: 1.4rem 0; }
.entry-photo a { display: block; cursor: zoom-in; }
.entry-photo img { display: block; max-width: 100%; height: auto; background: var(--snap-paper); padding: 6px; box-shadow: 0 4px 12px var(--card-shadow); }
.entry-photo figcaption { margin-top: 0.5rem; font-size: 0.88rem; line-height: 1.4; color: var(--color-muted); font-style: italic; }
.entry-photo.fig-full { clear: both; text-align: center; }
.entry-photo.fig-full img { margin: 0 auto; max-height: 75vh; width: auto; }
.entry-photo.fig-left, .entry-photo.fig-right { width: 42%; max-width: 340px; margin-top: 0.3rem; margin-bottom: 1rem; }
.entry-photo.fig-left { float: left; clear: left; margin-right: 1.6rem; }
.entry-photo.fig-right { float: right; clear: right; margin-left: 1.6rem; }
.entry-photo.fig-left img, .entry-photo.fig-right img { width: 100%; }
@media (max-width: 640px) {
  .entry-photo.fig-left, .entry-photo.fig-right { float: none; width: auto; max-width: 75%; margin: 1.4rem auto; text-align: center; }
  .entry-photo.fig-left img, .entry-photo.fig-right img { max-height: 60vh; width: auto; margin: 0 auto; }
}

/* editor */
.photo-insert { margin-top: -0.4rem; }
.photo-insert .button { margin: 0; }
.photo-insert-panel { margin-top: 0.6rem; padding: 0.8rem 1rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); }
.photo-insert-panel p { margin: 0.4rem 0; font-size: 0.85rem; }
.photo-insert-layouts { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: center; font-size: 0.9rem; }
.stacked-form .photo-insert-layouts label { flex-direction: row; align-items: center; gap: 0.3rem; }
.photo-insert-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 0.5rem; margin: 0.5rem 0; }
.stacked-form button.photo-insert-pick, button.photo-insert-pick {
  margin: 0; padding: 4px; border: 1px solid var(--color-border); background: var(--color-bg); border-radius: 3px;
  cursor: pointer; font-size: 0.75rem; font-weight: normal; color: var(--color-muted);
}
.stacked-form button.photo-insert-pick:hover, button.photo-insert-pick:hover { border-color: var(--color-accent); background: var(--color-bg); }
.photo-insert-pick img { display: block; width: 100%; height: 70px; object-fit: cover; margin-bottom: 3px; }

/* ---- Photo descriptions (photos-only page) ---- */
.photo-description { display: block; }
.photo-captions-form { margin: 0; }
.photo-captions-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; margin: 0.5rem 0 1.2rem; }
.photo-captions-bar .muted { flex: 1 1 320px; font-size: 0.9rem; }
.photo-captions-bar button { margin: 0; }
.saved-note { color: var(--cat-other); font-weight: 700; }
.photo-caption-input {
  width: 100%; margin-top: 0.35rem; padding: 0.35rem 0.5rem; font: inherit; font-size: 0.85rem;
  border: 1px solid var(--color-border); border-radius: 3px; background: var(--color-card-bg); color: var(--color-ink);
}

/* ---- Delete button on photos (admins) ---- */
.photo-item { position: relative; }
.photo-delete-form { margin: 0; }
button.photo-delete {
  position: absolute; top: 6px; right: 6px; z-index: 2; width: 30px; height: 30px; margin: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; line-height: 1; color: #fff; background: rgba(30, 20, 12, 0.65);
  border: none; border-radius: 50%; cursor: pointer; opacity: 0.75; transition: opacity 0.15s, background 0.15s;
}
button.photo-delete:hover, button.photo-delete:focus-visible { opacity: 1; background: #a8322a; }

/* ---- Cookie / statistics banner ---- */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 950; max-width: 640px; margin: 0 auto;
  padding: 1rem 1.2rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.2rem;
  background: var(--card-paper); color: var(--color-ink); border: 1px solid var(--card-edge); border-top: 3px solid var(--color-accent);
  border-radius: 4px; box-shadow: 0 12px 34px rgba(0, 0, 0, 0.25); font-size: 0.92rem;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { margin: 0; flex: 1 1 300px; line-height: 1.45; }
.cookie-banner-buttons { display: flex; gap: 0.5rem; }
.cookie-banner-buttons .button { margin: 0; }

/* ---- Index of names: numbered places, per-document index, highlighting ---- */
.index-head h1 { font-size: 2rem; }
.index-of { font-size: 1.3rem; font-weight: normal; }
.index-switch select { font: inherit; padding: 0.4rem 0.6rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); color: var(--color-ink); max-width: 320px; }
.index-places { margin-left: 0.4rem; font-family: var(--font-mono); font-size: 0.88rem; }
.index-places a { padding: 0 0.1rem; }
.index-doc { font-family: var(--font-sans, inherit); color: var(--color-muted); margin-right: 0.25rem; }
.index-places.per-doc { display: block; margin: 0.15rem 0 0 1.2rem; }
.people-list li { margin-bottom: 0.55rem; }
mark.person-hit { background: rgba(227, 189, 92, 0.55); color: inherit; padding: 0 0.1em; border-radius: 2px; scroll-margin-top: 30vh; }
mark.person-hit:target, .person-anchor:target + * { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.person-anchor { scroll-margin-top: 30vh; }
html[data-theme="midnight"] mark.person-hit { background: rgba(217, 160, 70, 0.45); }
.highlight-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; padding: 0.55rem 0.9rem; margin: 0 0 1.2rem;
  background: var(--card-paper); border: 1px solid var(--card-edge); border-left: 4px solid #e3bd5c; border-radius: 4px; font-size: 0.92rem;
}
.highlight-places { font-family: var(--font-mono); display: flex; gap: 0.5rem; }
.highlight-off { margin-left: auto; text-decoration: none; font-size: 1.2rem; line-height: 1; color: var(--color-muted); }

/* ---- Timeline zoom ---- */
.timeline-head { align-items: center; }
.zoom-bar { display: inline-flex; align-items: center; gap: 0.4rem; }
.zoom-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; line-height: 1; text-decoration: none;
  border: 1px solid var(--color-border); border-radius: 50%; background: var(--color-card-bg); color: var(--color-ink);
}
a.zoom-btn:hover { border-color: var(--color-accent); color: var(--color-accent); text-decoration: none; }
.zoom-btn.disabled { opacity: 0.35; }
.zoom-levels { display: inline-flex; border: 1px solid var(--color-border); border-radius: 4px; overflow: hidden; }
.zoom-levels a { padding: 0.45rem 0.85rem; font-size: 0.9rem; color: var(--color-ink); text-decoration: none; background: var(--color-card-bg); }
.zoom-levels a + a { border-left: 1px solid var(--color-border); }
.zoom-levels a.active { background: var(--color-ink); color: var(--color-bg); }
.timeline-crumbs { margin: -0.75rem 0 1.5rem; font-size: 0.95rem; }
.timeline-crumbs a, .timeline-crumbs strong { margin-right: 0.25rem; }
.period-card { text-align: left; }
.period-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; }
.period-label { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 700; color: var(--color-ink); }
a.period-label:hover { color: var(--color-accent); text-decoration: none; }
.zoom-into { font-size: 0.9rem; color: var(--color-accent); }
.period-counts { font-family: var(--font-mono); font-size: 0.8rem; color: var(--color-muted); }
.period-toggle { margin-top: 0.35rem; font-size: 0.88rem; }
.period-events, .period-entries { margin: 0.3rem 0 0.4rem; padding-left: 1.1rem; font-size: 0.92rem; }
.vtimeline-panel ul { margin: 0.4rem 0 0; }
@media (max-width: 700px) { .zoom-levels a { padding: 0.4rem 0.55rem; font-size: 0.8rem; } }

/* ---- Document cover photo (V9.0) ---- */
/* On a catalog card: a small snapshot clipped to the right of the title. */
.index-card-main { display: flex; align-items: flex-start; gap: 0.9rem; }
.index-card-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.index-card-cover {
  flex: 0 0 auto; width: 92px; height: 112px; object-fit: cover;
  margin-top: 0.4rem; padding: 4px; background: #fff;
  border: 1px solid var(--card-edge); box-shadow: 0 2px 6px var(--card-shadow);
  transform: rotate(2.5deg);
}
/* At the top of the document page. */
.diary-header.has-cover::after { content: ""; display: block; clear: both; }
.diary-cover {
  float: right; width: 200px; max-width: 38%; height: auto; margin: 0 0 1rem 1.5rem;
  padding: 6px; background: #fff; border: 1px solid var(--card-edge, #ccc);
  box-shadow: 0 3px 10px var(--card-shadow, rgba(0,0,0,.15)); transform: rotate(1.5deg);
}
.diary-form-cover { display: block; max-width: 220px; margin: 0.4rem 0; border-radius: 3px; }
@media (max-width: 520px) {
  .index-card-cover { width: 72px; height: 88px; }
  .diary-cover { width: 120px; margin-left: 1rem; }
}

/* ---- Header: language switch sits on the menu row (V9.1) ---- */
.nav-lang { font-size: 1rem; gap: 0.6rem; align-self: center; }

/* ---- Menu in small capitals; home heading on one line (V9.2) ---- */
.main-nav a { font-size: 1.02rem; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-title { max-width: none; font-size: clamp(1.5rem, 2.9vw, 2.35rem); }
@media (min-width: 760px) { .hero-title { white-space: nowrap; } }
.hero-kicker { font-size: 0.98rem; color: #f3dcae; }

/* ---- Condensed menu font; authors' line under the logo (V9.4) ---- */
.main-nav { gap: 1.1rem; }
.main-nav a { font-family: 'PT Sans Narrow', var(--font-sans, sans-serif); font-size: 1.12rem; letter-spacing: 0.06em; }
.brand { flex-direction: column; align-items: flex-start; gap: 0.15rem; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-byline { font-size: 0.72rem; line-height: 1.2; color: var(--color-muted); white-space: nowrap; }
.header-row { gap: 1rem 1.4rem; }
.nav-auth a { white-space: nowrap; }
.main-nav { gap: 0.95rem; }
.main-nav a { letter-spacing: 0.04em; }
.header-row { column-gap: 1.1rem; }
.nav-lang { gap: 0.45rem; }
.brand-byline { color: var(--color-ink); opacity: 0.85; }

/* ---- Byline black and bold; all cards in a grid as tall as the tallest (V9.6) ---- */
.brand-byline { color: #000; opacity: 1; font-weight: 700; }
/* 1fr auto rows: every row takes the height of the tallest card in the grid. */
.catalog-grid { grid-auto-rows: 1fr; }
.index-card-body { flex: 1; }
.index-card-main { flex: 1; }
/* The author's name sits at the bottom of every card, so it lines up across the row. */
.index-card-author { margin-top: auto; }
.index-card-main { align-items: stretch; }
.index-card-cover { align-self: flex-start; }

/* ---- About page (V9.8) ---- */
.about-page { max-width: 46rem; padding-top: 2.5rem; padding-bottom: 3rem; }
.about-page h1 { margin: 0 0 1.5rem; }
.about-page p { font-family: var(--font-serif); font-size: 1.15rem; line-height: 1.7; margin: 0 0 1.2rem; }
.about-page p:first-of-type::first-letter { float: left; font-size: 3.4em; line-height: 0.9; padding: 0.08em 0.1em 0 0; font-weight: 700; color: var(--color-accent); }
.main-nav { gap: 0.8rem; }
.main-nav a { font-size: 1.06rem; letter-spacing: 0.03em; }
.nav-auth { gap: 0.6rem; }

/* ---- Lifelines (V10.0) ---- */
.lifelines-page { padding-bottom: 3rem; }
.ll-lead { max-width: 52rem; font-family: var(--font-serif); font-size: 1.05rem; line-height: 1.6; }
.ll-toolbar { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: flex-end; margin: 1.25rem 0 0.4rem; }
.ll-toolbar label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--color-muted); }
.ll-toolbar select, .ll-toolbar input { font: inherit; font-size: 0.95rem; padding: 0.4rem 0.55rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); color: var(--color-ink); }
.ll-find { position: relative; }
.ll-find input { width: 16rem; max-width: 70vw; }
.ll-find-list { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: 2px 0 0; padding: 0.25rem 0; list-style: none; background: var(--color-card-bg); border: 1px solid var(--color-border); border-radius: 4px; box-shadow: 0 6px 18px rgba(60,40,10,.15); max-height: 18rem; overflow: auto; }
.ll-find-list li { padding: 0.35rem 0.7rem; cursor: pointer; font-size: 0.95rem; }
.ll-find-list li[aria-selected="true"], .ll-find-list li:hover { background: var(--color-border); }
.ll-find-list small { color: var(--color-muted); margin-left: 0.4rem; }
.ll-zoom { display: flex; gap: 0.35rem; }
.ll-zoom .button { min-width: 2.4rem; padding: 0.4rem 0.7rem; }
.ll-hint { font-size: 0.85rem; margin: 0.2rem 0 0.6rem; }
.ll-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; font-size: 0.85rem; color: var(--color-ink); margin-bottom: 0.9rem; align-items: center; }
.ll-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.ll-legend svg { flex: none; }
.ll-layout { display: grid; grid-template-columns: minmax(0, 1fr) 16.5rem; gap: 1.25rem; align-items: start; }
.ll-chart-wrap { position: relative; min-width: 0; }
.ll-chart { background: var(--color-card-bg); border: 1px solid var(--color-border); border-radius: 4px; overflow: hidden; touch-action: pan-y; user-select: none; cursor: grab; }
.ll-chart.dragging { cursor: grabbing; }
.ll-chart > p { padding: 1rem; margin: 0; }
.ll-chart svg { display: block; }
.ll-chart text { font-family: var(--font-sans); }
.ll-name { cursor: pointer; }
.ll-name:hover text, .ll-name:focus text { fill: var(--color-accent-dark); text-decoration: underline; }
.ll-name:focus { outline: none; }
.ll-name:focus-visible rect { stroke: var(--color-accent); stroke-width: 2; }
.ll-dot { cursor: pointer; }
.ll-tip { position: absolute; z-index: 15; pointer-events: none; background: #2b2318; color: #fbf6ea; font-size: 0.82rem; line-height: 1.35; padding: 0.4rem 0.6rem; border-radius: 4px; max-width: 18rem; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.ll-panel { position: sticky; top: 1rem; background: var(--color-card-bg); border: 1px solid var(--color-border); border-radius: 4px; padding: 1rem 1.1rem; max-height: calc(100vh - 2rem); overflow: auto; font-size: 0.95rem; }
.ll-panel h2 { font-size: 1.2rem; margin: 0 0 0.3rem; }
.ll-panel h3 { font-size: 0.95rem; margin: 1rem 0 0.4rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); font-family: var(--font-sans); }
.ll-panel .ll-close { float: right; background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--color-muted); padding: 0 0.2rem; }
.ll-panel dl { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.7rem; margin: 0.5rem 0; font-size: 0.9rem; }
.ll-panel dt { color: var(--color-muted); }
.ll-panel dd { margin: 0; }
.ll-cross-list { list-style: none; margin: 0; padding: 0; }
.ll-cross-list li { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px dotted var(--color-border); }
.ll-cross-list button { background: none; border: 0; padding: 0; font: inherit; color: var(--color-accent-dark); cursor: pointer; text-align: left; }
.ll-cross-list button:hover { text-decoration: underline; }
.ll-cross-list .n { margin-left: auto; color: var(--color-muted); font-size: 0.85rem; white-space: nowrap; }
.ll-entry { padding: 0.6rem 0; border-bottom: 1px dotted var(--color-border); }
.ll-entry .meta { font-size: 0.82rem; color: var(--color-muted); }
.ll-entry p { margin: 0.25rem 0; font-family: var(--font-serif); font-size: 0.95rem; line-height: 1.45; }
@media (max-width: 900px) {
  .ll-layout { grid-template-columns: 1fr; }
  .ll-panel { position: static; max-height: none; }
}
/* Nine menu items: a little tighter so login still fits on the row. */
.main-nav { gap: 0.62rem; }
.main-nav a { font-size: 1rem; letter-spacing: 0.02em; }
@media (min-width: 1180px) {
  .header-row { flex-wrap: nowrap; }
  .main-nav { flex: 1 1 auto; flex-wrap: nowrap; white-space: nowrap; }
}
@media (min-width: 1180px) {
  .main-nav { gap: 0.5rem; }
  .header-row { column-gap: 0.85rem; }
}


/* ---- Lifelines: place highlighting (V10.3) ---- */
.ll-places { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.9rem; margin: 0.6rem 0 0.35rem; }
.ll-places input { font: inherit; font-size: 0.95rem; padding: 0.4rem 0.55rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); color: var(--color-ink); width: 16rem; max-width: 70vw; }
.ll-chips { display: inline-flex; flex-wrap: wrap; gap: 0.35rem 0.4rem; }
.ll-chip { display: inline-flex; align-items: center; gap: 0.35rem; font: inherit; font-size: 0.88rem; line-height: 1.2; padding: 0.22rem 0.55rem; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-card-bg); color: var(--color-ink); cursor: pointer; }
.ll-chip:hover { border-color: var(--color-accent); }
.ll-chip .n { color: var(--color-muted); font-size: 0.8rem; }
.ll-chip.on { color: #fff; border-color: transparent; }
.ll-chip.on .n { color: rgba(255,255,255,.85); }
.ll-chip .x { font-size: 1rem; line-height: 1; margin-left: 0.1rem; }

/* ---- Place picker on entry pages (V10.5) ---- */
.entry-places-admin { margin: 2rem 0 1rem; padding: 1rem 1.2rem; border: 1px dashed var(--color-border); border-radius: 4px; background: var(--color-card-bg); }
.entry-places-admin h2 { font-size: 1.1rem; margin: 0 0 0.5rem; }
.pp-list { list-style: none; margin: 0 0 0.5rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pp-list li { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.3rem 0.2rem 0.65rem; border: 1px solid var(--color-border); border-radius: 999px; background: var(--color-bg, #fff); font-size: 0.92rem; }
.pp-list li.muted { border: 0; padding-left: 0; }
.pp-unlink { background: none; border: 0; cursor: pointer; font-size: 1.05rem; line-height: 1; color: var(--color-muted); padding: 0.1rem 0.35rem; border-radius: 999px; }
.pp-unlink:hover { color: #b3261e; background: rgba(179,38,30,.08); }
.pp-hint { font-size: 0.85rem; margin: 0.3rem 0 0.6rem; }
.pp-menu { position: absolute; z-index: 1000; background: var(--color-card-bg); border: 1px solid var(--color-border); border-radius: 4px; box-shadow: 0 6px 20px rgba(60,40,10,.2); padding: 0.3rem 0; min-width: 15rem; }
.pp-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; font-size: 0.95rem; padding: 0.5rem 0.9rem; cursor: pointer; color: var(--color-ink); }
.pp-menu button:hover, .pp-menu button:focus { background: var(--color-border); outline: none; }
.pp-menu small { display: block; padding: 0.2rem 0.9rem 0.3rem; color: var(--color-muted); font-size: 0.78rem; }
.pp-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--color-border); border-radius: 6px; padding: 1rem 1.2rem; background: var(--color-card-bg); color: var(--color-ink); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.pp-dialog::backdrop { background: rgba(30,20,10,.45); }
.pp-head { display: flex; align-items: center; justify-content: space-between; }
.pp-head h2 { margin: 0; font-size: 1.25rem; }
.pp-x { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--color-muted); }
.pp-search { display: flex; gap: 0.6rem; align-items: flex-end; margin-top: 0.7rem; flex-wrap: wrap; }
.pp-search label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: var(--color-muted); flex: 1; min-width: 12rem; }
.pp-search input { font: inherit; font-size: 1rem; padding: 0.45rem 0.6rem; border: 1px solid var(--color-border); border-radius: 4px; background: #fff; color: var(--color-ink); }
.pp-note, .pp-status, .pp-coords { font-size: 0.85rem; margin: 0.35rem 0; }
.pp-existing p { margin: 0.4rem 0 0.2rem; font-size: 0.9rem; }
.pp-existing ul { margin: 0 0 0.4rem; padding-left: 1.2rem; font-size: 0.92rem; }
.pp-map { height: 340px; border: 1px solid var(--color-border); border-radius: 4px; margin-top: 0.4rem; }
.pp-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.6rem; }
.pp-actions .button[disabled] { opacity: .45; cursor: not-allowed; }
@media (max-width: 600px) { .pp-map { height: 260px; } }

/* ---- Footnote editor on entry pages (V10.6) ---- */
.np-list { margin: 0 0 0.4rem; padding-left: 1.6rem; }
.np-list li { padding: 0.3rem 0; border-bottom: 1px dotted var(--color-border); }
.np-list li::marker { color: var(--color-muted); font-weight: 700; }
.np-text { font-family: var(--font-serif); font-size: 0.97rem; line-height: 1.45; }
.np-actions { display: inline-flex; gap: 0.15rem; margin-left: 0.5rem; vertical-align: middle; }
.np-btn { background: none; border: 0; cursor: pointer; font-size: 1rem; line-height: 1; color: var(--color-muted); padding: 0.15rem 0.35rem; border-radius: 4px; }
.np-btn:hover { color: var(--color-ink); background: var(--color-border); }
.np-del:hover { color: #b3261e; background: rgba(179,38,30,.08); }
.np-where { margin: 0.6rem 0 0.2rem; font-size: 0.92rem; }
.np-label { display: flex; flex-direction: column; gap: 0.25rem; margin-top: 0.5rem; font-size: 0.85rem; color: var(--color-muted); }
.np-dialog textarea { font: inherit; font-family: var(--font-serif); font-size: 1rem; line-height: 1.45; padding: 0.5rem 0.6rem; border: 1px solid var(--color-border); border-radius: 4px; background: #fff; color: var(--color-ink); resize: vertical; }
.np-dialog { width: min(600px, calc(100vw - 32px)); }
#entry-notes { margin-top: 1rem; }

/* ---- Person tools: rename / merge (V10.9) ---- */
.pt-inline { display: inline-flex; gap: 0.1rem; margin-left: 0.35rem; vertical-align: middle; }
.pt-btn { background: none; border: 1px solid transparent; border-radius: 4px; cursor: pointer; font-size: 0.95rem; line-height: 1; color: var(--color-muted); padding: 0.15rem 0.35rem; }
.pt-btn:hover, .pt-btn:focus-visible { color: var(--color-ink); border-color: var(--color-border); background: var(--color-card-bg); }
.pt-dialog { width: min(620px, calc(100vw - 32px)); }
.pt-dialog input[type=search], .pt-dialog input[type=text] { font: inherit; font-size: 1rem; padding: 0.45rem 0.6rem; border: 1px solid var(--color-border); border-radius: 4px; background: #fff; color: var(--color-ink); width: 100%; box-sizing: border-box; }
.pt-results { list-style: none; margin: 0.5rem 0; padding: 0; max-height: 15rem; overflow: auto; border: 1px solid var(--color-border); border-radius: 4px; }
.pt-results li { padding: 0.45rem 0.7rem; cursor: pointer; border-bottom: 1px dotted var(--color-border); font-size: 0.95rem; }
.pt-results li:last-child { border-bottom: 0; }
.pt-results li:hover, .pt-results li:focus { background: var(--color-border); outline: none; }
.pt-results li[aria-selected="true"] { background: #efe1c2; box-shadow: inset 3px 0 0 var(--color-accent); }
.pt-results .badge { margin-left: 0.4rem; }
.pt-label { margin: 0.8rem 0 0.3rem; font-weight: 700; }
.pt-radios { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.5rem; }
.pt-own { display: flex; flex-direction: column; gap: 0.25rem; margin: 0.5rem 0; font-size: 0.9rem; }
.pt-small { font-size: 0.85rem; margin: -0.2rem 0 0.4rem; }
.ll-admin { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.ll-admin .button { font-size: 0.88rem; padding: 0.35rem 0.6rem; }

/* ---- Person aliases (V10.10) ---- */
.alias-add { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.alias-add input { font: inherit; padding: 0.4rem 0.55rem; border: 1px solid var(--color-border); border-radius: 4px; background: #fff; color: var(--color-ink); min-width: 14rem; }
#aliases .pp-list form { display: inline; margin: 0; }
#aliases .pp-unlink { background: none; border: 0; box-shadow: none; color: var(--color-muted); font-size: 1.05rem; line-height: 1; padding: 0.1rem 0.35rem; min-height: 0; width: auto; border-radius: 999px; }
#aliases .pp-unlink:hover { color: #b3261e; background: rgba(179,38,30,.08); }
#aliases .pp-list li { padding: 0.15rem 0.25rem 0.15rem 0.7rem; }

/* ---- Search in the text of one document, on its page (V10.12) ---- */
.doc-search { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.4rem 0 1.4rem; }
.doc-search input[type=search] { flex: 1 1 22rem; max-width: 36rem; font: inherit; font-size: 1rem; padding: 0.55rem 0.75rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); color: var(--color-ink); }
.doc-search-clear { font-size: 0.92rem; }
.doc-search-summary { font-size: 1rem; margin: 0 0 1rem; }
.doc-search-group { margin: 0 0 1.6rem; }
.doc-search-group h2 { font-size: 1.2rem; margin: 0 0 0.4rem; }
.doc-search-group h2 .muted { font-size: 0.95rem; font-weight: 400; }
.doc-search-count { display: inline-block; min-width: 1.6rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: var(--color-border); color: var(--color-ink); font-size: 0.8rem; font-weight: 700; text-align: center; vertical-align: middle; font-family: var(--font-sans); }
.doc-search-group .snippet mark, mark.search-hl { background: #f3d58a; color: inherit; padding: 0 0.05em; border-radius: 2px; }

.entry-list .doc-search { margin: 0.2rem 0 1rem; }
.entry-list .search-results { margin-top: 0; }
.entry-list .snippet mark { background: #f3d58a; color: inherit; padding: 0 0.05em; border-radius: 2px; }

/* ---- Map popup: entries mentioning the place (V10.14) ---- */
.map-entries { margin-top: 0.45rem; font-size: 0.88rem; }
.map-entries ul { list-style: none; margin: 0.2rem 0 0; padding: 0; max-height: 11rem; overflow: auto; }
.map-entries li { padding: 0.12rem 0; }

/* ---- Map: numbered markers and the documents list (V10.15) ---- */
.map-docs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.7rem; margin-top: 0.8rem; }
.map-docs label { font-size: 0.92rem; color: var(--color-muted); }
.map-docs select { font: inherit; font-size: 0.95rem; padding: 0.4rem 0.55rem; border: 1px solid var(--color-border); border-radius: 4px; background: var(--color-card-bg); color: var(--color-ink); max-width: min(36rem, 100%); }
.map-num-icon { background: none; border: 0; }
.map-num {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: #8a4b2a; color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  font: 700 12px/1 var(--font-sans, sans-serif);
}
.map-num-wide { width: 30px; border-radius: 12px; margin-left: -3px; font-size: 11px; }
.leaflet-marker-icon:focus-visible .map-num { outline: 3px solid #1f6fa8; outline-offset: 1px; }

/* ---- Lifelines: overview with crossings (V10.17) ---- */
.ll-check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 0.4rem; font-size: 0.92rem !important; color: var(--color-ink) !important; cursor: pointer; align-self: center; }

/* ---- About page editing (V10.19) ---- */
.about-admin { margin-top: 2rem; }
.about-edit { max-width: 52rem; }
.about-edit textarea { font-family: var(--font-serif); font-size: 1.02rem; line-height: 1.55; }
.flash { padding: 0.6rem 0.9rem; border-radius: 4px; background: #e6efd9; color: #2f4a1c; }

/* ---- Lifelines: connections between checked people (V10.22) ---- */
.ll-pick { font-size: 0.9rem; margin: 0.3rem 0 0.2rem; display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center; }
.ll-box { cursor: pointer; }
.ll-box:focus { outline: none; }
.ll-box:focus-visible rect:nth-child(2) { stroke: #1f6fa8; stroke-width: 2.2; }
.ll-link { cursor: pointer; }
.ll-link:hover { opacity: 1 !important; }

/* ---- Life dates in the name index (V10.26) ---- */
.lifespan { color: var(--color-muted); font-size: 0.9em; font-weight: 400; white-space: nowrap; }
h1 .lifespan { font-size: 0.6em; }
.date-pair { display: flex; gap: 0.8rem; flex-wrap: wrap; }
.date-pair label { flex: 1 1 9rem; }

/* ---- Import data (V10.27) ---- */
.import-page fieldset { border: 1px solid var(--color-border); border-radius: 4px; padding: 0.6rem 0.9rem; display: flex; flex-direction: column; gap: 0.3rem; }
.import-page legend { font-weight: 700; padding: 0 0.3rem; }
.import-page h2 { margin-top: 1.8rem; font-size: 1.25rem; }
.import-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.import-table th { text-align: left; font-weight: 700; color: var(--color-muted); border-bottom: 1px solid var(--color-border); padding: 0.4rem; }
.import-table td { border-bottom: 1px dotted var(--color-border); padding: 0.45rem 0.4rem; vertical-align: top; }
.import-table td:first-child { width: 2rem; }
.import-table select { font: inherit; font-size: 0.92rem; max-width: 100%; padding: 0.25rem; }
.import-changes { list-style: none; margin: 0; padding: 0; }
.import-changes s { color: var(--color-muted); }
.import-merge { margin-top: 0.3rem; font-size: 0.9rem; }
.import-rest { margin-top: 1.2rem; }
.import-rest summary { cursor: pointer; font-weight: 700; }
.import-none { columns: 2 18rem; font-size: 0.92rem; }
.import-submit { position: sticky; bottom: 0; background: var(--color-bg, #f4ead6); padding: 0.8rem 0; margin-top: 1.5rem; border-top: 1px solid var(--color-border); }
@media (max-width: 700px) { .import-table td:nth-child(3) { min-width: 10rem; } }

/* Possible duplicates (V10.29) */
.dup-group { margin: 0 0 1.4rem; padding: 0.6rem 0.8rem 0.8rem; border: 1px solid var(--color-border); border-radius: 6px; background: rgba(255,255,255,0.35); }
.dup-group .import-table { margin: 0; }
.dup-group .import-table th:nth-child(-n+2), .dup-group .import-table td:nth-child(-n+2) { width: 5.5rem; text-align: center; }
.dup-also { font-size: 0.85rem; color: #8a4b1f; }
.dup-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.6rem; }
.dup-actions label { display: flex; gap: 0.5rem; align-items: center; flex: 1 1 22rem; }
.dup-name { flex: 1; min-width: 12rem; }
.dup-hidden { list-style: none; padding: 0; }
.dup-hidden li { padding: 0.5rem 0; border-bottom: 1px dotted var(--color-border); }
.dup-buttons { display: block; margin-top: 0.2rem; font-size: 0.92rem; }
.dup-buttons .inline-form button { background: none; color: var(--color-accent); font: inherit; padding: 0; border: 0; }
.dup-buttons .link-button { margin-right: 0.9rem; }
.flash-ok { background: #e6f0d8; border: 1px solid #b7cf95; padding: 0.5rem 0.8rem; border-radius: 4px; }
