/* One restrained dialog surface across consultation, editing and utility forms. */
:root{--link-modal-radius:28px;--link-modal-shadow:0 24px 80px #00000026;--link-modal-backdrop:#00000066;--link-modal-ivory:var(--ui-surface,#fff);--dialog-close-bg:#e9e9ed;--dialog-close-ink:#606168}
:is(.ui-dialog,.memory-dialog,.photo-compose-dialog,.family-edit-dialog,.family-detail-dialog,.profile-preview){border:0;border-radius:var(--link-modal-radius);background:var(--ui-surface,#fff);color:var(--ui-text,#252b2e);box-shadow:var(--link-modal-shadow)}
:is(.ui-dialog,.memory-dialog,.photo-compose-dialog,.family-edit-dialog,.family-detail-dialog,.profile-preview)::backdrop{background:var(--link-modal-backdrop);backdrop-filter:blur(8px)}
.ui-dialog-layout{display:block}
.ui-dialog-aside{background:transparent;padding:48px 40px 12px;border:0}
.ui-dialog-aside>:is(.nav-icon,.eyebrow){display:none}
.ui-dialog-aside h2,.workspace .ui-dialog-aside h2{font-size:32px;line-height:1.18;letter-spacing:-.025em;margin:0 40px 16px 0}
.ui-dialog-aside p{margin:0;line-height:1.6}
.ui-dialog-body{padding:8px 40px 36px}
:is(.workspace,.public-site) :is(.ui-dialog-close,.memory-close),.family-dialog-bar button,.profile-preview>button:first-child{display:inline-flex;align-items:center;justify-content:center;width:36px;height:36px;min-width:36px;min-height:36px;padding:0;margin:0;border:0;border-radius:50%;background:var(--dialog-close-bg);color:var(--dialog-close-ink);box-shadow:none;font-size:24px;line-height:1;z-index:5}
:is(.workspace,.public-site) :is(.ui-dialog-close,.memory-close){top:16px;right:16px}
:is(.ui-dialog-close,.memory-close,.family-dialog-bar button,.profile-preview>button:first-child):hover{filter:brightness(.95)}
:is(.ui-dialog-close,.memory-close,.family-dialog-bar button,.profile-preview>button:first-child):focus-visible{outline:2px solid var(--ui-link,#213e72);outline-offset:3px}
.memory-dialog .memory-media,.memory-dialog .memory-story{background:var(--ui-surface,#fff)}
.memory-dialog .memory-media>.memory-stage{display:block;flex:1;min-height:0;padding:0;overflow:auto;overscroll-behavior:contain;background:var(--ui-surface,#fff)}
.memory-dialog .memory-stage .memory-zoom-image{display:block;width:100%;max-width:100%;border-radius:0}
.memory-dialog .memory-stage img{display:block;width:100%;height:auto;max-height:none;object-fit:contain;border-radius:0;box-shadow:none}
.memory-dialog .memory-media-footer{padding:10px 20px;border:0;background:var(--ui-surface,#fff)}
.memory-dialog .memory-story{padding:24px 32px 28px}
.memory-dialog .memory-author{margin:0 40px 12px 0}
.photo-compose-document .photo-composer{background:var(--ui-surface,#fff)}
.photo-compose-document .photo-compose-stage{background:var(--ui-surface,#fff);padding:0;gap:0}
.photo-compose-document .photo-compose-stage .shared-photo-preview{width:100%;height:auto;max-height:none;border-radius:0;box-shadow:none}
.photo-compose-document .photo-compose-people{border:0;border-radius:0;background:var(--ui-surface,#fff);padding:24px}
.photo-compose-document .photo-compose-fixed{padding:40px 32px 16px}
.photo-compose-document .photo-compose-scroll{padding:0 32px 28px}
.family-dialog-bar{background:var(--ui-surface,#fff)}
#issue-report-dialog .ui-dialog-body{padding:48px 40px 36px}
#issue-report-dialog .issue-mobile-title{font-size:32px;line-height:1.18;letter-spacing:-.025em;margin:0 40px 24px 0}
html[data-color-scheme=dark]{--dialog-close-bg:#343941;--dialog-close-ink:#d5d9e0}
html[data-color-scheme=dark] .memory-dialog .memory-stage,html[data-color-scheme=dark] .photo-compose-document .photo-compose-stage{background:var(--ui-surface,#171d26)!important}
@media(min-width:801px){.memory-dialog-layout{grid-template-columns:minmax(0,1fr) minmax(320px,1fr)}}
@media(min-width:701px){.photo-compose-document .photo-composer{grid-template-columns:minmax(0,1fr) minmax(320px,1fr)}}
@media(max-width:800px){.memory-dialog .memory-media>.memory-stage{flex:none;overflow:visible}.memory-dialog .memory-story{padding:28px 24px}.memory-dialog .memory-media-footer{padding:10px 20px}}
@media(max-width:700px){:root{--link-modal-radius:22px}.ui-dialog-aside{padding:48px 24px 8px}.ui-dialog-aside h2,.workspace .ui-dialog-aside h2{font-size:26px}.ui-dialog-body{padding:8px 24px 28px}#issue-report-dialog .ui-dialog-body{padding:48px 24px 28px}#issue-report-dialog .issue-mobile-title{font-size:26px}.photo-compose-document .photo-compose-people{padding:24px 20px}.photo-compose-document .photo-compose-fixed{padding:28px 24px 12px}.photo-compose-document .photo-compose-scroll{padding:0 24px 28px}}
@media(pointer:coarse){:is(.workspace,.public-site) :is(.ui-dialog-close,.memory-close),.family-dialog-bar button,.profile-preview>button:first-child{width:44px;height:44px;min-width:44px;min-height:44px}}

/* Keep the shared loading state hidden until the image is ready. */
.memory-dialog .memory-stage .memory-zoom-image:has(img[hidden]),.memory-dialog .memory-stage img[hidden]{display:none}

/* Photo consultation and editing share a compact, readable title. */
.workspace .memory-dialog .memory-story h2,.photo-compose-document .photo-compose-fixed .photo-compose-title{font-size:20px;line-height:1.25}
.photo-compose-document .photo-compose-fixed{padding-top:20px;padding-bottom:4px}
.photo-compose-document .photo-compose-fixed .photo-title-editor{margin-bottom:0}
.photo-compose-document .photo-compose-fixed .photo-compose-title{margin-bottom:4px}
.photo-compose-document .photo-compose-scroll>.photo-extra-fields>.photo-extra:first-child{padding-top:4px}
.photo-compose-document .photo-date-group{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:12px}
.photo-compose-document .photo-date-group>label,.photo-compose-document .photo-date-group>.checkbox{margin:0}
.photo-compose-document .photo-date-group>.checkbox{min-height:40px;max-width:200px;line-height:1.35}
.photo-compose-document .photo-date-group>.checkbox input{flex:none}
.photo-compose-document .photo-extra{padding-top:6px;padding-bottom:6px}
@media(min-width:701px){.photo-compose-document .photo-compose-scroll{flex:none;overflow:visible}}

/* Keep image-related people and tags below the image in both modes. */
.memory-dialog .memory-photo-details{padding:18px 24px 10px}
.memory-dialog .memory-photo-details .memory-people{margin:0}
.memory-dialog .memory-photo-details .photo-labels{margin-top:14px}
.memory-dialog .memory-media>.memory-stage{flex:none;overflow:visible}
.memory-dialog .memory-dialog-layout{height:auto;min-height:0;align-items:start}
.memory-dialog .memory-media-footer{padding-top:4px}
.photo-compose-people>[data-photo-field]{margin-top:14px}
.photo-compose-document .photo-compose-people{padding-top:16px}
@media(min-width:801px){
 .memory-dialog .memory-story{max-height:calc(100dvh - 48px);overflow-y:auto}
 .memory-dialog .memory-story:has([data-tab-key=comments][aria-selected=true]){height:var(--memory-content-height,560px)}
}

@media(min-width:801px){.memory-dialog .memory-dialog-layout{grid-template-columns:minmax(0,var(--memory-image-width,1fr)) minmax(320px,1fr)}}
.photo-compose-document .photo-compose-scroll .editor-actions{margin-top:8px;padding-top:6px;padding-bottom:6px}

@media(min-width:801px){.memory-dialog .memory-stage img{max-height:var(--memory-image-height,calc(100dvh - 220px))}}

.photo-compose-document .photo-date-group>label:first-child{display:flex;align-items:center}.photo-compose-document .photo-date-group>label:first-child input{margin:0}
.family-existing-links{display:grid;gap:10px;margin-top:20px}.family-existing-links>a{display:flex;align-items:center;gap:10px;min-height:44px;overflow-wrap:anywhere}

/* Center both the detail fetch and the subsequent image load. */
.memory-dialog-loading .memory-story{min-height:240px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:48px 24px;text-align:center}
.memory-dialog-loading [data-memory-fetch-state]{margin:0}
.memory-dialog .memory-stage:has([data-memory-status]:not([hidden])){display:flex;align-items:center;justify-content:center;min-height:240px}
.memory-dialog [data-memory-status]:not([hidden]){justify-content:center;margin:0;padding:24px;text-align:center}
