.memories-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 86% 20%, rgba(218, 165, 75, .22), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f9f7f0 100%);
}

.memories-hero h1 {
  margin: 6px 0 10px;
  max-width: 820px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
}

.memories-hero p { max-width: 800px; }

.memories-hero-mark {
  width: 118px;
  height: 118px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 118px;
  font-size: 52px;
  color: #a67528;
  background: linear-gradient(145deg, #fff8e8, #f2e2b7);
  border: 1px solid #ead39c;
  box-shadow: inset 0 0 0 10px rgba(255,255,255,.46);
}

.memories-eyebrow {
  display: inline-block;
  color: #176c55;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.memories-errors ul {
  margin: 8px 0 0 18px;
}

.memories-section-head,
.memories-board-head,
.memory-post-head,
.memories-form-actions,
.memories-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.memories-section-head h2,
.memories-board-head h2 {
  margin: 5px 0 0;
}

.memories-public-badge,
.memories-count {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  background: #e9f8f2;
  color: #176c55;
  border: 1px solid #bfe6d7;
  font-size: 12px;
  font-weight: 800;
}

.memories-form-grid {
  grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr);
  margin-top: 18px;
}

.memories-photo-field small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.memory-honeypot {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.memory-character-count {
  margin-top: 5px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

.memory-photo-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.memory-photo-preview:empty { display: none; }

.memory-photo-preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 12px;
  background: #edf0f4;
  border: 1px solid var(--line);
}

.memory-photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.memory-photo-preview-item span {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  padding: 4px 6px;
  border-radius: 8px;
  background: rgba(15,23,42,.75);
  color: #fff;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.memories-form-actions p {
  flex: 1 1 420px;
  margin: 0;
}

.memories-board {
  margin-top: 26px;
}

.memories-board-head {
  margin-bottom: 14px;
}

.memories-post-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.memory-post {
  margin: 0;
  min-width: 0;
  align-self: start;
}

.memory-post-head {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.memory-author-avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  background: linear-gradient(135deg, #173e33, #2f8a6d);
  color: #fff;
  font-size: 18px;
  font-weight: 900;
}

.memory-post-head h3 {
  margin: 0 0 3px;
  font-size: 18px;
}

.memory-post-head time {
  color: var(--muted);
  font-size: 12px;
}

.memory-delete-form {
  margin-left: auto;
}

.memory-delete-button {
  min-height: 34px;
  padding: 6px 10px;
  width: auto;
  margin: 0;
  border-radius: 8px;
  background: #b42318;
  font-size: 12px;
}

.memory-post-message {
  margin: 4px 0 16px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.memory-slider {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: #111827;
}

.memory-slider-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
}

.memory-slider-track::-webkit-scrollbar { display: none; }

.memory-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  aspect-ratio: 4 / 3;
  background: #111827;
}

.memory-slide a {
  display: block;
  width: 100%;
  height: 100%;
}

.memory-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111827;
}

.memory-slide figcaption {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,.76);
  color: #fff;
  font-size: 11px;
}

.memory-slider-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 38px;
  height: 38px;
  min-height: 38px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: #111827;
  font-size: 28px;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
}

.memory-slider-button:hover { background: #fff; }
.memory-slider-prev { left: 10px; }
.memory-slider-next { right: 10px; }

.memory-slider-dots {
  position: absolute;
  left: 50%;
  bottom: 11px;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(15,23,42,.58);
}

.memory-slider-dots button {
  width: 8px;
  height: 8px;
  min-height: 8px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.5);
}

.memory-slider-dots button.is-active {
  width: 21px;
  background: #fff;
}

.memories-empty {
  text-align: center;
  padding: 42px 20px;
}

.memories-empty-icon {
  font-size: 48px;
  color: #a67528;
}

.memories-pagination {
  justify-content: center;
  margin-top: 20px;
}

.memories-pagination .btn { width: auto; }

@media (max-width: 850px) {
  .memories-post-list { grid-template-columns: 1fr; }
  .memories-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .memories-hero {
    grid-template-columns: 1fr;
  }

  .memories-hero-mark {
    display: none;
  }

  .memories-section-head,
  .memories-board-head,
  .memories-form-actions {
    align-items: flex-start;
  }

  .memories-form-actions button,
  .memory-delete-button,
  .memory-slider-button,
  .memory-slider-dots button,
  .memories-pagination .btn {
    width: auto;
  }

  .memory-slider-button {
    width: 36px;
  }

  .memory-slide {
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 420px) {
  .memories-hero h1 { font-size: 34px; }
  .memory-post { padding: 13px; }
  .memory-author-avatar { width: 40px; height: 40px; flex-basis: 40px; }
  .memory-slider-button { width: 34px; height: 34px; min-height: 34px; }
}
