/* Blackwell Cemetery — shared styles. Light by default, dark via
   prefers-color-scheme or the header's theme toggle. Keep all colors on these
   variables. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  /* plot map */
  /* Map cells colour by EVIDENCE, not just occupancy — see mergeStoneEvidence.
     Validated as a categorical set against this surface (all-pairs): worst
     colourblind separation dE 16.0, worst normal-vision 18.8. Dark steps below
     are chosen for the dark surface, not flipped. */
  --map-confirmed: #2a78d6;   /* a headstone we have read proves the burial */
  --map-occupied: #8c8a7e;    /* recorded in the register and/or the book */
  --map-unread: #8c8a7e;      /* recorded + photographed, stone not yet read */
  --map-reserved: #eda100;    /* stone set, no death date — spoken for */
  --map-owned: #eda100;       /* owned, nobody recorded */
  --map-norecord: transparent;
  --map-ring: rgba(11, 11, 11, 0.10);
  /* grave restrictions — red: cannot be used, amber: usable but limited */
  --restrict: #c22f2f;
  --restrict-bg: rgba(194, 47, 47, 0.07);
  --limit: #a06000;
  --limit-bg: rgba(160, 96, 0, 0.07);
  /* The map's cross for a settled unusable position. Grey, not red: a wall or a
     tree is a permanent, uncontested fact about the ground and wants to sit
     quietly behind the evidence colours, where red made it shout and read as an
     alert. Red on the map is reserved for the disputed ones, which ARE alerts. */
  --restrict-mute: #6f6f6a;
}

/* Dark palette. Applies when the system asks for dark (unless the person has
   chosen light with the header toggle), or when they have chosen dark.
   <html data-theme="light|dark"> is set before first paint by the one-line
   script in every page's <head>; see public/nav.js for the toggle.
   THE TWO COPIES BELOW MUST STAY IDENTICAL: CSS has no way to share one
   declaration block between a media query and a selector. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --text: #ffffff;
    --text-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --accent: #3987e5;
    --accent-ink: #0b0b0b;
    --map-confirmed: #3987e5;
    --map-occupied: #6e6c62;
    --map-unread: #6e6c62;
    --map-reserved: #c98500;
    --map-owned: #c98500;
    --map-norecord: transparent;
    --map-ring: rgba(255, 255, 255, 0.10);
    --restrict: #ff6f6f;
    --restrict-bg: rgba(255, 111, 111, 0.11);
    --limit: #e0a136;
    --limit-bg: rgba(224, 161, 54, 0.11);
    /* lighter than the light-mode grey, not darker — it has to read as a
       texture on top of dark cells, several of which are themselves grey */
    --restrict-mute: #a5a39b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --text: #ffffff;
  --text-2: #c3c2b7;
  --muted: #898781;
  --line: #2c2c2a;
  --accent: #3987e5;
  --accent-ink: #0b0b0b;
  --map-confirmed: #3987e5;
  --map-occupied: #6e6c62;
  --map-unread: #6e6c62;
  --map-reserved: #c98500;
  --map-owned: #c98500;
  --map-norecord: transparent;
  --map-ring: rgba(255, 255, 255, 0.10);
  --restrict: #ff6f6f;
  --restrict-bg: rgba(255, 111, 111, 0.11);
  --limit: #e0a136;
  --limit-bg: rgba(224, 161, 54, 0.11);
  /* lighter than the light-mode grey, not darker — it has to read as a
     texture on top of dark cells, several of which are themselves grey */
  --restrict-mute: #a5a39b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.55;
}

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 1.5rem 0.9rem;
}
header.site h1 { margin: 0 0 0.1rem; font-size: 1.45rem; letter-spacing: 0.01em; }
header.site .tagline { margin: 0; color: var(--text-2); font-size: 0.95rem; }

nav.site {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 1.5rem;
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
}
nav.site a {
  padding: 0.6rem 0.9rem;
  color: var(--text-2);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
nav.site a:hover { color: var(--text); }
nav.site a.current { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

main { max-width: 900px; margin: 0 auto; padding: 1.5rem; }

/* ---- keeper side panel (public/nav.js, issue #14) --------------------------
   Each keeper page carries an empty <nav class="sidebar" id="sidebar"> right
   after <body>, so the space is reserved before nav.js fills it. Wide screens:
   fixed on the left. Phones and narrow windows: a drawer behind the MENU
   button, so field pages keep the whole width. Pages without the placeholder
   (public view, sales page, login) are untouched by all of this. */
:root { --sidebar-w: 14rem; }
nav.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 1rem 0.7rem 1.2rem;
  z-index: 30;
  font-size: 0.93rem;
}
body:has(> nav.sidebar) { padding-left: var(--sidebar-w); }
.nav-group { margin-bottom: 0.9rem; }
.nav-group-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.65rem 0.25rem;
}
/* Collapsible group headings: the whole heading is the target, with a chevron
   on the right that points down when open and right when closed. */
summary.nav-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  user-select: none;
  padding-top: 0.3rem;
  padding-bottom: 0.3rem;
  border-radius: 6px;
}
summary.nav-group-title::-webkit-details-marker { display: none; }
summary.nav-group-title::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  margin-right: 0.15rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-0.1rem, -0.1rem);
  transition: transform 0.15s ease;
}
details.nav-group:not([open]) > summary.nav-group-title::after { transform: rotate(-45deg); }
summary.nav-group-title:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
summary.nav-group-title:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
details.nav-group:not([open]) { margin-bottom: 0.35rem; }
nav.sidebar a {
  display: block;
  padding: 0.38rem 0.65rem;
  border-radius: 6px;
  color: var(--text-2);
  text-decoration: none;
}
nav.sidebar a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
nav.sidebar a.current {
  color: var(--text);
  font-weight: 600;
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-foot {
  border-top: 1px solid var(--line);
  margin-top: 0.4rem;
  padding: 0.8rem 0.65rem 0;
  font-size: 0.85rem;
  color: var(--text-2);
}
.nav-who { margin-bottom: 0.3rem; overflow-wrap: anywhere; }
nav.sidebar a.nav-account { padding-left: 0; padding-right: 0; margin-bottom: 0.5rem; }
nav.sidebar a.nav-account.current { padding-left: 0.65rem; }
.nav-logout, .nav-toggle {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.nav-logout:hover, .nav-toggle:hover { border-color: var(--accent); }
.nav-toggle { display: none; }
/* Top-right of the header: the light/dark toggle, plus MENU on phones. */
header.site:has(.header-tools) { position: relative; padding-right: 4.5rem; }
.header-tools {
  position: absolute;
  top: 1rem; right: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.nav-scrim { display: none; }

@media (max-width: 960px) {
  body:has(> nav.sidebar) { padding-left: 0; }
  nav.sidebar {
    width: min(18rem, 85vw);
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: none;
  }
  body.nav-open nav.sidebar { transform: none; box-shadow: 0 0 24px rgba(0, 0, 0, 0.25); }
  body.nav-open .nav-scrim {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 29;
  }
  /* MENU joins the theme toggle top-right; the header keeps room for both so
     the title never runs underneath (a long title wraps instead). */
  header.site:has(.header-tools) { padding-right: 9.5rem; }
  header.site .nav-toggle { display: inline-block; height: 2.2rem; }
}
@media (max-width: 480px) {
  /* Narrow phones: a smaller title, so it wraps to two lines beside the two
     header buttons rather than three. */
  header.site:has(.header-tools) { padding-left: 1rem; padding-right: 8.6rem; }
  header.site:has(.header-tools) h1 { font-size: 1.2rem; line-height: 1.3; }
  header.site:has(.header-tools) .tagline { font-size: 0.85rem; }
  .header-tools { right: 0.75rem; gap: 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  nav.sidebar, summary.nav-group-title::after { transition: none; }
}
@media print {
  nav.sidebar, .nav-toggle, .nav-scrim, .header-tools { display: none !important; }
  body:has(> nav.sidebar) { padding-left: 0; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.25rem;
}
.card h2 { margin-top: 0.1rem; font-size: 1.15rem; }
.card h3 { font-size: 1rem; }

.sample-banner {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  color: var(--text-2);
  margin-bottom: 1.25rem;
}

table.prices { width: 100%; border-collapse: collapse; }
table.prices th, table.prices td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.prices th { color: var(--muted); font-weight: 600; font-size: 0.85rem; }
table.prices td.price { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.prices td.detail { color: var(--text-2); font-size: 0.9rem; }

.stat-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.stat {
  flex: 1 1 140px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.stat .num { font-size: 1.7rem; font-weight: 650; }
.stat .lbl { color: var(--text-2); font-size: 0.85rem; }

/* search */
form.search { display: flex; gap: 0.6rem; margin-bottom: 1.1rem; }
form.search input[type="search"] {
  flex: 1;
  font-size: 1rem;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
form.search button {
  font-size: 1rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
}

.result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.6rem;
  background: var(--surface);
  cursor: pointer;
}
.result:hover, .result.selected { border-color: var(--accent); }
.result .loc { font-weight: 650; }
.result .who { color: var(--text-2); font-size: 0.92rem; }
.result .status { color: var(--muted); font-size: 0.85rem; }

/* map */
.map-wrap { overflow-x: auto; }
.map-legend {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 0.8rem;
  font-size: 0.88rem;
  color: var(--text-2);
}
.map-legend .chip {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 1px solid var(--map-ring);
  margin-right: 0.4rem;
  vertical-align: -1px;
}
svg.plotmap text { font-family: system-ui, sans-serif; fill: var(--muted); }
svg.plotmap .cell { stroke: var(--map-ring); stroke-width: 1; rx: 2px; }
svg.plotmap .cell.confirmed { fill: var(--map-confirmed); }
svg.plotmap .cell.occupied { fill: var(--map-occupied); }
svg.plotmap .cell.owned { fill: var(--map-owned); }
svg.plotmap .cell.norecord { fill: var(--map-norecord); }
/* The two small states are the base fill plus a texture, so they survive
   colourblindness and greyscale printing without spending a hue. */
svg.plotmap .cell.unread { fill: var(--map-occupied); }
svg.plotmap .cell.unread-hatch { fill: url(#hatch-unread); pointer-events: none; }
svg.plotmap .cell.reserved { fill: var(--map-reserved); }
svg.plotmap .cell.reserved-ring {
  fill: none; stroke: var(--surface); stroke-width: 1.4; pointer-events: none;
}
svg.plotmap .hatch-line { stroke: var(--surface); stroke-width: 1.1; }
/* Graves the record book puts out of use, crossed through over whatever
   evidence colour is underneath — the same red the plot page strikes them
   with. Dashed where a burial is recorded in a position the record calls
   unusable: the mark still has to be visible, but it must not read as settled. */
svg.plotmap .cell.unusable-hatch { fill: url(#hatch-unusable); pointer-events: none; }
svg.plotmap .cell.unusable-hatch.disputed { fill: url(#hatch-unusable-disputed); }
svg.plotmap .strike-line { stroke: var(--restrict-mute); stroke-width: 0.9; fill: none; }
svg.plotmap .strike-line.disputed { stroke: var(--restrict); stroke-width: 1.1; stroke-dasharray: 1.6 1.6; }
/* legend swatches reuse the same textures */
.map-legend .chip.sw-unread { background-color: var(--map-occupied);
  background-image: repeating-linear-gradient(45deg, transparent 0 2px, var(--surface) 2px 3px); }
.map-legend .chip.sw-reserved { background-color: var(--map-reserved);
  box-shadow: inset 0 0 0 1.5px var(--surface); }
.map-legend .chip.sw-unusable {
  background-image:
    repeating-linear-gradient(45deg, transparent 0 2px, var(--restrict-mute) 2px 3px),
    repeating-linear-gradient(-45deg, transparent 0 2px, var(--restrict-mute) 2px 3px);
}
/* Full strength, and red: this is the one the records keeper has to chase. It
   was previously the same red at half opacity, which made the two swatches
   near-indistinguishable and muted the one that matters more. */
.map-legend .chip.sw-unusable-disputed {
  background-image:
    repeating-linear-gradient(45deg, transparent 0 2px, var(--restrict) 2px 3px),
    repeating-linear-gradient(-45deg, transparent 0 2px, var(--restrict) 2px 3px);
  border-color: var(--restrict);
}
svg.plotmap .cell.hit {
  stroke: var(--accent);
  stroke-width: 3;
  filter: drop-shadow(0 0 4px var(--accent));
}
@media (prefers-reduced-motion: no-preference) {
  svg.plotmap .cell.hit { animation: hit-pulse 1.1s ease-in-out 5; }
}
@keyframes hit-pulse {
  50% { stroke-width: 7; }
}
svg.plotmap .section-box { fill: none; stroke: var(--line); }
svg.plotmap .feature { stroke: none; }
svg.plotmap .feature.road { fill: color-mix(in srgb, var(--muted) 28%, var(--surface)); }
svg.plotmap .feature.lane { fill: color-mix(in srgb, var(--muted) 14%, var(--surface)); }
svg.plotmap .feature.path { fill: color-mix(in srgb, var(--muted) 14%, var(--surface)); }
svg.plotmap .feature.building {
  fill: color-mix(in srgb, var(--accent) 30%, var(--surface));
  fill-opacity: 0.85;
  stroke: var(--muted);
}
svg.plotmap .feature-label { fill: var(--text-2); }
svg.plotmap .sec-label { fill: var(--text-2); }

svg.plotmap .cell { cursor: pointer; }
svg.plotmap .pdot { fill: var(--muted); stroke: var(--surface); stroke-width: 0.6; }
svg.plotmap .pdot-gps { fill: var(--accent); }

/* plot detail card (click a map square) */
.detail {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.8rem 1rem;
  margin: 0.4rem 0 1rem;
}
.detail .dhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.detail .dclose {
  border: 1px solid var(--line);
  background: none;
  color: var(--text-2);
  border-radius: 6px;
  padding: 0.25rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 650;
  cursor: pointer;
}
.detail .dclose:hover { color: var(--text); border-color: var(--accent); }
.detail .gchips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

/* On a wide screen the photo strip and the camera buttons sit BESIDE the grave
   grid instead of under the records. The grid is only about 16rem across, so
   everything to its right was empty space, while the camera — the reason the
   page is open standing in front of a headstone — sat below a register entry
   whose obituary can run twenty lines. Flex-wrap rather than a media query: the
   panel drops underneath of its own accord once there is not 20rem beside the
   grid, which is exactly what happens on a phone. */
.plot-split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1.2rem;
}
.plot-split > .plot-split-grid { flex: 0 0 auto; }
/* Two side columns: the plot page gives the photos their own bordered panel,
   the search card is already inside one and uses a plain div. */
.plot-split > .detail,
.plot-split > .plot-split-side {
  flex: 1 1 20rem;
  min-width: 0;          /* let it shrink; without this the strip forces overflow */
  margin-top: 0.7rem;    /* line its top up with .plot-grid-head */
}
/* the block's own heading already spaces it — don't double up beside the grid */
.plot-split > .plot-split-side > h3:first-child { margin-top: 0; }

/* The selected grave's own material — its photos, and its records — sits in an
   accent box, the same blue as its card in the grid above, so the eye ties the
   grave you clicked to the blocks that describe it. What is left OUTSIDE the
   box is the plot-wide material: the record-book page, and who purchased graves
   in this plot. That is the arrangement /plot.html already had by accident of
   structure — blue panels for the grave, inside a plain card — and the search
   card now matches it. The card's own border steps back to neutral for the same
   reason: with the grave boxed inside it, a second blue frame around everything
   would be saying the highlight is the card rather than the grave. */
.gravebox {
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  padding: 0.75rem 0.9rem 0.85rem;
  margin: 0.9rem 0;
}
.gravebox > h3:first-child,
.gravebox > .rbox:first-child { margin-top: 0; }
#detail.detail { border-color: var(--line); }

/* spatial plot grid (arranged as on the ground, north up) */
.plot-grid-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0.7rem;
  font-size: 0.8rem;
  color: var(--muted);
  max-width: 26rem;
}
.plot-grid-head .gnorth { font-weight: 700; color: var(--text-2); }
.plot-grid {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.3rem;
}
.gcard {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  min-height: 3.6rem;
}
.gcard:hover { border-color: var(--accent); }
.gcard.current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  cursor: default;
}
.gcard .gnum { font-weight: 700; font-size: 0.95rem; }
.gcard .gwho {
  font-size: 0.7rem;
  color: var(--text-2);
  line-height: 1.25;
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gcard .gbadges { font-size: 0.7rem; min-height: 1em; }

/* Graves the record book puts out of use (see restrictions-ui.js). Red = cannot
   be used at all, amber = usable but limited. The reason opens with the grave.

   ONLY an unusable position is struck through. A cremation-only or restricted
   grave can still be buried in — drawing a line through it says the opposite of
   what the book says, and reads as "no burial here" on a grid scanned at a
   glance. The limit is carried by the amber tint, the dashed border and the
   spelled-out chip instead. This matches the map, which draws its cross for
   `unusable` alone and for the same reason. A broken line means the record
   contradicts itself and nothing is settled. */
.gcard.r-unusable, .gcard.r-cremation, .gcard.r-restricted { border-style: dashed; }
.gcard.r-unusable { background: var(--restrict-bg); border-color: var(--restrict); }
.gcard.r-cremation, .gcard.r-restricted { background: var(--limit-bg); border-color: var(--limit); }
.gcard.r-unusable::after {
  content: '';
  position: absolute;
  left: 7%;
  right: 7%;
  top: 50%;
  border-top: 2px solid var(--restrict);
  pointer-events: none;
}
.gcard.r-disputed::after { border-top-style: dashed; }
/* selecting a marked grave must still look selected — these rules come after
   .gcard.current, so without this the restriction tint would hide it */
.gcard.r-unusable.current, .gcard.r-cremation.current, .gcard.r-restricted.current {
  border-color: var(--accent);
  border-style: solid;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.rchip {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.3;
  padding: 0 0.25rem;
  border-radius: 3px;
  border: 1px solid currentcolor;
}
.rchip.r-unusable { color: var(--restrict); }
.rchip.r-cremation, .rchip.r-restricted { color: var(--limit); }

/* legend under the grid — only the kinds actually present on the page */
.rlegend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1rem;
  margin: 0.55rem 0 0;
  font-size: 0.78rem;
  color: var(--text-2);
}
.rlegend .ritem { display: inline-flex; align-items: center; gap: 0.35rem; }
/* The swatch has to be the mark it stands for: a struck line for the positions
   that are struck through, and a tinted dashed box — the card itself in
   miniature — for the ones that are only limited. */
.rline {
  display: inline-block;
  width: 1.15rem;
  border-top: 2px solid var(--restrict);
  flex: none;
}
.rline.r-cremation, .rline.r-restricted {
  height: 0.8rem;
  border: 1px dashed var(--limit);
  border-radius: 3px;
  background: var(--limit-bg);
}
.rline.r-restricted { border-style: dotted; }

/* the reason, in the panel that opens with the grave */
.rbox {
  border: 1px solid var(--line);
  border-left: 3px solid var(--restrict);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  margin: 0 0 0.7rem;
  background: var(--restrict-bg);
}
.rbox.r-cremation, .rbox.r-restricted {
  border-left-color: var(--limit);
  background: var(--limit-bg);
}
.rbox p { margin: 0.3rem 0; font-size: 0.9rem; }
.rbox .rhead { display: flex; align-items: center; gap: 0.4rem; }
.rbox .rconflict { color: var(--restrict); font-weight: 600; }
.rbox .rsays { margin: 0.2rem 0 0.3rem; padding-left: 1.1rem; }
.rbox .rsays li {
  font-size: 0.85rem;
  color: var(--text-2);
  font-style: italic;
}

/* zoomed columbarium view */
.face-grid {
  display: grid;
  gap: 0.3rem;
  margin: 0.4rem 0 1rem;
  align-items: stretch;
}
.face-grid .fhdr {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  align-self: center;
}
.face-grid .frow { text-align: right; padding-right: 0.3rem; }
.gcard.ncard { min-height: 3rem; padding: 0.3rem 0.2rem; }
.gchip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  min-width: 3.2rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.gchip:hover { border-color: var(--accent); }
.gchip.current {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  cursor: default;
}
.gchip .gnum { font-weight: 700; font-size: 0.95rem; }
.gchip .gwho { font-size: 0.72rem; color: var(--text-2); max-width: 5.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Record styling. Scoped to `.detail` alone until 2026-08-29, which meant the
   plot page's own cards — "Purchased by", the transcribed book entries — got
   none of it: every label stacked above its value instead of sitting beside it,
   and consecutive records ran together with no rule between them. Any container
   that lists records can opt in with `.records`. */
.detail h3,
.records h3 {
  margin: 0.9rem 0 0.3rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.detail h4,
.records h4 { margin: 0 0 0.25rem; font-size: 1rem; }
.detail .drecord,
.records .drecord {
  border-top: 1px solid var(--line);
  padding: 0.55rem 0;
}
.detail .drow,
.records .drow {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.6rem;
  font-size: 0.92rem;
  padding: 0.08rem 0;
}
/* the label column is generous for a wide card; on a phone it would leave the
   value squeezed into nothing, so stack there instead */
@media (max-width: 30rem) {
  .detail .drow,
  .records .drow { grid-template-columns: 1fr; gap: 0; }
  .detail .dlabel,
  .records .dlabel { font-size: 0.82rem; }
}
.detail .dlabel,
.records .dlabel { color: var(--muted); }
.detail .dnote,
.records .dnote { color: var(--text-2); font-size: 0.88rem; font-style: italic; }
/* the book's transcribed entries are a second source — separate them from the
   register's owners above rather than letting the two lists merge */
.records .book-records:not(:empty) {
  margin-top: 1.1rem;
  border-top: 2px solid var(--line);
}

/* Field notes on a grave (gravenotes-ui.js). Drawn as somebody's words rather
   than as a record: no label/value rows, and every note signed and dated. They
   are the keeper's own observations, not a fifth source, so they must not end
   up looking like the register and book blocks above them. */
.gnote {
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  padding: 0.45rem 0.7rem;
  margin: 0 0 0.5rem;
}
.gnote p { margin: 0; font-size: 0.92rem; white-space: pre-line; }
.gnote-by {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.gnote-del {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  padding: 0.1rem 0.2rem;
  cursor: pointer;
}
.gnote-del:hover { color: var(--restrict); }
.gnote-form textarea {
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.6rem;
  resize: vertical;
}
.gnote-form textarea:focus { outline: none; border-color: var(--accent); }

/* What a photograph is of, under its thumbnail (photokind-ui.js). Sized to the
   92px thumb so the strip stays a grid. Amber whenever it is NOT a plain
   headstone — including not-yet-identified, because that is precisely what the
   post-visit pass is hunting for, and because nothing unjudged should be able
   to pass for a headstone when these start being published. */
.pkind {
  display: block;
  width: 92px;
  margin-top: 0.25rem;
  font: inherit;
  font-size: 0.68rem;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1rem 0.15rem;
}
.pkind.pkind-flag {
  color: var(--limit);
  border-color: var(--limit);
  background: var(--limit-bg);
  font-weight: 650;
}

/* headstone photos in the detail card */
.photo-strip {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.3rem 0;
}
.photo-thumb { position: relative; display: inline-block; }
.photo-thumb img {
  width: 92px; height: 92px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}
.photo-thumb .photo-del {
  position: absolute; top: -6px; right: -6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.9rem; line-height: 1;
  cursor: pointer;
}
.photo-thumb .photo-del:hover { color: var(--text); border-color: var(--accent); }
.photo-thumb .photo-gps {
  position: absolute; bottom: 2px; right: 4px;
  font-size: 0.8rem;
  text-shadow: 0 0 3px rgba(0,0,0,0.6);
}
.photo-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.4rem;
  flex-wrap: wrap;   /* the plot page now runs these in a ~20rem side column */
}
.dphoto {
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
}
.dphoto.secondary {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.map-tip {
  position: fixed;
  pointer-events: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  z-index: 10;
  display: none;
  /* a restricted grave's tip is two lines: the record, then why it is struck */
  white-space: pre-line;
  max-width: 22rem;
}

/* survey page */
.wp-presets {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.wp-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}
.wp-chip:hover { border-color: var(--accent); }

/* map view toggle */
.map-toggle { display: flex; gap: 0.4rem; margin-bottom: 0.4rem; }
.map-toggle button {
  border: 1px solid var(--line);
  background: none;
  color: var(--text-2);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
}
.map-toggle button.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--text);
}
svg.plotmap .plot-num { fill: var(--text); }

/* record-book coverage tracker */
.bp-row {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}
.bp-sec { min-width: 4.5rem; font-weight: 650; }
.bp-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.bp-chip {
  position: relative;
  min-width: 2.2rem;
  padding: 0.3rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}
.bp-chip:hover { border-color: var(--accent); }
.bp-chip.bp-photo { background: color-mix(in srgb, var(--map-owned) 30%, var(--surface)); }
.bp-chip.bp-done { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.bp-badge { position: absolute; top: -6px; right: -4px; font-size: 0.65rem; }

footer.site {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 1.5rem 2rem;
}

/* ---- issue flags and the issues page ---- */
.issue-flag {
  display: inline-flex; align-items: center; gap: 0.15rem;
  margin-left: 0.3rem; text-decoration: none; line-height: 1;
}
.issue-flag:hover { filter: brightness(1.15); }
.issue .ihead { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.issue .inum {
  font-weight: 700; font-size: 0.9rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.05rem 0.4rem;
}
.issue .ibadge {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.5rem;
  color: var(--muted);
}
.issue.ifocus { outline: 2px solid #f2c200; outline-offset: 2px; }
.wrow { font-size: 0.85rem; margin-top: 0.4rem; }
.wchip {
  display: inline-block; border: 1px solid var(--line); border-radius: 6px;
  padding: 0.05rem 0.4rem; margin: 0.1rem 0.1rem 0.1rem 0; font-size: 0.8rem;
  color: var(--text-2); text-decoration: none;
}
a.wchip:hover { border-color: var(--accent); color: var(--accent); }
.inotes { border-top: 1px solid var(--line); margin-top: 0.6rem; }
.inote {
  border-left: 3px solid var(--line); padding: 0.25rem 0 0.25rem 0.6rem;
  margin-bottom: 0.45rem; font-size: 0.9rem;
}
.inote-meta { font-size: 0.75rem; color: var(--muted); }
.note-del {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 0.95rem; padding: 0 0.2rem;
}
.note-del:hover { color: #c0392b; }
.note-form textarea {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 0.9rem;
  padding: 0.4rem 0.5rem; border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text); resize: vertical;
}
.note-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.35rem; }
.issue.resolved { opacity: 0.72; }
.issue.resolved .ihead h3 { text-decoration: line-through; text-decoration-color: var(--muted); }
.issue .ibadge.done { border-color: #2e7d32; color: #2e7d32; }
.ires {
  border-left: 3px solid #2e7d32; padding: 0.3rem 0 0.3rem 0.6rem;
  margin: 0.5rem 0; font-size: 0.9rem;
}

/* ---- batch upload ---- */
.dropzone {
  border: 2px dashed var(--line); border-radius: 10px;
  padding: 1.4rem 1rem; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; gap: 0.25rem; align-items: center;
  margin-top: 0.6rem; transition: border-color 0.12s, background 0.12s;
}
.dropzone:hover { border-color: var(--accent); }
.dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.bu-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.7rem; margin-top: 0.8rem;
}
.bu-item {
  margin: 0; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.35rem; display: flex; flex-direction: column; gap: 0.25rem;
}
.bu-item.bad { border-color: #c0392b; }
.bu-item img {
  width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border-radius: 5px; background: var(--surface);
}
.bu-item figcaption {
  display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.8rem;
}
.bu-item figcaption span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bu-warn { color: #c0392b; font-size: 0.75rem; white-space: normal !important; }
.bu-assign { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.bu-assign input { font-size: 0.8rem; padding: 0.15rem 0.3rem; border: 1px solid var(--line);
  border-radius: 4px; background: var(--surface); color: var(--text); }
.bu-file { font-size: 0.7rem; padding: 0.15rem 0.4rem; border: 1px solid var(--line);
  border-radius: 4px; background: none; color: var(--muted); cursor: pointer; }
.bu-file:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- statistics page ---------- */
/* Charts are plain divs sized by inline width/height percentages, so there is
   no charting dependency and nothing to load. Two shapes only: a column chart
   for the by-decade series and a labelled bar row for the tallies. */

.sfig { color: var(--text-2); font-size: 0.85rem; margin: 0.15rem 0 1rem; }
.sfig strong { color: var(--text); }

/* column chart: one .scol per decade, bars stacked full-burial over cremation */
.scols {
  display: flex; align-items: flex-end; gap: 0.4rem;
  height: 190px; margin: 0.6rem 0 0.2rem; overflow-x: auto; padding-bottom: 0.2rem;
}
.scol { flex: 1 1 0; min-width: 34px; display: flex; flex-direction: column;
  height: 100%; gap: 2px; }
/* the bar lives in its own growing box so the count and the decade label below
   it cannot be pushed out of the chart by a full-height column */
.scol .barbox { flex: 1 1 auto; min-height: 0; display: flex; align-items: flex-end; }
.scol .stack { width: 100%; display: flex; flex-direction: column;
  border-radius: 4px 4px 0 0; overflow: hidden; }
.scol .seg-f { background: var(--map-occupied); }
.scol .seg-c { background: var(--accent); }
.scol .seg-u { background: color-mix(in srgb, var(--muted) 45%, transparent); }
.scol .cap { font-size: 0.7rem; color: var(--text-2); text-align: center;
  font-variant-numeric: tabular-nums; }
.scol .tick { font-size: 0.68rem; color: var(--muted); text-align: center; }

/* labelled bar rows */
.sbars { display: grid; grid-template-columns: auto 1fr auto; gap: 0.3rem 0.6rem;
  align-items: center; margin-top: 0.5rem; }
.sbars .k { font-size: 0.85rem; color: var(--text-2); white-space: nowrap; }
.sbars .t { font-size: 0.85rem; color: var(--text-2); font-variant-numeric: tabular-nums;
  text-align: right; }
.sbars .b { height: 12px; border-radius: 3px; background: var(--accent); min-width: 2px; }
.sbars .b.alt { background: var(--map-occupied); }

/* small legend shared by the charts */
.skey { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem;
  color: var(--text-2); margin-top: 0.5rem; }
.skey i { display: inline-block; width: 11px; height: 11px; border-radius: 3px;
  margin-right: 0.35rem; vertical-align: -1px; }

/* two-column definition list for the odds and ends */
.sdl { display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem;
  margin: 0.4rem 0 0; font-size: 0.9rem; }
.sdl dt { color: var(--text-2); margin: 0; }
.sdl dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 520px) { .sdl { font-size: 0.85rem; } }

/* ============================================================================
   /bylaws.html — the approved by-laws, and the trustees' notes on them.

   The governing rule of this page is that the APPROVED TEXT comes first and
   everything else stays quiet. A note, a proposal, an index disagreement — none
   of them are the by-law, and none may be styled loudly enough to be mistaken
   for it. Hence: notes collapsed behind a small badge, the discrepancy panel
   collapsed by default, and the flags drawn in --text-2 rather than in the alert
   colours this stylesheet uses everywhere else for the record's own problems.
   ========================================================================== */

/* This page is a document, so it gets more width than `main`'s 900px and a
   column of its own for the contents. */
main.bylaws { max-width: 1180px; }
.bl-layout { display: flex; gap: 1.6rem; align-items: flex-start; }
.bl-doc { flex: 1; min-width: 0; }

/* contents rail */
.bl-toc {
  position: sticky; top: 1rem;
  width: 17rem; flex: 0 0 17rem;
  max-height: calc(100vh - 2rem);
  display: flex; flex-direction: column;
}
.bl-toc input[type="search"] {
  width: 100%; box-sizing: border-box; font-size: 0.95rem;
  padding: 0.5rem 0.7rem; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--text);
}
.bl-toc .count { font-size: 0.8rem; color: var(--muted); margin: 0.4rem 0 0.2rem; }
.bl-toc nav { overflow-y: auto; padding-right: 0.3rem; }
.bl-toc .part {
  font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin: 0.9rem 0 0.3rem;
}
.bl-toc a {
  display: block; text-decoration: none; color: var(--text-2);
  font-size: 0.88rem; padding: 0.16rem 0; line-height: 1.3;
  border-left: 2px solid transparent; padding-left: 0.5rem;
}
.bl-toc a:hover { color: var(--text); }
.bl-toc a.current { color: var(--text); border-left-color: var(--accent); font-weight: 600; }
.bl-toc a .n { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 0.35rem; }

/* the by-laws themselves */
.bl-part { margin: 2rem 0 0; }
.bl-part > h2 {
  font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2); border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem; margin-bottom: 0.2rem;
}
.bl-sec { padding: 0.9rem 0; border-bottom: 1px solid var(--line); scroll-margin-top: 1rem; }
.bl-sec:last-child { border-bottom: none; }
.bl-sec > h3 {
  display: flex; align-items: baseline; gap: 0.5rem;
  margin: 0 0 0.4rem; font-size: 1.02rem; line-height: 1.35;
}
.bl-sec .n {
  color: var(--muted); font-variant-numeric: tabular-nums;
  font-weight: 600; flex: 0 0 auto; min-width: 2.4rem;
}
.bl-sec .n.none { font-style: italic; font-weight: 400; font-size: 0.85rem; }
.bl-sec .h { flex: 1; }
.bl-sec p { margin: 0 0 0.6rem; line-height: 1.55; }
.bl-sec p:last-child { margin-bottom: 0; }
.bl-sec ol, .bl-sec ul { margin: 0 0 0.6rem; padding-left: 1.6rem; }
.bl-sec li { margin-bottom: 0.3rem; line-height: 1.5; }
.bl-sec img { max-width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: 6px; background: #fff; padding: 0.5rem; }

.bl-lead { color: var(--text-2); font-size: 0.95rem; line-height: 1.6; }

/* The note button. Quiet at rest so a page with no notes reads as just the
   by-laws; it only takes on the accent once a section actually carries one. */
.bl-note-btn {
  flex: 0 0 auto; align-self: center;
  border: 1px solid transparent; background: none; cursor: pointer;
  color: var(--muted); font-size: 0.8rem; font-family: inherit;
  border-radius: 999px; padding: 0.1rem 0.5rem; line-height: 1.6;
  opacity: 0.45; transition: opacity 0.12s, color 0.12s;
}
.bl-sec:hover .bl-note-btn, .bl-note-btn:focus-visible { opacity: 1; }
.bl-note-btn:hover { color: var(--text); border-color: var(--line); }
.bl-note-btn.has {
  opacity: 1; color: var(--accent); border-color: var(--line);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  font-weight: 600;
}
.bl-note-btn.open { border-color: var(--accent); }

/* index/body disagreement — informational, deliberately not an alert colour */
.bl-flag {
  font-size: 0.83rem; color: var(--text-2); margin: -0.1rem 0 0.5rem;
  padding-left: 2.9rem;
}
.bl-flag b { font-weight: 600; color: var(--text); }

/* the notes drawer under a section */
.bl-notes {
  margin: 0.7rem 0 0.2rem 2.9rem; padding: 0.7rem 0.85rem;
  border: 1px solid var(--line); border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}
.bl-note { padding: 0.5rem 0; border-bottom: 1px dashed var(--line); }
.bl-note:first-child { padding-top: 0; }
.bl-note:last-child { border-bottom: none; padding-bottom: 0.2rem; }
.bl-note .body { white-space: pre-wrap; line-height: 1.5; font-size: 0.94rem; }
.bl-note .meta {
  font-size: 0.78rem; color: var(--muted); margin-top: 0.3rem;
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.bl-note .meta button {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.75rem;
  font-family: inherit; cursor: pointer;
}
.bl-note .meta button:hover { color: var(--text); border-color: var(--accent); }
.bl-status {
  border-radius: 999px; padding: 0.05rem 0.5rem; font-size: 0.72rem;
  font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
}
.bl-status.open { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.bl-status.adopted { background: var(--limit-bg); color: var(--limit); }
.bl-status.declined { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.bl-note.declined .body { color: var(--text-2); text-decoration: line-through;
  text-decoration-color: var(--muted); }

.bl-notes textarea {
  width: 100%; box-sizing: border-box; min-height: 4.2rem; resize: vertical;
  font: inherit; font-size: 0.94rem; padding: 0.5rem 0.6rem; margin-top: 0.5rem;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface); color: var(--text);
}
.bl-notes .add { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.4rem; }
.bl-notes .add button {
  border: none; border-radius: 6px; background: var(--accent); color: var(--accent-ink);
  font: inherit; font-size: 0.88rem; font-weight: 600;
  padding: 0.35rem 0.9rem; cursor: pointer;
}
.bl-notes .add .hint { font-size: 0.78rem; color: var(--muted); }

/* toolbar in the header card */
.bl-tools { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }
.bl-tools button {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 0.28rem 0.8rem; font: inherit; font-size: 0.85rem;
  cursor: pointer;
}
.bl-tools button:hover { color: var(--text); }
.bl-tools button.active {
  background: var(--accent); border-color: var(--accent);
  color: var(--accent-ink); font-weight: 600;
}

/* the review view and the document-checks panel */
.bl-review .bl-rsec { margin-bottom: 1.1rem; }
.bl-review .bl-rsec > a {
  font-weight: 650; text-decoration: none; color: var(--text);
  display: inline-block; margin-bottom: 0.2rem;
}
.bl-review .bl-rsec > a:hover { color: var(--accent); }
.bl-check {
  display: grid; grid-template-columns: 3.2rem 1fr auto;
  gap: 0.3rem 0.7rem; align-items: baseline;
  padding: 0.5rem 0; border-bottom: 1px solid var(--line); font-size: 0.9rem;
}
.bl-check:last-child { border-bottom: none; }
.bl-check .num { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.bl-check .what { line-height: 1.45; }
.bl-check .what em { color: var(--text-2); font-style: normal; }
.bl-check .what q { color: var(--text); }
.bl-check button {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  border-radius: 999px; padding: 0.15rem 0.6rem; font: inherit; font-size: 0.78rem;
  cursor: pointer; white-space: nowrap;
}
.bl-check button:hover { color: var(--text); border-color: var(--accent); }

.bl-sec mark, .bl-toc mark {
  background: color-mix(in srgb, var(--accent) 28%, transparent);
  color: inherit; border-radius: 2px; padding: 0 0.1em;
}

.bl-empty { color: var(--text-2); font-size: 0.92rem; padding: 0.6rem 0; }

/* Phone: the contents rail becomes a collapsible block above the document, and
   the notes drawer loses the indent it no longer has room for. */
@media (max-width: 800px) {
  .bl-layout { flex-direction: column; }
  .bl-toc { position: static; width: 100%; flex: none; max-height: none; }
  .bl-toc nav { max-height: 40vh; }
  .bl-flag, .bl-notes { padding-left: 0; margin-left: 0; }
  .bl-flag { padding-left: 0; }
  .bl-sec > h3 { flex-wrap: wrap; }
}

/* The initials badge — how a person is credited throughout the record. Small and
   monospaced so a column of them scans, and so TRJ and TRJ-AI line up. */
.u-ini {
  display: inline-block; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em;
  padding: 0.05rem 0.4rem; border-radius: 4px; vertical-align: 1px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
}

/* ---- Unified per-person grave cards (unified-ui.js) -----------------------
   One card per person; field rows with source chips; sources verbatim behind
   the WHERE THIS COMES FROM expansion. Chips must be allowed to wrap — a
   nowrap chip punches out of the card on a phone (seen on the mockup). */
.person {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin: 0.9rem 0;
  background: var(--surface);
}
.person h4 { margin: 0 0 0.2rem; font-size: 1.05rem; }
.person .psub { color: var(--text-2); font-size: 0.85rem; margin-bottom: 0.5rem; }
.frow {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.15rem 0.8rem;
  padding: 0.18rem 0;
  font-size: 0.95rem;
}
.flabel { color: var(--text-2); font-size: 0.85rem; padding-top: 0.1rem; }
.fval { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; min-width: 0; }
.uchip {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.05rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-2);
  max-width: 100%;
}
/* settled = the cemetery's record speaks; differ = unsettled disagreement.
   The amber is --limit, the site's existing "limited but real" colour. */
.uchip.settled { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); color: var(--accent); }
.uchip.differ { border-color: color-mix(in srgb, var(--limit) 65%, var(--line)); color: var(--limit); }
.src-toggle {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0;
  margin-top: 0.3rem;
}
.usources { border-top: 1px dashed var(--line); margin-top: 0.4rem; padding-top: 0.4rem; }
.source-block { margin: 0.6rem 0; }
.source-block .shead {
  font-size: 0.8rem;
  color: var(--text-2);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.2rem;
}
.source-block .sbody { border-left: 3px solid var(--line); padding-left: 0.7rem; font-size: 0.9rem; }
.source-block.det .sbody { border-left-color: var(--accent); }
.verb { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.84rem; color: var(--text-2); }
.before-after { font-size: 0.85rem; color: var(--text-2); }
.structure-note { margin-top: 0.6rem; }
@media (max-width: 480px) {
  .frow { grid-template-columns: 5.5rem 1fr; }
}

/* ---- unified card editing (phase 2) ---------------------------------------
   The differ chips double as buttons (click to settle), the person card grows
   an actions row, and one shared <dialog> hosts the correct/add flows. */
button.uchip { font: inherit; font-size: 0.72rem; cursor: pointer; background: transparent; }
.pactions { margin-top: 0.7rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.uact {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.uact.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.udet-retire {
  font: inherit;
  font-size: 0.7rem;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
dialog.udlg {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  max-width: 30rem;
  width: calc(100vw - 3rem);
  padding: 1.1rem 1.2rem;
}
dialog.udlg::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog.udlg h3 { margin-top: 0; }
dialog.udlg label { display: block; font-size: 0.85rem; color: var(--text-2); margin: 0.7rem 0 0.2rem; }
dialog.udlg .dnote-inline { font-weight: 400; }
dialog.udlg input[type=text], dialog.udlg input[type=number],
dialog.udlg textarea, dialog.udlg select {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}
dialog.udlg .uloc { display: flex; gap: 0.5rem; }
dialog.udlg .uloc input { width: auto; }
dialog.udlg .curvals {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
  margin-top: 0.3rem;
}
dialog.udlg .curvals div { padding: 0.12rem 0; }
dialog.udlg .uderr {
  margin-top: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  border: 1px solid color-mix(in srgb, var(--restrict) 65%, var(--line));
  color: var(--restrict);
}

/* Direct entry (phase 3): the fifth source's blocks and buttons */
.source-block.direct .sbody { border-left-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.udirect-retire {
  font: inherit;
  font-size: 0.7rem;
  margin-left: 0.5rem;
  padding: 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pactions.unew { border-top: 1px dashed var(--line); padding-top: 0.7rem; margin-top: 1rem; }

/* ---- historical documents (/historical.html) ----
   A document thumbnail must NOT be the square, object-fit:cover .photo-thumb
   used for headstones: cropping a page of typescript to a square throws away
   the shape that tells you what the paper is, and a 92px square of a
   full-page letter is a grey smudge. These keep the aspect ratio and are
   taller, so a page reads as a page and a scrap reads as a scrap. */
.hdoc-thumbs { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: flex-start; }
.hdoc-thumb { display: inline-block; text-decoration: none; }
.hdoc-thumb img {
  width: auto; height: 190px; max-width: 200px;
  object-fit: contain;
  background: var(--page);
  border-radius: 8px;
  border: 1px solid var(--line);
  display: block;
}
.hdoc-thumb:hover img { border-color: var(--accent); }
.hdoc-thumb .cap {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  max-width: 200px;
  margin-top: 0.2rem;
}
.hdoc-meta {
  color: var(--text-2);
  font-size: 0.9rem;
  margin: 0 0 0.6rem;
}
.hdoc-meta .sep { color: var(--muted); padding: 0 0.35rem; }
/* The transcription is the point of the page, so it is set for reading rather
   than for scanning: a measure near 70 characters, a little extra line height,
   and paragraph spacing instead of a <pre> block. Whitespace is normal — the
   text is emitted as one <p> per paragraph — because a <pre> of a full page
   forces a horizontal scrollbar on a phone. */
.hdoc-text {
  border-left: 3px solid var(--line);
  padding-left: 1rem;
  margin: 0.4rem 0 0;
  max-width: 40rem;
  line-height: 1.65;
}
.hdoc-text p { margin: 0 0 0.85rem; }
.hdoc-text p:last-child { margin-bottom: 0; }
.hdoc-text.centred p { text-align: center; margin-bottom: 0.15rem; }
.hdoc-attrib { color: var(--muted); font-size: 0.82rem; margin: 0.9rem 0 0; }
.hdoc-editorial {
  background: var(--limit-bg);
  border: 1px solid var(--limit);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
}
.hdoc-editorial > strong { color: var(--limit); }
.hdoc-empty { color: var(--text-2); }

/* The list is COLLAPSED by default and there may be hundreds of rows, so a row
   has to be scannable on its own: a thumbnail, the title, and what the paper is.
   Built on <details>/<summary> rather than a click handler and a hidden div, so
   keyboard and screen-reader behaviour come for free and there is no open/closed
   state for the page to get wrong. */
.hdoc-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.hdoc-item + .hdoc-item { border-top: 1px solid var(--line); }
.hdoc-item > summary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1rem;
  cursor: pointer;
  /* The default triangle sits badly against a flex row with a thumbnail in it;
     .twist below is the disclosure marker instead. */
  list-style: none;
}
.hdoc-item > summary::-webkit-details-marker { display: none; }
.hdoc-item > summary:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.hdoc-item > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.hdoc-item[open] > summary { border-bottom: 1px solid var(--line); }
.hdoc-item .rowthumb {
  flex: 0 0 auto;
  width: 34px; height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--page);
}
/* Keeps the title column aligned when a document has no photograph yet. */
.hdoc-item .rowthumb.none {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 0.9rem;
}
.hdoc-item .rowmain { flex: 1 1 auto; min-width: 0; }
.hdoc-item .rowtitle {
  /* display:block matters — both of these are spans (a <summary> may not hold
     block elements in older parsers), and text-overflow does nothing on an
     inline box. */
  display: block;
  font-weight: 600;
  /* One line, ellipsed: a long title must not push the row to three lines and
     undo the compaction this whole list exists for. */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hdoc-item .rowmeta {
  display: block;
  color: var(--text-2); font-size: 0.85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hdoc-item .rowmeta .sep { color: var(--muted); padding: 0 0.3rem; }
.hdoc-item .rowmeta .todo { color: var(--limit); }
.hdoc-item .twist {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.8rem;
  transition: transform 0.12s ease;
}
.hdoc-item[open] > summary .twist { transform: rotate(90deg); }
.hdoc-item .hdoc-body { padding: 1rem 1.3rem 1.2rem; }
.hdoc-item .hdoc-body > h3:first-child { margin-top: 0.2rem; }
.hdoc-item .hdoc-body .loading { color: var(--text-2); }

/* The chosen photograph in the add form, before it is sent. */
.hdoc-pick { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.hdoc-pick .preview {
  height: 64px; width: auto; max-width: 90px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--page);
}
.hdoc-pick .picked { color: var(--text-2); font-size: 0.88rem; }
