/* Profile polish 1098
   The profile identity is a compact row after the cover.  Older profile
   revisions reserved the avatar overlap twice (negative row margin plus a
   second avatar-sized padding on the copy), which produced the large empty
   block visible on narrow screens.  These rules are deliberately last in the
   profile cascade and keep the cover, portrait, name/actions, and About on
   one predictable layout contract. */

body.profile-page .profile-identity-card > .profile-identity {
  display: grid !important;
  grid-template-columns: var(--profile-avatar-size, 161px) minmax(0, 1fr);
  align-items: start !important;
  gap: 16px !important;
  width: min(var(--profile-content-max-width, 1120px), calc(100% - 32px)) !important;
  min-height: 0 !important;
  margin: calc(var(--profile-avatar-size, 161px) * -.6) auto 0 !important;
  padding: 0 !important;
}

body.profile-page .profile-identity-card > .profile-identity > .profile-avatar-wrap {
  grid-column: 1;
  grid-row: 1;
  align-self: start !important;
  width: var(--profile-avatar-size, 161px) !important;
  height: var(--profile-avatar-size, 161px) !important;
  flex: none !important;
  margin: 0 !important;
}

body.profile-page .profile-identity-card > .profile-identity > .profile-identity-copy {
  grid-column: 2;
  grid-row: 1;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center !important;
  align-self: start !important;
  gap: 6px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: calc(var(--profile-avatar-size, 161px) * .6) 0 0 !important;
  padding: 10px 12px !important;
  border: 1px solid rgba(255, 255, 255, .72) !important;
  border-radius: 14px !important;
  background: rgba(255, 253, 249, .94) !important;
  box-shadow: 0 8px 20px rgba(22, 53, 71, .08) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.04) !important;
  backdrop-filter: blur(12px) saturate(1.04) !important;
}

body.profile-page .profile-identity-card .profile-identity-copy > .profile-name-line {
  display: flex !important;
  align-items: center !important;
  grid-row: 1;
  flex: none !important;
  min-width: 0 !important;
  width: auto !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  gap: 8px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.profile-page .profile-identity-card .profile-identity-copy > .profile-name-line h3 {
  min-width: 0 !important;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(20px, 2.5vw, 28px);
  line-height: 1.1;
}

body.profile-page .profile-identity-card .profile-identity-copy > .profile-identity-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  grid-row: 2;
  justify-self: end !important;
  flex: none !important;
  gap: 7px !important;
  width: auto !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.profile-page .profile-identity-card .profile-identity-copy > .profile-identity-actions > :is(button, a) {
  display: inline-grid !important;
  place-items: center !important;
  flex: 0 0 36px !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.profile-page .profile-identity-card > .profile-details-box {
  width: min(var(--profile-content-max-width, 1120px), calc(100% - 32px)) !important;
  margin: 12px auto 0 !important;
  padding: 0 0 18px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

body.profile-page .profile-identity-card .profile-details-view > .profile-field-summary.profile-about-summary {
  width: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 14px 16px !important;
  border: 1px solid rgba(22, 53, 71, .14) !important;
  border-radius: 14px !important;
  background: rgba(255, 253, 249, .88) !important;
  box-shadow: 0 6px 16px rgba(22, 53, 71, .06) !important;
  color: #163547 !important;
}

body.profile-page .profile-identity-card .profile-about-summary :is(p, .profile-field-summary-row) {
  margin: 0 !important;
  font-size: 15px;
  line-height: 1.45;
}

/* Journey is the visual anchor below identity. Keep it dark and readable even
   when the page pattern is visible behind it. */
body.profile-page #profileCoffeeJourney {
  width: min(var(--profile-content-max-width, 1120px), calc(100% - 32px)) !important;
  margin-inline: auto !important;
  border: 1px solid rgba(255, 255, 255, .2) !important;
  border-radius: 18px !important;
  background: linear-gradient(135deg, rgba(10, 28, 37, .95), rgba(22, 53, 71, .95)) !important;
  color: #fffdf9 !important;
  box-shadow: 0 16px 34px rgba(10, 28, 37, .18) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.08) !important;
  backdrop-filter: blur(12px) saturate(1.08) !important;
}

body.profile-page #profileCoffeeJourney :is(h3, strong, b, .eyebrow, .coffee-journey-progress-copy, .coffee-journey-progress-copy span) {
  color: #fffdf9 !important;
}

body.profile-page > .profile-pattern-layer {
  opacity: .12 !important;
  pointer-events: none !important;
}

@media (max-width: 700px) {
  body.profile-page .profile-identity-card {
    --profile-avatar-size: 104px;
  }

  body.profile-page .profile-identity-card > .profile-identity {
    grid-template-columns: var(--profile-avatar-size) minmax(0, 1fr);
    gap: 10px !important;
    width: calc(100% - 16px) !important;
    margin-top: calc(var(--profile-avatar-size) * -.6) !important;
  }

  body.profile-page .profile-identity-card > .profile-identity > .profile-identity-copy {
    gap: 7px !important;
    margin-top: calc(var(--profile-avatar-size) * .6) !important;
    padding: 8px 9px !important;
    border-radius: 12px !important;
  }

  body.profile-page .profile-identity-card .profile-identity-copy > .profile-name-line {
    min-height: 34px !important;
    gap: 5px !important;
  }

  body.profile-page .profile-identity-card .profile-identity-copy > .profile-name-line h3 {
    font-size: 21px;
  }

  body.profile-page .profile-identity-card .profile-identity-copy > .profile-identity-actions {
    gap: 5px !important;
  }

  body.profile-page .profile-identity-card .profile-identity-copy > .profile-identity-actions > :is(button, a) {
    flex-basis: 34px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
  }

  body.profile-page .profile-identity-card > .profile-details-box {
    width: calc(100% - 16px) !important;
    margin-top: 10px !important;
    padding-bottom: 14px !important;
  }

  body.profile-page .profile-identity-card .profile-details-view > .profile-field-summary.profile-about-summary {
    padding: 12px 13px !important;
    border-radius: 12px !important;
  }

  body.profile-page .profile-identity-card .profile-about-summary :is(p, .profile-field-summary-row) {
    font-size: 14px;
  }

  body.profile-page #profileCoffeeJourney {
    width: calc(100% - 16px) !important;
    padding: 18px !important;
    border-radius: 15px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.profile-page #profileCoffeeJourney,
  body.profile-page .profile-identity-card .profile-identity-copy {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}
