/* Memory Feed replaces the former archive card grid on #/index. */
.memory-feed-page {
  min-height: 100vh;
  background: #fafaf9;
  color: #202020;
  --feed-ink: #202020;
  --feed-muted: #777;
  --feed-faint: #999;
  --feed-line: #e8e8e6;
  --feed-width: 540px;
  --avatar-size: 52px;
  --feed-gap: 14px;
}

.memory-feed-header {
  position: sticky;
  z-index: 30;
  top: 0;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(24px, 5.2vw, 84px);
  border-bottom: 1px solid #e9e9e6;
  background: rgba(250, 250, 249, .97);
}

.memory-feed-header__brand { width: 112px; display: flex; align-items: center; }
.memory-feed-header__brand img { width: 96px; height: 50px; object-fit: contain; object-position: left center; }
.memory-feed-header__nav { height: 100%; display: flex; align-items: stretch; gap: 34px; }
.memory-feed-header__nav a,
.memory-feed-header__nav button {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 1px 2px 0;
  border: 0;
  background: transparent;
  color: #555;
  font: 13px/1 var(--sans);
  white-space: nowrap;
}
.memory-feed-header__nav :is(a, button):hover { color: #111; }
.memory-feed-header__nav .is-current { color: #171717; font-weight: 600; }
.memory-feed-header__nav .is-current::after { position: absolute; right: 0; bottom: 8px; left: 0; height: 1px; background: #252525; content: ''; }
.memory-feed-header__tools { justify-self: end; display: flex; align-items: center; gap: 22px; }
.memory-feed-header__tools button { width: 26px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; color: #202020; }
.memory-feed-header__tools button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.memory-feed-header__language { color: #202020; font-size: 12px; letter-spacing: .04em; }
.memory-feed-search { position: absolute; top: calc(100% + 8px); right: clamp(24px, 5.2vw, 84px); width: min(350px, calc(100vw - 32px)); display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--feed-line); background: #fff; box-shadow: 0 8px 24px #16161612; }
.memory-feed-search[hidden] { display: none; }
.memory-feed-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.memory-feed-search input { min-width: 0; flex: 1; border: 0; padding: 7px 8px; outline: 0; color: var(--feed-ink); background: transparent; font-size: 13px; }
.memory-feed-search button { border: 0; padding: 8px 11px; background: #202020; color: white; font-size: 12px; }

.memory-feed { width: min(var(--feed-width), calc(100vw - 36px)); margin: 0 auto; padding: 22px 0 54px; }
.memory-feed__status { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin: 0 0 6px 66px; color: var(--feed-faint); font-size: 10px; line-height: 1.7; }
.memory-feed__status p { margin: 0; }
.memory-feed__status > span { flex: none; font-variant-numeric: tabular-nums; }
.memory-feed__filters { margin: 0 0 4px 66px; color: var(--feed-muted); font-size: 11px; }
.memory-feed__filters button { border: 0; padding: 2px 5px; background: transparent; color: var(--feed-ink); text-decoration: underline; text-underline-offset: 3px; }
.memory-post { padding: 20px 0 22px; border-bottom: 1px solid var(--feed-line); }
.memory-post__layout { display: grid; grid-template-columns: var(--avatar-size) minmax(0, 1fr); align-items: start; gap: var(--feed-gap); }
.memory-post__avatar { width: var(--avatar-size); height: var(--avatar-size); overflow: hidden; display: grid; place-items: center; border-radius: 50%; background: #efefed; color: #73736f; font: 16px/1 var(--serif); }
.memory-post__avatar img { width: 100%; height: 100%; object-fit: cover; }
.memory-post__identity { min-height: var(--avatar-size); display: flex; align-items: flex-start; gap: 10px; }
.memory-post__person { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 5px; padding-top: 4px; }
.memory-post__person strong { overflow: hidden; color: #292929; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.memory-post__person span { color: var(--feed-muted); font-size: 12px; line-height: 1.5; }
.memory-post__menu { position: relative; flex: none; }
.memory-post__menu summary { width: 28px; height: 27px; display: grid; place-items: center; list-style: none; cursor: pointer; color: #3a3a3a; }
.memory-post__menu summary::-webkit-details-marker { display: none; }
.memory-post__menu summary svg { width: 19px; height: 19px; fill: currentColor; }
.memory-post__menu-list { position: absolute; z-index: 2; top: 26px; right: 0; width: 126px; padding: 4px; border: 1px solid var(--feed-line); background: #fff; box-shadow: 0 5px 18px #1111; }
.memory-post__menu-list button { width: 100%; border: 0; padding: 9px 8px; background: transparent; color: var(--feed-ink); text-align: left; font-size: 11px; }
.memory-post__menu-list button:hover { background: #f4f4f1; }
.memory-post__body { min-width: 0; }
.memory-post__copy { margin-top: 4px; color: #252525; font: 16px/1.75 var(--serif); overflow-wrap: anywhere; }
.memory-post__copy p { margin: 0; }
.memory-post__excerpt-source { display: block; margin-top: 4px; color: var(--feed-faint); font: 10px/1.5 var(--sans); }
.memory-post__copy.is-collapsible[data-collapsed="true"] p { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 6; }
.memory-post__expand { margin-top: 3px; border: 0; padding: 0; background: none; color: #777; font: 12px var(--sans); }
.memory-post__missing-quote { margin: 1px 0 10px; color: #8a8a86; font-size: 11px; line-height: 1.7; }
.memory-post__media { width: 100%; margin-top: 11px; }
.memory-post__media.is-single { display: block; }
.memory-post__media.is-single .memory-post__media-item { width: 100%; max-height: 340px; }
.memory-post__media.is-single img { width: 100%; height: auto; max-height: 340px; object-fit: contain; background: #f0f0ed; }
.memory-post__media.is-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.memory-post__media.is-grid.is-count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.memory-post__media.is-grid.is-count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.memory-post__media-item { position: relative; min-width: 0; overflow: hidden; display: block; padding: 0; border: 0; background: #efefed; text-align: left; }
.memory-post__media.is-grid .memory-post__media-item { aspect-ratio: 1; }
.memory-post__media-item img { width: 100%; height: 100%; object-fit: cover; object-position: center; transition: opacity 150ms ease; }
.memory-post__media-item:hover img { opacity: .9; }
.memory-post__media-more { position: absolute; inset: 0; display: grid; place-items: center; background: #1717178c; color: #fff; font-size: 18px; }
.memory-post__audio-wrap { margin-top: 9px; }
.memory-post__audio-wrap > span { display: block; margin-bottom: 3px; color: var(--feed-muted); font-size: 10px; }
.memory-post__audio { width: 100%; height: 42px; }
.memory-post__external-media { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 9px 0 0; font-size: 11px; }
.memory-post__external-media a { color: #3b3b38; text-decoration: underline; text-decoration-color: #aaa8; text-underline-offset: 3px; }
.memory-post__external-media span { color: var(--feed-faint); font-size: 10px; }
.memory-post__source { margin: 5px 0 0; color: var(--feed-faint); font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.memory-post__source a { color: inherit; text-decoration: underline; text-decoration-color: #aaa8; text-underline-offset: 2px; }
.memory-post__tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 11px 0 0; padding: 0; list-style: none; }
.memory-post__tags li { border-radius: 3px; padding: 4px 9px; background: #f0f0ed; color: #62625e; font-size: 10px; }
.memory-post__actions { min-height: 30px; display: flex; align-items: center; gap: 20px; margin-top: 11px; }
.memory-post__action { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 4px 0; background: transparent; color: #555; font-size: 11px; }
.memory-post__action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.memory-post__action:hover { color: #111; }
.memory-post__action.is-saved { color: #252525; }
.memory-post__action.is-saved svg { fill: #252525; }
.memory-post__open { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; border: 0; padding: 4px 0; background: transparent; color: #666; font-size: 11px; }
.memory-post__open:hover { color: #111; }
.memory-post__open svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.memory-post__feedback { color: var(--feed-muted); font-size: 10px; }
.memory-feed__end { padding: 25px 0; color: var(--feed-faint); text-align: center; font-size: 10px; }
.memory-feed__empty { padding: 90px 10px; text-align: center; }
.memory-feed__empty h1 { margin: 0 0 9px; font: 500 22px var(--serif); }
.memory-feed__empty p { color: var(--feed-muted); font-size: 12px; }
.memory-feed__empty button { margin-top: 10px; border: 0; padding: 6px; background: transparent; color: var(--feed-muted); text-decoration: underline; text-underline-offset: 3px; }

.memory-lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; overflow: hidden; padding: 50px 64px 28px; border: 0; background: #111; color: #f5f5f2; }
.memory-lightbox::backdrop { background: #111; }
.memory-lightbox figure { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; margin: 0; }
.memory-lightbox figure img { min-height: 0; max-width: 100%; max-height: calc(100% - 55px); object-fit: contain; }
.memory-lightbox figcaption { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.memory-lightbox figcaption strong { font: 500 15px var(--serif); }
.memory-lightbox figcaption span { color: #aaa; font-size: 10px; }
.memory-lightbox__close, .memory-lightbox__step { position: absolute; z-index: 1; display: grid; place-items: center; border: 1px solid #ffffff40; border-radius: 50%; background: #222; color: #fff; }
.memory-lightbox__close { top: 18px; right: 20px; width: 36px; height: 36px; font-size: 25px; line-height: 1; }
.memory-lightbox__step { top: 50%; width: 42px; height: 42px; transform: translateY(-50%); font-size: 28px; }
.memory-lightbox__step.is-prev { left: 18px; }
.memory-lightbox__step.is-next { right: 18px; }

@media (max-width: 760px) {
  .memory-feed-header { height: 62px; grid-template-columns: 72px minmax(0, 1fr) 58px; gap: 7px; padding: 0 14px; }
  .memory-feed-header__brand { width: 70px; }
  .memory-feed-header__brand img { width: 68px; height: 48px; }
  .memory-feed-header__nav { justify-content: center; gap: clamp(12px, 5vw, 24px); }
  .memory-feed-header__nav a, .memory-feed-header__nav button { font-size: 11px; }
  .memory-feed-header__nav .is-current::after { bottom: 7px; }
  .memory-feed-header__tools { gap: 9px; }
  .memory-feed-header__tools button { width: 23px; }
  .memory-feed-header__tools button svg { width: 19px; height: 19px; }
  .memory-feed-header__language { font-size: 10px; }
  .memory-feed-search { right: 12px; }
  .memory-feed { width: calc(100vw - 32px); padding-top: 12px; }
  .memory-feed-page { --avatar-size: 48px; --feed-gap: 11px; }
  .memory-feed__status { margin-left: 59px; font-size: 9px; }
  .memory-feed__filters { margin-left: 59px; font-size: 10px; }
  .memory-post { padding: 18px 0 20px; }
  .memory-post__person { padding-top: 3px; gap: 4px; }
  .memory-post__person strong { font-size: 13px; }
  .memory-post__person span { font-size: 11px; }
  .memory-post__copy { font-size: 15px; line-height: 1.75; }
  .memory-post__media { margin-top: 9px; }
  .memory-post__media.is-single .memory-post__media-item,
  .memory-post__media.is-single img { max-height: 320px; }
  .memory-post__actions { gap: 16px; }
  .memory-post__action, .memory-post__open { font-size: 10px; }
  .memory-lightbox { padding: 52px 12px 24px; }
  .memory-lightbox__step.is-prev { left: 8px; }
  .memory-lightbox__step.is-next { right: 8px; }
}

@media (max-width: 370px) {
  .memory-feed-header { grid-template-columns: 60px minmax(0, 1fr) 52px; gap: 4px; padding-inline: 9px; }
  .memory-feed-header__brand { width: 60px; }
  .memory-feed-header__brand img { width: 59px; }
  .memory-feed-header__nav { gap: 9px; }
  .memory-feed-header__nav a, .memory-feed-header__nav button { font-size: 10px; }
  .memory-feed-header__tools { gap: 5px; }
  .memory-feed { width: calc(100vw - 28px); }
  .memory-feed-page { --avatar-size: 44px; --feed-gap: 9px; }
  .memory-post__actions { gap: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .memory-post__media-item img { transition: none; }
}
