/* Profile definition lists: stacked below 640px, two-column at 640px+ */

dl.profile-dl {
  width: 90%;
  max-width: 100%;
  margin: 0 0 1em;
  padding: 0 1em 0 0; /* prevent text bleeding off right */
  box-sizing: border-box;
}

dl.profile-dl .profile-dt {
  font-weight: bold;
  margin-top: 0.5em;
  padding-right: 0.5em;
}

dl.profile-dl .profile-dt:first-child {
  margin-top: 0;
}

dl.profile-dl .profile-dd {
  margin-left: 0;
  margin-bottom: 0.5em;
  padding-right: 0.5em; /* breathing room so text doesn't bleed right */
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-width: 0; /* allow shrinking in grid */
  box-sizing: border-box;
}

/* Stacked: label above, value below (narrow) */
@media (max-width: 639px) {
  dl.profile-dl .profile-dt,
  dl.profile-dl .profile-dd {
    display: block;
  }
}

/* Two-column: label left, value right (640px and above) */
@media (min-width: 640px) {
  section#content dl.profile-dl {
    display: grid !important;
    grid-template-columns: 38% minmax(0, 1fr);
    gap: 0.35em 1.25em;
    align-items: baseline;
  }

  section#content dl.profile-dl .profile-dt {
    margin-top: 0;
    grid-column: 1;
    padding-right: 0.75em;
  }

  section#content dl.profile-dl .profile-dd {
    margin-bottom: 0;
    grid-column: 2;
    padding-right: 0.25em;
  }
}

/* Profile docs: prevent upload box clipping inside .wrapper (overflow:hidden) */
section#content .signup-form {
  padding-left: 12px;
  padding-right: 12px;
  box-sizing: border-box;
}

.profile-doc-upload-box {
  max-width: 100%;
  box-sizing: border-box;
}

/* Profile docs: file input + delete button visible on mobile */
.profile-doc-upload-row {
  flex-wrap: wrap;
}

.profile-doc-upload-row .profile-doc-file-input {
  min-width: 0;
}

.profile-doc-upload-row .delete-btn {
  flex-shrink: 0;
}

@media (max-width: 639px) {
  .profile-doc-upload-row {
    flex-direction: column;
    align-items: stretch;
  }

  .profile-doc-upload-row .profile-doc-file-input {
    flex: none;
    width: 100%;
  }

  .profile-doc-upload-row .delete-btn {
    align-self: flex-start;
  }
}
