/* Member dashboard (userprofile.php) — editorial theme.
   Pairs with media_hub.css + editorial_shell.css + event_gallery_editorial.css
   + member_directory_editorial.css. Reuses .md-hero*, .md-facts,
   .md-directory__head, .md-card*, .mh-btn, .mh-actions, .md-reveal verbatim;
   this file only adds the dashboard-specific pieces (completion meter, tool
   rail, profile grid, media blocks, record grid). Scoped to .ud-page. */

/* Multiple stacked .md-directory sections would each carry the members.php
   single-section padding — too much for a dashboard. Tighten it. */
.ud-page .md-directory { padding-block: clamp(46px, 6vw, 80px); }
.ud-page .md-directory:nth-of-type(even) { background: #efe4d4; }

.ud-page .md-hero__aside .mh-eyebrow { color: var(--eg-gold); }

/* Count pill next to a section heading. */
.ud-count {
  display: inline-block;
  transform: translateY(-4px);
  margin-left: 6px;
  padding: 3px 11px;
  border: 1px solid var(--eg-line);
  border-radius: 999px;
  font: 600 13px var(--eg-sans);
  color: var(--eg-muted);
  vertical-align: middle;
}

/* ---- CSRF / status bar (between header and hero) ------------------- */
.ud-alert {
  margin: 0;
  padding: 15px var(--eg-gutter);
  background: #f3e3d2;
  border-bottom: 1px solid var(--eg-line);
  color: var(--eg-wine);
  font: 500 14px/1.5 var(--eg-sans);
}

/* ---- Hero: personal identity + completion ------------------------- */
.ud-hero__avatar {
  position: relative;
  display: inline-block;
  width: 92px;
  height: 92px;
  margin-bottom: 22px;
}
.ud-hero__avatar-frame {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .42);
  border-radius: 50%;
  background: #d9b98d;
}
.ud-hero__avatar-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Small pencil badge signalling the avatar itself is the "change your
   personal photo" control — distinct from the event/video manager links. */
.ud-hero__avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 2px solid var(--eg-wine);
  border-radius: 50%;
  background: var(--eg-gold);
  color: #251d1a;
  font-size: 14px;
  line-height: 1;
}

.ud-progress {
  height: 6px;
  margin: 6px 0 4px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .24);
}
.ud-progress i { display: block; height: 100%; background: var(--eg-gold); }

/* ---- Member tool rail (below the hero) --------------------------- */
.ud-toolrail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  padding: 15px var(--eg-gutter);
  background: var(--eg-paper);
  border-bottom: 1px solid var(--eg-line);
}
.ud-toolrail a {
  padding: 7px 13px;
  border-radius: 999px;
  color: var(--eg-muted);
  font: 600 12px var(--eg-sans);
  letter-spacing: .03em;
  text-decoration: none;
}
.ud-toolrail a:hover { background: var(--eg-cream); color: var(--eg-wine); }
.ud-toolrail__sep { flex: 0 0 1px; height: 18px; margin: 0 9px; background: var(--eg-line); }

/* ---- Profile details -------------------------------------------- */
.ud-profile {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 58px);
  align-items: start;
  margin-top: 46px;
}
.ud-profile__photo {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: #e6d6c1;
}
.ud-profile__photo img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  filter: saturate(.9);
}
/* Overlay CTA shown only when there is no custom photo yet — a clickable
   .ud-profile__photo anchor wraps this, same "add your personal photo"
   affordance as the hero avatar badge, scoped to the empty state. */
.ud-profile__photo-cta {
  position: absolute;
  inset: auto 0 0 0;
  padding: 30px 14px 14px;
  background: linear-gradient(0deg, rgba(37, 29, 26, .85), rgba(37, 29, 26, 0));
  color: #fff;
  font: 700 13px var(--eg-sans);
  letter-spacing: .02em;
  text-align: center;
}
a.ud-profile__photo:hover .ud-profile__photo-cta { background: linear-gradient(0deg, rgba(217, 164, 65, .92), rgba(217, 164, 65, 0)); color: #251d1a; }
.ud-kv { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 15px 26px; margin: 0; }
.ud-kv dt {
  padding-top: 3px;
  color: var(--eg-muted);
  font: 700 11px var(--eg-sans);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ud-kv dd { margin: 0; font-size: 15px; line-height: 1.62; overflow-wrap: anywhere; }
.ud-kv a { color: var(--eg-wine); }

/* ---- Media library --------------------------------------------- */
.ud-media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(30px, 4vw, 60px);
  margin-top: 46px;
}
.ud-media__col > h3 {
  margin: 0 0 4px;
  font: 600 clamp(20px, 2vw, 27px)/1.15 var(--eg-serif);
  letter-spacing: -.02em;
}
.ud-media__col > p { margin: 0; color: var(--eg-muted); font-size: 13px; line-height: 1.7; }

.ud-stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin: 18px 0 20px;
  padding-top: 15px;
  border-top: 1px solid var(--eg-line);
}
.ud-stat-row strong {
  display: block;
  color: var(--eg-wine);
  font: 600 21px/1 var(--eg-serif);
  overflow-wrap: anywhere;
}
.ud-stat-row span {
  display: block;
  margin-top: 5px;
  color: var(--eg-muted);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ud-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ud-photo-grid a { display: block; overflow: hidden; aspect-ratio: 1 / 1; background: #dbcdbd; }
.ud-photo-grid img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  filter: saturate(.86);
  transition: transform .5s ease, filter .5s ease;
}
.ud-photo-grid a:hover img { transform: scale(1.05); filter: saturate(1); }

.ud-videos { display: grid; gap: 16px; }
.ud-video {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 15px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--eg-line);
}
.ud-video:last-child { border-bottom: 0; padding-bottom: 0; }
.ud-video__thumb { display: block; overflow: hidden; aspect-ratio: 16 / 10; background: #dbcdbd; }
.ud-video__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ud-video__body { min-width: 0; }
.ud-video__body strong { display: block; font: 600 15px/1.3 var(--eg-serif); overflow-wrap: anywhere; }
.ud-video__body span { display: block; margin-top: 4px; color: var(--eg-muted); font-size: 12px; }

.ud-media__col > .mh-actions,
.ud-media__col .ud-photo-grid + .mh-actions,
.ud-media__col .ud-videos + .mh-actions { margin-top: 20px; }

/* ---- Records (jobs / businesses / volunteering) ---------------- */
.ud-records {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 3vw, 40px) clamp(22px, 3vw, 44px);
  margin-top: 46px;
}
.ud-page .ud-records .md-card { display: block; }
.ud-record__body {
  margin: 12px 0 0;
  color: var(--eg-ink);
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

/* Compact buttons inside the record + video cards (match .md-card sizing). */
.ud-page .ud-record__actions .mh-btn,
.ud-page .ud-video__body .mh-btn { min-height: 36px; padding: 0 13px; font-size: 12px; }
.ud-record__actions,
.ud-video__body .mh-actions { margin-top: 12px; }
.ud-record__actions form,
.ud-video__body form { display: inline; }

/* Delete buttons: quiet danger tint over the .mh-btn ghost base. */
.ud-page .mh-btn.ud-btn-danger { border-color: rgba(157, 41, 41, .5); color: #9d2929; }
.ud-page .mh-btn.ud-btn-danger:hover { background: rgba(157, 41, 41, .08); }

/* ---- Responsive ---------------------------------------------- */
@media (max-width: 1050px) {
  .ud-media { grid-template-columns: 1fr; }
  .ud-records { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .ud-profile { grid-template-columns: 1fr; }
  .ud-profile__photo { max-width: 240px; aspect-ratio: 1 / 1; }
  .ud-toolrail { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ud-toolrail__sep { display: none; }
}
@media (max-width: 460px) {
  .ud-kv { grid-template-columns: 1fr; gap: 4px 0; }
  .ud-kv dd { margin-bottom: 10px; }
  .ud-photo-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ud-video { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .ud-photo-grid img { transition: none; }
}
