/* WalkAtlas Stage 4D — Friendship presentation */

.wa-profile-friendship {
    display: grid;
    gap: 12px;
    min-inline-size: 0;
    container-type: inline-size;
    container-name: wa-friendship;
    color: #173c30;
}

.wa-profile-friendship,
.wa-profile-friendship * {
    box-sizing: border-box;
}

.wa-friendship-section {
    min-inline-size: 0;
    padding: 14px;
    background: #ffffff;
    border: 1px solid #dce5dc;
    border-radius: 14px;
}

.wa-friendship-section__heading {
    margin: 0 0 12px;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.wa-friendship-section__description {
    margin: 6px 0 0;
    color: #52665c;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Friendship status */

.wa-friendship-status {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid #dce5dc;
    border-radius: 12px;
    background: #f5f7f3;
    color: #173c30;
}

.wa-friendship-status[data-state="friends"] {
    background: #edf5ed;
    border-color: #c9dec9;
    color: #175333;
}

.wa-friendship-status[data-state="outgoing"] {
    background: #fff5db;
    border-color: #e7d5a5;
    color: #76520d;
}

.wa-friendship-status[data-state="incoming"] {
    background: #edf4fa;
    border-color: #cdddea;
    color: #244e70;
}

.wa-friendship-status__icon {
    display: grid;
    place-items: center;
    flex: 0 0 38px;
    inline-size: 38px;
    block-size: 38px;
    border-radius: 12px;
    background: rgb(255 255 255 / 75%);
}

.wa-friendship-status__body {
    flex: 1;
    min-inline-size: 0;
}

.wa-friendship-status__title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.wa-friendship-status__text {
    margin: 4px 0 0;
    font-size: 0.82rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Friendship actions */

.wa-friendship-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-block-start: 12px;
}

.wa-friendship-actions > :only-child {
    grid-column: 1 / -1;
}

.wa-friendship-actions button,
.wa-friendship-actions a,
.wa-friendship-group__action {
    display: flex;
    align-items: center;
    justify-content: center;
    min-inline-size: 0;
    min-block-size: 44px;
    padding: 10px 12px;
    border: 1px solid #dce5dc;
    border-radius: 10px;
    background: #ffffff;
    color: #173c30;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 650;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.wa-friendship-actions .is-primary {
    background: #236b43;
    border-color: #236b43;
    color: #ffffff;
}

.wa-friendship-actions .is-destructive {
    background: #fff5f5;
    border-color: #e9c7cd;
    color: #8d2438;
}

/* Shared walking statistics */

.wa-friendship-walk-total {
    display: grid;
    gap: 4px;
    padding: 14px;
    border-radius: 12px;
    background: #edf5ed;
    text-align: center;
}

.wa-friendship-walk-total__value {
    font-size: 1.8rem;
    font-weight: 750;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}

.wa-friendship-walk-total__label {
    color: #52665c;
    font-size: 0.82rem;
    line-height: 1.4;
}

/* Group lists */

.wa-friendship-groups {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.wa-friendship-group {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-inline-size: 0;
    padding: 10px;
    background: #f5f7f3;
    border: 1px solid #dce5dc;
    border-radius: 12px;
}

.wa-friendship-group__avatar {
    display: grid;
    place-items: center;
    inline-size: 44px;
    block-size: 44px;
    overflow: hidden;
    border-radius: 12px;
    background: #edf5ed;
    color: #236b43;
    font-weight: 750;
}

.wa-friendship-group__avatar img {
    display: block;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
}

.wa-friendship-group__body {
    min-inline-size: 0;
}

.wa-friendship-group__name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.wa-friendship-group__meta {
    margin: 4px 0 0;
    color: #52665c;
    font-size: 0.78rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.wa-friendship-group__action {
    min-inline-size: 44px;
}

/* Empty and unavailable states */

.wa-friendship-empty {
    padding: 14px;
    border: 1px dashed #dce5dc;
    border-radius: 10px;
    background: #f5f7f3;
    color: #52665c;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* Interaction and accessibility */

.wa-profile-friendship
:is(button, a, summary):focus-visible {
    outline: 3px solid #236b43;
    outline-offset: 3px;
}

.wa-profile-friendship
:is(button, a)[aria-disabled="true"],
.wa-profile-friendship button:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

@media (hover: hover) {
    .wa-friendship-actions
    :is(button, a):not(:disabled):not([aria-disabled="true"]):hover,
    .wa-friendship-group__action:hover {
        box-shadow: 0 0 0 2px #c9dec9;
    }
}

/* Narrow Profile containers and zoom reflow */

@container wa-friendship (max-width: 280px) {
    .wa-friendship-section {
        padding: 10px;
    }

    .wa-friendship-actions {
        grid-template-columns: minmax(0, 1fr);
    }

    .wa-friendship-group {
        grid-template-columns: 40px minmax(0, 1fr);
    }

    .wa-friendship-group__avatar {
        inline-size: 40px;
        block-size: 40px;
    }

    .wa-friendship-group__action {
        grid-column: 1 / -1;
    }
}

/* Visitor Profile integration with the shared Stage 4 styles. */
#panel #accountWalkSections[data-wa-profile-4d] .wa-profile-friendship {
    margin: 12px;
    color: var(--p4-ink, #173c30);
}

#panel #accountWalkSections[data-wa-profile-4d] .profilePrivateCard .wa-profile-friendship {
    margin: 0;
}

.wa-profile-friendship .wa-friendship-section {
    background: var(--p4-paper, #fff);
    border-color: var(--p4-line, #dce5dc);
}

.wa-profile-friendship .wa-friendship-group,
.wa-profile-friendship .wa-friendship-empty {
    background: var(--p4-bg, #f5f7f3);
    border-color: var(--p4-line, #dce5dc);
}

.wa-profile-friendship .wa-friendship-empty { margin: 0; }
.wa-profile-friendship .wa-friendship-status__icon svg { inline-size: 20px; block-size: 20px; }
.wa-profile-friendship .wa-friendship-group__avatar > * { inline-size: 100%; block-size: 100%; }

#panel #accountWalkSections[data-wa-profile-4d] .wa-p4-tab :is(.wa-p4-tab-label,.wa-p4-tab-value) {
    min-inline-size: 0;
    white-space: normal;
    overflow-wrap: anywhere;
}

#panel #accountWalkSections[data-wa-profile-4d] :is(.wa-p4-name,.wa-p4-handle) {
    overflow-wrap: anywhere;
}

#panel #accountWalkSections[data-wa-profile-4d] .wa-p4-avatar.friendAvatar { cursor: default; }

#panel #accountWalkSections[data-wa-profile-4d] .profilePrivateCard,
#panel #sharedProfileRouteStatus {
    margin: 12px;
    padding: 14px;
    border: 1px solid var(--p4-line, #dce5dc);
    border-radius: 14px;
    background: var(--p4-paper, #fff);
    color: var(--p4-ink, #173c30);
    overflow-wrap: anywhere;
}

#panel #accountWalkSections[data-wa-profile-4d] .profilePrivateAction,
#panel #sharedProfileRouteStatus button {
    min-block-size: 44px;
}

@container wa-profile-4a (max-width: 265px) {
    #panel #accountWalkSections[data-wa-profile-4d] .wa-p4-nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (prefers-reduced-motion: reduce) {
    .wa-profile-friendship * { transition: none; }
}
