/*
 * Canonical Spossity profile shell.
 *
 * This file is loaded after page-level styles so responsive rules cannot turn
 * a person profile back into a circle. Location pins, presence dots, virtual
 * avatars, and action icons are intentionally outside this contract.
 */
:root {
  --sp-account-profile-photo: none;
  --sp-account-avatar: none; /* your avatar portrait, drawn over your photo (not on the profile card) */
  --sp-account-profile-photo-size: cover;
}

.sp-profile-shell,
body:not(.is-logged-in) :is(.avatar, .person-avatar, .sam-avatar),
body.is-logged-in :is(
  .person-avatar,
  .home-family-profile-initials,
  .friend-avatar,
  .friend-discovery-avatar,
  .vibe-chat-avatar,
  .comment-avatar,
  .timeline-followed-avatar,
  .timeline-avatar,
  .timeline-keep-map-avatar,
  .presence-avatar,
  .profile-invite-avatar,
  .profile-social-avatar,
  .profile-summary-avatar,
  .host-event-audience-avatar,
  .event-studio-profile-avatar,
  .event-studio-live-audience-faces i,
  .avatar-consent-photo,
  .avatar-source-photo,
  [data-attendee-event-host-avatar]
) {
  box-sizing: border-box;
  height: auto !important;
  aspect-ratio: var(--sp-profile-shell-aspect);
  overflow: hidden;
  border: var(--sp-profile-shell-border) solid var(--sp-profile-shell-outer) !important;
  border-radius: 28% / 22% !important;
  color: #fff !important;
  background-clip: padding-box;
  box-shadow:
    inset 0 0 0 1.5px var(--sp-profile-shell-inner),
    var(--sp-profile-shell-shadow) !important;
}

body.is-logged-in .top-profile,
body.is-logged-in .app-sidebar-profile::before,
body.is-logged-in .app-topbar .top-profile::before,
body.is-logged-in :is(
  .friend-avatar.user,
  .friend-discovery-avatar.user,
  .presence-avatar.user,
  .timeline-avatar.user,
  .profile-summary-avatar
) {
  box-sizing: border-box;
  aspect-ratio: var(--sp-profile-shell-aspect);
  border: var(--sp-profile-shell-border) solid transparent !important;
  border-radius: 28% / 22% !important;
  color: transparent !important;
  /* Layers: your avatar, your photo, then the signature violet frame (the frame always stays last). */
  background-image: var(--sp-account-avatar), var(--sp-account-profile-photo), var(--sp-profile-shell-gradient);
  background-repeat: no-repeat;
  background-position: center 20%, center, center;
  background-size: cover, var(--sp-account-profile-photo-size), 100% 100%;
  background-origin: padding-box, padding-box, border-box;
  background-clip: padding-box, padding-box, border-box;
  box-shadow:
    inset 0 0 0 1.5px var(--sp-profile-shell-inner),
    var(--sp-profile-shell-shadow) !important;
}

body.is-logged-in .top-profile {
  width: 48px;
  height: auto !important;
}

body.is-logged-in.account-without-photo :is(.top-profile, .profile-summary-avatar) {
  color: #fff !important;
}
body.is-logged-in.account-without-photo .app-sidebar-profile::before {
  content: attr(data-profile-initials);
  display: grid;
  place-items: center;
  color: #fff !important;
  font-size: 12px;
  /* Keep the border-box layer when initials replace the account photo. */
  background-image: var(--sp-profile-shell-gradient), var(--sp-profile-shell-gradient);
}

body.is-logged-in .top-profile .profile-status {
  display: none;
}

body.is-logged-in .app-sidebar-profile::before,
body.is-logged-in .app-topbar .top-profile::before {
  width: 36px;
  height: auto !important;
}

body.is-logged-in .profile-menu-identity {
  grid-template-columns: 56px minmax(0, 1fr);
}

body.is-logged-in .profile-menu-identity .profile-summary-avatar {
  width: 56px;
}

body.is-logged-in .me-view.profile-menu-source .friends-preview-header {
  display: none;
}

@media (max-width: 1100px) {
  body.is-logged-in .top-profile { width: 44px; }
}

/* Light profile uses the approved pale-blue weather-card finish. */
html:not([data-theme="dark"]) body.is-logged-in .profile-menu-panel {
  border: 1.5px solid #ffffff;
  background: linear-gradient(135deg, #f8fbff 0%, #edf4ff 45%, #e2edff 100%);
  box-shadow: 0 10px 24px rgba(23,58,115,0.14);
  backdrop-filter: none;
}

/* Light-mode version of the profile icon signature. */
html:not([data-theme="dark"]) body.is-logged-in .profile-menu-panel .profile-menu-icon {
  position: relative;
  overflow: hidden;
  border: 1px solid #7fa9df;
  color: #2167f5;
  background: radial-gradient(ellipse at 32% 12%, rgba(255,255,255,.95), transparent 52%), linear-gradient(160deg, #dcecff 8%, #bdd7f8 55%, #d5e7ff 100%);
  box-shadow: 0 3px 6px rgba(38,83,149,.18), inset 0 1px 0 #ffffff, inset 1px 0 0 rgba(255,255,255,.8), inset 0 -2px 2px rgba(89,138,200,.22) !important;
}
html:not([data-theme="dark"]) body.is-logged-in .profile-menu-panel .profile-menu-icon::after {
  content: ""; position: absolute; top: 2px; left: 2px; right: 2px; height: 45%;
  border-radius: 8px 8px 5px 5px; border-top: 1px solid #ffffff; background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.08)); pointer-events: none;
}
html:not([data-theme="dark"]) body.is-logged-in .profile-menu-panel .profile-menu-icon svg {
  position: relative; z-index: 1; color: #2167f5; stroke: currentColor;
}

html:not([data-theme="dark"]) body.is-logged-in .profile-menu-panel .profile-menu-icon svg [stroke] {
  stroke: #2167f5; stroke-width: 1.9;
}

/* Photo selection previews use the same portrait frame as account avatars. */
.profile-photo-preview-shell {
  position: relative;
  width: 120px;
  max-width: 100%;
  flex-shrink: 0;
}
.profile-photo-preview-shell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-photo-preview-shell.is-sample img { transform: scale(1.9); }
.profile-photo-preview-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1.5px var(--sp-profile-shell-inner);
  pointer-events: none;
}

/* Canonical uploaded photos fill identity frames without stretching. */
.sp-user-photo-frame { position: relative; overflow: hidden; }
.sp-user-photo-frame > img.sp-user-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  max-width: none; max-height: none; object-fit: cover; object-position: center;
  border-radius: inherit;
}
.sp-user-photo-frame > img.sp-user-photo[hidden] { display: none; }

.profile-security-action.profile-delete-action { color: #b42332; border-color: rgba(180,35,50,.38); }
html[data-theme="dark"] .profile-security-action.profile-delete-action { color: #ffb2bc; border-color: rgba(255,178,188,.4); }
.profile-delete-action:disabled { opacity: .45; cursor: not-allowed; }

.spossity-account-delete-dialog {
  box-sizing: border-box; width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 40px);
  overflow: auto; padding: 26px; border-radius: 28px; border: 2px solid rgba(255,255,255,.95);
  color: #0b285b; background: linear-gradient(135deg, #e8f7f4, #e7f0ff);
  box-shadow: 0 16px 48px rgba(16,45,92,.18); font: inherit;
}
.spossity-account-delete-dialog::backdrop { background: rgba(6,16,32,.38); }
.spossity-account-delete-dialog h2 { font-size: 22px; line-height: 1.3; margin: 0 0 16px; }
.spossity-account-delete-dialog p { font-size: 15px; line-height: 1.5; }
.account-deletion-dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.account-deletion-dialog-actions button { min-height: 44px; padding: 10px 22px; border-radius: 16px; border: 1px solid #c7d8ef; background: #f7fbff; color: #0b285b; font: inherit; cursor: pointer; }
.account-deletion-dialog-actions button[data-confirm] { color: #b42332; border-color: #dca4ae; }
html[data-theme="dark"] .spossity-account-delete-dialog { background: #081421; color: #f5f8ff; border-color: #345377; }
html[data-theme="dark"] .account-deletion-dialog-actions button { color: #f5f8ff; background: #10243a; border-color: #345377; }
html[data-theme="dark"] .account-deletion-dialog-actions button[data-confirm] { color: #ffb2bc; }

/* Follow lists size to their rows rather than the profile editor. */
/* Inherit the viewport-based limit; a percentage cannot resolve against an
   auto-height popover and lets long account forms escape below the screen. */
body.is-logged-in .home-profile-popover-content :is(.profile-menu-panel, .profile-settings-panel) {
  max-height: inherit;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
body.is-logged-in .profile-edit-form .profile-security-action { min-height: 44px; }
body.is-logged-in .home-profile-popover-content:has(.follow-list-panel) {
  width: min(280px, calc(100vw - 32px));
  right: auto;
  max-height: 55svh;
}
body.is-logged-in .home-profile-popover-content .follow-list-panel {
  min-height: 0 !important;
  height: auto !important;
  padding: 12px 16px !important;
}
.follow-list-panel [data-follow-lists] { max-height: 40svh !important; padding-top: 28px !important; }
.follow-list-panel [data-follow-lists] li { padding: 8px 0 !important; }

/* The popover panel owns scrolling. Keep its menu content at natural height
   rather than allowing a nested flex scroller to collapse below the identity. */
body.is-logged-in .home-profile-popover-content .profile-menu-panel > .profile-menu-identity,
body.is-logged-in .home-profile-popover-content .profile-menu-panel > .profile-menu-scroll {
  flex: 0 0 auto;
}
body.is-logged-in .home-profile-popover-content .profile-menu-scroll {
  overflow: visible;
}
/* Give the menu a definite viewport-bounded height, including embedded web
   views whose auto-height flex layout otherwise sizes to the identity alone. */
body.is-logged-in .home-profile-popover-content:has(> .profile-menu-panel) {
  height: min(780px, calc(100svh - 112px - env(safe-area-inset-bottom)));
}
body.is-logged-in .home-profile-popover-content > .profile-menu-panel {
  box-sizing: border-box;
  height: 100%;
  max-height: 100%;
}
/* Family and friends: their avatar portrait sits over the photo, on a soft violet glass backdrop. */
.sp-user-photo-frame > img.sp-avatar-portrait { object-fit: cover; object-position: center 20%; background: radial-gradient(circle at 50% 35%, #f4ecff, #d9c8ff 70%); }
html[data-theme="dark"] .sp-user-photo-frame > img.sp-avatar-portrait { background: radial-gradient(circle at 50% 35%, #2a2350, #141c38 70%); }

/* The portrait shows only once it has loaded; until then (or if there is none) the photo shows. */
.sp-user-photo-frame > img.sp-avatar-portrait:not([data-loaded]) { visibility: hidden; }

/* The profile card (Timeline profile and the sidebar profile with Keep Ups) shows your real photo. */
body.is-logged-in .app-sidebar-profile::before,
body.is-logged-in .profile-summary-avatar { --sp-account-avatar: none; }

/* The photo under an avatar picture stays hidden until we know there is no avatar (no photo flash). */
.sp-user-photo-frame > img.sp-photo-behind-avatar { visibility: hidden; }

/* A Spot is not a person: its picture keeps the approved Spot shape (a rounded square in the
   signature violet frame, as on the Spot's own page), never the vertical profile card. */
body.is-logged-in :is(.timeline-avatar.spot, .sp-spot-avatar) {
  box-sizing: border-box;
  width: 46px; /* as tall as a person's profile card beside it */
  height: 46px !important;
  aspect-ratio: 1 / 1 !important;
  border: 2px solid var(--sp-color-violet, #9b6cff) !important;
  border-radius: 26% !important;
  background: #ffffff !important;
  box-shadow: 0 4px 12px rgba(20, 56, 112, 0.16) !important;
  color: var(--sp-text-light-primary, #0b285b) !important;
}
body.is-logged-in.timeline-open .timeline-avatar.spot { width: 40px; height: 40px !important; }
body.is-logged-in :is(.timeline-avatar.spot, .sp-spot-avatar) > img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
/* The Spot's name is the same name element as a person's (same font, size and colour); the link only inherits it. */
body.is-logged-in .timeline-author .spot-profile-link { font: inherit !important; color: inherit !important; letter-spacing: inherit; text-shadow: inherit; }
html[data-theme="dark"] body.is-logged-in :is(.timeline-avatar.spot, .sp-spot-avatar) { background: var(--sp-surface-dark-raised, #08172b) !important; }

/* Avatar or nothing (audits/photo-to-avatar-audit-2026-11-11.md). Photos stay only on the
   profile card and Timeline posts. Everywhere else a person is their avatar portrait, standing
   free — no frame, no photo, no initials — and nothing at all when they have no avatar yet. */
html:root body .sp-avatar-only.sp-avatar-only {
  background: none !important; border-color: transparent !important; border-width: 0 !important;
  box-shadow: none !important; color: transparent !important; outline: 0 !important;
  font-size: 0 !important; overflow: visible !important; border-radius: 0 !important;
}
html:root body .sp-avatar-only.sp-avatar-only::before, html:root body .sp-avatar-only.sp-avatar-only::after { content: none !important; }
html:root body .sp-avatar-only > .sp-avatar-only-img {
  display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom;
  border: 0; border-radius: 0; background: none;
}
/* Your header and sidebar profile buttons: your profile photo, the same as your Timeline posts (your Me card shows your avatar). */
html:root body.is-logged-in .app-topbar .top-profile::before { content: none !important; }
/* The sidebar profile button opens your profile card, so it shows the same picture as the card
   (your profile photo in the violet frame, or your initials); see the rules near the top. */
/* You, shown in lists and pickers (not a Timeline post): your avatar, or nothing. */
html:root body.is-logged-in :is(.friend-avatar.user, .friend-discovery-avatar.user, .presence-avatar.user) {
  background: var(--sp-own-avatar, none) center bottom / contain no-repeat !important;
  border-color: transparent !important; box-shadow: none !important; color: transparent !important; font-size: 0 !important;
}
