.guest-action,
.chapter-home .guest-return-link,
.chapter-home .detail-link,
.chapter-home .date-keepsake > a,
.chapter-home .story-invite .chapter-text-link,
.form-page .guest-return-link,
.form-page .form-back,
.guest-access-card .guest-access-back,
.receipt-actions > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    max-width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--wedding-dust);
    border-radius: 12px;
    background: #fffefa;
    color: var(--wedding-ink);
    text-align: center;
    text-decoration: none;
    font: 650 13px/1.4 Manrope, Arial, sans-serif;
    cursor: pointer;
}

.guest-action-primary {
    border-color: var(--wedding-ink);
    background: var(--wedding-ink);
    color: #fff;
}

.guest-action svg {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
}

@media (hover: hover) {
    .guest-action:hover,
    .chapter-home .guest-return-link:hover,
    .chapter-home .detail-link:hover,
    .chapter-home .date-keepsake > a:hover,
    .chapter-home .story-invite .chapter-text-link:hover,
    .form-page .guest-return-link:hover,
    .form-page .form-back:hover,
    .guest-access-card .guest-access-back:hover,
    .receipt-actions > a:hover { background: var(--wedding-soft-blue); }
    .guest-action-primary:hover { background: var(--wedding-blue-text); }
}

.guest-action:focus-visible,
.form-page .form-back:focus-visible,
.guest-access-card .secondary-action:focus-visible,
.receipt-card :is(button,a):focus-visible {
    outline: 2px solid var(--wedding-dust);
    outline-offset: 3px;
}

.chapter-header nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 9px 13px;
    border: 1px solid #ffffffa6;
    border-radius: 12px;
    background: #233945de;
    color: #fff;
    font-size: 12px;
}
.chapter-header .header-rsvp {
    border: 1px solid var(--wedding-card);
    background: var(--wedding-card);
    color: var(--wedding-ink);
    letter-spacing: 0;
    font-weight: 700;
}
.chapter-header .header-rsvp span { margin-left: 6px; }
.chapter-header nav { gap: 8px; }
.chapter-home .date-keepsake > a { width: auto; margin-top: 18px; }
.chapter-home .story-invite .chapter-text-link { margin-top: 0; }
.chapter-home .detail-contacts { justify-content: center; gap: 8px; }
.detail-contacts a.guest-action { padding-inline: 12px; }
.form-page .guest-return-link { display: flex; width: fit-content; }
.form-page .form-back { margin-bottom: 12px; }
.form-page .reminder-form .reminder-consent { min-height: 44px; padding: 12px; background: var(--wedding-blue-paper); border-radius: 10px; }
.form-page .response-content :is(input[type="text"],input[type="email"],input[autocomplete="name"]) { font-size: 16px; }
.guest-access-card h1 { margin: 0; font: 400 clamp(32px,6vw,44px)/1.15 'Cormorant Garamond', Georgia, serif; }
.guest-access-card .guest-access-back { display: flex; width: fit-content; margin-inline: auto; }
.guest-access-card .secondary-action { border-color: var(--wedding-dust); font-weight: 650; }
.guest-access-card input[type="email"] { font-size: 16px; }
.receipt-actions > a:not(.pdf-link) { background: var(--wedding-blue-paper); }

/* Keep shortcuts in the header so they cannot cover gallery controls. */
html:has(.memory-experience) { scroll-padding-top: 0; }
.memory-experience .memory-masthead {
    position: sticky;
    top: 0;
    z-index: 12;
    padding: 10px 0 11px;
    background: var(--wedding-blue-paper);
}
.memory-experience .memory-masthead nav { gap: 8px; }
.memory-experience .memory-masthead nav a.guest-action {
    display: inline-flex;
    font: 650 13px/1.4 Manrope, Arial, sans-serif;
    color: var(--wedding-ink);
}
.memory-experience .memory-masthead nav a.guest-action-primary { color: #fff; }
.memory-experience :is(#memory-guests,#memory-collection,.memory-album,.album-photo) { scroll-margin-top: 96px; }
.memory-experience .memory-heading { margin-top: 24px; }
.memory-experience .memory-heading > p:last-child,
.memory-experience .feed-welcome > span { font-size: 13px; letter-spacing: 0; }
.memory-experience .feed-welcome a.guest-action { flex-shrink: 0; }
.memory-experience .memory-composer p { font-size: 12px; }
.memory-experience .memory-button { font-size: 13px; min-height: 46px; font-weight: 650; }
.memory-collection-heading { align-items: center; flex-wrap: wrap; }
.memory-collection-heading > div { min-width: 0; }
.memory-collection-heading p { margin: 4px 0 0; font: 12px/1.5 Manrope, Arial, sans-serif; color: var(--wedding-muted); }
.memory-people .person-name { font-size: 11px; }
.memory-people .person-count { font-size: 10px; }
.person-chip:focus-visible { outline-offset: 1px; }

.memory-experience .gallery-filters {
    padding: 16px;
    border: 1px solid var(--wedding-border);
    border-radius: 16px;
    background: #fffefa;
}
.memory-filter-heading h2,
.memory-experience .gallery-filters label { font-size: 13px; font-weight: 650; }
.memory-filter-heading > span { font-size: 12px; }
.memory-filter-fields {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto;
    gap: 12px;
    align-items: end;
}
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.memory-experience .gallery-filters .filter-submit {
    min-height: 48px;
    padding-inline: 14px;
    border-color: var(--wedding-ink);
    background: var(--wedding-ink);
    color: #fff;
    font: 650 13px/1.4 Manrope, Arial, sans-serif;
}
.filter-actions .guest-action { min-height: 48px; }
.guest-select { position: relative; min-width: 0; }
.memory-experience .guest-select > select {
    position: relative;
    z-index: auto;
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-height: 48px;
    margin: 0;
    padding: 10px 47px 10px 11px;
    border-color: var(--wedding-dust);
    background: #fffefa;
    color: var(--wedding-ink);
    font: 500 16px/1.4 Manrope, Arial, sans-serif;
    cursor: pointer;
}
.guest-select-arrow {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 27px;
    height: 27px;
    border-radius: 50%;
    background: var(--wedding-soft-blue);
    color: var(--wedding-ink);
    pointer-events: none;
}
.guest-select-arrow svg { width: 16px; height: 16px; }
.guest-select:focus-within .guest-select-arrow { background: var(--wedding-ink); color: #fff; }
@media (forced-colors: active) {
    .memory-experience .guest-select > select { appearance: auto; }
    .guest-select-arrow { display: none; }
}

.memory-experience .post-actions { padding: 5px 0; }
.memory-experience .post-actions .like-button,
.memory-experience .post-comments > summary.guest-action {
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid var(--wedding-dust);
    border-radius: 10px;
    background: #fffefa;
    font: 650 13px/1.4 Manrope, Arial, sans-serif;
    color: var(--wedding-ink);
    cursor: pointer;
}
.memory-experience .post-actions .like-button.liked { background: #faedf1; border-color: #a35b70; color: #87435b; }
.memory-experience .post-comments { padding-block: 8px 12px; }
.memory-experience .post-comments > summary.guest-action { width: 100%; justify-content: flex-start; }
.memory-experience .comment-modal-close { min-width: 44px; min-height: 44px; cursor: pointer; }
.memory-experience .comment-form button { min-height: 44px; font-size: 13px; cursor: pointer; }
.memory-experience .comment-form textarea,
.memory-experience .upload-form :is(textarea,input[data-slot="input"]) { font-size: 16px; }
.memory-experience .post-caption { max-height: none; font-size: 14px; }
.memory-experience .post-image { position: relative; }
.memory-experience .post-header strong { font-size: 14px; }
.memory-experience .post-header time { font-size: 11px; }
.upload-identity { margin: 0 0 16px; overflow-wrap: anywhere; font-size: 14px; }
.memory-experience .photo-picker { min-height: 0; padding: 18px; }
.memory-experience .photo-picker input[type=file] { min-height: 46px; font-size: 13px; }
.memory-experience .photo-picker input::file-selector-button { min-height: 44px; font-size: 13px; }
.memory-experience .upload-selection-help { margin: 9px 0 0; }
.memory-experience .upload-form label:not(.consent) { font-size: 13px; }
.memory-experience .upload-form .primary[data-slot=button] { font-size: 14px; }
.memory-experience .upload-form .consent { min-height: 44px; cursor: pointer; }
.memory-experience .upload-form .consent span { font-size: 13px; }

@media (max-width: 760px) {
    .memory-experience .memory-masthead { flex-direction: column; align-items: stretch; gap: 3px; padding-block: 6px 9px; }
    .memory-masthead .wordmark { font-size: 24px; align-self: flex-start; }
    .memory-experience .memory-masthead nav { display: grid; grid-template-columns: auto auto minmax(0,1fr); gap: 6px; }
    .memory-experience .memory-masthead nav a.guest-action { padding-inline: 8px; font-size: 12px; }
    .memory-experience :is(#memory-guests,#memory-collection,.memory-album,.album-photo) { scroll-margin-top: 114px; }
    .memory-filter-fields { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .filter-actions { grid-column: 1 / -1; }
    .filter-actions .filter-submit { flex: 1; }
}
@media (max-width: 480px) {
    .memory-filter-fields { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 360px) {
    .memory-experience .feed-welcome { justify-content: flex-start; }
    .memory-experience .feed-welcome > span { flex-basis: 100%; }
    .chapter-header { padding-inline: 16px; }
    .chapter-header nav a { font-size: 11px; padding-inline: 9px; }
}
@media (max-height: 480px) {
    .memory-experience .memory-masthead { position: static; }
    .memory-experience :is(#memory-guests,#memory-collection,.memory-album,.album-photo) { scroll-margin-top: 20px; }
}

.memory-filter-panel { margin: 0 0 17px; }
.memory-filter-panel > summary { width: fit-content; list-style: none; }
.memory-filter-panel > summary::-webkit-details-marker { display: none; }
.memory-filter-panel[open] > summary svg { transform: rotate(180deg); }
.memory-experience .memory-filter-panel .gallery-filters { margin: 8px 0 0; }
.memory-experience .guest-select.is-enhanced > select,
.guest-select.is-enhanced > .guest-select-arrow { display: none; }
.guest-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 48px;
    padding: 8px 10px 8px 12px;
    border: 1px solid var(--wedding-dust);
    border-radius: 10px;
    background: #fffefa;
    color: var(--wedding-ink);
    font: 500 16px/1.4 Manrope,Arial,sans-serif;
    text-align: left;
    cursor: pointer;
}
.guest-picker-trigger > span { min-width: 0; overflow-wrap: anywhere; }
.guest-picker-trigger > svg {
    flex: 0 0 27px;
    width: 27px;
    height: 27px;
    padding: 5px;
    border-radius: 50%;
    background: var(--wedding-soft-blue);
}
.guest-picker-trigger[aria-expanded="true"] > svg { transform: rotate(180deg); }
.guest-picker-trigger[aria-invalid="true"] { border-color: #a23e43; }
.guest-picker-list {
    position: absolute;
    z-index: 5;
    inset: calc(100% + 5px) 0 auto;
    max-height: min(45dvh,240px);
    overflow: auto;
    padding: 4px;
    border: 1px solid var(--wedding-border);
    border-radius: 12px;
    background: #fffefa;
    box-shadow: 0 8px 20px #29465324;
}
.guest-picker-list > button {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--wedding-ink);
    font: 500 14px/1.4 Manrope,Arial,sans-serif;
    text-align: left;
    overflow-wrap: anywhere;
    cursor: pointer;
}
.guest-picker-list.is-above { inset: auto 0 calc(100% + 5px); }
.guest-picker-list > button:is([aria-selected="true"],:focus-visible,:hover) {
    background: var(--wedding-soft-blue);
    outline-offset: -2px;
}
.memory-experience .memory-feed { grid-template-columns: minmax(0,1fr); gap: 16px; }
.memory-experience .memory-album:not(.is-single) { grid-column: 1 / -1; }
.memory-experience .memory-album.is-single .album-grid { grid-template-columns: minmax(0,1fr); }
.memory-experience .memory-album.is-single:only-child { width: min(100%,450px); grid-column: 1 / -1; justify-self: center; }
.memory-experience .album-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(175px,1fr));
    align-items: start;
    gap: 10px;
    padding: 0 13px 13px;
}
.memory-experience .album-photo {
    display: grid;
    grid-template-columns: minmax(0,1fr) minmax(0,1fr);
    align-items: start;
    gap: 6px;
    min-width: 0;
    padding: 4px;
    border: 1px solid var(--wedding-border);
    border-radius: 11px;
}
.memory-experience .memory-album .post-image {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    aspect-ratio: 5 / 4;
    border-radius: 7px;
    overflow: hidden;
}
.memory-experience .memory-album .post-image img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: cover;
}
.memory-experience .memory-album.is-single .post-image { max-height: 235px; }
.memory-experience .album-photo .post-actions,
.memory-experience .album-photo .post-comments {
    display: block;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
}
.memory-experience .album-photo .post-comments[open] { grid-column: 1 / -1; }
.memory-experience .album-photo :is(.like-button,.post-comments > summary.guest-action) {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    gap: 4px;
    padding: 3px;
    font-size: 11px;
}
.album-comments-label,
.album-photo .like-button .tile-like-label { display: none; }
.album-photo .notes-count { border: 0; min-width: 0; }
.album-photo .delete-photo { grid-column: 1 / -1; }
.memory-experience .album-photo .delete-photo button { min-height: 44px; width: 100%; cursor: pointer; }
.memory-experience .has-album-viewer .album-grid {
    grid-template-columns: repeat(6,minmax(0,1fr));
    gap: 3px;
    margin: 0 13px 13px;
    padding: 0;
    overflow: hidden;
    border-radius: 10px;
    background: var(--wedding-card);
}
.memory-experience .has-album-viewer .album-photo {
    grid-column: span 2;
    display: block;
    padding: 0;
    border: 0;
    border-radius: 0;
}
.memory-experience .has-album-viewer .album-photo > :is(.post-actions,.post-comments,.delete-photo) { display: none; }
.memory-experience .has-album-viewer .album-photo .post-image {
    aspect-ratio: 5 / 4;
    height: auto;
    max-height: 235px;
    border-radius: 0;
    cursor: zoom-in;
}
.memory-experience .has-album-viewer .album-photo .post-image:focus-visible { outline-offset: -4px; }
.has-album-viewer .album-photo:nth-child(3n+1):last-child { grid-column: span 6; }
.has-album-viewer .album-photo:nth-child(3n+1):nth-last-child(2),
.has-album-viewer .album-photo:nth-child(3n+2):last-child,
.has-album-viewer :is([data-photo-count="2"],[data-photo-count="4"]) .album-photo,
.has-album-viewer [data-photo-count="5"] .album-photo:nth-child(-n+2) { grid-column: span 3; }
.has-album-viewer [data-photo-count="4"] .album-photo:last-child { grid-column: span 3; }
.has-album-viewer [data-photo-count="5"] .album-photo:nth-child(n+3) { grid-column: span 2; }
.memory-experience .has-album-viewer .is-single .album-photo { grid-column: 1 / -1; }
@media(max-width:600px) {
    .memory-experience .album-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; padding-inline: 9px; }
}
@media(min-width:761px) {
    .memory-experience .memory-feed { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .memory-experience .memory-album[data-photo-count="2"] { width: min(100%, 530px); justify-self: center; }
    .memory-experience .memory-album[data-photo-count="3"] { width: min(100%, 780px); justify-self: center; }
    .memory-experience .memory-album[data-photo-count="4"] { width: min(100%, 1000px); justify-self: center; }
    .memory-experience .memory-album[data-photo-count="5"] { width: min(100%, 780px); justify-self: center; }
}

/* The album is a clean collage. Captions expand into the natural page scroll. */
.memory-experience .post-caption-block { margin: 0 0 12px; }
.memory-experience .post-caption-block .post-caption { margin-bottom: 0; padding-bottom: 0; }
.memory-experience .post-caption-block .caption-limited { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; }
.memory-experience .caption-toggle { display: block; min-height: 44px; margin: 0 13px; padding: 0 3px; border: 0; border-radius: 0; background: transparent; color: var(--wedding-ink); font: 650 12px/1.5 Manrope,Arial,sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.memory-experience .caption-toggle[hidden] { display: none; }
