/* WalkAtlas Stage 4C — owner Profile photo gallery, mobile first.
   Load after profile-stage4a.css and profile-stage4b.css.
   Add hooks to the existing renderer; keep existing IDs, actions and guards.
   Scope excludes visitor Profile, Social Group galleries, Business and shared viewer.
   JS owns gallery filter/size state, media lifecycle and permission decisions. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c {
  --p4c-ink: var(--p4-ink, #173c30);
  --p4c-text: var(--p4-text, #263d35);
  --p4c-muted: var(--p4-muted, #52665c);
  --p4c-green: var(--p4-green, #236b43);
  --p4c-dark: var(--p4-green-dark, #175333);
  --p4c-soft: var(--p4-soft, #edf5ed);
  --p4c-paper: var(--p4-paper, #fff);
  --p4c-bg: var(--p4-bg, #f5f7f3);
  --p4c-line: var(--p4-line, #dce5dc);
  --p4c-strong: var(--p4-strong-line, #849b89);
  --p4c-focus: var(--p4-focus, #176f9f);
  --p4c-danger: var(--p4-alert, #a51d35);
  --p4c-radius: var(--p4-radius, 14px);
  container: wa-profile-photos / inline-size;
  min-inline-size: 0;
  max-inline-size: 100%;
  margin-block-start: 12px;
  color: var(--p4c-text);
  font: inherit;
  line-height: 1.45;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c *,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c *::before,
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c *::after { box-sizing: border-box; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c[hidden],
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c [hidden] { display: none !important; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c :is(button,a,select,summary,input):focus-visible {
  outline: 3px solid var(--p4c-focus); outline-offset: 2px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-icon {
  inline-size: 1.05rem; block-size: 1.05rem; flex: 0 0 auto; color: inherit;
}
/* 1. One heading + eligible count, compact controls in a single toolbar. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-header {
  display: grid; gap: 10px; min-inline-size: 0; margin: 0 0 14px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-heading {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 12px; padding-inline: 2px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-title {
  margin: 0; font-size: 1.125rem; font-weight: 780; line-height: 1.3;
  color: var(--p4c-ink); overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-count {
  font-size: .78rem; font-weight: 650; color: var(--p4c-muted);
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filters {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px;
  padding: 0; margin: 0; min-inline-size: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filter {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; inline-size: 100%; min-inline-size: 0; min-block-size: 58px;
  margin: 0; padding: 7px 4px; background: var(--p4c-paper);
  border: 1px solid var(--p4c-line); border-radius: 11px; box-shadow: none;
  color: var(--p4c-ink); font: inherit; font-size: .75rem; font-weight: 650;
  line-height: 1.25; text-align: center; white-space: normal; overflow-wrap: anywhere;
  cursor: pointer;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filter-count {
  font-size: .95rem; font-weight: 780; font-variant-numeric: tabular-nums;
  line-height: 1.2; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filter:is([aria-selected="true"],[aria-pressed="true"], [data-selected="true"]) {
  background: var(--p4c-soft); border-color: var(--p4c-green); color: var(--p4c-dark);
  box-shadow: inset 0 -2px 0 var(--p4c-green);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-size-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-inline-size: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-size-label {
  color: var(--p4c-muted); font-size: .78rem; font-weight: 650; margin: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-sizes {
  display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); flex: 1 1 190px;
  min-inline-size: 0; gap: 4px; padding: 3px; background: var(--p4c-bg);
  border: 1px solid var(--p4c-line); border-radius: 11px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-size {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  min-inline-size: 0; min-block-size: 44px; margin: 0; padding: 6px 4px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--p4c-ink); font: inherit; font-size: .78rem; font-weight: 700;
  white-space: normal; overflow-wrap: anywhere; cursor: pointer;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-size[aria-pressed="true"] {
  color: #fff; background: var(--p4c-dark); border-color: var(--p4c-dark);
}
/* 2. Layout follows the available panel width, not the full map viewport.
   data-size belongs to the existing gallery grid, not individual filters. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid {
  display: grid; grid-template-columns: minmax(0,1fr); align-items: start;
  gap: 10px; min-inline-size: 0; margin: 0; padding: 0; list-style: none;
}
@container wa-profile-photos (min-width: 17rem) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid:is([data-size="small"],[data-size="medium"]) {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}
@container wa-profile-photos (min-width: 27rem) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid[data-size="small"] {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-sizes { flex: 0 1 230px; }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filter { min-block-size: 52px; }
}
@container wa-profile-photos (max-width: 16.99rem) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filters,
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-sizes { grid-template-columns: minmax(0,1fr); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filter { flex-direction: row; min-block-size: 44px; }
}
/* 3. Image-first cards. Keep menu/visibility controls OUTSIDE the image button.
   Do not clip the card itself: existing action popovers may extend past it. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-card {
  display: grid; align-content: start; gap: 0; min-inline-size: 0;
  margin: 0; padding: 0; border: 1px solid var(--p4c-line);
  border-radius: var(--p4c-radius); background: var(--p4c-paper); box-shadow: none;
  overflow: visible;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-media {
  position: relative; min-inline-size: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-open {
  display: block; position: relative; inline-size: 100%; min-inline-size: 0;
  aspect-ratio: 4 / 3; min-block-size: 44px; padding: 0; margin: 0;
  border: 0; border-radius: calc(var(--p4c-radius) - 1px) calc(var(--p4c-radius) - 1px) 0 0;
  background: var(--p4c-soft); color: var(--p4c-muted); box-shadow: none;
  overflow: hidden; cursor: pointer; text-align: center;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-image {
  display: block; inline-size: 100%; block-size: 100%; max-inline-size: 100%;
  margin: 0; object-fit: cover; object-position: center; border-radius: 0;
}
/* In Large mode use trusted known dimensions to reserve the aspect ratio.
   If dimensions are unavailable, leave a stable 4:3 contained preview.
   Never infer dimensions from secrets or issue requests solely for size. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid[data-size="large"] .wa-p4c-open {
  aspect-ratio: var(--p4c-photo-ratio, 4 / 3);
  max-block-size: 34rem;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid[data-size="large"] .wa-p4c-image { object-fit: contain; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-preview-state {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 6px;
  padding: 8px; color: var(--p4c-muted); background: var(--p4c-soft);
  font-size: .75rem; line-height: 1.35; overflow-wrap: anywhere;
  pointer-events: none;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-preview-state .wa-p4c-icon { margin-inline: auto; }
/* Menu trigger is a sibling of the image button, not its child. Use existing
   portal/popover placement and focus logic; never trap menus in a cropped box. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-menu-trigger {
  position: absolute; inset-block-start: 5px; inset-inline-end: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  inline-size: 44px; block-size: 44px; min-inline-size: 44px; min-block-size: 44px;
  margin: 0; padding: 0; border: 1px solid var(--p4c-strong); border-radius: 10px;
  background: var(--p4c-paper); color: var(--p4c-ink); box-shadow: 0 1px 4px #173c3020;
  cursor: pointer;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-card-body {
  display: grid; gap: 5px; min-inline-size: 0; padding: 8px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-status-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-inline-size: 0;
}
/* 4. Effective audience and moderation status are separate. A pending Public
   request is NOT a Public audience. Use server-authorized status, not CSS. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge {
  --p4c-badge-bg: #eff2ef; --p4c-badge-ink: #40524a; --p4c-badge-line: #d3ddd4;
  display: inline-flex; align-items: center; gap: 4px; max-inline-size: 100%; min-inline-size: 0;
  padding: 4px 7px; border: 1px solid var(--p4c-badge-line); border-radius: 8px;
  color: var(--p4c-badge-ink); background: var(--p4c-badge-bg);
  font: inherit; font-size: .75rem; font-weight: 700; line-height: 1.3;
  white-space: normal; overflow-wrap: anywhere; text-align: start;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge[data-audience="friends"] {
  --p4c-badge-bg: #e9f4f9; --p4c-badge-ink: #175575; --p4c-badge-line: #c4deea;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge[data-audience="public"] {
  --p4c-badge-bg: #edf5ed; --p4c-badge-ink: #175333; --p4c-badge-line: #c4dcc5;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge[data-audience="group"] {
  --p4c-badge-bg: #f0ebfb; --p4c-badge-ink: #54398c; --p4c-badge-line: #d8cbee;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge[data-review="pending"] {
  --p4c-badge-bg: #fff5db; --p4c-badge-ink: #805509; --p4c-badge-line: #e7d39b;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge[data-review="rejected"] {
  --p4c-badge-bg: #fff0f2; --p4c-badge-ink: #92253b; --p4c-badge-line: #e9c5cc;
}
#panel #accountWalkSections[data-wa-profile-4a] button.wa-p4c-badge {
  min-block-size: 44px; min-inline-size: 44px; cursor: pointer; box-shadow: none;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-badge .wa-p4c-icon { inline-size: .9rem; block-size: .9rem; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-status-detail {
  margin: 0; color: var(--p4c-muted); font-size: .75rem; line-height: 1.4; overflow-wrap: anywhere;
}
/* Existing select may live in a disclosure or menu; retain options, accessible
   label, disabled state, handler and confirmation behaviour. No new choices. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-visibility-select {
  inline-size: 100%; min-inline-size: 0; max-inline-size: 100%; min-block-size: 44px;
  padding: 6px; border: 1px solid var(--p4c-strong); border-radius: 8px;
  background: var(--p4c-paper); color: var(--p4c-ink); font: inherit; font-size: .875rem;
}
/* 5. Compact attribution; full existing metadata in accessible disclosure or
   existing viewer/details. Never remove permission-relevant status text. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-walk-name {
  display: block; margin: 0; min-inline-size: 0; color: var(--p4c-ink);
  font-size: .82rem; font-weight: 730; line-height: 1.35; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-meta {
  margin: 0; color: var(--p4c-muted); font-size: .75rem; line-height: 1.4;
  min-inline-size: 0; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-group-name { color: #54398c; font-weight: 650; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-details { min-inline-size: 0; margin: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-details > summary {
  min-block-size: 44px; padding-block: 10px; color: var(--p4c-ink);
  font-size: .78rem; font-weight: 650; cursor: pointer; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-details > :not(summary) { margin-block: 0 6px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid[data-size="large"] .wa-p4c-card-body { padding: 12px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid[data-size="large"] .wa-p4c-walk-name { font-size: .95rem; }
/* 6. Existing empty, busy, failure, paging and ordering controls. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-state {
  display: grid; gap: 6px; padding: 16px 12px; margin: 0 0 8px;
  min-inline-size: 0; border: 1px dashed var(--p4c-line); border-radius: var(--p4c-radius);
  background: var(--p4c-bg); color: var(--p4c-muted); font-size: .875rem;
  text-align: center; overflow-wrap: anywhere;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-state-title {
  font-size: .95rem; font-weight: 740; color: var(--p4c-ink); margin: 0;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-state p { margin: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-footer {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 8px; min-inline-size: 0; margin-block: 12px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-action {
  display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  min-inline-size: 44px; max-inline-size: 100%; min-block-size: 44px; padding: 8px 12px;
  border: 1px solid var(--p4c-strong); border-radius: 10px; background: var(--p4c-paper);
  color: var(--p4c-ink); font: inherit; font-size: .82rem; font-weight: 700;
  white-space: normal; overflow-wrap: anywhere; cursor: pointer; box-shadow: none;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-action[data-variant="primary"] {
  background: var(--p4c-dark); border-color: var(--p4c-dark); color: #fff;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-action[data-variant="danger"] {
  color: var(--p4c-danger); background: #fff5f5; border-color: #e9c5cc;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c :is(button,select):disabled {
  cursor: not-allowed; opacity: .7;
}
@media (hover: hover) and (pointer: fine) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c :is(.wa-p4c-filter,.wa-p4c-menu-trigger,.wa-p4c-action):not(:disabled):hover { border-color: var(--p4c-green); }
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-open:hover { box-shadow: inset 0 0 0 2px var(--p4c-green); }
}
@media (prefers-reduced-motion: reduce) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c *,
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c *::before,
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-filter:is([aria-selected="true"],[aria-pressed="true"],[data-selected="true"]),
  #panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-size[aria-pressed="true"] { border: 2px solid Highlight; }
}

/* Integration with the managed Profile renderer and its existing selectors. */
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c { margin-inline: 12px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c > .photoV2MyPhotos { padding: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-size-row { margin-block-end: 10px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-sizes { margin: 0; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-size { inline-size: 100%; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-open { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-open .wa-p4c-image {
  min-inline-size: 0;
  min-block-size: 0;
  max-block-size: none;
  block-size: 100%;
  aspect-ratio: auto;
  object-fit: cover;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c-grid[data-size="large"] .wa-p4c-open .wa-p4c-image { object-fit: contain; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-menu-trigger { z-index: 1; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-privacy > summary {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 4px;
  border: 1px solid var(--p4c-line);
  border-radius: 8px;
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-privacy > summary::after {
  content: "";
  inline-size: 6px;
  block-size: 6px;
  flex: 0 0 6px;
  margin-inline-start: auto;
  margin-inline-end: 4px;
  border-inline-end: 1px solid currentColor;
  border-block-end: 1px solid currentColor;
  transform: rotate(45deg);
}
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-privacy[open] > summary::after { transform: rotate(225deg); }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-privacy > select { margin-block-start: 6px; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-details > small { display: block; overflow-wrap: anywhere; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-details > small:empty { display: none; }
#panel #accountWalkSections[data-wa-profile-4a] .wa-p4c .wa-p4c-footer:not(:has(> :not([hidden]))) { display: none; }
