.memory-card:hover {
  transform: translateY(-8px) rotate(calc(var(--tilt) - 3deg));
  box-shadow: 0 16px 32px rgba(0,0,0,0.18), 0 4px 8px rgba(0,0,0,0.12);
}

.collection-grid > [class*="col-"]:nth-child(4n+1) .memory-card {
  --tilt: -1.6deg;
}

.collection-grid > [class*="col-"]:nth-child(4n+2) .memory-card {
  --tilt: 1.6deg;
}

.collection-grid > [class*="col-"]:nth-child(4n+3) .memory-card {
  --tilt: -1.2deg;
}

.collection-grid > [class*="col-"]:nth-child(4n+4) .memory-card {
  --tilt: 1.2deg;
}

.collection-grid > [class*="col-"] {
  display: flex;
}

.collection-grid {
  margin-top: 1.5rem;
}

.collection-grid > [class*="col-"] .memory-card {
  width: 100%;
}

.collection-grid--archive .memory-content-wrapper .memory-content {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-weight: 300;
  font-size: 0.96rem;
  line-height: 1.6;
}

.collection-grid--archive .memory-content-wrapper {
  row-gap: 0;
}

.collection-grid--archive .memory-footer-collection {
  position: relative;
  top: -0.14rem;
  margin-bottom: 0;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.42rem;
}

.collection-grid--archive .memory-card-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.45rem 0.75rem;
  min-width: 0;
}

.collection-grid--archive .memory-card-identity {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
}

.collection-grid--archive .memory-card-identity-inline {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  min-width: 0;
  flex: 1 1 auto;
}

.collection-grid--archive .memory-year-collection {
  font-size: 0.64rem;
  font-weight: 600;
  color: rgba(232, 237, 242, 0.76);
  white-space: nowrap;
}

.collection-grid--archive .memory-year-collection svg {
  display: none;
}

.collection-grid--archive .memory-likes-collection {
  position: relative;
  z-index: 2;
  flex-wrap: wrap;
  gap: 0.28rem;
  font-size: 0.66rem;
  font-weight: 600;
  color: rgba(232, 237, 242, 0.94);
  cursor: help;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.collection-grid--archive .memory-likes-collection svg {
  width: 0.78rem;
  height: 0.78rem;
  opacity: 0.95;
}

.memory-likes-tooltip-small .tooltip-inner {
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.28rem 0.52rem;
}

.collection-grid--archive .memory-actions-inline {
  margin-top: 0;
  flex: 0 0 auto;
  justify-content: flex-end;
  min-width: 0;
}

.collection-grid--archive .memory-actions-inline button {
  max-width: 100%;
  padding: 0.34rem 0.72rem;
  font-size: 0.66rem;
  gap: 0.3rem;
  white-space: nowrap;
  text-align: center;
}

.collection-grid--archive .memory-card-category-icons {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.28rem;
  min-height: 1.35rem;
}

.collection-grid--archive .memory-category-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(232, 237, 242, 0.88);
  cursor: help;
}

.collection-grid--archive .memory-category-icon svg {
  width: 0.72rem;
  height: 0.72rem;
  opacity: 0.92;
}

.collection-grid--archive .memory-category-icon-emoji {
  width: 0.95rem;
  height: 0.95rem;
  object-fit: contain;
}

.collection-grid--archive .memory-category-empty {
  color: rgba(232, 237, 242, 0.66);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
}

@media (max-width: 1199px) {
  .collection-grid--archive .memory-card-meta-row {
    align-items: center;
  }

  .collection-grid--archive .memory-card-identity-inline {
    flex-wrap: wrap;
    gap: 0.18rem 0.55rem;
  }

  .collection-grid--archive .memory-actions-inline button {
    padding-inline: 0.58rem;
    font-size: 0.58rem;
  }
}

.collection-grid--archive .stretched-link::after {
  bottom: 92px;
}

.tag-select {
  display: none;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud--stacked {
  flex-direction: column;
  align-items: flex-start;
}

.tag-cloud--categories .tag-option {
  font-size: 0.88rem;
  gap: 0.32rem;
  padding: 0.34rem 0.72rem;
}

.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border: 1px solid #c5d3dc;
  background: rgba(248, 250, 251, 0.92);
  color: #4a5c6a;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  font-size: 0.86rem;
  transition: all 0.15s ease;
  cursor: pointer;
}

.tag-option input[type="checkbox"],
.tag-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-option.is-selected {
  background: linear-gradient(180deg, rgba(231, 237, 241, 0.96) 0%, rgba(214, 223, 230, 0.94) 100%);
  border-color: rgba(137, 157, 173, 0.72);
  color: #475968;
}

.filter-input {
  background: rgba(243, 247, 250, 0.96);
  border: 1px solid rgba(179, 197, 212, 0.85);
  border-radius: 14px;
  color: var(--ink);
  padding: 0.5rem 0.85rem;
  box-shadow: inset 0 1px 2px rgba(58, 74, 86, 0.05);
}

.filter-input:focus {
  border-color: rgba(137, 157, 173, 0.7);
  box-shadow:
    inset 0 1px 2px rgba(58, 74, 86, 0.05),
    0 0 0 0.2rem rgba(137, 157, 173, 0.16);
}

.collection-keyword-filter {
  max-width: 420px;
}

.collection-filter-actions {
  margin-top: 1.35rem;
}


.collection-header {
  background: rgba(248, 250, 251, 0.92);
  border: 1px solid #c5d3dc;
  border-radius: 16px;
  padding: 1rem 1.4rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 10px 24px rgba(58, 74, 86, 0.08);
}

.collection-header h2 {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 400;
  line-height: 1.15;
  color: #2f3944;
  margin-bottom: 0.25rem;
}

.collection-header-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.collection-meta {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 400;
  color: #3e4a55;
}

.collection-header-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.45rem;
  text-align: right;
}

.filter-summary {
  font-size: 12px;
  color: #7c8b98;
}

.collection-sort {
  display: inline-flex;
  align-items: flex-end;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.42rem;
}

.collection-sort-label {
  font-size: 12px;
  font-weight: 500;
  color: #3e4a55;
}

.collection-sort-segmented {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(168, 182, 194, 0.9);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
  overflow: hidden;
}

.collection-sort-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.38rem 0.78rem;
  background: transparent;
  color: #7b8792;
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.collection-sort-button + .collection-sort-button {
  border-left: 1px solid rgba(168, 182, 194, 0.9);
}

.collection-sort-button.is-active {
  background: linear-gradient(180deg, rgba(230, 236, 240, 0.96) 0%, rgba(214, 223, 230, 0.94) 100%);
  color: #33424f;
  font-weight: 500;
}

.collection-sort-button:hover {
  color: #445564;
}

.pagination {
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 1.6rem;
  padding-left: 0;
}

.pagination .page-link {
  border: 1px solid #c5d3dc;
  border-radius: 14px;
  background: rgba(248, 250, 251, 0.88);
  color: #4a5c6a;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 0.9rem;
  line-height: 1.2;
  padding: 0.42rem 0.72rem;
  box-shadow: none;
}

.pagination .page-link:hover {
  background: rgba(232, 238, 242, 0.9);
  border-color: #b3c5d4;
  color: #3a4a56;
}

.pagination .page-item.active .page-link {
  background: rgba(232, 238, 242, 0.96);
  border-color: #aebfcc;
  color: #33424f;
  font-weight: 600;
}

.pagination .page-item.disabled .page-link {
  background: rgba(248, 250, 251, 0.72);
  border-color: rgba(197, 211, 220, 0.8);
  color: #8b97a2;
  box-shadow: none;
}

.pagination-label-short {
  display: none;
}

@media (min-width: 992px) {
  .collection-filter-grid {
    display: grid;
    grid-template-columns: minmax(18rem, 1.38fr) minmax(8.5rem, 0.78fr) minmax(11.5rem, 0.96fr) minmax(12.5rem, 0.98fr);
    column-gap: 0.8rem;
    padding-left: 0.35rem;
  }

  .collection-filter-grid > .collection-filter-col {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
    width: auto;
  }

  .tag-cloud--categories {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(3, auto);
    grid-auto-columns: max-content;
    gap: 0.42rem 0.5rem;
  }
}

@media (max-width: 991px) {
  .collection-header {
    overflow: hidden;
  }

  .collection-header-controls {
    width: 100%;
    align-items: flex-start;
    justify-content: flex-start;
    text-align: left;
  }

  .collection-sort {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    width: 100%;
  }

  .collection-sort-segmented {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    border-radius: 18px;
  }

  .collection-sort-button {
    min-width: 0;
    min-height: 2.35rem;
    padding: 0.42rem 0.38rem;
    font-size: 0.72rem;
    line-height: 1.15;
    text-align: center;
    white-space: normal;
  }
}

@media (max-width: 767px) {
  .collection-grid {
    margin-left: 0;
    margin-right: 0;
  }

  .collection-grid > [class*="col-"] {
    padding-left: 0.35rem;
    padding-right: 0.35rem;
  }

  .collection-grid > [class*="col-"] .memory-card {
    transform: none;
  }

  .memory-card:hover {
    transform: translateY(-4px);
  }

  .collection-header {
    padding: 1rem;
  }

  .collection-header .d-flex {
    gap: 0.8rem;
  }

  .collection-header h2 {
    font-size: 1.4rem;
  }

  .collection-meta {
    font-size: 0.95rem;
    line-height: 1.45;
  }

  .pagination {
    gap: 0.28rem;
    row-gap: 0.45rem;
    margin-top: 1.35rem;
  }

  .pagination .page-link {
    min-width: 2.35rem;
    padding: 0.38rem 0.54rem;
    text-align: center;
  }

  .pagination-label-full {
    display: none;
  }

  .pagination-label-short {
    display: inline;
    font-size: 1.1rem;
    line-height: 1;
  }
}

@media (max-width: 420px) {
  .collection-sort-button {
    font-size: 0.66rem;
    padding-inline: 0.24rem;
  }

  .pagination .page-link {
    min-width: 2.15rem;
    padding: 0.34rem 0.46rem;
    font-size: 0.82rem;
  }
}
