/* The public and archive cards share the empty-state artwork from the mini-program. */
.memory-grid .module-card {
  display: grid;
  grid-template-rows: auto 1fr;
  align-items: stretch;
  padding: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 19px;
  background: var(--surface);
}

.module-cards { gap: clamp(12px, 1.8vw, 24px); }
.module-card .module-art {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1.24;
  overflow: hidden;
  isolation: isolate;
}

.module-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(13px, 1.7vw, 24px);
  min-width: 0;
}

.module-card .module-body :is(h2, h3) { font-size: clamp(19px, 2vw, 26px); margin-bottom: 6px; }
.module-card .module-body p { font-size: 14px; line-height: 1.68; text-wrap: pretty; }
.module-card .book-note { color: #85472f; margin-top: 7px; text-wrap: balance; }
.module-body .module-arrow {
  width: 24px;
  height: 16px;
  align-self: flex-end;
  margin-top: auto;
  padding-top: 24px;
  position: relative;
  color: var(--forest);
  box-sizing: content-box;
}
.module-arrow::before {
  content: '';
  position: absolute;
  right: 5px;
  top: 27px;
  width: 13px;
  height: 1px;
  background: currentColor;
}
.module-arrow::after {
  content: '';
  position: absolute;
  right: 5px;
  top: 24px;
  width: 7px;
  height: 7px;
  border-top: 1px solid;
  border-right: 1px solid;
  transform: rotate(45deg);
}

.module-art--portrait { background: radial-gradient(ellipse at 52% 25%, #f4f4ec 12%, #e1e6d9 100%); }
.module-portrait {
  width: 48%;
  height: 80%;
  min-width: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid #a8b5a4;
  border-radius: 50% 50% 6px 6px / 31% 31% 6px 6px;
  background: #d8e2d3;
  box-shadow: 0 9px 21px #39493c23;
}
.module-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 51% 44%; }
.module-portrait small {
  display: block;
  text-align: center;
  background: #faf8f0;
  color: #425448;
  padding: 5px 2px;
  font-size: 11px;
  line-height: 1.2;
}
.module-portrait-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  background: radial-gradient(ellipse at 50% 33%, #e9f0e3 15%, #becdbd);
}
.module-portrait-fallback::before {
  content: '';
  width: 35px;
  aspect-ratio: 1;
  border: 1px solid #546d58;
  border-radius: 50%;
  background: linear-gradient(135deg, #f9faf4, #d3dfce);
}

.module-art--book { background: linear-gradient(142deg, #f6efe1, #e8ddc8); }
.module-book-cover {
  position: relative;
  width: 49%;
  height: 74%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding-bottom: 7%;
  border-radius: 3px 7px 7px 3px;
  border-right: 4px solid #dccbae;
  border-bottom: 4px solid #ddcdb3;
  background: linear-gradient(90deg, #c8b390 1%, #e7d7bc 8%, #f9f0df 14%, #f5e8d1 100%);
  color: #514534;
  font-family: var(--serif);
  text-align: center;
  transform: rotate(-8deg);
  box-shadow: 0 11px 20px #57422c30;
}
.module-book-cover::after {
  content: '';
  position: absolute;
  inset: 8% 9% 9% 15%;
  border: 1px solid #a48d697a;
  border-radius: 2px;
  pointer-events: none;
}
.module-book-cover span {
  display: block;
  min-width: 0;
  margin-inline: 16% 9%;
  white-space: nowrap;
  font-size: clamp(11px, 1.1vw, 15px);
  line-height: 1.18;
}
.module-book-cover .module-book-name {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-weight: 700;
  font-size: clamp(17px, 1.8vw, 25px);
}
.module-book-cover::before {
  content: '';
  position: absolute;
  bottom: 20%;
  left: 42%;
  width: 26%;
  height: 1px;
  background: #9a7548;
}

.module-art--world { background: #e5ece6; }
.module-window {
  position: relative;
  display: grid;
  place-items: center;
  width: 64%;
  height: 76%;
  overflow: hidden;
  border: 1px solid #b4c2b4;
  border-radius: 51% 51% 17px 17px / 48% 48% 17px 17px;
  background: linear-gradient(180deg, #f6f7ef, #d6e1d5 76%, #c5d3c6);
  box-shadow: inset 0 0 0 4px #f8f9f27d;
}
.module-orbit {
  position: absolute;
  width: 89%;
  height: 42%;
  border: 1px solid #8ba08b97;
  border-radius: 50%;
  transform: rotate(-29deg);
}
.module-orbit--inner { width: 73%; height: 34%; transform: rotate(36deg); border-color: #8ba08b6b; }
.module-globe, .module-globe::before, .module-globe::after { border: 1px solid #718b73; border-radius: 50%; }
.module-globe {
  position: relative;
  height: 42%;
  aspect-ratio: 1;
  background: radial-gradient(circle at 30% 24%, #f1f5e9, #cad9c9);
}
.module-globe::before, .module-globe::after { content: ''; position: absolute; }
.module-globe::before { inset: -1px 25%; }
.module-globe::after { inset: 27% -1px; }

.module-art--letters { background: radial-gradient(ellipse at 51% 30%, #f0f2e9, #dce6db); }
.module-letter-paper {
  position: relative;
  z-index: 1;
  width: 63%;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  padding: 12%;
  background: #fffdf4;
  border-radius: 2px;
  color: #62523b;
  font-family: var(--serif);
  font-size: clamp(12px, 1.24vw, 17px);
  white-space: nowrap;
  transform: translate(-6%, -12%) rotate(-8deg);
  box-shadow: 0 10px 18px #3a493921;
}
.module-letter-paper i { width: 100%; height: 1px; background: #cfbea3; }
.module-letter-paper i:last-child { width: 70%; }
.module-envelope {
  position: absolute;
  width: 62%;
  height: 42%;
  display: grid;
  place-items: center;
  border: 1px solid #ad9a7866;
  border-radius: 3px;
  background: linear-gradient(153deg, transparent 49.4%, #b59f7a 50%, transparent 50.7%) bottom right / 55% 100% no-repeat,
              linear-gradient(27deg, transparent 49.4%, #b59f7a 50%, transparent 50.7%) bottom left / 55% 100% no-repeat,
              #ecdfc4;
  transform: translate(10%, 28%) rotate(9deg);
  box-shadow: 0 9px 16px #4238281c;
}

@media (max-width: 930px) {
  .module-card .module-art { aspect-ratio: 1.53; }
  .module-card .module-book-cover { width: 41%; }
}
@media (max-width: 640px) {
  .module-card .module-art { aspect-ratio: 1.09; }
  .module-cards { gap: 12px; }
  .module-card .module-body p { font-size: 13px; }
  .module-card .book-note { font-size: 12px; }
  .module-card .module-book-cover { width: 49%; }
  .module-book-cover span { font-size: 11px; }
}
@media (max-width: 720px) {
  .archive-shell #archive-menu .module-card .module-art { height: clamp(169px, 45vw, 227px); aspect-ratio: auto; }
  .archive-shell #archive-menu .module-portrait { width: min(45%, 154px); }
  .archive-shell #archive-menu .module-book-cover { width: min(43%, 133px); }
  .archive-shell #archive-menu .module-window { width: min(59%, 186px); }
  .archive-shell #archive-menu .module-letter-paper, .archive-shell #archive-menu .module-envelope { width: min(57%, 173px); }
}
@media (max-width: 345px) {
  .module-card .module-art { aspect-ratio: 1.46; }
}
html[data-frame="true"] .archive-shell #archive-menu .module-art { max-height: min(37vh, 260px); }
