body[data-section="memories"] {
  --bg: #eee9dd;
  --bg-soft: #f4efe4;
  --surface: #fffaf0;
  --surface-2: #e6e7d9;
  --line: #d7cfbf;
  --text: #252d22;
  --muted: #5a604f;
  --accent: #4b6245;
  --accent-rgb: 75, 98, 69;
  --accent-soft: #9eab8e;
  --danger: #9b4136;
  color-scheme: light;
  background: radial-gradient(ellipse at 50% 0, #faf6eb, #eee9dd 74%);
}

body[data-section="memories"] .topbar { background: rgba(247, 243, 232, .92); }
body[data-section="memories"] .switcher { background: #eae6d9; }
body[data-section="memories"] .switcher__pill {
  transform: translateX(400%);
  box-shadow: 0 1px 4px #393e272b;
}
.switcher__btn[data-section="memories"]::before { background: #729366; }
body[data-section="memories"] .main { max-width: 1360px; }

.album {
  --album-forest: #273b2d;
  --album-paper: #fbf7ed;
  --album-muted: #5c624f;
  --album-serif: "Playfair Display", Georgia, serif;
}
.album h1, .album h2, .album h3 {
  font-family: var(--album-serif);
  font-weight: 500;
  letter-spacing: -.045em;
}
.album-cover {
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  min-height: clamp(290px, 34vw, 458px);
  overflow: hidden;
  border: 1px solid #26382c;
  border-radius: 20px;
  background: var(--album-forest);
  color: #fff7e3;
  box-shadow: 0 18px 36px #34382724;
}
.album-cover__copy {
  position: relative;
  z-index: 1;
  align-self: center;
  padding: clamp(26px, 6vw, 84px);
  padding-right: 0;
}
.album-cover h1 {
  font-size: clamp(37px, 6vw, 91px);
  line-height: 1.05;
}
.album-cover p { color: #e0e2cc; margin: 18px 0 28px; font-size: clamp(14px, 1.45vw, 18px); }
.album-cover__photo {
  background:
    linear-gradient(90deg, var(--album-forest), #273b2d00 25%),
    url('/memories-cover.jpg') center 55% / cover;
}
.album.section--active .album-cover__copy {
  animation: album-cover-open .46s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes album-cover-open {
  from { opacity: 0; transform: translateX(-12px); }
}
.album-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--album-forest);
  color: #fff8e9;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: background .18s, box-shadow .18s;
}
.album-button:hover { background: #3e5843; }
.album-button--cream { background: #efe6cc; color: #26372a; }
.album-button--cream:hover { background: #fff6df; }
.album button:disabled { opacity: .5; cursor: wait; }
.album :is(button, a, input, textarea):focus-visible { outline: 2px solid #826139; outline-offset: 3px; }
.album-index {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  margin: 36px 0 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.album-index h2 { font-size: clamp(28px, 3.5vw, 44px); }
.album-years { display: flex; flex-wrap: wrap; gap: 6px; }
.album-years button {
  min-height: 38px;
  padding: 6px 15px;
  border: 1px solid #c9c7b6;
  border-radius: 20px;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.album-years button:hover { background: #e3e5d7; }
.album-years button[aria-pressed="true"] { background: var(--album-forest); color: #fff8e9; border-color: transparent; }
.album-year { margin: 0 0 26px; }
.album-year[data-turn="forward"] { --album-page-angle: -7deg; }
.album-year[data-turn="back"] { --album-page-angle: 7deg; }
.album-year[data-turn]:not([data-turn=""]) .album-spread:first-of-type {
  animation: album-page-turn .42s cubic-bezier(.18, .72, .32, 1) both;
  transform-origin: center left;
}
.album-year[data-turn="back"] .album-spread:first-of-type { transform-origin: center right; }
@keyframes album-page-turn {
  from { opacity: .48; transform: perspective(1300px) rotateY(var(--album-page-angle)); }
  to { opacity: 1; transform: none; }
}
.album-year > h2 { color: var(--album-muted); font-size: 31px; margin: 14px 0 11px; }
.album-spread {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr);
  min-height: 340px;
  margin-bottom: 22px;
  background: var(--album-paper);
  border: 1px solid #d7cfbd;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 14px #302a1d10, 0 3px 0 -1px #ded6c6;
}
.album-spread__story {
  align-content: center;
  padding: clamp(26px, 5.2vw, 76px);
  min-width: 0;
}
.album-spread__meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 0 10px;
  color: var(--album-muted);
  font-size: 12px;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.album-spread__meta span::before { content: '·'; margin-right: 10px; }
.album-spread h3 { font-size: clamp(34px, 4.2vw, 61px); line-height: 1.12; overflow-wrap: anywhere; }
.album-spread__note, .album-gallery-note {
  font-size: 14px;
  color: var(--album-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.7;
}
.album-spread__note {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.album-spread__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 13px;
  font-weight: 800;
  color: #3b5740;
  cursor: pointer;
}
.album-spread__link:hover { text-decoration: underline; text-underline-offset: 4px; }
.album-spread__photos {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
  padding: clamp(16px, 3vw, 36px);
  background: linear-gradient(90deg, #32251922, #32251906 2%, transparent 9%), #f3ebdc;
}
.album-frame {
  display: block;
  width: 100%;
  position: relative;
  overflow: hidden;
  padding: 0;
  border: 4px solid #fff9ed;
  border-radius: 4px;
  background: #d8d7c4;
  color: #fff8e9;
  aspect-ratio: 1.65;
  cursor: pointer;
  box-shadow: 0 2px 5px #2d271b2e;
}
.album-frame img, .album-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .28s ease;
}
.album-frame:hover :is(img, video) { transform: scale(1.045); }
.album-spread__strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.album-spread__strip .album-frame { aspect-ratio: 2.15; }
.album-frame__count, .album-frame__more, .album-video-mark { position: absolute; z-index: 1; background: #213024eb; }
.album-frame__count { right: 8px; bottom: 8px; border-radius: 3px; padding: 5px 8px; font-size: 11px; }
.album-frame__more { display: grid; place-items: center; inset: 0; font-size: 15px; background: #2335268c; }
.album-frame:has(video) { background: radial-gradient(ellipse at 25% 0, #667b60, #273b2d 78%); }
.album-video-mark {
  display: grid;
  place-items: center;
  inset: 50% auto auto 50%;
  translate: -50% -50%;
  width: 30px;
  aspect-ratio: 1;
  border: 1px solid #ffffff70;
  border-radius: 50%;
  font-size: 12px;
}
.album-frame--cover .album-video-mark { width: 52px; font-size: 20px; }

.album-empty {
  margin-top: 22px;
  padding: clamp(38px, 6vw, 86px) 16px;
  border: 1px solid #d7cfbd;
  border-radius: 14px;
  background: var(--album-paper);
  text-align: center;
  box-shadow: 0 3px 0 -1px #ded6c6;
}
.album-empty h2 { font-size: clamp(32px, 5vw, 55px); }
.album-empty p, .album-message { margin: 10px 0 22px; color: var(--album-muted); }

.album-dialog {
  width: min(calc(100% - 28px), 580px);
  max-height: calc(100dvh - 28px);
  overscroll-behavior: contain;
  padding: clamp(18px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--album-paper);
  color: var(--text);
  box-shadow: 0 22px 90px #15241666;
}
.album-dialog::backdrop { background: #1c291feb; }
.album-dialog[open] { animation: album-dialog-open .24s ease-out both; }
@keyframes album-dialog-open {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
}
.album-dialog--gallery { width: min(calc(100% - 28px), 1000px); }
.album-dialog__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.album-dialog__head h2 { font-size: clamp(27px, 4vw, 43px); line-height: 1.14; overflow-wrap: anywhere; }
.album-dialog__head .album-spread__meta { margin-bottom: 5px; }
.album-dialog__close {
  flex: 0 0 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font-size: 25px;
  cursor: pointer;
}
.album-player { position: relative; background: #202c22; border-radius: 7px; }
#album-player-media { display: grid; place-items: center; height: min(60dvh, 610px); color: #fff8e9; overflow: hidden; border-radius: inherit; }
.album-player__leaf { width: 100%; height: 100%; min-height: 0; }
.album-player__leaf[data-turn="forward"] { --album-frame-angle: -18deg; transform-origin: left center; }
.album-player__leaf[data-turn="back"] { --album-frame-angle: 18deg; transform-origin: right center; }
.album-player__leaf[data-turn] { animation: album-frame-turn .44s cubic-bezier(.18, .72, .32, 1) both; }
@keyframes album-frame-turn {
  from { opacity: .35; filter: brightness(.76); transform: perspective(1100px) rotateY(var(--album-frame-angle)) scale(.985); }
  to { opacity: 1; filter: none; transform: none; }
}
#album-player-media :is(img, video) { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
#album-player-media img { touch-action: pan-y pinch-zoom; }
#album-player-media p { padding: 0 54px; text-align: center; }
.album-player button {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 44px;
  height: 44px;
  border: 1px solid #ffffff7a;
  border-radius: 50%;
  background: #202c22df;
  color: #fff8e9;
  font-size: 26px;
  cursor: pointer;
}
.album-player__prev { left: 8px; }
.album-player__next { right: 8px; }
.album-gallery-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 16px; padding: 9px 0; font-size: 13px; }
#album-position { margin-right: auto; color: var(--album-muted); }
.album-gallery-bar a, .album-gallery-bar button {
  display: inline-flex;
  align-items: center;
  min-height: 37px;
  color: #385541;
  background: none;
  border: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.album-gallery-note { margin: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.album-form-row { display: grid; grid-template-columns: minmax(135px, .7fr) minmax(0, 1fr); gap: 12px; }
.album-attachments { min-width: 0; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; }
.album-attachments label { display: flex; gap: 6px; align-items: baseline; font-size: 13px; overflow-wrap: anywhere; }
.album-attachments legend { color: var(--album-muted); font-size: 13px; }
.album-upload {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px dashed #9ba38a;
  border-radius: 8px;
  background: #e9ecdf;
  cursor: pointer;
  font-size: 14px;
}
.album-upload span { font-size: 12px; color: var(--album-muted); }
.album-upload input { width: 100%; font-size: 12px; }
.album-file-list { margin: 9px 0; font-size: 12px; overflow-wrap: anywhere; }
.album-progress { width: 100%; margin-top: 12px; accent-color: var(--album-forest); }
.album-form-status { font-size: 13px; color: var(--album-muted); }
.album-form-status:empty { display: none; }
.album-form-actions { display: flex; justify-content: space-between; gap: 6px; margin-top: 14px; }
.album-form-actions .album-button { margin-left: auto; }
.album-form-delete { border: 0; padding: 0; color: var(--danger); background: none; font-size: 13px; cursor: pointer; }

@media (max-width: 760px) {
  .album-cover { grid-template-columns: 1fr; min-height: 0; }
  .album-cover__copy { padding: 26px 20px 8px; }
  .album-cover__photo { min-height: clamp(150px, 43vw, 300px); background-image: linear-gradient(var(--album-forest), #273b2d00 34%), url('/memories-cover.jpg'); }
  .album-cover p { margin: 10px 0 17px; }
  .album-index { margin-top: 22px; }
  .album-spread { grid-template-columns: 1fr; min-height: 0; }
  .album-spread__story { padding: 20px 18px 10px; }
  .album-spread__photos { padding: 12px; background: #f3ebdc; }
  #album-player-media { height: min(53dvh, 500px); }
}
@media (max-width: 360px) {
  .album-cover h1 { font-size: 32px; }
  .album-form-row { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .album, .album * { animation: none !important; transition: none !important; }
}
