/* Person page header: the Stammbaum panel's language (serif name, quiet labels,
   relatives with miniatures) laid out as one card above the photos. */
#people-directory.fz-page .person-back {
  display: inline-block;
  font-size: 0.9375rem;
  color: var(--hb-muted);
  text-decoration: none;
}
#people-directory.fz-page .person-back:hover {
  color: var(--hb-ink);
}
#people-directory.fz-page .person-hero {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr) minmax(14rem, 17rem);
  gap: 2.25rem;
  align-items: start;
  margin: 1rem 0 3rem;
  padding: 2rem;
  background: var(--fz-surface);
  border: 1px solid var(--hb-hair);
  border-radius: 1.25rem;
  box-shadow: 0 1.4rem 2.6rem -2rem rgba(22, 32, 26, 0.35);
  overflow-wrap: anywhere;
}

/* Portrait */
#people-directory.fz-page .person-hero-portrait {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  padding: 0;
  border: 0;
  border-radius: 0.9rem;
  background: #ecece6;
  overflow: hidden;
}
#people-directory.fz-page .person-hero-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 20%;
  transition: filter 0.2s;
}
#people-directory.fz-page button.person-hero-portrait:hover img {
  filter: brightness(0.92);
}
.person-hero-initials {
  display: grid;
  place-items: center;
  height: 100%;
  font: italic 400 4rem/1 var(--hb-display);
  color: #8a918b;
}
.person-hero-portrait-badge {
  position: absolute;
  right: 0.6rem;
  bottom: 0.6rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--hb-ink);
  box-shadow: 0 0.4rem 1rem -0.6rem rgba(22, 32, 26, 0.6);
}

/* Name and facts */
#people-directory.fz-page .person-hero h1 {
  margin: 0 0 1.25rem;
  font: 400 clamp(2.4rem, 4vw, 3.3rem) / 1.02 var(--hb-display);
  letter-spacing: -0.01em;
  color: var(--hb-ink);
  text-wrap: balance;
}
.person-facts-list {
  margin: 0;
}
.person-facts-list > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--hb-hair);
}
.person-facts-list > div:last-child {
  border-bottom: 1px solid var(--hb-hair);
}
.person-facts-list dt {
  padding-top: 0.2rem;
  font: 500 0.875rem/1.4 var(--fz-font);
  color: var(--hb-faint);
}
.person-facts-list dd {
  margin: 0;
  font: 400 1.15rem/1.45 var(--hb-text);
  color: var(--hb-ink);
}
.person-facts-list dd > span {
  display: block;
}
#people-directory.fz-page .person-facts-more {
  margin-top: 0.15rem;
  padding: 0;
  border: 0;
  background: none;
  font: 500 0.875rem/1.4 var(--fz-font);
  color: var(--hb-muted);
  text-decoration: underline;
  text-decoration-color: #c3c9c1;
  text-underline-offset: 0.2em;
}
#people-directory.fz-page .person-facts-more:hover {
  color: var(--hb-ink);
}
.person-facts-list em {
  font-style: normal;
  color: #7f6630;
}
#people-directory.fz-page .person-hero-open {
  margin: 0.9rem 0 0;
  font-size: 0.9375rem;
  color: #7f6630;
}
.person-hero-notes {
  margin-top: 0.9rem;
  font-size: 0.9375rem;
  color: var(--hb-muted);
}
#people-directory.fz-page .person-hero-notes summary {
  font-weight: 500;
  color: var(--hb-muted);
}
#people-directory.fz-page .person-hero-notes p {
  margin: 0.5rem 0 0;
  max-width: 44rem;
  color: var(--hb-muted);
}

/* Buttons: one filled pill for the main action, outlined pills for the rest. */
#people-directory.fz-page .person-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}
#people-directory.fz-page .person-button,
.person-relation-dialog .person-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.6rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 0.9688rem/1.2 var(--fz-font);
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
#people-directory.fz-page .person-button--ink {
  background: var(--hb-ink);
  border-color: var(--hb-ink);
  color: #fff;
}
#people-directory.fz-page .person-button--ink:hover:not(:disabled) {
  background: #343a36;
}
#people-directory.fz-page .person-button--outline,
.person-relation-dialog .person-button--outline {
  background: var(--fz-surface);
  border-color: #c9cec7;
  color: var(--hb-ink);
}
#people-directory.fz-page .person-button--outline:hover {
  background: var(--hb-ground);
  border-color: #aeb4ac;
}
#people-directory.fz-page .person-button--quiet {
  background: transparent;
  color: var(--hb-muted);
}
#people-directory.fz-page .person-button--quiet:hover {
  color: var(--hb-ink);
  background: var(--hb-ground);
}

/* Family column */
#people-directory.fz-page .person-family {
  display: grid;
  gap: 1.1rem;
  margin: 0;
  padding-left: 2rem;
  border-left: 1px solid var(--hb-hair);
}
#people-directory.fz-page .person-family h3 {
  margin: 0 0 0.25rem;
  font: 500 0.875rem/1.4 var(--fz-font);
  color: var(--hb-faint);
}
.person-family ul {
  display: grid;
  gap: 0.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.person-family li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.person-family li > a {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  margin-left: -0.4rem;
  padding: 0.3rem 0.4rem;
  border-radius: 0.5rem;
  color: var(--hb-ink);
  text-decoration: none;
  transition: background 0.15s;
}
.person-family li > a:hover {
  background: var(--hb-ground);
}
.person-mini {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: #ecece6;
  color: #7d847e;
  font: italic 400 0.9rem/1 var(--hb-display);
  overflow: hidden;
}
.person-mini img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.person-family-name {
  font: 500 1.08rem/1.2 var(--hb-text);
}
.person-family-name small {
  display: block;
  margin-top: 0.1rem;
  font: 400 0.8125rem/1.3 var(--fz-font);
  color: var(--hb-faint);
}
#people-directory.fz-page .person-family-remove {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--hb-muted);
}
#people-directory.fz-page .person-family-remove:hover:not(:disabled) {
  color: #a52d2d;
  background: #f7eceb;
}
.person-family-unlisted li > span {
  flex: 1;
  font: 500 1.02rem/1.2 var(--hb-text);
}
.person-family-unlisted small {
  display: block;
  font: 400 0.8125rem/1.3 var(--fz-font);
  color: var(--hb-faint);
}
#people-directory.fz-page .person-family-empty,
#people-directory.fz-page .person-family-warning {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--hb-muted);
}
#people-directory.fz-page .person-family-warning {
  color: #7f6630;
}
#people-directory.fz-page .person-family-add {
  justify-self: start;
}

/* In-place editing */
#people-directory.fz-page .person-edit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: start;
}
#people-directory.fz-page .person-edit label {
  display: grid;
  gap: 0.35rem;
}
.person-edit label > span,
.person-edit-label {
  font: 500 0.875rem/1.3 var(--fz-font);
  color: var(--hb-muted);
}
.person-edit label > span small {
  font-weight: 400;
  color: var(--hb-faint);
}
#people-directory.fz-page
  .person-edit
  input:not([type="checkbox"], [type="radio"]) {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 1rem;
}
#people-directory.fz-page .person-edit input[aria-invalid="true"] {
  border-color: #b85a55 !important;
}
.person-edit-error {
  font-size: 0.8125rem;
  color: #a52d2d;
}
.person-edit-wide {
  grid-column: 1 / -1;
}
#people-directory.fz-page .person-edit .person-edit-check {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 0.55rem;
  min-height: 2.75rem;
  font-size: 0.9375rem;
  color: var(--hb-muted);
}
.person-edit-check input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--hb-ink);
}
.person-edit-death,
.person-edit-locked {
  display: grid;
  gap: 0.35rem;
}
.person-edit-locked p {
  margin: 0;
  padding: 0.55rem 0 0;
  font: 400 1.1rem/1.4 var(--hb-text);
}
.person-edit-locked small {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.1rem;
  font: 400 0.8125rem/1.3 var(--fz-font);
  color: var(--hb-faint);
}
.person-edit-switch {
  display: inline-flex;
  justify-self: start;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--hb-ground);
  border: 1px solid var(--hb-hair);
}
#people-directory.fz-page .person-edit-switch label {
  display: flex;
  align-items: center;
  min-height: 2.3rem;
  padding: 0 1rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  color: var(--hb-muted);
  cursor: pointer;
}
.person-edit-switch label:has(input:checked) {
  background: var(--fz-surface);
  color: var(--hb-ink);
  box-shadow: 0 0.2rem 0.6rem -0.3rem rgba(22, 32, 26, 0.45);
}
.person-edit-switch label:has(input:focus-visible) {
  outline: 2px solid rgba(27, 31, 28, 0.35);
  outline-offset: 2px;
}
.person-edit-switch label:has(input:disabled) {
  cursor: default;
  opacity: 0.7;
}
.person-edit-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.person-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.4rem;
}

/* Photo sections below the header, in the same voice. Scoped to this page; the
   face question itself is shared with "Fotos erkennen". */
#people-directory.fz-page [data-person-photos] {
  margin-top: 0;
  margin-bottom: 3rem;
}
#people-directory.fz-page [data-person-photos] > h2 {
  margin: 0 0 0.4rem;
  font: 400 2rem/1.1 var(--hb-display);
  letter-spacing: 0;
  color: var(--hb-ink);
}
#people-directory.fz-page [data-person-photos] > h2 > span {
  color: var(--hb-faint);
}
#people-directory.fz-page [data-person-photos] > p {
  margin: 0 0 1.25rem;
  color: var(--hb-muted);
}
#people-directory.fz-page .person-photos article {
  border-color: var(--hb-hair);
  border-radius: 0.9rem;
}
#people-directory.fz-page .person-photos .identity-question {
  padding: 0.75rem;
  border-radius: 0.7rem;
  background: var(--hb-ground);
}
#people-directory.fz-page .person-photos .identity-question strong {
  font: 500 1.02rem/1.3 var(--hb-text);
}
#people-directory.fz-page .person-photos .identity-question button {
  min-height: 2.5rem;
  border-radius: 999px;
  font-weight: 500;
}
#people-directory.fz-page
  .person-photos
  .identity-question
  [data-confirm-person] {
  background: var(--hb-ink) !important;
  border-color: var(--hb-ink) !important;
}
#people-directory.fz-page
  .person-photos
  .identity-question
  [data-confirm-person]:hover:not(:disabled) {
  background: #343a36 !important;
}
#people-directory.fz-page
  .person-photos
  .identity-question
  button:not([data-confirm-person]) {
  border-color: #c9cec7;
}

/* Rare repairs at the end of the page */
#people-directory.fz-page .person-manage {
  margin-top: 3rem;
  padding: 1rem 1.25rem;
  background: transparent;
}
#people-directory.fz-page .person-manage > summary {
  font-weight: 500;
  color: var(--hb-muted);
}

/* Relationship dialog */
.person-relation-dialog {
  box-sizing: border-box;
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1.75rem;
  border: 0;
  border-radius: 1.1rem;
  background: var(--fz-surface);
  color: var(--fz-ink);
  font-family: var(--fz-font);
  box-shadow: 0 2rem 4rem -2rem rgba(22, 32, 26, 0.55);
}
.person-relation-dialog::backdrop {
  background: rgba(16, 24, 19, 0.45);
}
.person-dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--hb-ground);
  color: var(--hb-ink);
  cursor: pointer;
}
.person-relation-dialog form {
  display: grid;
  gap: 1rem;
}
.person-relation-dialog h3 {
  margin: 0 3rem 0.25rem 0;
  font: 400 1.9rem/1.1 var(--hb-display);
}
.person-relation-dialog label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--hb-muted);
}
.person-relation-dialog :is(input:not([type="checkbox"]), select) {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--fz-control-line);
  border-radius: 0.6rem;
  background: var(--fz-surface);
  color: var(--fz-ink);
  font: 400 1rem var(--fz-font);
}
.person-relation-dialog fieldset {
  margin: 0;
  padding: 0.75rem 1rem 1rem;
  border: 1px solid var(--hb-hair);
  border-radius: 0.75rem;
}
.person-relation-dialog [data-relation] > button[type="submit"] {
  justify-self: start;
  min-height: 2.75rem;
  padding: 0.6rem 1.3rem;
  border: 0;
  border-radius: 999px;
  background: var(--hb-ink);
  color: #fff;
  font: 500 0.9688rem/1.2 var(--fz-font);
  cursor: pointer;
}
.person-relation-dialog [data-relation-status]:empty {
  display: none;
}

/* Tablet: family moves below name and facts. */
@media (max-width: 980px) {
  #people-directory.fz-page .person-hero {
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 2rem;
  }
  #people-directory.fz-page .person-family {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    align-items: start;
    padding: 1.5rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--hb-hair);
  }
  .person-family
    > :is(
      .person-family-empty,
      .person-family-warning,
      .person-family-unlisted,
      .person-family-add
    ) {
    grid-column: 1 / -1;
  }
}

/* Phone: small round portrait beside the name, everything else full width. */
@media (max-width: 640px) {
  #people-directory.fz-page .person-hero {
    grid-template-columns: 5.5rem minmax(0, 1fr);
    gap: 1.25rem 1rem;
    margin-top: 0.75rem;
    padding: 1.25rem;
    border-radius: 1rem;
  }
  #people-directory.fz-page .person-hero-portrait {
    grid-row: 1;
    aspect-ratio: 1;
    border-radius: 50%;
    overflow: visible;
  }
  #people-directory.fz-page .person-hero-portrait img {
    border-radius: 50%;
  }
  .person-hero-initials {
    font-size: 2rem;
  }
  .person-hero-portrait-badge {
    right: -0.15rem;
    bottom: -0.15rem;
    width: 1.9rem;
    height: 1.9rem;
  }
  .person-hero-main {
    display: contents;
  }
  .person-hero-main > * {
    grid-column: 1 / -1;
  }
  #people-directory.fz-page .person-hero-main > h1 {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    margin: 0;
    font-size: clamp(2rem, 9vw, 2.5rem);
  }
  .person-facts-list > div {
    grid-template-columns: 6.25rem minmax(0, 1fr);
    gap: 0.75rem;
  }
  .person-facts-list dd {
    font-size: 1.08rem;
  }
  #people-directory.fz-page .person-hero-actions {
    margin-top: 0;
  }
  #people-directory.fz-page .person-hero-actions > * {
    flex: 1 1 auto;
  }
  #people-directory.fz-page .person-family {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 1.25rem;
  }
  #people-directory.fz-page .person-edit {
    grid-template-columns: minmax(0, 1fr);
  }
  #people-directory.fz-page .person-edit .person-edit-check {
    min-height: 0;
  }
  .person-relation-dialog {
    padding: 1.25rem;
  }
}

/* Keep the whole photo as context, with the face and decision together below it. */
#people-directory.fz-page .person-photo-section > h2 {
  margin-bottom: 0.5rem;
}
#people-directory.fz-page .person-photo-section > p {
  margin: 0 0 1.25rem;
}
#people-directory.fz-page [data-person-photos="suggested"] .person-photos {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  align-items: stretch;
  gap: 1.25rem;
}
#people-directory.fz-page [data-person-photos="suggested"] article {
  min-width: 0;
}
#people-directory.fz-page
  [data-person-photos="suggested"]
  .identity-photo-context {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 0;
  background: #ebece5;
}
#people-directory.fz-page [data-person-photos="suggested"] .face-marked-image,
#people-directory.fz-page
  [data-person-photos="suggested"]
  .face-marked-image
  > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
}
#people-directory.fz-page .person-photos article > .person-suggestion-review {
  display: block;
  padding: 1rem;
  border-top: 1px solid var(--fz-line, #d2dbc9);
}
#people-directory.fz-page .person-suggestion-review .identity-face-question {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 0.875rem;
}
#people-directory.fz-page .person-suggestion-review .person-open-face {
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
}
#people-directory.fz-page .person-suggestion-review [data-suggested-crop] {
  width: 72px;
  height: 72px;
  margin: 0;
  border-radius: 0.5rem;
}
#people-directory.fz-page .person-suggestion-review .identity-question {
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 0.625rem 0.5rem;
  background: transparent;
}
#people-directory.fz-page .person-suggestion-review .identity-question strong {
  font: 500 0.9375rem/1.4 var(--fz-font, sans-serif);
  overflow-wrap: anywhere;
}
#people-directory.fz-page .person-suggestion-review .identity-question button {
  min-height: 44px;
  padding: 0.5rem 0.625rem;
  border-radius: 99px;
}
#people-directory.fz-page .person-suggestion-review [role="status"] {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
@media (max-width: 550px) {
  #people-directory.fz-page [data-person-photos="suggested"] .person-photos {
    grid-template-columns: minmax(0, 1fr);
  }
}
