/* A quiet album inside the shared dialog; #body remains its only scroller. */
#place.friend-book {
  --book-line: #d5b78433;
  --book-paper: #122526;
  width: min(1120px, calc(100% - 40px));
  max-width: 1120px;
  height: min(940px, 94dvh);
  max-height: 94dvh;
  padding: 26px 30px 20px;
  overflow: hidden;
  background: radial-gradient(ellipse at top left, #d5b7840a, transparent 55%), var(--room-surface, #172a29);
}
#place.friend-book[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 0; }
#place.friend-book > form { position: absolute; top: 12px; right: 12px; float: none; z-index: 5; margin: 0; background: var(--room-surface, #172a29); border-radius: 50%; }
#place.friend-book > #eyebrow { margin: 0 44px 0 0; }
#place.friend-book > #title { margin: 7px 40px 22px 0; font-size: clamp(27px, 3.4vw, 37px); line-height: 1.15; overflow-wrap: anywhere; }
#place.friend-book > #body {
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-padding-block: 18px;
  padding: 2px 10px 8px 2px;
}
#place.friend-book > .return { margin: 12px 0 0; padding-top: 12px; font-size: 11px; }
#place.friend-book .friend-book-content { min-width: 0; }
#place.friend-book .friend-book-intro { max-width: 690px; margin: 0 0 13px; color: var(--room-ink, #f0e3cd); font-size: 15px; line-height: 1.65; }
#place.friend-book .friend-book-disclosure { max-width: 720px; margin: 0 0 25px; color: var(--room-muted, #bcb29f); font-size: 12px; line-height: 1.6; }
#place.friend-book .friend-book-section-title { margin: 0 0 18px; color: var(--room-ink, #f0e3cd); font: normal 24px/1.25 Georgia, serif; }
#place.friend-book .friend-book-guide-hint { margin: -6px 0 20px; color: var(--room-muted, #bcb29f); font-size: 12px; line-height: 1.5; }

/* Small portrait rows make the people guide feel separate from the photographs. */
#place.friend-book .friend-book-guide { padding: 21px 24px 23px; border: 1px solid var(--book-line); border-radius: 8px; background: #d5b78404; }
#place.friend-book .friend-book-people-group + .friend-book-people-group { margin-top: 23px; padding-top: 20px; border-top: 1px solid #d5b7841c; }
#place.friend-book .friend-book-people-group > :is(h2, h3) { margin: 0 0 15px; color: var(--room-muted, #bcb29f); font: normal 12px/1.4 Georgia, serif; letter-spacing: 1px; }
#place.friend-book .friend-book-people { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 15px; width: 100%; max-width: 660px; list-style: none; margin: 0; padding: 0; }
#place.friend-book .friend-book-people-group[data-kind="ai"] .friend-book-people { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 525px; }
#place.friend-book .friend-book-person { min-width: 0; }
#place.friend-book .friend-book-person figure { margin: 0; text-align: center; }
#place.friend-book .friend-book-person-button { display: block; width: min(100%, 96px); height: auto; aspect-ratio: 1; margin-inline: auto; padding: 0; border: 0; border-radius: 9px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
#place.friend-book .friend-book-portrait { display: block; position: relative; width: min(100%, 96px); aspect-ratio: 1; margin-inline: auto; overflow: hidden; border: 1px solid #d5b78466; border-radius: 9px; background: #0c191a; box-shadow: 0 4px 12px #0002; }
#place.friend-book .friend-book-person-button .friend-book-portrait { width: 100%; height: 100%; }
#place.friend-book .friend-book-person-button:hover .friend-book-portrait { border-color: #f4d59b; box-shadow: 0 0 0 1px #f4d59b55; }
/* Inline source/crop percentages also support the preserved original portraits. */
#place.friend-book .friend-book-portrait img { position: absolute; display: block; max-width: none; max-height: none; object-fit: fill; }
#place.friend-book .friend-book-portrait-placeholder { display: grid; place-items: center; color: var(--room-muted, #bcb29f); background: radial-gradient(circle at 35% 25%, #d5b78413, transparent 70%), #0c191a; font: normal 38px/1 Georgia, serif; }
#place.friend-book .friend-book-portrait-status { margin: 5px 0 0; color: var(--room-muted, #bcb29f); font-size: 10px; line-height: 1.4; }
#place.friend-book .friend-book-person figcaption { margin-top: 10px; color: var(--room-ink, #f0e3cd); font-size: 17px; line-height: 1.3; overflow-wrap: anywhere; }
#place.friend-book .friend-book-description { margin: 5px auto 0; max-width: 145px; color: var(--room-muted, #bcb29f); font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }

/* Native, labelled controls stay in the album's single reading flow. */
#place.friend-book .friend-book-memories { margin-top: 32px; }
#place.friend-book .friend-book-filter-bar { position: static; float: none; z-index: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; gap: 15px; width: 100%; margin: 0 0 9px; padding: 18px; border: 1px solid var(--book-line); border-radius: 8px; background: var(--book-paper); }
#place.friend-book .friend-book-filter-label { display: grid; min-width: 0; gap: 8px; color: var(--room-muted, #bcb29f); font: normal 12px/1.4 Georgia, serif; }
#place.friend-book .friend-book-search-label { grid-column: span 2; }
#place.friend-book .friend-book-filter-bar :is(input, select) { width: 100%; min-width: 0; min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #cfb78f55; border-radius: 5px; background: #0b1c1e; color: var(--room-ink, #f0e3cd); color-scheme: dark; font: normal 16px/1.35 Georgia, serif; text-overflow: ellipsis; }
#place.friend-book .friend-book-filter-bar select { padding-right: 27px; }
#place.friend-book .friend-book-filter-bar input::placeholder { color: #bcb29f99; opacity: 1; }
#place.friend-book .friend-book-clear-filters { grid-column: 3 / -1; justify-self: end; width: auto; height: auto; min-height: 44px; align-self: end; font-family: Georgia, serif; }
#place.friend-book .friend-book-result-count { margin: 0 0 22px; color: var(--room-muted, #bcb29f); font-size: 12px; line-height: 1.5; text-align: right; }
#place.friend-book .friend-book-filter-note { margin: 0 0 18px; padding: 10px 12px; border-left: 2px solid var(--room-accent, #d5b784); background: #d5b78409; color: var(--room-muted, #bcb29f); font-size: 12px; line-height: 1.6; }

#place.friend-book .friend-book-date-group + .friend-book-date-group { margin-top: 34px; }
#place.friend-book .friend-book-date-heading { margin: 0 0 17px; padding: 0 0 12px; border-bottom: 1px solid var(--book-line); color: var(--room-accent, #d5b784); font: normal 20px/1.35 Georgia, serif; overflow-wrap: anywhere; }
#place.friend-book .friend-book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; gap: 20px; }
#place.friend-book .friend-book-card { display: flex; flex-direction: column; width: 100%; height: auto; min-width: 0; padding: 0; overflow: hidden; border: 1px solid var(--book-line); border-radius: 7px; background: var(--book-paper); color: var(--room-ink, #f0e3cd); text-align: left; font-family: Georgia, serif; transition: border-color .2s, background .2s, box-shadow .2s; }
#place.friend-book .friend-book-card:hover { border-color: var(--room-accent, #d5b784); background: #19302f; box-shadow: 0 5px 18px #0002; }
#place.friend-book .friend-book-card .friend-book-image { display: block; width: 100%; height: auto; aspect-ratio: 4/5; object-fit: contain; background: #091719; border-bottom: 1px solid #d5b78420; }
#place.friend-book :is(.friend-book-card-title, .friend-book-card-people) { display: block; padding: 15px 16px 0; color: var(--room-ink, #f0e3cd); font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
#place.friend-book .friend-book-meta { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 5px 16px; color: var(--room-muted, #bcb29f); font-size: 12px; line-height: 1.6; }
#place.friend-book .friend-book-card .friend-book-meta { margin-top: auto; padding: 9px 16px 16px; }
#place.friend-book .friend-book-credit { white-space: nowrap; }

/* Only the detail navigation sticks; the original image is never cover-cropped. */
#place.friend-book .friend-book-toolbar { position: sticky; top: -2px; z-index: 2; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 0 0 20px; padding: 4px 0 13px; border-bottom: 1px solid var(--book-line); background: var(--room-surface, #172a29); }
#place.friend-book .friend-book-toolbar .story-action { width: auto; height: auto; min-height: 44px; white-space: nowrap; }
#place.friend-book .friend-book-page-nav { display: flex; align-items: center; gap: 9px; }
#place.friend-book .friend-book-position { min-width: 48px; text-align: center; font-size: 12px; color: var(--room-muted, #bcb29f); }
#place.friend-book .friend-book-memory { margin: 0; min-width: 0; }
#place.friend-book .friend-book-memory > .friend-book-image { display: block; width: 100%; height: auto; max-height: 59dvh; object-fit: contain; background: #091719; border: 1px solid var(--book-line); border-radius: 6px; }
#place.friend-book .friend-book-caption { padding: 0 0 18px; }
#place.friend-book .friend-book-left-to-right { margin: 0 0 8px; color: var(--room-ink, #f0e3cd); font-size: 18px; line-height: 1.5; overflow-wrap: anywhere; }
#place.friend-book .friend-book-status,
#place.friend-book .friend-book-empty { margin: 16px 0; padding: 20px; border: 1px solid var(--book-line); border-radius: 6px; color: var(--room-muted, #bcb29f); font-size: 14px; line-height: 1.7; }
#place.friend-book :is(button, input, select):focus-visible,
#place.friend-book .friend-book-section-title:focus-visible { outline: 2px solid #f4d59b; outline-offset: 3px; }

@media (max-width: 900px) {
  #place.friend-book .friend-book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #place.friend-book .friend-book-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #place.friend-book .friend-book-clear-filters { grid-column: 1 / -1; }
}
@media (max-width: 600px) {
  #place.friend-book { width: calc(100% - 16px); padding: 20px 16px 15px; }
  #place.friend-book > #title { font-size: 28px; margin-bottom: 18px; }
  #place.friend-book > #body { padding-right: 7px; }
  #place.friend-book .friend-book-intro { font-size: 14px; }
  #place.friend-book .friend-book-disclosure { margin-bottom: 20px; font-size: 11px; }
  #place.friend-book .friend-book-guide { padding: 17px 14px 19px; }
  #place.friend-book .friend-book-people { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px 12px; }
  #place.friend-book .friend-book-people-group[data-kind="ai"] .friend-book-people { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 235px; gap: 17px 12px; }
  #place.friend-book .friend-book-portrait { width: min(100%, 78px); }
  #place.friend-book .friend-book-person-button { width: min(100%, 78px); }
  #place.friend-book .friend-book-person figcaption { margin-top: 8px; font-size: 16px; }
  #place.friend-book .friend-book-description { font-size: 11px; }
  #place.friend-book .friend-book-memories { margin-top: 27px; }
  #place.friend-book .friend-book-section-title { font-size: 23px; }
  #place.friend-book .friend-book-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 10px; padding: 13px; }
  #place.friend-book .friend-book-filter-label { font-size: 11px; gap: 6px; }
  #place.friend-book .friend-book-filter-label:is([for="friend-book-sort"], [for="friend-book-date"]) { grid-column: 1 / -1; }
  #place.friend-book .friend-book-filter-bar :is(input, select) { padding-left: 10px; font-size: 16px; }
  #place.friend-book .friend-book-clear-filters { grid-column: 1 / -1; justify-self: stretch; width: 100%; }
  #place.friend-book .friend-book-result-count { font-size: 11px; }
  #place.friend-book .friend-book-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  #place.friend-book .friend-book-date-heading { font-size: 19px; }
  #place.friend-book .friend-book-date-group + .friend-book-date-group { margin-top: 28px; }
  #place.friend-book .friend-book-card .friend-book-image { aspect-ratio: 1; }
  #place.friend-book .friend-book-toolbar { gap: 10px; margin-bottom: 17px; }
  #place.friend-book .friend-book-toolbar .story-action { padding: 8px 10px !important; font-size: 12px !important; }
  #place.friend-book .friend-book-page-nav { gap: 7px; }
  #place.friend-book .friend-book-memory > .friend-book-image { max-height: none; }
  #place.friend-book .friend-book-left-to-right { font-size: 17px; }
}
@media (max-width: 360px) {
  #place.friend-book { padding-inline: 13px; }
  #place.friend-book .friend-book-guide { padding-inline: 11px; }
  #place.friend-book .friend-book-people { gap: 16px 10px; }
  #place.friend-book .friend-book-portrait { width: min(100%, 68px); }
  #place.friend-book .friend-book-person-button { width: min(100%, 68px); }
  #place.friend-book .friend-book-person figcaption { font-size: 15px; }
  #place.friend-book .friend-book-filter-bar { padding: 11px; }
  #place.friend-book .friend-book-toolbar .story-action { padding-inline: 8px !important; }
  #place.friend-book .friend-book-position { min-width: 43px; }
}
@media (max-height: 650px) {
  #place.friend-book { padding-block: 14px; }
  #place.friend-book > #title { margin-block: 6px 10px; font-size: 25px; }
  #place.friend-book > .return { margin-top: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #place.friend-book .friend-book-card { transition: none; }
}
@media (forced-colors: active) {
  #place.friend-book :is(.friend-book-guide, .friend-book-filter-bar, .friend-book-card, .friend-book-portrait, .friend-book-memory > .friend-book-image) { border-color: CanvasText; }
  #place.friend-book :is(button, input, select):focus-visible { outline-color: Highlight; }
}
