/* 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 {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .42);
  border-radius: 50%;
  background: linear-gradient(150deg, #e8bf6a, var(--eg-gold) 55%, #b9832c);
}
.ud-hero__avatar-frame .ud-monogram { color: var(--eg-wine); font-size: 34px; }

/* ---- Photo frame layers (profile_media_photo_layers()) ------------- */
/* The initials sit underneath; a photo, when there is one, covers them.
   A photo that fails to load removes itself and the initials show. */
.ud-monogram {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 600 1em/1 var(--eg-serif);
  letter-spacing: .02em;
  user-select: none;
}
.ud-hero__avatar-frame img,
.ud-profile__photo img {
  position: absolute;
  inset: 0;
  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;
  border-radius: 20px;
  background: radial-gradient(120% 90% at 28% 18%, #8c2f3d 0%, var(--eg-wine) 48%, var(--eg-wine-dark) 100%);
  box-shadow: 0 22px 44px -26px rgba(45, 11, 18, .7);
  text-decoration: none;
}
/* Thin gold inner frame, drawn over the photo too. */
.ud-profile__photo::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(217, 164, 65, .45);
  border-radius: 13px;
  pointer-events: none;
}
.ud-profile__photo .ud-monogram {
  padding-bottom: 12%;
  color: var(--eg-gold);
  font-size: clamp(60px, 7vw, 86px);
}
.ud-profile__photo img { transition: transform .4s ease; }
a.ud-profile__photo:hover img { transform: scale(1.03); }

/* Owner-only button on the frame: gold "Add photo" when there is none,
   a quieter dark "Change photo" (.is-subtle) once there is. Always shown,
   since touch screens have no hover. */
.ud-profile__photo-cta {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--eg-gold);
  color: var(--eg-ink);
  font: 700 13px var(--eg-sans);
  letter-spacing: .02em;
  white-space: nowrap;
  transform: translateX(-50%);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .55);
  transition: background .2s ease, color .2s ease;
}
.ud-profile__photo-cta.is-subtle {
  background: rgba(37, 29, 26, .72);
  color: #fff;
  backdrop-filter: blur(4px);
}
a.ud-profile__photo:hover .ud-profile__photo-cta,
a.ud-profile__photo:focus-visible .ud-profile__photo-cta { background: #fff; color: var(--eg-wine); }
a.ud-profile__photo:focus-visible { outline: 3px solid var(--eg-gold); outline-offset: 4px; }
.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; }
}
