/* The profile card and the full-screen dialog share one Leaflet canvas. */
.profile-overview {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, calc((100% - 40px) / 3));
    grid-template-areas: "identity summary" "filters summary";
    gap: 20px;
    margin-bottom: clamp(28px, 3vw, 48px);
}
.profile-overview .profile-header { grid-area: identity; margin: 0; }
.profile-overview .profile-details { min-width: 0; }
.profile-overview .profile-details h1 { margin: 0 0 8px; overflow-wrap: anywhere; }
.profile-map-summary {
    grid-area: summary;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    min-width: 0;
}
.profile-map-summary .profile-stats-row {
    width: 100%;
    justify-content: flex-end;
    margin: 0;
    gap: 0;
    text-align: end;
}
.profile-map-summary .profile-stat-filter {
    min-width: 0;
    min-height: 44px;
    margin: 0;
    padding: 8px 12px;
    overflow-wrap: anywhere;
}
.profile-map-summary .profile-stat-filter > strong { translate: -2px; }
@media (max-width: 1200px) {
    .profile-map-summary .profile-stat-filter { padding-inline: 6px; }
}
#page-profile .profile-overview .profile-library-panel {
    grid-area: filters;
    align-self: end;
    min-width: 0;
    margin: 0;
    padding: 0;
}
#page-profile .profile-overview .profile-library-panel > :is(.profile-tabs, .memories-search-row, .memories-filter-section),
#page-profile .profile-overview .profile-library-panel.no-memories .memories-search-wrap {
    width: 100%;
    max-width: 100%;
}
#page-profile .profile-overview .profile-library-panel.no-memories .memories-search-wrap { flex: 1 1 auto; }
#page-profile .profile-overview .profile-tabs { margin-bottom: 8px; }
#page-profile .profile-overview .memories-search-wrap { min-width: 0; }
#page-profile .profile-overview #memoriesSearch { min-width: 0; }
.profile-map-card {
    position: relative;
    aspect-ratio: 2.48;
    min-width: 0;
    isolation: isolate;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--color-divider);
    background: var(--color-neutral);
}
.profile-map-preview,
.profile-map-trigger {
    position: absolute;
    inset: 0;
}
.profile-map-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 12px;
    border: 0;
    background: transparent;
    color: var(--color-ink, var(--app-color-maps-171717,#171717));
    text-align: start;
    cursor: pointer;
}
.profile-map-trigger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -4px;
}
.profile-map-preview .leaflet-control-attribution { font-size: 8px; }
.profile-map-preview .pm-cluster { --map-cluster-size: 32px; font-size: 13px; }
.profile-map-section[open] {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: max(14px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
    box-sizing: border-box;
    border: 0;
    overflow: auto;
    overscroll-behavior: contain;
    background: var(--color-paper, var(--app-color-maps-ffffff,#fff));
    color: var(--color-ink, var(--app-color-maps-171717,#171717));
}
body:has(.profile-map-section[open]) { overflow: hidden; }
.profile-map-controls {
    display: grid;
    grid-template-columns: minmax(0,1fr) 40px;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.profile-map-layers,
.profile-map-sharing {
    display: flex;
    align-items: center;
    min-width: 0;
}
.profile-map-layers,
.profile-map-sharing { gap: 8px; flex-wrap: wrap; }
.profile-map-layers { grid-area: 2 / 1 / auto / -1; }
.profile-map-sharing { grid-area: 1 / 1; }
#profileMapClose { grid-area: 1 / -2; align-self: start; }
#profileMapLocationAction:empty,
.profile-map-sharing:has(> [data-profile-map-share][hidden] + #profileMapLocationAction:empty) { display: none; }

@media (min-width: 1025px) {
    .profile-map-controls { grid-template-columns: 40px minmax(0,1fr) auto minmax(0,1fr) 40px; }
    .profile-map-layers { grid-area: 1 / 1 / auto / 3; }
    #profileMapNavigation { grid-area: 1 / 3; }
    .profile-map-sharing { grid-area: 1 / 4; justify-content: flex-end; flex-wrap: nowrap; }
    .profile-map-sharing > * { flex: 0 1 auto; min-width: 0; }
    .profile-map-sharing .map-button-with-label { max-width: 100%; }
    #profileMapClose { align-self: center; }
}
.profile-map-viewport { flex: 1 0 200px; min-width: 0; position: relative; }
.profile-map-canvas { width: 100%; height: 100%; isolation: isolate; background: var(--color-neutral); }
.profile-map-viewport .profile-map-canvas { position: absolute; inset: 0; border-radius: 14px; }
.profile-map-footer {
    display: flex;
    align-items: baseline;
    gap: 4px 16px;
    flex: 0 0 auto;
    font-size: 13px;
}
.profile-map-status { margin: 0; color: var(--color-muted); }
.profile-map-status:empty { display: none; }
.pm-own-place { margin-inline-start: auto; text-align: end; }
.profile-map-list { display: flex; gap: 8px; overflow: auto; padding: 4px 0; }
.profile-map-list:empty, .pm-own-place:empty { display: none; }
.profile-map-list button { text-align: left; }
.profile-map-footer details { margin-top: 3px; }
.profile-map-footer summary { cursor: pointer; }
@media (min-width: 1025px) {
    #page-profile .profile-overview .memories-filter-section-category,
    #page-profile .profile-overview .memories-filter-chips { flex-wrap: nowrap; }
    #page-profile .profile-overview .memories-filter-chips {
        overflow-x: auto;
        scrollbar-width: none;
    }
}
@media (max-width: 1024px) {
    .profile-overview {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "identity" "summary" "filters";
        gap: 14px;
    }
    #page-profile .profile-overview .profile-info {
        flex-direction: row;
        align-items: center;
        text-align: start;
        gap: 12px;
    }
    #page-profile .profile-overview .profile-info > .avatar-xl {
        flex: 0 0 auto;
        width: clamp(64px, 14vw, 96px);
        height: clamp(64px, 14vw, 96px);
        font-size: clamp(24px, 5vw, 36px);
    }
    .profile-overview .profile-details { padding-top: 0; }
    .profile-overview .profile-details h1 { font-size: clamp(21px, 4vw, 28px); }
    .profile-map-summary .profile-stats-row {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        text-align: center;
    }
    .profile-map-summary .profile-stats-row > .profile-stat-filter > span {
        white-space: normal;
        overflow-wrap: anywhere;
    }
    .profile-map-card { aspect-ratio: auto; height: clamp(130px, 36vw, 188px); }
}
@media (max-width: 1024px) {
    .profile-map-layers {
        display: grid;
        grid-auto-flow: column;
        grid-auto-columns: minmax(0,1fr);
    }
    .profile-map-footer { flex-direction: column; align-items: center; text-align: center; }
    #profileMapCounts,
    .pm-own-place:not(:has(.profile-map-location-notice)) { display: none; }
    .pm-own-place { margin-inline-start: 0; text-align: center; }
}
@media (max-width: 600px) {
    .profile-map-section[open] {
        gap: 8px;
        padding-inline: max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-right));
    }
    .profile-map-viewport .profile-map-canvas { border-radius: 10px; }
}

.pm-marker { background: transparent; border: 0; }
.pm-pin {
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    border: 3px solid var(--app-color-maps-ffffff,white);
    border-radius: 50%;
    background: var(--app-color-maps-00b252,#00b252);
    box-shadow: 0 2px 9px var(--app-color-maps-00000033,#0003);
}
.pm-marker .ui-person-avatar { border:3px solid var(--app-color-maps-ffffff,white); box-shadow:0 2px 9px var(--app-color-maps-00000033,#0003); background:var(--app-color-maps-ffd100,#ffd100); color:var(--app-color-maps-171717,#171717); }
.pm-person-marker .ui-person-avatar { --ui-person-avatar-size:38px; border-color:var(--color-action); }
.pm-dialog{border:1px solid var(--color-divider);border-radius:20px;padding:24px;width:min(520px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;background:var(--color-paper,var(--app-color-maps-ffffff,#fff));color:var(--color-ink);font-family:Geist,sans-serif}.pm-dialog::backdrop{background:var(--app-color-maps-00000066,#0006)}.pm-dialog h2{font-size:24px;margin:0 0 12px}.pm-dialog p{font-size:14px;line-height:1.5}.pm-dialog label{display:block;margin:14px 0 6px;font-size:14px}.pm-dialog input:not([type=checkbox]),.pm-dialog select{width:100%;padding:12px;border:1px solid var(--color-divider);border-radius:8px;background:transparent;font:inherit;color:inherit}.pm-dialog fieldset{border:0;padding:0;margin:16px 0}.pm-dialog legend{font-weight:600;font-size:14px}.pm-dialog .pm-recipient{display:flex;gap:10px;align-items:center}.pm-dialog footer{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;margin-top:20px}.pm-dialog [role=status]{color:var(--color-muted)}.pm-city-results{display:grid;gap:4px;margin-top:8px}.pm-dialog .pm-circle{margin:4px}
@media(max-width:600px){.pm-dialog{padding:20px}}

@layer remembrand-buttons {
 @media(min-width:1025px) {
    .profile-overview .memories-filter-chips > [data-rb-button] {
        padding-inline: clamp(12px, calc(4vw - 40px), 24px) !important;
    }
 }
 @media(max-width:420px) {
    .profile-overview .profile-lists-trigger[data-rb-button] { padding-inline: 12px !important; }
 }
 @media(max-width:340px) {
    .profile-overview .profile-lists-trigger[data-rb-button] { padding-inline: 8px !important; }
 }
 .profile-map-controls .ui-toggle-row {
    --ui-setting-row-height:40px;
    width:auto!important;flex:0 0 auto!important;min-width:0!important;
 }
 @media(max-width:1024px) {
    .profile-map-controls .ui-toggle-row {
        --ui-setting-row-height:44px;
        --ui-setting-inset-left:13px;
        --ui-setting-inset-right:8px;
        width:100%!important;
        gap:8px!important;
    }
 }
 .profile-map-section .profile-map-list button{max-width:300px!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;display:block!important;flex:0 0 auto!important;padding:0 16px!important}

}

.pm-dialog{margin:auto;box-sizing:border-box}.pm-dialog input[type=checkbox]:not(.ui-switch){accent-color:var(--color-selected,var(--app-color-maps-dad6ff,#dad6ff));width:18px;height:18px;flex:0 0 18px}

.publish-location-footer { width: 100%; text-align: start; }
#publishLocationHint { margin: 8px 0 0; color: var(--color-muted); font-size: 13px; }
#publishLocationHint:empty { display: none; }
@layer remembrand-buttons {
    #publishLocationPublicChoice[hidden] { display: none !important; }
    #memoryEditModal .memory-publishing-person.has-location-switch {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) 44px 32px !important;
        align-items: center !important;
        gap: 8px !important;
    }
    #memoryEditModal .memory-publishing-person.has-location-switch.is-readonly {
        grid-template-columns: auto minmax(0, 1fr) 44px !important;
    }
    #memoryEditModal .has-location-switch > .collab-person-body { display: flex !important; }
    #memoryEditModal .has-location-switch .collab-person-copy { display: grid !important; min-width: 0; }
    #memoryEditModal .has-location-switch .collab-person-copy > :is(strong, small) { grid-column: 1 !important; }
    #memoryEditModal .has-location-switch > .publish-location-switch {
        display: grid !important;
        place-items: center;
        grid-column: 2;
        grid-row: 1;
        width: 44px;
        border: 0 !important;
        padding: 0 !important;
        cursor: pointer;
    }
    #memoryEditModal .has-location-switch.is-readonly > .publish-location-switch { grid-column: 3; }
    #memoryEditModal .has-location-switch .ui-switch:disabled { opacity: .7; }
}
/* Map sharing uses the same per-person switches on narrow and wide screens. */
#mapLocationDialog .ui-toggle-row{display:flex;align-items:center;justify-content:space-between;gap:16px;width:100%;box-sizing:border-box}
#mapLocationDialog .ui-switch{flex-shrink:0}
#mapLocationDialog small{display:block;font-size:12px;color:var(--color-muted);line-height:1.5}
#mapLocationPeople .ui-toggle-row>span{min-width:0;overflow-wrap:anywhere}
/* Reuse the co-author palette, including its email row, circles and people. */
#mapLocationDialog.map-location-picker{position:fixed;inset:0;margin:auto;border:0;width:min(560px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;box-sizing:border-box;padding:32px;border-radius:32px;background:var(--bg,var(--app-color-maps-f7f5eb,#f7f5eb));color:var(--text,var(--app-color-maps-111111,#111))}
#mapLocationDialog.map-location-picker::backdrop{background:var(--app-color-maps-00000066,#0006)}
#mapLocationDialog.map-location-picker h2{text-align:center;margin:0 0 8px}
#mapLocationDialog.map-location-picker>p{text-align:center;line-height:1.45;margin:0 0 28px}
#mapLocationDialog.map-location-picker .collab-card{padding:0;border:0;background:transparent}
#mapLocationDialog.map-location-picker .collab-person{grid-template-columns:40px minmax(0,1fr) 40px;border-radius:0}
#mapLocationDialog.map-location-picker .collab-person-copy{min-width:0;overflow-wrap:anywhere}
#mapLocationDialog.map-location-picker .collab-person-remove{grid-column:3}
#mapLocationDialog.map-location-picker .memory-edit-modal-actions{display:flex;justify-content:space-between;margin-top:24px}
#mapLocationDialog.map-location-picker .memory-edit-modal-actions button{width:48px;height:48px;padding:0;border-radius:50%}
#mapLocationDialog.map-location-picker .ui-control-help,#mapLocationDialog.map-location-picker [role=status]{font-size:12px;line-height:1.5;color:var(--color-muted,var(--app-color-maps-666666,#666))}
#mapLocationDialog.map-location-picker .memory-contact-options{max-height:180px;overflow:auto}
@media(max-width:600px){#mapLocationDialog.map-location-picker{padding:24px}}
@layer remembrand-buttons {
#mapLocationDialog.map-location-picker .collab-invite-row{display:grid!important;grid-template-columns:minmax(0,1fr) 40px!important;gap:10px!important;width:100%;align-items:center}
#mapLocationDialog.map-location-picker .invitation-email-picker{min-width:0;width:100%}
#mapLocationDialog.map-location-picker .collab-invite-row .collab-add-person{width:40px!important;min-width:40px!important;max-width:40px!important;height:40px!important;padding:0!important;border-radius:50%!important;background:var(--color-purple,var(--app-color-maps-5b4abb,#5b4abb))!important;color:var(--app-color-maps-ffffff,white)!important;display:grid!important;place-items:center}
#mapLocationDialog.map-location-picker .collab-person{display:grid!important;grid-template-columns:40px minmax(0,1fr) 40px!important}
#mapLocationDialog.map-location-picker .collab-person-copy{grid-column:2!important;justify-self:stretch!important;text-align:left}

}

@layer remembrand-buttons {
 #mapLocationDialog.map-location-picker .map-location-public{display:flex!important;justify-content:space-between!important;align-items:center!important;gap:16px!important;width:100%!important;box-sizing:border-box!important;text-align:left!important}
 #mapLocationDialog.map-location-picker .map-location-public .ui-setting-label{min-width:0;white-space:normal!important}
 #mapLocationDialog.map-location-picker .map-location-public .ui-switch{flex-shrink:0!important}
}

@layer remembrand-buttons {
 #mapLocationDialog.map-location-picker .collab-invite-card{padding-top:var(--overlay-content-gap)!important}
 #mapLocationDialog.map-location-picker .map-location-people-label{display:block!important;margin:0 0 var(--overlay-label-gap)!important;text-align:center!important}
 #mapLocationDialog.map-location-picker .collab-invite-row{margin-top:0!important}
}

@layer remembrand-buttons {
 #mapLocationDialog.map-location-picker .collab-invite-card[hidden]{display:none!important}
}

@layer remembrand-buttons {
 .profile-map-section [hidden] { display:none!important; }
}

/* The full-card opener is transparent in every pointer/keyboard state. */
@layer remembrand-buttons {
 #profileMapOpen, #profileMapOpen:is(:hover,:focus-visible,:active) {background:transparent!important;}
}

#mapLocationDialog .map-location-contact-status {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 2px 8px;
    margin: 4px 0 0;
    color: var(--color-muted, var(--app-color-maps-666666,#666));
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}
#mapLocationDialog .map-location-contact-status[hidden] {
    display: none;
}
#mapLocationDialog .map-location-contact-status [data-invite-contact] {
    display: contents;
}
#mapLocationDialog .map-location-contact-status :is(small, a) {
    font: inherit;
}
#mapLocationDialog .map-location-contact-status a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Mobile profile identity follows the category-row reference. */
@media (max-width: 768px) {
    #page-profile .profile-overview .profile-info > .avatar-xl {
        width: clamp(76.8px, 16.8vw, 115.2px);
        height: clamp(76.8px, 16.8vw, 115.2px);
    }
    #page-profile .profile-overview .profile-details h1 { margin-left: 3px; }
}
