html[data-scene="memories"] .sky {
  background: radial-gradient(ellipse at 57% 42%, #211a39, #090d1c 67%);
}
html[data-scene="memories"] .sky-cloud {
  background-image: url("../assets/images/midnight-dust.webp");
  opacity: .68;
}
html[data-scene="memories"] .sky::after {
  background: radial-gradient(ellipse at 51% 45%, #10101d18 15%, #080c1a8c 85%);
}
.memories {
  width: min(100%, 1000px);
  margin-inline: auto;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 19px;
  padding-block: clamp(20px, 4.5svh, 42px) 20px;
}
.memories-intro { text-align: center; }
.memories-intro .eyebrow {
  font: 400 clamp(12px, 3.2vw, 18px)/1.3 var(--serif);
  letter-spacing: .24em;
}
.memories-intro h2 {
  color: var(--ivory);
  font: 400 clamp(42px, 11.5vw, 79px)/1.13 var(--display-song);
  transform: skewX(-6deg);
  letter-spacing: .04em;
  margin-block: 5px 9px;
}
.memories-dedication {
  font: 400 clamp(14px, 4.1vw, 19px)/1.5 var(--display-song);
  letter-spacing: .09em;
  color: #edd4c5;
  margin-top: 9px;
}
.memory-album { width: min(100%, 510px); min-width: 0; }
.memory-reel {
  display: grid;
  grid-template-columns: 44px minmax(0, auto) 44px;
  gap: clamp(6px, 2vw, 16px);
  align-items: center;
  justify-content: center;
}
.memory-arrow {
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  background: #15172a99;
  border: 1px solid #e7c2a76b;
  color: var(--champagne);
  border-radius: 50%;
  font: 400 24px/1 var(--serif);
  cursor: pointer;
}
.memory-arrow:hover { background: #4b354bbf; }
.memory-arrow:disabled, .memory-frame:disabled { cursor: default; opacity: .55; }
.memory-frame {
  position: relative;
  display: block;
  padding: 9px 14px;
  width: clamp(148px, 52vw, 239px);
  max-width: 100%;
  aspect-ratio: .49;
  background: linear-gradient(145deg, #413247, #1b1b2b 48%, #32273c);
  border: 1px solid #e5bd9c83;
  border-radius: 10px;
  box-shadow: 0 15px 45px #07071da6, inset 0 0 0 2px #1a1629;
  cursor: zoom-in;
  touch-action: pan-y pinch-zoom;
  overflow: hidden;
}
.memory-frame::before, .memory-frame::after {
  position: absolute;
  inset: 10px auto;
  content: "";
  width: 5px;
  background: repeating-linear-gradient(#eac5a354 0 4px, transparent 4px 17px);
  border-radius: 1px;
}
.memory-frame::before { left: 4px; }
.memory-frame::after { right: 4px; }
.memory-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 3px;
}
.memory-zoom {
  position: absolute;
  right: 17px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #19162dee;
  border: 1px solid #f3cd99ab;
  color: #ffecd3;
  font: 400 18px var(--serif);
}
.memory-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .65em;
  margin: 8px 0 9px;
  color: #e7c09f;
  font: 400 15px/1.35 var(--serif);
  letter-spacing: .14em;
}
.memory-story { color: var(--muted); text-align: center; margin-bottom: 9px; }
.memory-gesture { display: none; color: var(--muted); font: 12px/1.4 var(--body); letter-spacing: .04em; }
@media (pointer: coarse) {
  .memory-gesture { display: inline; }
}
.memory-thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(54px, 1fr);
  overflow-x: auto;
  gap: clamp(4px, 1.5vw, 9px);
  padding: 4px 4px 7px;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 4px;
  scrollbar-width: thin;
  scrollbar-color: #ad806b #161627;
}
.memory-thumb {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 47px;
  background: #1b182a;
  color: #f5d6bb;
  border: 1px solid #f0c5a94c;
  border-radius: 4px;
  padding: 4px 3px 3px;
  cursor: pointer;
  font: 400 11px/1 var(--serif);
  scroll-snap-align: start;
}
.memory-thumb[aria-pressed="true"] { border-color: #edc49e; background: #53394e; box-shadow: inset 0 0 0 1px #edc49e5e; }
.memory-thumb img {
  display: block;
  width: 100%;
  height: clamp(32px, 8.3vw, 46px);
  object-fit: contain;
  margin-bottom: 3px;
}
.memories-back { font-family: var(--display-song); border-color: #e7c2a75e; }
.memory-editor {
  margin-top: 9px;
  text-align: center;
  color: var(--champagne);
}
.memory-editor summary { cursor: pointer; min-height: 44px; padding: 11px 8px; }
.memory-editor[open] {
  border: 1px solid #e7c2a75e;
  background: #15172ad9;
  border-radius: 12px;
  padding: 0 10px 9px;
}
.memory-editor p { color: var(--muted); font-size: 13px; }
.memory-editor-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 10px 0; }
.memory-editor-actions button {
  min-height: 44px;
  color: var(--champagne);
  border: 1px solid #e7c2a75e;
  background: #30243b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.memory-editor-actions button:disabled { opacity: .48; cursor: default; }
.memory-editor-status:empty { display: none; }

.viewing-memory { overflow: hidden; }
.memory-viewer {
  width: min(calc(100% - 22px), 660px);
  max-width: none;
  max-height: min(calc(100% - 22px), 900px);
  max-height: min(calc(100dvh - 22px), 900px);
  overflow: hidden;
  padding: 0;
  color: var(--white);
  background: #141628;
  border: 1px solid #dcb29085;
  border-radius: 15px;
}
.memory-viewer[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  animation: scene-in .2s ease both;
}
.memory-viewer::backdrop { background: #060713e8; }
.memory-viewer-head, .memory-viewer-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
}
.memory-viewer-head { justify-content: space-between; min-height: 38px; }
.memory-viewer-head h2 { color: var(--champagne); font: 400 18px var(--display-song); }
.memory-viewer-head span { color: var(--muted); font-size: 12px; }
.memory-viewer-nav { justify-content: center; color: var(--champagne); font: 400 16px var(--serif); }
.memory-viewer-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; outline-offset: -3px; touch-action: pan-y pinch-zoom; }
.memory-viewer-image { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-out; }
.memory-viewer-image:focus-visible { outline-offset: -3px; }
.memory-viewer-scroll img { display: block; width: 100%; height: auto; margin-inline: auto; }
.memory-unavailable { display: block; color: var(--muted); padding: 16px 6px; font-size: 13px; }
.memory-viewer-scroll .memory-unavailable { min-height: 125px; text-align: center; }

@media (min-width: 800px) {
  .memories { grid-template: 1fr auto 1fr / minmax(0, .8fr) minmax(0, 1.2fr); gap: 15px 30px; }
  .memories-intro { grid-area: 1/1/3/2; align-self: end; }
  .memory-album { grid-area: 1/2/4/3; }
  .memories-back { grid-area: 3/1/4/2; align-self: start; margin-top: 13px; }
}
@media (max-width: 599px) {
  .memories { gap: 13px; padding-top: 22px; }
  .memory-frame { width: clamp(164px, min(60vw, 26.5svh), 246px); padding: 7px 11px; }
  .memory-frame::before, .memory-frame::after { width: 3px; }
  .memory-zoom { right: 13px; }
}

